Skip to content

Instantly share code, notes, and snippets.

@m-mizutani
Last active September 8, 2017 07:15
Show Gist options
  • Save m-mizutani/b8f0451d081527f483667ec09e4a4204 to your computer and use it in GitHub Desktop.
Save m-mizutani/b8f0451d081527f483667ec09e4a4204 to your computer and use it in GitHub Desktop.
setup script of ubuntu16.04 dev env (fish + emacs + tmux for c++, python and ruby)
#!/bin/bash
sudo apt update
sudo apt -o Dpkg::Options::='--force-confold' --force-yes -y dist-upgrade
sudo apt install -y emacs24-nox fish tmux git python-pip lv build-essential cmake \
libssl-dev libreadline-dev zlib1g-dev libbz2-dev libbz2-1.0 libsqlite3-0 libsqlite3-dev
sudo apt install -y libmsgpack3 libmsgpack-dev libpcap-dev
# setup ruby 2.4.1
git clone https://github.com/rbenv/rbenv.git $HOME/.rbenv
cd $HOME/.rbenv && src/configure && make -C src
git clone https://github.com/rbenv/ruby-build.git "$($HOME/.rbenv/bin/rbenv root)"/plugins/ruby-build
$HOME/.rbenv/bin/rbenv install 2.4.1
$HOME/.rbenv/bin/rbenv global 2.4.1
# setup python 3.6.2
export PATH="$HOME/.pyenv/bin:$PATH"
sudo pip install --upgrade pip
sudo pip install --egg pyenv
sudo chown -R $(whoami) $HOME/.pyenv
$HOME/.pyenv/bin/pyenv install 3.6.2
$HOME/.pyenv/bin/pyenv global 3.6.2
# setup fish
sudo chsh $(whoami) -s /usr/bin/fish
mkdir -p $HOME/.config/fish/
cat <<EOF > $HOME/.config/fish/config.fish
alias em='emacs -nw'
set -x PATH \$HOME/.rbenv/bin \$PATH
rbenv init - | source
set -x PATH \$HOME/.pyenv/shims \$PATH
set -x PATH \$HOME/.pyenv/bin \$PATH
. (pyenv init - | psub)
export LANG='ja_JP.UTF-8'
export LC_ALL='ja_JP.UTF-8'
EOF
# setup locale
sudo sed -i -e "s@# ja_JP\.UTF-8@ja_JP.UTF-8@g" /etc/locale.gen
sudo locale-gen
# setup emacs
mkdir -p $HOME/.emacs.d/
cat << EOF > $HOME/.emacs.d/init.el
; package
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)
(prefer-coding-system 'utf-8)
; C-h
(global-set-key "\C-h" 'backward-delete-char)
; disable backup
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq inhibit-startup-message t)
; Company
(require 'company)
(global-company-mode)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2) ;
(setq company-selection-wrap-around t) ;
(define-key company-active-map (kbd "M-n") nil)
(define-key company-active-map (kbd "M-p") nil)
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-n") 'company-select-next)
(define-key company-active-map (kbd "C-p") 'company-select-previous)
(define-key company-active-map (kbd "C-h") nil)
(define-key company-active-map (kbd "C-s") 'company-filter-candidates)
(add-hook 'c-mode-common-hook 'google-set-c-style)
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment