]> oss.titaniummirror.com Git - smckown/dotfiles.git/commitdiff
No need to link ~/.vimrc
authorR. Steve McKown <rsmckown@gmail.com>
Mon, 8 Jun 2015 21:04:04 +0000 (15:04 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Mon, 8 Jun 2015 21:04:04 +0000 (15:04 -0600)
Because VIM 7.4 (and maybe earlier) looks for the .vimrc file in
$HOME/.vimrc and $HOME/vim/.vimrc on Linux, there is no need to make a
separate link for .vimrc if vimrc is in vim/.

install.sh
vim/vimrc [new file with mode: 0644]
vimrc [deleted file]

index d2331cd7f370d59a8e4bf38a39a30db721bbdaf3..e2365a5430ab0889b7963fef941067adbf5bf81b 100755 (executable)
@@ -27,7 +27,6 @@ cd ~
 # to run different commands depending upon the host OS.
 
 dolink .dotfiles/vim .vim
-dolink .dotfiles/vimrc .vimrc
 # ranger rewrites its bookmarks file and undoes the symlink on each run...
 #dolink ~/.dotfiles/ranger/bookmarks .config/ranger/bookmarks
 dolink ~/.dotfiles/ranger/rc.conf .config/ranger/rc.conf
diff --git a/vim/vimrc b/vim/vimrc
new file mode 100644 (file)
index 0000000..68d687e
--- /dev/null
+++ b/vim/vimrc
@@ -0,0 +1,378 @@
+" smckown .vimrc file
+
+" Tricky to get a nice terminal color scheme that works well in both vim and
+" gvim.  Step 1 is to ensure that vi knows the underlying device is 256 color
+" capable.  The solution of setting xterm:
+"   TERM=xterm-256color in .bashrc:
+"   if [[ $TERM == xterm && $COLORTERM == gnome* ]]; then
+"     export TERM=xterm-256color
+"   fi
+" ... works for vi, but seems to cause problems with the terminal pager.
+" Setting t_Co at the very top of vimrc so all the plugins see the setting
+" seems to be working the best.
+set t_Co=256
+
+" All addons managed via pathogen
+filetype off
+runtime bundle/vim-pathogen/autoload/pathogen.vim
+call pathogen#infect()
+call pathogen#helptags()
+
+" This .vimrc depends upon the sensible plugin for proper operation.
+" Load the sensible plugin immediately so its Y remap can be undone.
+runtime! plugin/sensible.vim
+nnoremap Y Y
+
+" Set the correct font for gvim
+if has("gui_running")
+  if has("gui_gtk2")
+    set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 9
+  elseif has("gui_macvim")
+    set guifont=Menlo\ Regular:h14
+  elseif has("gui_win32")
+    set guifont=Consolas:h11:cANSI
+  endif
+endif
+
+colors lucius
+
+" Local listchars def if utf-8 terminal.  Otherwise sensible defaults are OK.
+if &termencoding ==# 'utf-8' || &encoding ==# 'utf-8'
+  "let &listchars = tab:»·,trail:·
+  let &listchars = "tab:»·,trail:\u2423,extends:\u21c9,precedes:\u21c7,nbsp:\u26ad"
+endif
+
+" Disable certain keys that aren't very helpful
+nnoremap <F1> <ESC>
+inoremap <F1> <ESC>
+vnoremap <F1> <ESC>
+nnoremap <up> <nop>
+nnoremap <down> <nop>
+nnoremap <left> <nop>
+nnoremap <right> <nop>
+inoremap <up> <nop>
+inoremap <down> <nop>
+inoremap <left> <nop>
+inoremap <right> <nop>
+vnoremap <up> <nop>
+vnoremap <down> <nop>
+vnoremap <left> <nop>
+vnoremap <right> <nop>
+
+" Try out <space> as <leader>
+map <space> <leader>
+
+" Make tabs and trailing spaces visible.  Show them and special chars in gray.
+highlight NonText ctermfg=gray guifg=gray
+highlight SpecialKey ctermfg=gray guifg=gray
+set list
+
+" Set default indent policy.  smarttab, roundshift enabled by sensible
+set softtabstop=2 shiftwidth=2 expandtab
+
+" File type specific settings.
+if has("autocmd")
+  autocmd filetype make setlocal sts=0 sw=8 noexpandtab tw=80 fo-=t fo+=j
+  autocmd filetype sh,ld setlocal sts=4 sw=4 tw=80 fo-=t fo+=j
+  autocmd filetype python setlocal sts=4 sw=4 tw=79 fo-=t fo+=j
+  autocmd filetype html,xml setlocal listchars-=tab:>. tw=80 fo-=t fo+=j
+  autocmd filetype text,markdown,mkd,md setlocal tw=80 fo-=t fo+=j
+  autocmd filetype c,cpp,java setlocal tw=80 fo-=t fo+=j
+  autocmd filetype nesc setlocal syntax=c.doxygen tw=80 fo-=t fo+=j
+
+  " Whitelist for auto-stripping trailing whitespace on buffer write
+  autocmd BufWritePre *.c,*.h,*.nesc,*.py,*.java,*.sh,make :call <SID>StripTrailingWhitespace()
+
+  " Accept .plt and .gnuplot extensions
+  autocmd BufNewFile,BufRead *.plt,*.gnnuplot setf gnuplot
+endif
+
+" Setup swap/backup/undo
+" Note that as of vim 7.4, backupdir // will not expand backup files to a full
+" path as is the case with directory and undodir.
+let s:dir = expand(has('win32') ? '~/Application Data/Vim' : has('mac') ?
+  \ '~/Library/Vim' : '~/.local/share/vim')
+execute 'set directory^=' . s:dir . '/swap//'
+if !isdirectory(s:dir . '/')
+  call mkdir(s:dir)
+endif
+if !isdirectory(s:dir . '/swap/')
+  call mkdir(s:dir . '/swap')
+endif
+if !isdirectory(s:dir . '/backup/')
+  call mkdir(s:dir . '/backup')
+endif
+if !isdirectory(s:dir . '/undo/')
+  call mkdir(s:dir . '/undo')
+endif
+if isdirectory(s:dir . '/backup/')
+  execute 'set backupdir=' . s:dir . '/backup//'
+  set backup
+else
+  set nobackup
+endif
+if has('persistent_undo') && isdirectory(s:dir . '/undo/')
+  execute 'set undodir=' . s:dir . '/undo//'
+  set undofile
+else
+  set noundofile
+endif
+
+" Local netrw hide list.  Sensible default shows .o files, etc.
+let g:netrw_list_hide = '\~$,^tags$,\.swp$,\.o$,\.pyc$,\.class$'
+
+" Preferred local settings
+"set visualbell noerrorbells           " Bells set to visual only
+set novisualbell noerrorbells          " Bells set to visual only
+set number                             " Use con to toggle numbers
+set relativenumber                     " Use cor to toggle relative numbers
+"set mouse=a                           " Enable mouse (thinkpad scroll)
+set scrolloff=5                                " Cursor offset from screen top/bottom
+set hidden                             " Don't warn when hiding a changed buffer
+set modeline                           " Best not to allow per-file override
+if exists('+cursorline')
+  " unimpaired.vim adds change option: coc toggles cursorline
+  "hi CursorLine cterm=NONE,underline  " Underline makes '_' and ' ' alike
+  "set cursorline                      " Highlight current line
+  "nnoremap <leader>c :set cursorline!<CR>
+endif
+
+" Search options
+" unimpaired.vim adds change option: coh toggles hlsearch
+set ignorecase smartcase nohlsearch
+
+" Ignore files
+set wildignore=*.swp,*.bak,*.o,*.pyc,*.class,*.a,*.so
+
+" Mapping for paste toggle
+nnoremap <F2> :set invpaste paste?<CR>
+set pastetoggle=<F2>
+
+" Use Q for formatting the current paragraph (or selection)
+vmap Q gq
+nmap Q gqap
+
+" Intuitive window navigation
+map <C-h> <C-w>h
+map <C-j> <C-w>j
+map <C-k> <C-w>k
+map <C-l> <C-w>l
+
+" Window resizing
+nnoremap <M-left> :vertical resize -1<CR>
+nnoremap <M-right> :vertical resize +1<CR>
+nnoremap <M-up> :resize +1<CR>
+nnoremap <M-down> :resize -1<CR>
+
+" w!! to write file with sudo
+cmap w!! w!sudo tee % >/dev/null
+
+" Stuff for supporting ctags.  Need a better way to select the right ctags
+" set tags=/usr/include/tags,./tags,./../tags,./../**/tags
+set tags=tags;/
+
+" %% on an ex command line expands to the dir path of the current buffer
+cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
+
+" Create some edit maps for opening new files
+map <leader>ew :e %%<CR>
+map <leader>es :sp %%<CR>
+map <leader>ev :vsp %%<CR>
+map <leader>et :tabe %%<CR>
+
+" Make <C-]> and g] work like g<C-]>, which uses :tjump
+nnoremap g] g<C-]>
+nnoremap <C-]> g<C-]>
+
+" Spell check
+" unimpaired.vim adds change option: cos toggles spell
+"nmap <silent> <leader>s :set spell!<CR> :set spell?<CR>
+set spelllang=en
+
+" Toggle numbers on and off
+" unimpaired.vim adds change option: con toggles numbers
+"nmap <silent> <leader>n :set number!<CR>
+
+" Toggle word wrap
+" unimpaired.vim adds change option: cow toggles wrap
+"nmap <silent> <leader>w :set wrap!<CR> :set wrap?<CR>
+
+" Custom statusline
+set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
+
+if has("autocmd")
+  " Auto-close fugitive buffers
+  autocmd BufReadPost fugitive://* set bufhidden=delete
+
+  " Navigate up one level from fugitive trees and blobs
+  autocmd User fugitive
+    \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
+    \   nnoremap <buffer> .. :edit %:h<CR> |
+    \ endif
+endif
+
+" EasyGrep
+" To ignore tags file, use system grep.
+let g:EasyGrepCommand=1
+let g:EasyGrepFilesToExclude='tags'
+
+" Gitv settings
+set lazyredraw
+let g:Gitv_OpenHorizontal = 1
+let g:Gitv_DoNotMapCtrlKey = 1
+let g:Gitv_OpenPreviewOnLaunch = 1
+nmap <leader>gv :Gitv --all<cr>
+nmap <leader>gV :Gitv! --all<cr>
+vmap <leader>gV :Gitv! --all<cr>
+
+" Reduce EasyMotion functionality; use single Leader to activate
+" map <Leader> <Plug>(easymotion-prefix)
+let g:EasyMotion_do_mapping = 0
+" Map multi input search to <leader>s.  Not wise to map to / because the
+" performance of easymotion-sn on large files is very slow.
+nmap <leader>s <Plug>(easymotion-sn)
+xmap <leader>s <Plug>(easymotion-sn)
+omap <leader>s <Plug>(easymotion-sn)
+" These are the uni-directional mappings.  They are faster.
+"nmap <Leader>f <Plug>(easymotion-f)
+"nmap <Leader>F <Plug>(easymotion-F)
+"nmap <Leader>w <Plug>(easymotion-w)
+"nmap <Leader>b <Plug>(easymotion-b)
+"nmap <Leader>W <Plug>(easymotion-W)
+"nmap <Leader>B <Plug>(easymotion-B)
+"nmap <Leader>e <Plug>(easymotion-e)
+"nmap <Leader>E <Plug>(easymotion-E)
+"nmap <Leader>ge <Plug>(easymotion-ge)
+"nmap <Leader>gE <Plug>(easymotion-gE)
+"nmap <Leader>j <Plug>(easymotion-j)
+"nmap <Leader>k <Plug>(easymotion-k)
+"nmap <Leader>n <Plug>(easymotion-n)
+"nmap <Leader>N <Plug>(easymotion-N)
+" These are the bi-directional mappings.  They are more flexible but slower.
+nmap <Leader>f <Plug>(easymotion-bd-f)
+nmap <Leader>F <Plug>(easymotion-bd-f)
+nmap <Leader>w <Plug>(easymotion-bd-w)
+nmap <Leader>b <Plug>(easymotion-bd-w)
+nmap <Leader>W <Plug>(easymotion-bd-W)
+nmap <Leader>B <Plug>(easymotion-bd-W)
+nmap <Leader>e <Plug>(easymotion-bd-e)
+nmap <Leader>E <Plug>(easymotion-bd-E)
+nmap <Leader>ge <Plug>(easymotion-bd-e)
+nmap <Leader>gE <Plug>(easymotion-bd-E)
+nmap <Leader>j <Plug>(easymotion-bd-jk)
+nmap <Leader>k <Plug>(easymotion-bd-jk)
+nmap <Leader>n <Plug>(easymotion-bd-n)
+nmap <Leader>N <Plug>(easymotion-bd-n)
+
+" Airline configuration
+" Single character mode, since showmode is set
+let g:airline_powerline_fonts = 1
+let g:airline_mode_map = {
+    \ '__' : '-',
+    \ 'n'  : 'N',
+    \ 'i'  : 'I',
+    \ 'R'  : 'R',
+    \ 'c'  : 'C',
+    \ 'v'  : 'V',
+    \ 'V'  : 'V',
+    \ '\16' : 'V',
+    \ 's'  : 'S',
+    \ 'S'  : 'S',
+    \ '\13' : 'S',
+    \ }
+" Customize sections
+let g:airline_section_x = airline#section#create(['filetype'])
+let g:airline_section_y = airline#section#create(['ffenc'])
+let g:airline_section_z = airline#section#create(['linenr', ':%3c '])
+let g:airline#extensions#whitespace#checks = [ 'trailing' ]
+" Minimize hunks summary under version control
+let g:airline#extensions#hunks#non_zero_only = 1
+" tabline shows buffers
+let g:airline#extensions#tabline#enabled = 1
+let g:airline#extensions#tabline#buffer_min_count = 2
+let g:airline#extensions#tabline#buffer_idx_mode = 1
+nmap <leader>1 <Plug>AirlineSelectTab1
+nmap <leader>2 <Plug>AirlineSelectTab2
+nmap <leader>3 <Plug>AirlineSelectTab3
+nmap <leader>4 <Plug>AirlineSelectTab4
+nmap <leader>5 <Plug>AirlineSelectTab5
+nmap <leader>6 <Plug>AirlineSelectTab6
+nmap <leader>7 <Plug>AirlineSelectTab7
+nmap <leader>8 <Plug>AirlineSelectTab8
+nmap <leader>9 <Plug>AirlineSelectTab9
+
+" Highlight only long lines
+" This solution has two problems:
+" 1. On first file edit, the status bar does not render until a key is pressed
+" 2. When creating new lines the last column isn't known until it's arrived
+"augroup collumnLimit
+"  autocmd!
+"  autocmd BufEnter,WinEnter,FileType scala,java,c,nesc,make
+"        \ highlight CollumnLimit ctermbg=LightGrey guibg=LightGrey
+"  let collumnLimit = 79
+"  let pattern =
+"        \ '\%<' . (collumnLimit+1) . 'v.\%>' . collumnLimit . 'v'
+"  autocmd BufEnter,WinEnter,FileType scala,java,c,nesc,make
+"        \ let w:m1=matchadd('CollumnLimit', pattern, -1)
+"augroup END
+
+" The simpler solution to the above, which generates a column
+if exists('+colorcolumn')
+  if v:version >= 703
+    " Set color column relative to defined textwidth.
+    " Highlights the column immediately after the last valid.
+    set colorcolumn=+1
+  else
+    set colorcolumn=80
+  endif
+else
+  au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
+endif
+
+" delimitMate
+let g:delimitMate_matchpairs = "{:},[:],(:)"
+let g:delimitMate_autoclose = 1
+let g:delimitMate_expand_cr = 1
+let g:delimitMate_expand_space = 1
+nnoremap coa :DelimitMateSwitch<CR>
+
+" Rainbow Parenthesis -- off by default but set toggle
+nnoremap cop :RainbowParenthesesToggle<CR>
+
+" Turn on doxygen syntax highlighting for C, C++, C# and IDL files.
+let g:load_doxygen_syntax=1
+
+" Use <C-x>/ to gain omnicomplete html tag completion
+imap <C-x>/ </<C-x><C-o>
+
+nnoremap <leader>W :call <SID>StripTrailingWhitespace()<CR>
+function! <SID>StripTrailingWhitespace()
+  " Save last search, and cursor position.
+  let _s=@/
+  let l = line(".")
+  let c = col(".")
+  " Perform the substitution.
+  %s/\s\+$//e
+  " Restore last search and cursor position.
+  let @/=_s
+  call cursor(l, c)
+endfunction
+
+" Implement 'cot' -- Toggle formatoption 't' -- wrap texts to textwidth
+nnoremap cot :call ToggleFormatOptionT()<CR>
+function! ToggleFormatOptionT()
+  let tmp = substitute(&formatoptions, 't', '', '')
+  if &formatoptions == tmp
+    set fo+=t
+    :echo "Enable text wrap"
+  else
+    set fo-=t
+    :echo "Disable text wrap"
+  endif
+endfunction
+
+" Insert date and time in insert mode.  Have to use the native <Leader>, not
+" its re-mapped version <space>
+imap <leader>d <C-R>=strftime("%Y%m%d")<CR>
+imap <leader>D <C-R>=strftime("%Y-%m-%d")<CR>
+imap <leader>t <C-R>=strftime("%H:%M:%S")<CR>
diff --git a/vimrc b/vimrc
deleted file mode 100644 (file)
index 68d687e..0000000
--- a/vimrc
+++ /dev/null
@@ -1,378 +0,0 @@
-" smckown .vimrc file
-
-" Tricky to get a nice terminal color scheme that works well in both vim and
-" gvim.  Step 1 is to ensure that vi knows the underlying device is 256 color
-" capable.  The solution of setting xterm:
-"   TERM=xterm-256color in .bashrc:
-"   if [[ $TERM == xterm && $COLORTERM == gnome* ]]; then
-"     export TERM=xterm-256color
-"   fi
-" ... works for vi, but seems to cause problems with the terminal pager.
-" Setting t_Co at the very top of vimrc so all the plugins see the setting
-" seems to be working the best.
-set t_Co=256
-
-" All addons managed via pathogen
-filetype off
-runtime bundle/vim-pathogen/autoload/pathogen.vim
-call pathogen#infect()
-call pathogen#helptags()
-
-" This .vimrc depends upon the sensible plugin for proper operation.
-" Load the sensible plugin immediately so its Y remap can be undone.
-runtime! plugin/sensible.vim
-nnoremap Y Y
-
-" Set the correct font for gvim
-if has("gui_running")
-  if has("gui_gtk2")
-    set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 9
-  elseif has("gui_macvim")
-    set guifont=Menlo\ Regular:h14
-  elseif has("gui_win32")
-    set guifont=Consolas:h11:cANSI
-  endif
-endif
-
-colors lucius
-
-" Local listchars def if utf-8 terminal.  Otherwise sensible defaults are OK.
-if &termencoding ==# 'utf-8' || &encoding ==# 'utf-8'
-  "let &listchars = tab:»·,trail:·
-  let &listchars = "tab:»·,trail:\u2423,extends:\u21c9,precedes:\u21c7,nbsp:\u26ad"
-endif
-
-" Disable certain keys that aren't very helpful
-nnoremap <F1> <ESC>
-inoremap <F1> <ESC>
-vnoremap <F1> <ESC>
-nnoremap <up> <nop>
-nnoremap <down> <nop>
-nnoremap <left> <nop>
-nnoremap <right> <nop>
-inoremap <up> <nop>
-inoremap <down> <nop>
-inoremap <left> <nop>
-inoremap <right> <nop>
-vnoremap <up> <nop>
-vnoremap <down> <nop>
-vnoremap <left> <nop>
-vnoremap <right> <nop>
-
-" Try out <space> as <leader>
-map <space> <leader>
-
-" Make tabs and trailing spaces visible.  Show them and special chars in gray.
-highlight NonText ctermfg=gray guifg=gray
-highlight SpecialKey ctermfg=gray guifg=gray
-set list
-
-" Set default indent policy.  smarttab, roundshift enabled by sensible
-set softtabstop=2 shiftwidth=2 expandtab
-
-" File type specific settings.
-if has("autocmd")
-  autocmd filetype make setlocal sts=0 sw=8 noexpandtab tw=80 fo-=t fo+=j
-  autocmd filetype sh,ld setlocal sts=4 sw=4 tw=80 fo-=t fo+=j
-  autocmd filetype python setlocal sts=4 sw=4 tw=79 fo-=t fo+=j
-  autocmd filetype html,xml setlocal listchars-=tab:>. tw=80 fo-=t fo+=j
-  autocmd filetype text,markdown,mkd,md setlocal tw=80 fo-=t fo+=j
-  autocmd filetype c,cpp,java setlocal tw=80 fo-=t fo+=j
-  autocmd filetype nesc setlocal syntax=c.doxygen tw=80 fo-=t fo+=j
-
-  " Whitelist for auto-stripping trailing whitespace on buffer write
-  autocmd BufWritePre *.c,*.h,*.nesc,*.py,*.java,*.sh,make :call <SID>StripTrailingWhitespace()
-
-  " Accept .plt and .gnuplot extensions
-  autocmd BufNewFile,BufRead *.plt,*.gnnuplot setf gnuplot
-endif
-
-" Setup swap/backup/undo
-" Note that as of vim 7.4, backupdir // will not expand backup files to a full
-" path as is the case with directory and undodir.
-let s:dir = expand(has('win32') ? '~/Application Data/Vim' : has('mac') ?
-  \ '~/Library/Vim' : '~/.local/share/vim')
-execute 'set directory^=' . s:dir . '/swap//'
-if !isdirectory(s:dir . '/')
-  call mkdir(s:dir)
-endif
-if !isdirectory(s:dir . '/swap/')
-  call mkdir(s:dir . '/swap')
-endif
-if !isdirectory(s:dir . '/backup/')
-  call mkdir(s:dir . '/backup')
-endif
-if !isdirectory(s:dir . '/undo/')
-  call mkdir(s:dir . '/undo')
-endif
-if isdirectory(s:dir . '/backup/')
-  execute 'set backupdir=' . s:dir . '/backup//'
-  set backup
-else
-  set nobackup
-endif
-if has('persistent_undo') && isdirectory(s:dir . '/undo/')
-  execute 'set undodir=' . s:dir . '/undo//'
-  set undofile
-else
-  set noundofile
-endif
-
-" Local netrw hide list.  Sensible default shows .o files, etc.
-let g:netrw_list_hide = '\~$,^tags$,\.swp$,\.o$,\.pyc$,\.class$'
-
-" Preferred local settings
-"set visualbell noerrorbells           " Bells set to visual only
-set novisualbell noerrorbells          " Bells set to visual only
-set number                             " Use con to toggle numbers
-set relativenumber                     " Use cor to toggle relative numbers
-"set mouse=a                           " Enable mouse (thinkpad scroll)
-set scrolloff=5                                " Cursor offset from screen top/bottom
-set hidden                             " Don't warn when hiding a changed buffer
-set modeline                           " Best not to allow per-file override
-if exists('+cursorline')
-  " unimpaired.vim adds change option: coc toggles cursorline
-  "hi CursorLine cterm=NONE,underline  " Underline makes '_' and ' ' alike
-  "set cursorline                      " Highlight current line
-  "nnoremap <leader>c :set cursorline!<CR>
-endif
-
-" Search options
-" unimpaired.vim adds change option: coh toggles hlsearch
-set ignorecase smartcase nohlsearch
-
-" Ignore files
-set wildignore=*.swp,*.bak,*.o,*.pyc,*.class,*.a,*.so
-
-" Mapping for paste toggle
-nnoremap <F2> :set invpaste paste?<CR>
-set pastetoggle=<F2>
-
-" Use Q for formatting the current paragraph (or selection)
-vmap Q gq
-nmap Q gqap
-
-" Intuitive window navigation
-map <C-h> <C-w>h
-map <C-j> <C-w>j
-map <C-k> <C-w>k
-map <C-l> <C-w>l
-
-" Window resizing
-nnoremap <M-left> :vertical resize -1<CR>
-nnoremap <M-right> :vertical resize +1<CR>
-nnoremap <M-up> :resize +1<CR>
-nnoremap <M-down> :resize -1<CR>
-
-" w!! to write file with sudo
-cmap w!! w!sudo tee % >/dev/null
-
-" Stuff for supporting ctags.  Need a better way to select the right ctags
-" set tags=/usr/include/tags,./tags,./../tags,./../**/tags
-set tags=tags;/
-
-" %% on an ex command line expands to the dir path of the current buffer
-cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
-
-" Create some edit maps for opening new files
-map <leader>ew :e %%<CR>
-map <leader>es :sp %%<CR>
-map <leader>ev :vsp %%<CR>
-map <leader>et :tabe %%<CR>
-
-" Make <C-]> and g] work like g<C-]>, which uses :tjump
-nnoremap g] g<C-]>
-nnoremap <C-]> g<C-]>
-
-" Spell check
-" unimpaired.vim adds change option: cos toggles spell
-"nmap <silent> <leader>s :set spell!<CR> :set spell?<CR>
-set spelllang=en
-
-" Toggle numbers on and off
-" unimpaired.vim adds change option: con toggles numbers
-"nmap <silent> <leader>n :set number!<CR>
-
-" Toggle word wrap
-" unimpaired.vim adds change option: cow toggles wrap
-"nmap <silent> <leader>w :set wrap!<CR> :set wrap?<CR>
-
-" Custom statusline
-set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
-
-if has("autocmd")
-  " Auto-close fugitive buffers
-  autocmd BufReadPost fugitive://* set bufhidden=delete
-
-  " Navigate up one level from fugitive trees and blobs
-  autocmd User fugitive
-    \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
-    \   nnoremap <buffer> .. :edit %:h<CR> |
-    \ endif
-endif
-
-" EasyGrep
-" To ignore tags file, use system grep.
-let g:EasyGrepCommand=1
-let g:EasyGrepFilesToExclude='tags'
-
-" Gitv settings
-set lazyredraw
-let g:Gitv_OpenHorizontal = 1
-let g:Gitv_DoNotMapCtrlKey = 1
-let g:Gitv_OpenPreviewOnLaunch = 1
-nmap <leader>gv :Gitv --all<cr>
-nmap <leader>gV :Gitv! --all<cr>
-vmap <leader>gV :Gitv! --all<cr>
-
-" Reduce EasyMotion functionality; use single Leader to activate
-" map <Leader> <Plug>(easymotion-prefix)
-let g:EasyMotion_do_mapping = 0
-" Map multi input search to <leader>s.  Not wise to map to / because the
-" performance of easymotion-sn on large files is very slow.
-nmap <leader>s <Plug>(easymotion-sn)
-xmap <leader>s <Plug>(easymotion-sn)
-omap <leader>s <Plug>(easymotion-sn)
-" These are the uni-directional mappings.  They are faster.
-"nmap <Leader>f <Plug>(easymotion-f)
-"nmap <Leader>F <Plug>(easymotion-F)
-"nmap <Leader>w <Plug>(easymotion-w)
-"nmap <Leader>b <Plug>(easymotion-b)
-"nmap <Leader>W <Plug>(easymotion-W)
-"nmap <Leader>B <Plug>(easymotion-B)
-"nmap <Leader>e <Plug>(easymotion-e)
-"nmap <Leader>E <Plug>(easymotion-E)
-"nmap <Leader>ge <Plug>(easymotion-ge)
-"nmap <Leader>gE <Plug>(easymotion-gE)
-"nmap <Leader>j <Plug>(easymotion-j)
-"nmap <Leader>k <Plug>(easymotion-k)
-"nmap <Leader>n <Plug>(easymotion-n)
-"nmap <Leader>N <Plug>(easymotion-N)
-" These are the bi-directional mappings.  They are more flexible but slower.
-nmap <Leader>f <Plug>(easymotion-bd-f)
-nmap <Leader>F <Plug>(easymotion-bd-f)
-nmap <Leader>w <Plug>(easymotion-bd-w)
-nmap <Leader>b <Plug>(easymotion-bd-w)
-nmap <Leader>W <Plug>(easymotion-bd-W)
-nmap <Leader>B <Plug>(easymotion-bd-W)
-nmap <Leader>e <Plug>(easymotion-bd-e)
-nmap <Leader>E <Plug>(easymotion-bd-E)
-nmap <Leader>ge <Plug>(easymotion-bd-e)
-nmap <Leader>gE <Plug>(easymotion-bd-E)
-nmap <Leader>j <Plug>(easymotion-bd-jk)
-nmap <Leader>k <Plug>(easymotion-bd-jk)
-nmap <Leader>n <Plug>(easymotion-bd-n)
-nmap <Leader>N <Plug>(easymotion-bd-n)
-
-" Airline configuration
-" Single character mode, since showmode is set
-let g:airline_powerline_fonts = 1
-let g:airline_mode_map = {
-    \ '__' : '-',
-    \ 'n'  : 'N',
-    \ 'i'  : 'I',
-    \ 'R'  : 'R',
-    \ 'c'  : 'C',
-    \ 'v'  : 'V',
-    \ 'V'  : 'V',
-    \ '\16' : 'V',
-    \ 's'  : 'S',
-    \ 'S'  : 'S',
-    \ '\13' : 'S',
-    \ }
-" Customize sections
-let g:airline_section_x = airline#section#create(['filetype'])
-let g:airline_section_y = airline#section#create(['ffenc'])
-let g:airline_section_z = airline#section#create(['linenr', ':%3c '])
-let g:airline#extensions#whitespace#checks = [ 'trailing' ]
-" Minimize hunks summary under version control
-let g:airline#extensions#hunks#non_zero_only = 1
-" tabline shows buffers
-let g:airline#extensions#tabline#enabled = 1
-let g:airline#extensions#tabline#buffer_min_count = 2
-let g:airline#extensions#tabline#buffer_idx_mode = 1
-nmap <leader>1 <Plug>AirlineSelectTab1
-nmap <leader>2 <Plug>AirlineSelectTab2
-nmap <leader>3 <Plug>AirlineSelectTab3
-nmap <leader>4 <Plug>AirlineSelectTab4
-nmap <leader>5 <Plug>AirlineSelectTab5
-nmap <leader>6 <Plug>AirlineSelectTab6
-nmap <leader>7 <Plug>AirlineSelectTab7
-nmap <leader>8 <Plug>AirlineSelectTab8
-nmap <leader>9 <Plug>AirlineSelectTab9
-
-" Highlight only long lines
-" This solution has two problems:
-" 1. On first file edit, the status bar does not render until a key is pressed
-" 2. When creating new lines the last column isn't known until it's arrived
-"augroup collumnLimit
-"  autocmd!
-"  autocmd BufEnter,WinEnter,FileType scala,java,c,nesc,make
-"        \ highlight CollumnLimit ctermbg=LightGrey guibg=LightGrey
-"  let collumnLimit = 79
-"  let pattern =
-"        \ '\%<' . (collumnLimit+1) . 'v.\%>' . collumnLimit . 'v'
-"  autocmd BufEnter,WinEnter,FileType scala,java,c,nesc,make
-"        \ let w:m1=matchadd('CollumnLimit', pattern, -1)
-"augroup END
-
-" The simpler solution to the above, which generates a column
-if exists('+colorcolumn')
-  if v:version >= 703
-    " Set color column relative to defined textwidth.
-    " Highlights the column immediately after the last valid.
-    set colorcolumn=+1
-  else
-    set colorcolumn=80
-  endif
-else
-  au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
-endif
-
-" delimitMate
-let g:delimitMate_matchpairs = "{:},[:],(:)"
-let g:delimitMate_autoclose = 1
-let g:delimitMate_expand_cr = 1
-let g:delimitMate_expand_space = 1
-nnoremap coa :DelimitMateSwitch<CR>
-
-" Rainbow Parenthesis -- off by default but set toggle
-nnoremap cop :RainbowParenthesesToggle<CR>
-
-" Turn on doxygen syntax highlighting for C, C++, C# and IDL files.
-let g:load_doxygen_syntax=1
-
-" Use <C-x>/ to gain omnicomplete html tag completion
-imap <C-x>/ </<C-x><C-o>
-
-nnoremap <leader>W :call <SID>StripTrailingWhitespace()<CR>
-function! <SID>StripTrailingWhitespace()
-  " Save last search, and cursor position.
-  let _s=@/
-  let l = line(".")
-  let c = col(".")
-  " Perform the substitution.
-  %s/\s\+$//e
-  " Restore last search and cursor position.
-  let @/=_s
-  call cursor(l, c)
-endfunction
-
-" Implement 'cot' -- Toggle formatoption 't' -- wrap texts to textwidth
-nnoremap cot :call ToggleFormatOptionT()<CR>
-function! ToggleFormatOptionT()
-  let tmp = substitute(&formatoptions, 't', '', '')
-  if &formatoptions == tmp
-    set fo+=t
-    :echo "Enable text wrap"
-  else
-    set fo-=t
-    :echo "Disable text wrap"
-  endif
-endfunction
-
-" Insert date and time in insert mode.  Have to use the native <Leader>, not
-" its re-mapped version <space>
-imap <leader>d <C-R>=strftime("%Y%m%d")<CR>
-imap <leader>D <C-R>=strftime("%Y-%m-%d")<CR>
-imap <leader>t <C-R>=strftime("%H:%M:%S")<CR>