.vimrc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. " My vimrc
  2. " based on Auré. Vieux truc since 1996 ;)
  3. if has("syntax") && &t_Co > 2
  4. syntax on
  5. endif
  6. if has("autocmd")
  7. filetype plugin indent on
  8. endif " has ("autocmd")
  9. " don't don't out in insert mode
  10. set noinsertmode
  11. " allow us to backspace before an insert
  12. set backspace=2
  13. " tabs are to be set at 4 spaces
  14. set tabstop=4
  15. " show the ruler for editing
  16. set ruler
  17. " turn off the mouse in the xterm
  18. " set mouse=a
  19. " show the command in the status line
  20. set showcmd
  21. " always have a status line
  22. set laststatus=2
  23. " Highlighting Matches
  24. set hlsearch
  25. " Virginie Vacca
  26. set autoread " répercute dynamiquement les modifs (vim5)
  27. set incsearch " Incremental search (comme emacs :)
  28. set lazyredraw " redraw screen while executing Cmds
  29. set nobackup " Don't keep a backup file
  30. set nocompatible " Use Vim defaults (much better!)
  31. set path=.,~/Documents,/var/www/,$VIMRUNTIME/syntax/
  32. set whichwrap=<,>,[,] " Allow cursor keys to wrap around lines.
  33. set viminfo=%,'50,\"100,:100,n~/.vim/.viminfo
  34. " Be nice and quiet
  35. set noerrorbells
  36. set visualbell
  37. set t_vb=
  38. set title
  39. set showmode
  40. "set showmatch " matching bracket
  41. " but not all the messages
  42. set shortmess=atTI
  43. set ttyscroll=0
  44. " Useful for CTRL-] stuff.
  45. "set iskeyword=@,48-57,_,192-255,-,.
  46. " comments default: sr:/*,mb:*,el:*/,://,b:#,:%,:XCOMM,n:>,fb:-
  47. "set comments=b:#,:%,fb:-,n:>,n:),sr:/*,mb:*,el:*/,n:###,n:\"
  48. set joinspaces
  49. " Email/News (mega bordel mais ça marche)
  50. " ==========
  51. "
  52. " Clear Empty Lines
  53. map ,cel :%s/^\s\+$//e^M
  54. map ,cqoq :%s/^>\s\+/> /e^M
  55. " remove all > On blah... stuff left behind in quoted text - huggie
  56. "nmap ,cqmh :g/^\([>*] \)\+On.*wrote:$/d<CR>
  57. " vim doesn't yet do matching on multilines AFAIK.
  58. "map ,db :1,20s/\(^On.*wrote:$\)\n\+/\1/^M
  59. " Clear blank lines after my On foo wrote:
  60. map ,db /^>.*On.*wrote:$/e^Mjmt:.,.s/^$//gec^Mq/^.\+$^Mkmb`td'b^M
  61. " Kill empty quoted lines
  62. nmap ,ceql :g/^\(> \)\{2,}\s*$/d<CR>^M
  63. nmap ,cqel :%s/^> \s*$//<CR>^M
  64. " remove quoted sig
  65. map ,rq1 /^> *-- ^Mmt/^[^>]*$^Mkmb``d'b^M
  66. map ,rq2 /^> *-----------^Mmt/^[^>]*$^Mkmb``d'b^M
  67. map ,rq3 /^> *___________^Mmt/^[^>]*$^Mkmb``d'b^M
  68. " Turn all blocks of empty lines (within current visual)
  69. " into *one* empty line:
  70. map ,dl :g/^$/,/./-j<CR>^M
  71. " Condense multiple Re:'s
  72. map ,re 1G/^Subject:<CR>:s/\(Re: \)\+/Re: /e<CR>^M
  73. " Sven's wondeful change subject macro
  74. map ,cs 1G/^Subject: <CR>yypIX-Old-<ESC>-W
  75. vmap ,qp :s/^/> /<CR>^M
  76. " this clears out the old colors before we begin
  77. "highlight Constant NONE
  78. "highlight Delimiter NONE
  79. "highlight Directory NONE
  80. "highlight Error NONE
  81. "highlight ErrorMsg NONE
  82. "highlight Identifier NONE
  83. "highlight LineNr NONE
  84. "highlight ModeMsg NONE
  85. "highlight MoreMsg NONE
  86. "highlight Normal NONE
  87. "highlight NonText NONE
  88. "highlight PreProc NONE
  89. "highlight Question NONE
  90. "highlight Search NONE
  91. "highlight Special NONE
  92. "highlight SpecialKey NONE
  93. "highlight Statement NONE
  94. highlight StatusLine NONE
  95. "highlight StatusLineNC NONE
  96. "highlight Title NONE
  97. "highlight Todo NONE
  98. "highlight Type NONE
  99. "highlight Visual NONE
  100. "highlight WarningMsg NONE
  101. " these are the new superior colors
  102. "highlight Comment term=bold ctermfg=5 ctermbg=0 guifg=#FF005F guibg=gray
  103. "highlight Constant term=underline ctermfg=6 guifg=#FF2f8f
  104. "highlight Delimiter term=bold cterm=bold ctermfg=1 gui=bold guifg=Red
  105. "highlight Directory term=bold ctermfg=DarkBlue guifg=Blue
  106. "highlight Error term=standout cterm=bold ctermbg=1 ctermfg=1 gui=bold guifg=red
  107. "highlight ErrorMsg term=standout cterm=bold ctermfg=1 gui=bold guifg=red
  108. "highlight Identifier term=underline ctermfg=3 guifg=yellow3
  109. "highlight LineNr term=underline cterm=bold ctermfg=3 guifg=Brown
  110. "highlight ModeMsg term=bold cterm=bold ctermfg=3 ctermbg=1 guifg=yellow2 guibg=red
  111. "highlight MoreMsg term=bold cterm=bold ctermfg=2 gui=bold guifg=Green
  112. "highlight NonText term=bold ctermfg=2 guifg=green3
  113. "highlight Normal ctermfg=white ctermbg=black guifg=grey90 guibg=#000020
  114. "highlight PreProc term=underline ctermfg=14 guifg=cyan
  115. "highlight Question term=standout cterm=bold ctermfg=2 gui=bold guifg=Green
  116. "highlight Search term=reverse ctermbg=2 guibg=Yellow
  117. "highlight Special term=bold ctermfg=5 guifg=SlateBlue
  118. "highlight SpecialKey term=bold ctermfg=DarkBlue guifg=Blue
  119. "highlight Statement term=bold ctermfg=2 gui=bold guifg=green3
  120. highlight StatusLine term=reverse cterm=bold ctermfg=3 ctermbg=4 guifg=wheat guibg=#2f4f4f
  121. "highlight StatusLineNC term=bold ctermfg=3 ctermbg=2 guifg=#071f1f guibg=#5f9f9f
  122. "highlight Title term=bold cterm=bold ctermfg=4 gui=bold guifg=Blue
  123. "highlight Todo term=bold ctermfg=red ctermbg=yellow guifg=red guibg=yellow1 gui=bold
  124. "highlight Type term=underline cterm=bold ctermfg=3 guifg=yellow3 gui=bold
  125. "highlight Visual term=reverse cterm=bold ctermfg=6 ctermbg=5 guifg=yellow guibg=blue
  126. "highlight WarningMsg term=standout cterm=bold ctermfg=1 ctermbg=4 guifg=Red
  127. " all of this stuff allows me to write gzipped files natively...cool eh?
  128. "autocmd BufRead *.gz set bin|%!gunzip
  129. "autocmd BufRead *.gz set nobin
  130. "autocmd BufWritePre *.gz %!gzip
  131. "autocmd BufWritePre *.gz set bin
  132. "autocmd BufWritePost *.gz undo|set nobin
  133. "autocmd FileReadPost *.gz set bin|'[,']!gunzip
  134. "autocmd FileReadPost set nobin
  135. " Spécial fichier ChangeLog
  136. autocmd BufRead ChangeLog set expandtab
  137. " Divers...
  138. set wig=*.o,*.obj,*~
  139. set sw=4
  140. set cin
  141. set ai
  142. set ul=200
  143. set ch=1
  144. set wc=<Tab>
  145. set smd
  146. set bs=2
  147. "set bg=dark
  148. "set nowrap
  149. set smartindent
  150. " Automatically save before commands like :next and :make
  151. set autowrite
  152. " instructions for VIM on processing this file
  153. "vim:ts=3
  154. " Taille du texte et des tabluations selon les fichiers que l'on édite
  155. autocmd BufRead *.tex,*.latex set tw=100
  156. autocmd BufRead *.tex,*.latex set nocin
  157. autocmd BufRead .followup,.article,.letter,mutt* set tw=72
  158. autocmd BufRead .followup,.article,.letter,mutt* set tabstop=8
  159. autocmd BufRead .followup,.article,.letter,mutt* set nocin
  160. " Mail and News autocommands
  161. " ==========================
  162. "au BufRead ~/.article*,~/.followup,mutt* source ~/.vim/words_tools.vim
  163. "au BufRead ~/.article*,~/.followup,mutt* source ~/.vim/Mail_mutt_alias.set
  164. " Remove quoted On blah stuff
  165. "au BufRead ~/.article*,~/.followup,mutt* :silent! normal ,cqmh
  166. " Remove many Re:'s from the Subject line
  167. au BufRead ~/.article*,~/.followup,mutt* normal ,re
  168. " Remove empty quoted lines
  169. au BufRead ~/.article*,~/.followup,mutt* normal ,ceql
  170. " Remove the empty lines after an unquoted On blah stuff
  171. au BufRead ~/.article*,~/.followup,mutt* normal ,db
  172. " Clear empty lines and turn into space to write in
  173. au BufRead ~/.article*,~/.followup,mutt* normal ,cqel
  174. au BufRead ~/.article*,~/.followup,mutt* normal ,cel
  175. au BufRead ~/.article*,~/.followup,mutt* normal ,cqoq
  176. " remove quoted signatures
  177. au BufRead ~/.article*,~/.followup,mutt* normal ,rq1
  178. au BufRead ~/.article*,~/.followup,mutt* normal ,rq2
  179. au BufRead ~/.article*,~/.followup,mutt* normal ,rq3
  180. " Remove blocks of empty lines
  181. au BufRead ~/.article*,~/.followup,mutt* :silent! normal ,dl
  182. " Auré
  183. nnoremap Q gq
  184. vnoremap Q gq
  185. "map F {!}par -w76 -gtjq
  186. " multiple indent (delaballe merci Matt Kunze)
  187. noremap < <<CR>gv
  188. noremap > ><CR>gv
  189. " Scroll in insert mode CRTL E and CTRL Y
  190. inoremap <C-E> <C-X><C-E>
  191. inoremap <C-Y> <C-X><C-Y>
  192. "noremap <F8> :so `~/bin/vimspell.sh %`<CR><CR>
  193. "noremap <F7> :syntax clear SpellErrors<CR>
  194. " Mail (plus utilisé car automatique cf au dessus)
  195. "
  196. " ,kqs = kill quoted signature
  197. "map ,kqs G?^> *-- $<CR>d}
  198. " ,kpq kill SuperCite (aka PowerQuote) quote (replacing it by `>')
  199. "map ,kpq :%s/^> *[a-zA-Z]*>/> >/<C-M>
  200. " reformat body text to current textwidth
  201. "map ,ref 1G/^$<CR>V/^-- $<CR><Up>Q1G
  202. "map ,ref G?^-- $<CR><Up>V1G/^[ \t]*$<CR>Q1G
  203. " Correction orthgraphique (megadelaballe)
  204. map ,i :w<CR>:!aspell --mode=email -c %<CR>:e %<CR>
  205. map ,I :w<CR>:!aspell -c %<CR>:e %<CR>
  206. " snip (merci Nico)
  207. vmap <buffer> ;snip c>[...]<Esc>
  208. " Mettre/virer un bloc en commentaire
  209. vmap <buffer> ;com :s/^/#/g<CR>
  210. vmap <buffer> ;uncom :s/^#//g<CR>
  211. " Affiche la date au format RFC822 - ftplugin/debchangelog. Nico
  212. function! Date822()
  213. let savelang = v:lc_time
  214. execute "language time C"
  215. let dateandtime = strftime("%a, %d %b %Y %X %z")
  216. execute "language time " . savelang
  217. return dateandtime
  218. endfunction
  219. iab debdate <C-R>=Date822()<CR>
  220. " Racourcis sympas
  221. " dans le texte
  222. "iab ca ça
  223. "iab Ca Ça
  224. "iab << «
  225. "iab >> »
  226. "iab etre être
  227. "iab meme même
  228. iab ladate <C-R>=strftime("%A %d %B %Y")<CR>
  229. iab lheure <C-R>=strftime("%H:%M")<CR>
  230. iab cuthere -------------------- cut here --------------------<CR><CR>-------------------- cut here --------------------
  231. " Spécial Popossum
  232. vmap <buffer> ,pik :s/ / pik /g<CR>
  233. vmap <buffer> ,unpik :s/ pik / /g<CR>
  234. map ,n :NERDTreeToggle<CR>
  235. vmap b :!git blame =expand("%:p") \| sed -n =line("',=line("'>") p
  236. colorscheme delek
  237. filetype plugin on
  238. set tabstop=4 shiftwidth=4 expandtab
  239. execute pathogen#infect()
  240. syntax on
  241. filetype plugin indent on
  242. "Nerdtree
  243. "Auto Strat
  244. "autocmd vimenter * NERDTree
  245. " force start with no files
  246. autocmd StdinReadPre * let s:std_in=1
  247. autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
  248. "Toggle on C-n
  249. map <C-n> :NERDTreeToggle<CR>
  250. "Quit if no tabs
  251. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
  252. map <C-b> <plug>NERDTreeTabsToggle<CR>
  253. " Markdown
  254. augroup markdown
  255. au!
  256. au BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown
  257. augroup END
  258. "augroup crux
  259. " au WinLeave * set nocursorline nocursorcolumn
  260. " au WinEnter * set cursorline cursorcolumn
  261. " set cursorline cursorcolumn
  262. "augroup END
  263. map ,c <ESC>:set cursorline cursorcolumn nu<CR>
  264. map ,v <ESC>:set nocursorline nocursorcolumn nonu<CR>
  265. set statusline+=%#warningmsg#
  266. set statusline+=%{SyntasticStatuslineFlag()}
  267. set statusline+=%*
  268. let g:syntastic_always_populate_loc_list = 1
  269. let g:syntastic_auto_loc_list = 1
  270. let g:syntastic_check_on_open = 1
  271. let g:syntastic_check_on_wq = 0
  272. "let g:syntastic_puppet_checkers = ['puppetlint']
  273. let g:syntastic_puppet_puppetlint_args = "--no-80chars-check --no-case_without_default-check --no-140chars-check --no-autoloader_layout-check --no-quoted_booleans --no-selector_inside_resource"
  274. let g:syntastic_eruby_ruby_quiet_messages =
  275. \ {'regex': 'possibly useless use of a variable in void context'}
  276. set expandtab
  277. set tabstop=2
  278. set shiftwidth=2