Skip to content

Instantly share code, notes, and snippets.

@paulja
Last active January 31, 2017 14:46
Show Gist options
  • Save paulja/fb626ac48d60fd4e0791e320dbead12a to your computer and use it in GitHub Desktop.
Save paulja/fb626ac48d60fd4e0791e320dbead12a to your computer and use it in GitHub Desktop.
Bash script to step-up a basic dev environment on a Linux box
#!/usr/bin/env bash
#--------------------------------------------------
# install software
#--------------------------------------------------
sudo apt-get update
sudo apt-get upgrade -y
# system
sudo apt-get install tmux htop tree -y
# development
sudo apt-get install git build-essential -y
sudo apt-get install golang -y
sudo apt-get install jq -y
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
#--------------------------------------------------
# configuration
#--------------------------------------------------
# git
cat > ~/.gitconfig << EOF
[user]
name = Paul
email = pjackson@gmail.com
[color]
ui = true
[alias]
sg = log --all --oneline --graph --decorate
ls = log --oneline --decorate -5
s = status -s
co = checkout
[help]
autocorrect = 1
[core]
editor = vim
excludesfile = ~/.gitignore_global
[push]
default = simple
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
EOF
# Vim
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim &>/dev/null
cat > ~/.vimrc << EOF
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'itchyny/vim-cursorword'
Plugin 'itchyny/lightline.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'airblade/vim-gitgutter'
Plugin 'morhetz/gruvbox'
Plugin 'fatih/vim-nginx'
Plugin 'fatih/vim-go'
Plugin 'Valloric/YouCompleteMe'
Plugin 'majutsushi/tagbar'
Plugin 'tpope/vim-surround'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"http://stackoverflow.com/questions/20186975/vim-mac-how-to-copy-to-clipboard-without-pbcopy
set clipboard^=unnamed
set clipboard^=unnamedplus
syntax on
set laststatus=2
set number
set smartindent
set tabstop=4
set shiftwidth=2
set expandtab
set listchars=eol:¬,tab:>-
set hlsearch
set incsearch
set background=dark
colorscheme hybrid
" Make the higlight line red in Visual mode
hi Visual ctermbg=1
" Keyboard mappings
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
nnoremap <silent> <F2> :NERDTreeToggle<CR>
nnoremap <silent> <F6> :TagbarToggle<CR>
nnoremap <silent> gb :GoBuild<CR>
nnoremap <silent> gt :GoTest<CR>
nnoremap <silent> gl :GoMetaLinter<CR>
nnoremap <silent> gr :GoRun<CR>
" File extension
set suffixesadd+=.js
" format with goimports instead of gofmt
let g:go_fmt_command = "goimports"
" turn highlighting on
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
EOF
vim +PluginInstall +qall
# tmux
cat > ~/.tmux.conf << EOF
# Enable all the colours
set -g default-terminal "screen-256color"
# Make the command delay more responsive
set -s escape-time 0
# Make the splitting of windows more intuitive
bind | split-window -h
bind - split-window -v
# Make resizing panes easier
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Turn on vi keybindings in commandline
# (NOTE: you must hot ESC twice
set -g status-keys vi
# Turn on vi keybindings in copy mode
setw -g mode-keys vi
# Bigger history
set -g history-limit 10000
EOF
# Environment
# Add to .profile as needed
# >> alias goenv='export GOPATH=$PWD && export PATH=$GOPATH/bin:$PATH'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment