diff options
Diffstat (limited to 'vimrc')
| -rw-r--r-- | vimrc | 20 |
1 files changed, 13 insertions, 7 deletions
| @@ -1,13 +1,12 @@ | |||
| 1 | set nocompatible | 1 | set nocompatible |
| 2 | set path+=** | ||
| 3 | set number relativenumber autoindent | 2 | set number relativenumber autoindent |
| 4 | set smartcase ignorecase incsearch | 3 | set ignorecase smartcase incsearch |
| 5 | set hidden nowrap nobackup noswapfile autoread | 4 | set hidden nowrap nobackup noswapfile autoread |
| 6 | set wildmenu laststatus=2 | 5 | set wildmenu laststatus=2 |
| 7 | set encoding=utf8 spelllang=en_us | 6 | set encoding=utf8 spelllang=en_us |
| 8 | set backspace=2 scrolloff=4 | 7 | set backspace=2 scrolloff=4 |
| 9 | set shiftwidth=4 tabstop=4 | 8 | set shiftwidth=4 tabstop=4 |
| 10 | set gp=grep\ -irn | 9 | set path+=** gp=grep\ -irn |
| 11 | 10 | ||
| 12 | filetype plugin indent on | 11 | filetype plugin indent on |
| 13 | syntax enable | 12 | syntax enable |
| @@ -29,10 +28,17 @@ augroup commenting_blocks_of_code | |||
| 29 | autocmd FileType vim let b:comment_leader = '" ' | 28 | autocmd FileType vim let b:comment_leader = '" ' |
| 30 | augroup END | 29 | augroup END |
| 31 | noremap <silent> cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> | 30 | noremap <silent> cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> |
| 32 | noremap <silent> cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> | 31 | noremap <silent> cu :<C-B>silent <C-E>s/^\(\s*\)\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> |
| 33 | 32 | ||
| 34 | " Personal tabs/spaces settings. | 33 | " Personal tabs/spaces settings. |
| 35 | autocmd Filetype make,go setlocal noexpandtab tabstop=4 shiftwidth=4 | 34 | autocmd Filetype make,go,sh setlocal noexpandtab tabstop=4 shiftwidth=4 |
| 36 | autocmd Filetype c,cpp,sh,lua setlocal expandtab tabstop=4 shiftwidth=4 | 35 | autocmd Filetype c,cpp,lua setlocal expandtab tabstop=4 shiftwidth=4 |
| 37 | autocmd Filetype html,javascript,css setlocal expandtab tabstop=2 shiftwidth=2 | 36 | autocmd Filetype nix,html,javascript,css setlocal expandtab tabstop=2 shiftwidth=2 |
| 37 | |||
| 38 | " Function to auto format source code files. | ||
| 39 | function! Format() | ||
| 40 | if &filetype == 'c' | call system('clang-format -i '.expand('%')) | edit! | endif | ||
| 41 | if &filetype == 'go' | call system('go fmt '.expand('%')) | edit! | endif | ||
| 42 | endfunction | ||
| 43 | command! Format call Format() | ||
| 38 | 44 | ||
