.vimrc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. set rtp+=~/.vim/bundle/Vundle.vim
  72. call vundle#begin()
  73. Plugin 'VundleVim/Vundle.vim'
  74. Plugin 'tpope/vim-fugitive'
  75. Plugin 'bling/vim-airline'
  76. Plugin 'vim-airline/vim-airline-themes'
  77. Plugin 'mkitt/tabline.vim'
  78. Plugin 'tpope/vim-surround'
  79. Plugin 'tpope/vim-repeat'
  80. Plugin 'raimondi/delimitmate'
  81. Plugin 'neomake/neomake'
  82. Plugin 'fisadev/dragvisuals.vim'
  83. Plugin 'maralla/completor.vim'
  84. Plugin 'junegunn/fzf'
  85. call vundle#end()
  86. filetype plugin indent on " required
  87. " }}}
  88. " ########## Plugin Settings ########## {{{
  89. autocmd FileType java setlocal omnifunc=javacomplete#Complete
  90. call neomake#configure#automake('nrwi', 500)
  91. " Use TAB to complete when typing words, else inserts TABs as usual. Uses
  92. " dictionary, source files, and completor to find matching words to complete.
  93. " Note: usual completion is on <C-n> but more trouble to press all the time.
  94. " Never type the same word twice and maybe learn a new spellings!
  95. " Use the Linux dictionary when spelling is in doubt.
  96. function! Tab_Or_Complete() abort
  97. " If completor is already open the `tab` cycles through suggested completions.
  98. if pumvisible()
  99. return "\<C-N>"
  100. " If completor is not open and we are in the middle of typing a word then
  101. " `tab` opens completor menu.
  102. elseif col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^[[:keyword:][:ident:]]'
  103. return "\<C-R>=completor#do('complete')\<CR>"
  104. else
  105. " If we aren't typing a word and we press `tab` simply do the normal `tab`
  106. " action.
  107. return "\<Tab>"
  108. endif
  109. endfunction
  110. " Use `tab` key to select completions. Default is arrow keys.
  111. inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
  112. inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  113. " Use tab to trigger auto completion.
  114. inoremap <expr> <Tab> Tab_Or_Complete()
  115. " }}}