.vimrc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. " ########## General ########## {{{
  2. syntax on
  3. colorscheme peachpuff
  4. let g:airline_theme='atomic'
  5. set encoding=utf-8
  6. set fileencoding=utf-8
  7. set wildmenu
  8. set autoindent
  9. set smartindent
  10. set incsearch
  11. set smarttab
  12. set ignorecase
  13. set smartcase
  14. set number relativenumber
  15. set so=7
  16. set tabstop=4 shiftwidth=4
  17. set expandtab
  18. let mapleader = ","
  19. let maplocalleader = "\\"
  20. " }}}
  21. " ########## Highlighting ########## {{{
  22. highlight ExtraWhitespace ctermbg=red guibg=red
  23. match ExtraWhitespace /\s\+$/
  24. augroup trailingwhitespace
  25. autocmd!
  26. autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
  27. augroup END
  28. " }}}
  29. " ########## Keybinds ########## {{{
  30. nnoremap <leader>ev :vsplit $MYVIMRC<cr>
  31. nnoremap <leader>sv :source $MYVIMRC<cr>
  32. nnoremap <leader>f :FZF<cr>
  33. nnoremap <leader>gs :Gstatus<cr>
  34. nnoremap <leader>gc :Gcommit<cr>
  35. nnoremap <leader>gr :Git rebase -i
  36. noremap <leader>c :w! \| !compiler <c-r>%<CR>
  37. noremap <leader>p :!opout <c-r>%<CR><CR>
  38. " Local (scope) replace
  39. nnoremap gr gd[{V%::s/<C-R>///gc<left><left><left>
  40. " Global replace
  41. nnoremap gR gD:%s/<C-R>///gc<left><left><left>
  42. nnoremap Y y$
  43. nnoremap H ^
  44. nnoremap L $
  45. vnoremap H ^
  46. vnoremap L $
  47. inoremap jk <esc>
  48. inoremap <esc> <nop>
  49. inoremap <Left> <nop>
  50. inoremap <Right> <nop>
  51. inoremap <Up> <nop>
  52. inoremap <Down> <nop>
  53. " Dragvisuals keybinds
  54. vmap <expr> <LEFT> DVB_Drag('left')
  55. vmap <expr> <RIGHT> DVB_Drag('right')
  56. vmap <expr> <DOWN> DVB_Drag('down')
  57. vmap <expr> <UP> DVB_Drag('up')
  58. vmap <expr> D DVB_Duplicate()
  59. " Remove any introduced trailing whitespace after moving...
  60. let g:DVB_TrimWS = 1
  61. " }}}
  62. " ########## Abbreviations ########## {{{
  63. iabbrev ret return
  64. iabbrev @@ frans@tankernn.eu
  65. iabbrev ssig -- <cr>Frans Bergman<cr>frans@tankernn.eu
  66. " }}}
  67. " ########## File-specific settings ########## {{{
  68. autocmd FileType gitcommit,groff :set spell
  69. autocmd FileType vim :set foldmethod=marker
  70. autocmd BufNewFile,BufRead *.ms,*.me,*.mom,*.man set filetype=groff
  71. " }}}
  72. " ########## Plugins ########## {{{
  73. call plug#begin()
  74. Plug 'VundleVim/Vundle.vim'
  75. Plug 'tpope/vim-fugitive'
  76. Plug 'bling/vim-airline'
  77. Plug 'vim-airline/vim-airline-themes'
  78. Plug 'mkitt/tabline.vim'
  79. Plug 'tpope/vim-surround'
  80. Plug 'tpope/vim-repeat'
  81. Plug 'raimondi/delimitmate'
  82. Plug 'neomake/neomake'
  83. Plug 'fisadev/dragvisuals.vim'
  84. Plug 'maralla/completor.vim'
  85. Plug 'junegunn/fzf'
  86. call plug#end()
  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. " }}}