.vimrc 1.7 KB

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