.vimrc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. " ########## General ########## {{{
  2. syntax on
  3. colorscheme peachpuff
  4. let g:airline_theme='atomic'
  5. set wildmenu
  6. set autoindent
  7. set smartindent
  8. set incsearch
  9. set smarttab
  10. set ignorecase
  11. set smartcase
  12. set number relativenumber
  13. set so=7
  14. set tabstop=4 shiftwidth=4
  15. set expandtab
  16. let mapleader = ","
  17. let maplocalleader = "\\"
  18. " }}}
  19. " ########## Highlighting ########## {{{
  20. highlight ExtraWhitespace ctermbg=red guibg=red
  21. match ExtraWhitespace /\s\+$/
  22. augroup trailingwhitespace
  23. autocmd!
  24. autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
  25. augroup END
  26. " }}}
  27. " ########## Keybinds ########## {{{
  28. nnoremap <leader>ev :vsplit $MYVIMRC<cr>
  29. nnoremap <leader>sv :source $MYVIMRC<cr>
  30. nnoremap <leader>f :FZF<cr>
  31. nnoremap <leader>gs :Gstatus<cr>
  32. nnoremap <leader>gc :Gcommit<cr>
  33. nnoremap <leader>gr :Git rebase -i
  34. noremap <leader>c :w! \| !compiler <c-r>%<CR>
  35. noremap <leader>p :!opout <c-r>%<CR><CR>
  36. " Local (scope) replace
  37. nnoremap gr gd[{V%::s/<C-R>///gc<left><left><left>
  38. " Global replace
  39. nnoremap gR gD:%s/<C-R>///gc<left><left><left>
  40. nnoremap Y y$
  41. nnoremap H ^
  42. nnoremap L $
  43. vnoremap H ^
  44. vnoremap L $
  45. inoremap jk <esc>
  46. inoremap <esc> <nop>
  47. inoremap <Left> <nop>
  48. inoremap <Right> <nop>
  49. inoremap <Up> <nop>
  50. inoremap <Down> <nop>
  51. " Dragvisuals keybinds
  52. vmap <expr> <LEFT> DVB_Drag('left')
  53. vmap <expr> <RIGHT> DVB_Drag('right')
  54. vmap <expr> <DOWN> DVB_Drag('down')
  55. vmap <expr> <UP> DVB_Drag('up')
  56. vmap <expr> D DVB_Duplicate()
  57. " Remove any introduced trailing whitespace after moving...
  58. let g:DVB_TrimWS = 1
  59. " }}}
  60. " ########## Abbreviations ########## {{{
  61. iabbrev ret return
  62. iabbrev @@ frans@tankernn.eu
  63. iabbrev ssig -- <cr>Frans Bergman<cr>frans@tankernn.eu
  64. " }}}
  65. " ########## File-specific settings ########## {{{
  66. autocmd FileType gitcommit,groff :set spell
  67. autocmd FileType vim :set foldmethod=marker
  68. autocmd BufNewFile,BufRead *.ms,*.me,*.mom,*.man set filetype=groff
  69. " }}}
  70. " ########## Plugins ########## {{{
  71. call plug#begin()
  72. Plug 'VundleVim/Vundle.vim'
  73. Plug 'tpope/vim-fugitive'
  74. Plug 'bling/vim-airline'
  75. Plug 'vim-airline/vim-airline-themes'
  76. Plug 'mkitt/tabline.vim'
  77. Plug 'tpope/vim-surround'
  78. Plug 'tpope/vim-repeat'
  79. Plug 'raimondi/delimitmate'
  80. Plug 'neomake/neomake'
  81. Plug 'fisadev/dragvisuals.vim'
  82. Plug 'maralla/completor.vim'
  83. Plug 'junegunn/fzf'
  84. call plug#end()
  85. " }}}
  86. " ########## Plugin Settings ########## {{{
  87. autocmd FileType java setlocal omnifunc=javacomplete#Complete
  88. call neomake#configure#automake('nrwi', 500)
  89. " Use TAB to complete when typing words, else inserts TABs as usual. Uses
  90. " dictionary, source files, and completor to find matching words to complete.
  91. " Note: usual completion is on <C-n> but more trouble to press all the time.
  92. " Never type the same word twice and maybe learn a new spellings!
  93. " Use the Linux dictionary when spelling is in doubt.
  94. function! Tab_Or_Complete() abort
  95. " If completor is already open the `tab` cycles through suggested completions.
  96. if pumvisible()
  97. return "\<C-N>"
  98. " If completor is not open and we are in the middle of typing a word then
  99. " `tab` opens completor menu.
  100. elseif col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^[[:keyword:][:ident:]]'
  101. return "\<C-R>=completor#do('complete')\<CR>"
  102. else
  103. " If we aren't typing a word and we press `tab` simply do the normal `tab`
  104. " action.
  105. return "\<Tab>"
  106. endif
  107. endfunction
  108. " Use `tab` key to select completions. Default is arrow keys.
  109. inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
  110. inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  111. " Use tab to trigger auto completion.
  112. inoremap <expr> <Tab> Tab_Or_Complete()
  113. " }}}