.vimrc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. "not VI compatible
  2. set nocompatible
  3. "set the path where the plugins live
  4. "in this case in the folder .vim in home
  5. set packpath+=~/.vim
  6. "needed for language server integration
  7. set runtimepath+=~/.vim-plugins/LanguageClient-neovim
  8. "turn off the taskbar in gvim
  9. set guioptions-=m
  10. "a bit more readable
  11. set guifont=Lucida_Console:h10
  12. "make backspace behave normally in insert mode
  13. set backspace=indent,eol,start
  14. "highlight search
  15. set hlsearch
  16. "search while entering the search query
  17. set incsearch
  18. "show me the options to autocomplete while in command mode
  19. set wildmenu
  20. "autocomplete stuff by giving me the match up to the first differing character
  21. "then tab through the options
  22. set wildmode=longest:list,full
  23. "NO, I don't want ANSI.
  24. set fileencodings=utf-8
  25. set encoding=utf-8
  26. set fileencoding=utf-8
  27. "turn on syntax highlighting and indentation
  28. "syntax on
  29. filetype indent plugin on
  30. "for indentating html - otherwise these tags are not recognized
  31. let g:html_indent_inctags = "html,body,head,tbody,table,td,tr,th,canvas"
  32. "whitespace
  33. set tabstop=4
  34. set shiftwidth=4
  35. set list
  36. set listchars=tab:>~,trail:~,extends:>,precedes:<
  37. "don't wrap - duh. - maybe I should change this, it seems actually quite
  38. "practical for keeping the right width for readability.
  39. set nowrap
  40. set textwidth=0
  41. set wrapmargin=0
  42. "line numbers
  43. set nu
  44. set rnu
  45. "colors
  46. syntax on
  47. "colorscheme desert
  48. colorscheme zellner
  49. "send all backups to home/vimbackups
  50. set backupdir=~/.vim/backups,.
  51. set directory=~/.vim/swapfiles,.
  52. " Persistent undo
  53. set undodir=~/.vim/undofiles,.
  54. set undofile
  55. "search and replace options ignore case, except if there's something uppercase
  56. "in it
  57. set ignorecase
  58. set smartcase
  59. "set the current working directory when entering a new file
  60. autocmd BufEnter * silent! :lcd%:p:h
  61. "remove all trailing whitespace on lines with non-whitespace characters
  62. " autocmd BufEnter * silent! :call <SID>StripTrailingWhitespaces()
  63. "____________MAPPINGS______________
  64. "
  65. "disable the fucking F1 key
  66. nmap <F1> <nop>
  67. "remap leader to space
  68. nnoremap <SPACE> <nop>
  69. let mapleader = " "
  70. "move screen
  71. nnoremap <C-h> 4zh
  72. nnoremap <C-l> 4zl
  73. nnoremap <C-j> 4<C-E>
  74. nnoremap <C-k> 4<C-Y>
  75. "getting the next match of f or t, but more logically - at least on a german
  76. "keyboard
  77. nnoremap ; ,
  78. nnoremap , ;
  79. "removes the highlighting after search
  80. "until I can fix the escape codes sent by the terminal, I'll have to press esc
  81. "twice
  82. nnoremap <silent> <esc><esc> :noh<CR>
  83. " nnoremap <silent> <esc> :noh<CR>
  84. "commenting:
  85. "autocmd FileType c,cpp,java,scala let b:comment_leader = '// '
  86. "autocmd FileType sh,ruby,python let b:comment_leader = '# '
  87. "autocmd FileType conf,fstab let b:comment_leader = '# '
  88. "autocmd FileType tex let b:comment_leader = '% '
  89. "autocmd FileType mail let b:comment_leader = '> '
  90. "autocmd FileType vim let b:comment_leader = '" '
  91. "
  92. "nnoremap <leader>c<leader> _ib:comment_leader<esc>
  93. "_____________AUX FUNCTIONS_________________
  94. "doesn't remove lines with ONLY whitespace
  95. fun! <SID>StripTrailingWhitespaces()
  96. let l = line(".")
  97. let c = col(".")
  98. %s/\v([^\t])(\t|\s)+$/\1/g
  99. call cursor(l, c)
  100. endfun
  101. "FILETYPE SPECIFIC STUFF
  102. "txt - Language is turned to German
  103. "z= to get suggestions for wrong word
  104. "zg to add word to dictionary
  105. "zw to add word as incorrect
  106. autocmd Filetype txt setlocal spell spelllang=de_DE
  107. :syn match txt_checkbox_unchecked display "[ ]"
  108. :hi txt_checkbox guibg=#FF0000
  109. :syn match txt_checkbox_checked display "[x]"
  110. :hi txt_checkbox guibg=#00FF00
  111. "Stuff for working with povray
  112. autocmd Filetype txt nnoremap <F5> :!povray .