Vim

Vim

Un article de Tifauve|NET.

VIM

Sommaire

Liens pour configurer vim

CheatSheets pour Vim

Combinaisons à retenir

python_fn.vim
" ]t -- Jump to beginning of block
" ]e -- Jump to end of block
" ]v -- Select (Visual Line Mode) block
" ]< -- Shift block to left
" ]> -- Shift block to right
" ]# -- Comment selection
" ]u -- Uncomment selection
" ]c -- Select current/previous class
" ]d -- Select current/previous function
" ]<up> -- Jump to previous line with the same/lower indentation
" ]<down> -- Jump to next line with the same/lower indentation
 
python.vim
Execute file being edited with <Shift> + e
:Pyflakes
:Pylint
 
pydiction.vim
C-n -- Code completion
C-S-n -- reverse direction
 
Mettre/enlever les numéros de ligne
<F2>
 
Navigation dans les modules
<F4>
 
Arbre
:NERDTree
:nmap <F9> NERDTree
 
Utiliser des Onglets
:tabnew nomDuFichier
Ctrl-PageUp/PageDown: cycler dans les fichiers ouverts
 
VJDE (java)
autocompletion via C-X C-U
 
Copy/paste sans soucis
:set paste
insert
:set paste!
 
Visual blocks
ctrl+v pour passer en visuel
shift+i pour passer en insertion faire la modif puis ctrl+c
 
Using viewports
:sp will split the Vim window horizontally. Can be written out entirely as :split .
:vsp will split the Vim window vertically. Can be written out as :vsplit .
Ctrl-w Ctrl-w moves between Vim viewports.
Ctrl-w j moves one viewport down.
Ctrl-w k moves one viewport up.
Ctrl-w h moves one viewport to the left.
Ctrl-w l moves one viewport to the right.
Ctrl-w = tells Vim to resize viewports to be of equal size.
Ctrl-w - reduce active viewport by one line.
Ctrl-w + increase active viewport by one line.
Ctrl-w q will close the active window.
Ctrl-w r will rotate windows to the right.
Ctrl-w R will rotate windows to the left.

Ma configuration

" Mode non compatible avec Vi
set nocompatible
 
" un historique raisonnable
set history=100
 
" undo, pour revenir en arrière
set undolevels=150
 
" Suffixes à cacher
set suffixes=.jpg,.png,.jpeg,.gif,.bak,~,.swp,.swo,.o,.info,.aux
 
" Quand un fichier est changé en dehors de Vim, il est relu automatiquement
set autoread
 
" Quand une fermeture de parenthèse est entrée par l'utilisateur,
" l'éditeur saute rapidement vers l'ouverture pour montrer où se
" trouve l'autre parenthèse. Cette fonction active aussi un petit
" beep quand une erreur se trouve dans la syntaxe.
set showmatch
set matchtime=2
 
" Tout ce qui concerne la recherche. Incrémentale
" avec un highlight. Elle prend en compte la
" différence entre majuscule/minuscule.
set incsearch
set noignorecase
set infercase
 
" Quand la rechercher atteint la fin du fichier, pas
" la peine de la refaire depuis le début du fichier
set hlsearch
 
" Format the statusline
set statusline=%F%m\ %r\ Line:%l\/%L,%c\ %p%%
 
" Sélectionner tout
map <C-a> ggVG
 
" Copier (le gv c'est pour remettre le sélection)
map <C-c> "+ygv
 
" Couper
map <C-x> "+x
 
" Coller
map <C-y> "+gP
 
 
" Coloration syntaxique
syntax on
let python_highlight_all = 1
 
 
" Turn on line numbers:
set number
 
" Toggle line numbers and fold column for easy copying:
nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
 
" indentation
filetype plugin indent on
 
" indentation = 4 + remplacer les tablulations par des espaces
set tabstop=4
set shiftwidth=4
set expandtab
 
"color
colorscheme desert
set gfn="Droid Sans Mono" 10
 
" Améliorer indentation
autocmd FileType python set complete+=k~/.vim/syntax/python.vim isk+=.,(
 
" Taglist variables
" Display function name in status bar:
let g:ctags_statusline=1
" Automatically start script
let generate_tags=1
" Displays taglist results in a vertical window:
let Tlist_Use_Horiz_Window=0
" Shorter commands to toggle Taglist display
nnoremap TT :TlistToggle<CR>
map <F4> :TlistToggle<CR>
" Various Taglist diplay config:
let Tlist_Use_Right_Window = 1
let Tlist_Compact_Format = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_File_Fold_Auto_Close = 1
 
" complétude Python
filetype plugin on
let g:pydiction_location = '/home/tifauve/.vim/libs/pydiction/complete-dict'
" Pyflake / Pylint
" autocmd BufWrite *.{py} :call Pyflakes()
 
map <F9> :NERDTree<CR>
 
 
"Java
"set cfu=VjdeCompletionFun
"let g:vjde_show_paras=1
"let g:vjde_cfu_java_para=1
let g:vjde_lib_path = '/home/tifauve/Documents/Code/INCUBATEUR/Play_Framework/play-1.0/play.jar'
let g:vjde_src_path="/home/tifauve/Documents/Code/INCUBATEUR/Play_Framework/play-1.0/framework/src/play"
Récupérée de « http://www.tifauve.net/Vim »

Dernière modification de cette page le 14 novembre 2009 à 21:27.
Cette page a été consultée 57 fois.