From fed8c201dc4ba27627bfb66c9bc1c3d7e05b96ee Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Wed, 19 Aug 2015 20:03:18 +0200 Subject: Updated vimrc for nvim compatiblity --- vim/.vimrc | 69 ++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 27 deletions(-) (limited to 'vim') diff --git a/vim/.vimrc b/vim/.vimrc index 20d49fb..cde36c1 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,11 +1,11 @@ -execute pathogen#infect() +silent! execute pathogen#infect() """ DEFAULT VIM SETTINGS " Reload vimrc on save augroup reload_vimrc " { - autocmd! - autocmd BufWritePost $MYVIMRC source $MYVIMRC + autocmd! + autocmd BufWritePost $MYVIMRC source $MYVIMRC augroup END " } let mapleader=" " @@ -14,9 +14,15 @@ syntax on filetype plugin indent on " Set colorscheme when the terminal has 256 color support -if &t_Co == 256 - colorscheme Benokai -endif +try + if (&t_Co == 256) && match($TERM, "256color") >= 0 + colorscheme Benokai + else + throw "nocolor" + endif +catch + colorscheme desert +endtry " Some vim settings set number @@ -30,7 +36,6 @@ set listchars=trail:·,tab:▸\ ,eol:¬ set scrolloff=1 set backspace=indent,eol,start set cursorline -set cursorcolumn " Disable ex mode nnoremap Q @@ -56,30 +61,40 @@ noremap! " Append modeline when pressing ml function! AppendModeline() - let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", - \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') - let l:modeline = substitute(&commentstring, "%s", l:modeline, "") - call append(line("$"), l:modeline) + let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", + \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') + let l:modeline = substitute(&commentstring, "%s", l:modeline, "") + call append(line("$"), l:modeline) endfunction nnoremap ml :call AppendModeline() +" NeoVIM specifics +if has('nvim') + nmap h + tnoremap +endif + """ PLUGIN SPECIFIC SETTINGS -" NERDTree: -" Open NERDTree when no file is specified -autocmd StdinReadPre * let s:std_in=1 -autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif - -" Airline: -" On arch linux install the following: -" otf-powerline-symbols-git -" powerline-fonts-git -let g:airline_powerline_fonts = 1 -if !exists('g:airline_symbols') - let g:airline_symbols = {} +if exists("g:loaded_pathogen") + + " NERDTree: + " Open NERDTree when no file is specified + autocmd StdinReadPre * let s:std_in=1 + autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif + autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif + + " Airline: + " On arch linux install the following: + " otf-powerline-symbols-git + " powerline-fonts-git + let g:airline_powerline_fonts = 1 + if !exists('g:airline_symbols') + let g:airline_symbols = {} + endif + let g:airline_symbols.space = "\ua0" + set laststatus=2 + endif -let g:airline_symbols.space = "\ua0" -set laststatus=2 -" vim: set ts=8 sw=8 tw=78 noet : +" vim: set ts=4 sw=4 tw=4 et : -- cgit v1.2.3