.vimrc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. call plug#begin('~/.vim/plugged')
  2. Plug 'tpope/vim-sensible'
  3. Plug 'tpope/vim-sleuth'
  4. Plug 'tpope/vim-fugitive'
  5. Plug 'bling/vim-airline'
  6. Plug 'mhinz/vim-signify'
  7. Plug 'Shougo/unite.vim'
  8. Plug 'trusktr/seti.vim'
  9. call plug#end()
  10. " ----- plugin settings ------
  11. let g:signify_vcs_list = [ 'git' ]
  12. call unite#filters#matcher_default#use(['matcher_fuzzy'])
  13. let g:unite_source_rec_async_command = ['ag', '--follow', '--nocolor', '--nogroup', '-g', '']
  14. autocmd FileType unite call s:unite_settings()
  15. function! s:unite_settings()
  16. " Enable navigation with control-j and control-k in insert mode
  17. imap <buffer> <C-j> <Plug>(unite_select_next_line)
  18. imap <buffer> <C-k> <Plug>(unite_select_previous_line)
  19. endfunction
  20. " ------ settings ------
  21. " default indentation
  22. set shiftwidth=2
  23. set tabstop=4
  24. set expandtab
  25. " permanent undo history
  26. set undofile
  27. set undodir=~/.vim/undo
  28. " allow switching buffers
  29. set hidden
  30. " always scroll
  31. set scrolloff=99
  32. " show line numbers
  33. set number
  34. set relativenumber
  35. " set wordwrap indent
  36. set nowrap
  37. set linebreak
  38. if exists("&breakindent")
  39. set breakindent
  40. set breakindentopt=shift:2,sbr
  41. endif
  42. " show whitespace
  43. set list
  44. " make a new copy of the file for backup
  45. " setting to no or auto messes with filewatchers
  46. set backupcopy=yes
  47. " ------ key bindings ------
  48. " ; as :
  49. nnoremap ; :
  50. vnoremap ; :
  51. " allow <ESC> via jj in insert mode
  52. inoremap jj <ESC>
  53. " fix j/k with wraps
  54. nnoremap j gj
  55. nnoremap k gk
  56. vnoremap j gj
  57. vnoremap k gk
  58. " opening unite
  59. nnoremap <C-P> :Unite -no-split -buffer-name=files -start-insert file_rec<cr>
  60. nnoremap <C-O> :Unite -no-split -buffer-name=buffers -start-insert buffer<cr>
  61. " ------ nvim specific ------
  62. if has('nvim')
  63. tnoremap jj <C-\><C-N>
  64. tnoremap <C-W> <C-\><C-N><C-W>
  65. nnoremap <C-P> :Unite -no-split -buffer-name=files -start-insert file_rec/neovim<cr>
  66. endif
  67. augroup formatting
  68. au!
  69. " strip trailing whitespace
  70. autocmd BufWritePre * :%s/\s\+$//e
  71. augroup end
  72. colorscheme seti