.vimrc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. "NO, I don't want ANSI.
  17. set fileencodings=utf-8
  18. set encoding=utf-8
  19. set fileencoding=utf-8
  20. "turn on syntax highlighting and indentation
  21. "syntax on
  22. filetype indent plugin on
  23. "for indentating html - otherwise these tags are not recognized
  24. let g:html_indent_inctags = "html,body,head,tbody,table,td,tr,th,canvas"
  25. "whitespace
  26. set tabstop=4
  27. set shiftwidth=4
  28. set list
  29. set listchars=tab:>~,trail:~,extends:>,precedes:<
  30. "don't wrap - duh. - maybe I should change this, it seems actually quite
  31. "practical for keeping the right width for readability.
  32. set nowrap
  33. set textwidth=0
  34. set wrapmargin=0
  35. "line numbers
  36. set nu
  37. set rnu
  38. "colors
  39. syntax on
  40. colorscheme desert
  41. "send all backups to home/vimbackups
  42. set backupdir=./vimbackups,../vimbackups,~/vim/backups,.
  43. set directory=./vimbackups,../vimbackups,~/vim/backups,.
  44. " Persistent undo
  45. set undodir=~/.vim/undofiles
  46. set undofile
  47. "search and replace options ignore case, except if there's something uppercase
  48. "in it
  49. set ignorecase
  50. set smartcase
  51. "set the current working directory when entering a new file
  52. autocmd BufEnter * silent! :lcd%:p:h
  53. "remove all trailing whitespace on lines with non-whitespace characters
  54. " autocmd BufEnter * silent! :call <SID>StripTrailingWhitespaces()
  55. "____________MAPPINGS______________
  56. "
  57. "disable the fucking F1 key
  58. nmap <F1> <nop>
  59. "remap leader to space
  60. nnoremap <SPACE> <nop>
  61. "let mapleader = "\<SPACE>"
  62. let mapleader = " "
  63. "move screen
  64. nnoremap <C-h> 4zh
  65. nnoremap <C-l> 4zl
  66. nnoremap<C-j> 4<C-E>
  67. nnoremap <C-k> 4<C-Y>
  68. "getting the next match of f or t, but more logical - at least on a german
  69. "keyboard
  70. nnoremap ; ,
  71. nnoremap , ;
  72. "mapping to adapt indentation when pasting converts spaces to tabs, not always wanted
  73. " nmap P ]P
  74. " nmap p ]p
  75. "for keeping indentation on lines where I don't write anything
  76. "(leftover habit from eclipse)
  77. inoremap <CR> <CR>x<BS>
  78. nnoremap o ox<BS>
  79. nnoremap O Ox<BS>
  80. "copying and pasting the standard windows way - doesn't really work if I don't
  81. "have a clipboard manager
  82. inoremap <silent> <C-v> <C-R>+
  83. nnoremap <silent> <C-v> "+p
  84. nnoremap <silent> <C-c> "+Y<esc>
  85. vnoremap <silent> <C-c> "+y<esc>
  86. vnoremap <silent> <C-v> "+p
  87. " nnoremap <silent> <C-a> <esc>ggVG
  88. "removes the highlighting after search
  89. "until I can fix the escape codes sent by the terminal, I'll have to press esc
  90. "twice
  91. nnoremap <silent> <esc><esc> :noh<CR>
  92. " nnoremap <silent> <esc> :noh<CR>
  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. "PLUGINS
  102. let g:NERDSpaceDelims = 1