Que serait le monde sans vim ? Je vous le demande :) Ajoutez ici vos options préférées...
Générateur de vimrc:
~/.vimrc
"Toujours afficher la 'status bar' set ls=2 "Coloration syntaxique syntax on "Un truc sympa : lors d'une recherche, colorer tous les mots correspondant set hlsearch "la recherche n'est pas dépendante de la casse (maj / min) set ignorecase "recherche intelligente : Match 'word' case-insensitive and 'Word' case-sensitive set smartcase "recherche incrémentale (comme dans emacs ^^) set incsearch "tabulation sur 4 caractères, utile pour faire du python set ts=4 "affiche la parenthèse correspondante set sm "Ne pas faire de swap files set noswapfile "Ne pas faire de backup files set nobackup "long lines set nowrap " Completion a la 'Bash' set wildmenu " command-line completion shows a list of matches set wildmode=longest,list:longest,full " Bash-vim completion behavior " C syntax specific(and cpp, php, js ...) autocmd FileType c,cpp,php,d,css set formatoptions=croql autocmd FileType c,cpp,php,d,css set cindent autocmd FileType c,cpp,php,d,,css set comments=sl:/*,mb:**,elx:*/,:// autocmd FileType c,cpp,php,d,css set cinoptions=(2,f1,{1,>2 autocmd FileType c,cpp,php,d,css set fdm=syntax " php let php_sql_query = 1 let php_htmlInStrings = 1 "autoformatage map <F2> gg=G''k<CR> imap <F2> <esc>gg=G''ki<CR> "utilisation des tabs map <C-Right> :tabn<CR> imap <C-Right> <C-O>:tabn<CR> map <C-Left> :tabp<CR> imap <C-Left> <C-O>:tabp<CR> map <C-Up> :tabnew<CR> imap <C-Up> <C-O>:tabnew<CR> map <C-Down> :tabc<CR> imap <C-Down> <C-O>:tabc<CR>
A l'utilisation
- forcer la coloration syntaxique (exemple pour le langage python)
:set syntax=python
- recharger le fichier courant
:e (ou :e! pour ne pas prendre en compte les modifications)
Ksamak's Conf.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""Ksa's Conf.
"""" you'll be needing a couple plug-ins for some features.
"""" eg: OmniCppComplete, bufferlist, pydiction, justify, alternate, file:line, taglist, yankring
""any questions: ksamak £ at % ksamak ; dot ¬ com.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Automatically read a file again if it has been modified outside vim
" and not in the current session
set autoread
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Swap files and backups are annoying but can save you a lot of trouble.
" Rather than spreading them all around your filesystem, isolate them to a
" single directory:
set backupdir=~/.vim/tmp,~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim/tmp,~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set undodir=~/.vim/tmp/undo,~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set backup undofile
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Add bundles to the path
call pathogen#runtime_append_all_bundles()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:pydiction_location='/home/ksamak/.vim/ftplugin/pydiction/complete-dict'
set nocp
"set number " numbers on the side.
" map <C-F12> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q
" .<CR>
" Map C-Down and C-Up to move lines up/down
map ^[[A <C-Up>
map ^[[B <C-Down>
map ^[Oa <C-Up>
map ^[Ob <C-Down>
map! ^[[A <C-Up>
map! ^[[B <C-Down>
map! ^[Oa <C-Up>
map! ^[Ob <C-Down>
nmap <C-Down> :m+<CR>==
nmap <C-Up> :m-2<CR>==
imap <C-Down> <Esc>:m+<CR>==gi
imap <C-Up> <Esc>:m-2<CR>==gi
vmap <C-Down> :m'>+<CR>gv=gv
vmap <C-Up> :m-2<CR>gv=gv
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map code fetching on ctrl-right (optional)
nmap ^[Od <C-Left>
nmap ^[Oc <C-Right>
nmap ^[[D <C-Left>
nmap ^[[C <C-Right>
imap ^[Od <C-Left>
imap ^[Oc <C-Right>
imap ^[[D <C-Left>
imap ^[[C <C-Right>
vmap ^[Od <C-Left>
vmap ^[Oc <C-Right>
vmap ^[[D <C-Left>
vmap ^[[C <C-Right>
"map <C-Left> <C-T>
"map <C-Right> <C-]>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" configure tags - add additional tags here or comment out not-used ones
set tags+=~/.vim/tags/cpp
set tags+=~/.vim/tags/opencv
" set tags+=~/.vim/tags/qt4
" " build tags of your own project with Ctrl-F12
map <C-F12> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
" " OmniCppComplete
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
let OmniCpp_MayCompleteDot = 1 " autocomplete after .
let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
" let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" " automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menuone,menu,longest,preview
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" bufferlist plugin
map <silent> <C-v>v :call BufferList()<CR>
map <silent> <C-v><C-v> :call BufferList()<CR>
" change buffers and viewports easily (:vsp && :sp)
"map <M-z> :bn<CR>
nmap <silent><C-Right> :bn<CR>
imap <silent><C-Right> <Esc>:bn<CR>i
"map <M-x> :bp<CR>
nmap <silent><C-Left> :bp<CR>
imap <silent><C-Left> <Esc>:bp<CR>i
nmap <silent><A-Right> <C-w><C-w>
imap <silent><A-Right> <Esc><C-w><C-w><CR>i
nmap <silent><A-Left> <C-w>h
imap <silent><A-Left> <Esc><C-w>h<CR>i
nmap <silent><A-Down> <C-w>j
imap <silent><A-Down> <Esc><C-w>j<CR>i
nmap <silent><A-Up> <C-w>k
imap <silent><A-Up> <Esc><C-w>k<CR>i
" let me change buffers without saving!
set hidden
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Clickodrome binds
map <C-s> :w!<CR>
imap <C-s> <Esc>:w!<CR>a
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Write file with sudo // Life saver !
function! Sudowq()
exe "w !sudo tee % > /dev/null"
exe "e!"
endfunction
nmap <F2> :call Sudowq()<CR><Enter> \\ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""