init.vim 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. " ########## General ########## {{{
  2. syntax on
  3. colorscheme elflord
  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 hlsearch
  12. set smarttab
  13. set ignorecase
  14. set smartcase
  15. set mouse=
  16. set number relativenumber
  17. set so=7
  18. set tabstop=4 shiftwidth=4
  19. set expandtab
  20. let mapleader = ","
  21. let maplocalleader = "\\"
  22. " }}}
  23. " ########## Highlighting ########## {{{
  24. highlight ExtraWhitespace ctermbg=red guibg=red
  25. match ExtraWhitespace /\s\+$/
  26. augroup trailingwhitespace
  27. autocmd!
  28. autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
  29. augroup END
  30. " Tabs
  31. set list
  32. set listchars=tab:\|\ ,
  33. " }}}
  34. " ########## Keybinds ########## {{{
  35. nnoremap <leader>ev :vsplit $MYVIMRC<cr>
  36. nnoremap <leader>sv :source $MYVIMRC<cr>
  37. nnoremap <leader>f :FZF<cr>
  38. nnoremap <leader>gs :Gstatus<cr>
  39. nnoremap <leader>gc :Gcommit<cr>
  40. nnoremap <leader>gr :Git rebase -i
  41. noremap <leader>c :w! \| !compiler <c-r>%<CR><CR>
  42. noremap <leader>o :!open <c-r>%<CR><CR>
  43. noremap <leader>p :!opout <c-r>%<CR><CR>
  44. nnoremap <leader>u :!ctags -R .<CR>
  45. " Local (scope) replace
  46. nnoremap gr gd[{V%::s/<C-R>///gc<left><left><left>
  47. " Global replace
  48. nnoremap gR gD:%s/<C-R>///gc<left><left><left>
  49. " Cscope keybinds
  50. map g<C-]> :cs find 3 <C-R>=expand("<cword>")<CR><CR>
  51. map g<C-\> :cs find 0 <C-R>=expand("<cword>")<CR><CR>
  52. nnoremap Y y$
  53. nnoremap H ^
  54. nnoremap L $
  55. vnoremap H ^
  56. vnoremap L $
  57. inoremap jk <esc>
  58. inoremap <esc> <nop>
  59. inoremap <Left> <nop>
  60. inoremap <Right> <nop>
  61. inoremap <Up> <nop>
  62. inoremap <Down> <nop>
  63. " Dragvisuals keybinds
  64. vmap <expr> <LEFT> DVB_Drag('left')
  65. vmap <expr> <RIGHT> DVB_Drag('right')
  66. vmap <expr> <DOWN> DVB_Drag('down')
  67. vmap <expr> <UP> DVB_Drag('up')
  68. vmap <expr> D DVB_Duplicate()
  69. " Remove any introduced trailing whitespace after moving...
  70. let g:DVB_TrimWS = 1
  71. " }}}
  72. " ########## Abbreviations ########## {{{
  73. iabbrev @@ frans@tankernn.eu
  74. iabbrev ssig -- <cr>Frans Bergman<cr>frans@tankernn.eu
  75. " }}}
  76. " ########## File-specific settings ########## {{{
  77. autocmd FileType gitcommit,groff :set spell
  78. autocmd FileType vim :set foldmethod=marker
  79. autocmd BufNewFile,BufRead *.ms,*.me,*.mom,*.man set filetype=groff
  80. " }}}
  81. " ########## Plugin Settings ########## {{{
  82. let g:ale_linters = {'rust': ['analyzer']}
  83. set omnifunc=ale#completion#OmniFunc
  84. let g:ale_completion_enabled = 1
  85. let g:ale_completion_autoimport = 1
  86. let g:ale_fix_on_save = 1
  87. let g:ale_fixers = {
  88. \ '*': ['remove_trailing_lines', 'trim_whitespace'],
  89. \ 'rust': ['rustfmt'],
  90. \}
  91. nmap <leader>an <Plug>(ale_next)
  92. nmap <leader>ap <Plug>(ale_previous)
  93. augroup rust
  94. autocmd!
  95. autocmd FileType rust let b:delimitMate_smart_quotes='\%(\w\|[^[:punct:][:space:]]\|\%(\\\\\)*\\\)\%#\|\%#\%(\w\|[^[:space:][:punct:]]\)\|\<\%#\|\&\%#'
  96. augroup END
  97. " Use `tab` key to select completions. Default is arrow keys.
  98. inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
  99. inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  100. " }}}
  101. " ########## Plugins ########## {{{
  102. call plug#begin()
  103. Plug 'tpope/vim-fugitive'
  104. Plug 'bling/vim-airline'
  105. Plug 'vim-airline/vim-airline-themes'
  106. Plug 'mkitt/tabline.vim'
  107. Plug 'tpope/vim-surround'
  108. Plug 'tpope/vim-repeat'
  109. Plug 'raimondi/delimitmate'
  110. Plug 'fisadev/dragvisuals.vim'
  111. Plug 'dense-analysis/ale'
  112. Plug 'junegunn/fzf'
  113. Plug 'preservim/nerdtree'
  114. Plug 'vim-scripts/taglist.vim'
  115. Plug 'ashinkarov/nvim-agda'
  116. Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
  117. call plug#end()
  118. " }}}