diff options
Diffstat (limited to 'vim')
| -rw-r--r-- | vim/.vimrc | 69 |
1 files changed, 42 insertions, 27 deletions
| @@ -1,11 +1,11 @@ | |||
| 1 | execute pathogen#infect() | 1 | silent! execute pathogen#infect() |
| 2 | 2 | ||
| 3 | """ DEFAULT VIM SETTINGS | 3 | """ DEFAULT VIM SETTINGS |
| 4 | 4 | ||
| 5 | " Reload vimrc on save | 5 | " Reload vimrc on save |
| 6 | augroup reload_vimrc " { | 6 | augroup reload_vimrc " { |
| 7 | autocmd! | 7 | autocmd! |
| 8 | autocmd BufWritePost $MYVIMRC source $MYVIMRC | 8 | autocmd BufWritePost $MYVIMRC source $MYVIMRC |
| 9 | augroup END " } | 9 | augroup END " } |
| 10 | 10 | ||
| 11 | let mapleader=" " | 11 | let mapleader=" " |
| @@ -14,9 +14,15 @@ syntax on | |||
| 14 | filetype plugin indent on | 14 | filetype plugin indent on |
| 15 | 15 | ||
| 16 | " Set colorscheme when the terminal has 256 color support | 16 | " Set colorscheme when the terminal has 256 color support |
| 17 | if &t_Co == 256 | 17 | try |
| 18 | colorscheme Benokai | 18 | if (&t_Co == 256) && match($TERM, "256color") >= 0 |
| 19 | endif | 19 | colorscheme Benokai |
| 20 | else | ||
| 21 | throw "nocolor" | ||
| 22 | endif | ||
| 23 | catch | ||
| 24 | colorscheme desert | ||
| 25 | endtry | ||
| 20 | 26 | ||
| 21 | " Some vim settings | 27 | " Some vim settings |
| 22 | set number | 28 | set number |
| @@ -30,7 +36,6 @@ set listchars=trail:·,tab:▸\ ,eol:¬ | |||
| 30 | set scrolloff=1 | 36 | set scrolloff=1 |
| 31 | set backspace=indent,eol,start | 37 | set backspace=indent,eol,start |
| 32 | set cursorline | 38 | set cursorline |
| 33 | set cursorcolumn | ||
| 34 | 39 | ||
| 35 | " Disable ex mode | 40 | " Disable ex mode |
| 36 | nnoremap Q <Nop> | 41 | nnoremap Q <Nop> |
| @@ -56,30 +61,40 @@ noremap! <Right> <Esc> | |||
| 56 | 61 | ||
| 57 | " Append modeline when pressing <leader> ml | 62 | " Append modeline when pressing <leader> ml |
| 58 | function! AppendModeline() | 63 | function! AppendModeline() |
| 59 | let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", | 64 | let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", |
| 60 | \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') | 65 | \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') |
| 61 | let l:modeline = substitute(&commentstring, "%s", l:modeline, "") | 66 | let l:modeline = substitute(&commentstring, "%s", l:modeline, "") |
| 62 | call append(line("$"), l:modeline) | 67 | call append(line("$"), l:modeline) |
| 63 | endfunction | 68 | endfunction |
| 64 | nnoremap <silent> <Leader>ml :call AppendModeline()<CR> | 69 | nnoremap <silent> <Leader>ml :call AppendModeline()<CR> |
| 65 | 70 | ||
| 71 | " NeoVIM specifics | ||
| 72 | if has('nvim') | ||
| 73 | nmap <BS> <C-W>h | ||
| 74 | tnoremap <Esc> <C-\><C-n> | ||
| 75 | endif | ||
| 76 | |||
| 66 | """ PLUGIN SPECIFIC SETTINGS | 77 | """ PLUGIN SPECIFIC SETTINGS |
| 67 | 78 | ||
| 68 | " NERDTree: | 79 | if exists("g:loaded_pathogen") |
| 69 | " Open NERDTree when no file is specified | 80 | |
| 70 | autocmd StdinReadPre * let s:std_in=1 | 81 | " NERDTree: |
| 71 | autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | 82 | " Open NERDTree when no file is specified |
| 72 | autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | 83 | autocmd StdinReadPre * let s:std_in=1 |
| 73 | 84 | autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
| 74 | " Airline: | 85 | autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif |
| 75 | " On arch linux install the following: | 86 | |
| 76 | " otf-powerline-symbols-git | 87 | " Airline: |
| 77 | " powerline-fonts-git | 88 | " On arch linux install the following: |
| 78 | let g:airline_powerline_fonts = 1 | 89 | " otf-powerline-symbols-git |
| 79 | if !exists('g:airline_symbols') | 90 | " powerline-fonts-git |
| 80 | let g:airline_symbols = {} | 91 | let g:airline_powerline_fonts = 1 |
| 92 | if !exists('g:airline_symbols') | ||
| 93 | let g:airline_symbols = {} | ||
| 94 | endif | ||
| 95 | let g:airline_symbols.space = "\ua0" | ||
| 96 | set laststatus=2 | ||
| 97 | |||
| 81 | endif | 98 | endif |
| 82 | let g:airline_symbols.space = "\ua0" | ||
| 83 | set laststatus=2 | ||
| 84 | 99 | ||
| 85 | " vim: set ts=8 sw=8 tw=78 noet : | 100 | " vim: set ts=4 sw=4 tw=4 et : |
