" VIM configuration
+
+" Basic options
syn on
set nu
-
set background=dark
set nobackup
set nowritebackup
set noswapfile
-
set noautoindent
set nosmartindent
set tabstop=2
set nocompatible
set laststatus=2
set shortmess+=I
-
set ignorecase
set smartcase
+" Window title handling
set title
set titleold="terminal"
set titlestring=vim:\ %F
-" Command mode completion
-" See https://stackoverflow.com/questions/526858/how-do-i-make-vim-do-normal-bash-like-tab-completion-for-file-names
-"set wildmode=longest,list
-set wildmode=longest,list,full
-set wildmenu
-
" Thanks to http://stackoverflow.com/questions/1673649/vimrc-action-onclose
function! ResetTitle(title)
" disable vim's ability to set the title
au VimLeave *mutt/* silent call ResetTitle("mutt")
au VimLeave *remind/* silent call ResetTitle("wyrd")
+" Command mode completion
+" See https://stackoverflow.com/questions/526858/how-do-i-make-vim-do-normal-bash-like-tab-completion-for-file-names
+"set wildmode=longest,list
+set wildmode=longest,list,full
+set wildmenu
+
" Folding
set foldmethod=syntax
set foldlevelstart=99
\ 'active_filetypes': [],
\ 'passive_filetypes': [] }
-" Shortcut to open a new tab
+" Write, quit and close shortcuts using Esc-key combos
+" ESC keys have the advantage over Alt shortcuts as they
+" are difficult to be mistaken for the Meta key
nmap <ESC>n :tabnew<CR>
+nmap <ESC>t :OpenNERDTree<CR>
+nmap <ESC>q :wqa <CR>
+"map <ESC>c :wqa <CR>
+"map <ESC>f :wq <CR>
+nmap <ESC>c :tabclose <CR>
+"map <ESC>e :tabclose <CR>
+nmap <ESC>m :q! <CR>
+nmap <ESC>w :w <CR>
+imap <ESC>n <ESC>:tabnew<CR>
+imap <ESC>t <ESC>:OpenNERDTree<CR>
+imap <ESC>q <ESC>:wqa <CR>
+"map <ESC>c <ESC>:wqa <CR>
+"map <ESC>f <ESC>:wq <CR>
+imap <ESC>c <ESC>:tabclose <CR>
+"map <ESC>e <ESC>:tabclose <CR>
+imap <ESC>m <ESC>:q! <CR>
+imap <ESC>w <ESC>:w <CR>
" Write, quit and close shortcuts using Alt-key combos
"
" but this does not seem to be the case. Anyway there's interesting discussion at
" https://stackoverflow.com/questions/5142099/how-to-auto-save-vim-session-on-quit-and-auto-reload-on-start-including-split-wi
"map \eq :wqa <CR>
-map \ec :wqa <CR>
-map \ef :wq <CR>
+"map \ec :wqa <CR>
+"map \ef :wq <CR>
"map \ec :tabclose <CR>
-map \ee :tabclose <CR>
-map \em :q! <CR>
-map \ew :w <CR>
+"map \ee :tabclose <CR>
+"map \em :q! <CR>
+"map \ew :w <CR>
" Write, quit and close shortcuts using Ctrl-key combos
" We're using these due to a conflict with wyrd(1)
"map m :q! <CR>
"map w :w <CR>
+" Tab navigation
+" See http://vim.wikia.com/wiki/Alternative_tab_navigation
+" http://comments.gmane.org/gmane.os.cygwin.xfree/16419
+nmap <ESC>[5^ <C-PageUp>
+nmap <ESC>[6^ <C-PageDown>
+nnoremap <C-PageDown> :tabn<CR>
+nnoremap <C-PageUp> :tabp<CR>
+nmap \e1 1gt
+nmap \e2 2gt
+nmap \e3 3gt
+nmap \e4 4gt
+nmap \e5 5gt
+nmap \e6 6gt
+nmap \e7 7gt
+nmap \e8 8gt
+nmap \e9 9gt
+nmap \e0 10gt
+
+" Buffer navigation: Alt-{Up,Down}
+map \eOd :bprevious<CR>
+map \eOc :bnext<CR>
+
+" Window navigation
+"map \e<Left> <C-w><Left>
+"map \e<Right> <C-w><Right>
+"map \e<Down> <C-w><Down>
+"map \e<Up> <C-w><Up>
+nmap <ESC><Left> <C-w><Left>
+nmap <ESC><Right> <C-w><Right>
+nmap <ESC><Down> <C-w><Down>
+nmap <ESC><Up> <C-w><Up>
+imap <ESC><Left> <ESC><C-w><Left>
+imap <ESC><Right> <ESC><C-w><Right>
+imap <ESC><Down> <ESC><C-w><Down>
+imap <ESC><Up> <ESC><C-w><Up>
+
" NERDTree section
" Thanks to http://stackoverflow.com/questions/1447334/how-do-you-add-nerdtree-to-your-vimrc
command -nargs=1 -complete=dir T :call TabNew(<f-args>)
command -nargs=1 -complete=customlist,nerdtree#completeBookmarks B :call TabNewBookmark(<f-args>)
command -nargs=0 OpenNERDTree :call OpenNERDTree()
-nmap <ESC>t :OpenNERDTree<CR>
" See http://superuser.com/questions/10588/how-to-make-cut-copy-paste-in-gvim-on-ubuntu-work-with-ctrlx-ctrlc-ctrlv
"imap <C-v> <C-r><C-o>+
set showtabline=2 " Always display the tabline, even if there is only one tab
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
-" Tab navigation
-" See http://vim.wikia.com/wiki/Alternative_tab_navigation
-" http://comments.gmane.org/gmane.os.cygwin.xfree/16419
-nmap <ESC>[5^ <C-PageUp>
-nmap <ESC>[6^ <C-PageDown>
-nnoremap <C-PageDown> :tabn<CR>
-nnoremap <C-PageUp> :tabp<CR>
-nmap \e1 1gt
-nmap \e2 2gt
-nmap \e3 3gt
-nmap \e4 4gt
-nmap \e5 5gt
-nmap \e6 6gt
-nmap \e7 7gt
-nmap \e8 8gt
-nmap \e9 9gt
-nmap \e0 10gt
-
-" Buffer navigation: Alt-{Up,Down}
-map \eOd :bprevious<CR>
-map \eOc :bnext<CR>
-
-" Window navigation
-map \e<Left> <C-w><Left>
-map \e<Right> <C-w><Right>
-map \e<Down> <C-w><Down>
-map \e<Up> <C-w><Up>
-
" See
" http://vim.wikia.com/wiki/Have_Vim_check_automatically_if_the_file_has_changed_externally
" http://stackoverflow.com/questions/2490227/how-does-vims-autoread-work