.vimrc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. "turn off the taskbar in gvim
  7. set guioptions-=m
  8. "a bit more readable
  9. set guifont=Lucida_Console:h10
  10. "make backspace behave normally in insert mode
  11. set backspace=indent,eol,start
  12. "highlight search
  13. set hlsearch
  14. "search while entering the search query
  15. set incsearch
  16. "show me the options to autocomplete while in command mode
  17. set wildmenu
  18. "autocomplete stuff by giving me the match up to the first differing character
  19. "then tab through the options
  20. set wildmode=longest:list,full
  21. "NO, I don't want ANSI.
  22. set fileencodings=utf-8
  23. set encoding=utf-8
  24. set fileencoding=utf-8
  25. "turn on syntax highlighting and indentation
  26. syntax on
  27. filetype indent plugin on
  28. "Akin to intellisense
  29. "I should set this up to work with <C-N>
  30. filetype plugin on
  31. set omnifunc=syntaxcomplete#Complete
  32. "also autocomplete words which are hyphen-separated
  33. set iskeyword+=\-
  34. "colorscheme zellner
  35. colorscheme gentooish "available in the void-package vim-colorschemes
  36. "colorscheme holokai "available in the void-package vim-colorschemes
  37. "always underline spelling errors instead of making their background red
  38. hi clear SpellBad
  39. hi SpellBad cterm=underline ctermfg=red
  40. "for indentating html - otherwise these tags are not recognized
  41. let g:html_indent_inctags = "html,body,head,tbody,table,td,tr,th,canvas"
  42. "whitespace
  43. set tabstop=4
  44. set shiftwidth=4
  45. set list
  46. set listchars=tab:>~,trail:~,extends:>,precedes:<
  47. "don't wrap - duh. - maybe I should change this, it seems actually quite
  48. "practical for keeping the right width for readability.
  49. set nowrap
  50. set textwidth=0
  51. set wrapmargin=0
  52. "line numbers
  53. set nu
  54. set rnu
  55. "send all backups to home/vimbackups
  56. set backupdir=~/.vim/backups,.
  57. set directory=~/.vim/swapfiles,.
  58. " Persistent undo
  59. set undodir=~/.vim/undofiles,.
  60. set undofile
  61. "search and replace options ignore case, except if there's something uppercase
  62. "in it
  63. set ignorecase
  64. set smartcase
  65. "set the current working directory when entering a new file
  66. autocmd BufEnter * silent! :lcd%:p:h
  67. "remove all trailing whitespace on lines with non-whitespace characters
  68. " autocmd BufEnter * silent! :call <SID>StripTrailingWhitespaces()
  69. "____________MAPPINGS______________
  70. "
  71. "disable the fucking F1 key
  72. nmap <F1> <nop>
  73. "remap leader to space
  74. nnoremap <SPACE> <nop>
  75. let mapleader = " "
  76. "insert line-break
  77. nnoremap <leader><CR> o<esc>
  78. "move screen
  79. nnoremap <C-h> 4zh
  80. nnoremap <C-l> 4zl
  81. nnoremap <C-j> 4<C-E>
  82. nnoremap <C-k> 4<C-Y>
  83. "getting the next match of f or t, but more logically - at least on a german
  84. "keyboard
  85. nnoremap ; ,
  86. nnoremap , ;
  87. "removes the highlighting after search
  88. "until I can fix the escape codes sent by the terminal, I'll have to press esc
  89. "twice
  90. nnoremap <silent> <esc><esc> :noh<CR>
  91. " nnoremap <silent> <esc> :noh<CR>
  92. "AUTOCOMMANDS
  93. "for povray files
  94. augroup pov
  95. autocmd!
  96. au BufWritePost *.pov !povray .
  97. augroup END
  98. "for the regular text
  99. augroup txt
  100. autocmd!
  101. au BufReadPost *.txt setlocal spell
  102. au BufReadPost *.txt setlocal tw=80
  103. au BufReadPost *.txt highlight Checked ctermfg=White ctermbg=DarkGreen
  104. au BufReadPost *.txt highlight Unchecked ctermfg=White ctermbg=DarkRed
  105. au BufReadPost *.txt syn match Unchecked /\[ \]/
  106. au BufReadPost *.txt syn match Checked /\[x\]/
  107. augroup END
  108. "for the regular text
  109. augroup md
  110. autocmd!
  111. au BufReadPost *.md setlocal spell
  112. au BufReadPost *.md setlocal tw=80
  113. augroup END
  114. "for tsv files - which I like to be nicely aligned
  115. augroup tsv
  116. autocmd!
  117. au BufReadPost *.tsv setlocal tabstop=20
  118. augroup END
  119. "for the twig templating language
  120. augroup twig
  121. autocmd!
  122. au BufReadPost *.twig set ft=html
  123. augroup END