diff options
| -rw-r--r-- | vim/.vimrc | 59 |
1 files changed, 35 insertions, 24 deletions
| @@ -1,51 +1,34 @@ | |||
| 1 | execute pathogen#infect() | 1 | execute pathogen#infect() |
| 2 | 2 | ||
| 3 | """ DEFAULT VIM SETTINGS | ||
| 4 | |||
| 3 | let mapleader=" " | 5 | let mapleader=" " |
| 4 | 6 | ||
| 5 | syntax on | 7 | syntax on |
| 6 | filetype plugin indent on | 8 | filetype plugin indent on |
| 7 | 9 | ||
| 10 | " Set colorscheme when the terminal has 256 color support | ||
| 8 | if &t_Co == 256 | 11 | if &t_Co == 256 |
| 9 | colorscheme Benokai | 12 | colorscheme Benokai |
| 10 | endif | 13 | endif |
| 11 | 14 | ||
| 12 | " On arch linux install the following: | 15 | " Some vim settings |
| 13 | " otf-powerline-symbols-git | 16 | set relativenumber |
| 14 | " powerline-fonts-git | ||
| 15 | let g:airline_powerline_fonts = 1 | ||
| 16 | if !exists('g:airline_symbols') | ||
| 17 | let g:airline_symbols = {} | ||
| 18 | endif | ||
| 19 | let g:airline_symbols.space = "\ua0" | ||
| 20 | |||
| 21 | set number | ||
| 22 | set hlsearch | 17 | set hlsearch |
| 23 | set list | 18 | set list |
| 24 | set modeline | 19 | set modeline |
| 25 | set relativenumber | ||
| 26 | |||
| 27 | set background=dark | 20 | set background=dark |
| 28 | set foldmethod=indent | 21 | set foldmethod=indent |
| 29 | set listchars=trail:·,tab:▸\ ,eol:¬ | 22 | set listchars=trail:·,tab:▸\ ,eol:¬ |
| 30 | set scrolloff=1 | 23 | set scrolloff=1 |
| 31 | 24 | ||
| 32 | autocmd StdinReadPre * let s:std_in=1 | 25 | " Switch windows with <C-W>[direction] |
| 33 | autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | ||
| 34 | autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | ||
| 35 | |||
| 36 | function! AppendModeline() | ||
| 37 | let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", | ||
| 38 | \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') | ||
| 39 | let l:modeline = substitute(&commentstring, "%s", l:modeline, "") | ||
| 40 | call append(line("$"), l:modeline) | ||
| 41 | endfunction | ||
| 42 | nnoremap <silent> <Leader>ml :call AppendModeline()<CR> | ||
| 43 | |||
| 44 | map <C-J> <C-W>j | 26 | map <C-J> <C-W>j |
| 45 | map <C-K> <C-W>k | 27 | map <C-K> <C-W>k |
| 46 | map <C-H> <C-W>h | 28 | map <C-H> <C-W>h |
| 47 | map <C-L> <C-W>l | 29 | map <C-L> <C-W>l |
| 48 | 30 | ||
| 31 | " Never use the arrow keys | ||
| 49 | noremap <Up> "" | 32 | noremap <Up> "" |
| 50 | noremap! <Up> <Esc> | 33 | noremap! <Up> <Esc> |
| 51 | noremap <Down> "" | 34 | noremap <Down> "" |
| @@ -55,4 +38,32 @@ noremap! <Left> <Esc> | |||
| 55 | noremap <Right> "" | 38 | noremap <Right> "" |
| 56 | noremap! <Right> <Esc> | 39 | noremap! <Right> <Esc> |
| 57 | 40 | ||
| 41 | " Append modeline when pressing <leader> ml | ||
| 42 | function! AppendModeline() | ||
| 43 | let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", | ||
| 44 | \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') | ||
| 45 | let l:modeline = substitute(&commentstring, "%s", l:modeline, "") | ||
| 46 | call append(line("$"), l:modeline) | ||
| 47 | endfunction | ||
| 48 | nnoremap <silent> <Leader>ml :call AppendModeline()<CR> | ||
| 49 | |||
| 50 | """ PLUGIN SPECIFIC SETTINGS | ||
| 51 | |||
| 52 | " NERDTree: | ||
| 53 | " Open NERDTree when no file is specified | ||
| 54 | autocmd StdinReadPre * let s:std_in=1 | ||
| 55 | autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | ||
| 56 | autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | ||
| 57 | |||
| 58 | " Airline: | ||
| 59 | " On arch linux install the following: | ||
| 60 | " otf-powerline-symbols-git | ||
| 61 | " powerline-fonts-git | ||
| 62 | let g:airline_powerline_fonts = 1 | ||
| 63 | if !exists('g:airline_symbols') | ||
| 64 | let g:airline_symbols = {} | ||
| 65 | endif | ||
| 66 | let g:airline_symbols.space = "\ua0" | ||
| 67 | set laststatus=2 | ||
| 68 | |||
| 58 | " vim: set ts=8 sw=8 tw=78 noet : | 69 | " vim: set ts=8 sw=8 tw=78 noet : |
