Utilisateur:Kaze/vimrc
Apparence
Pour ceux que ça intéresse, voilà mon fichier ~/.vimrc ; il est assez simpliste car je me suis longtemps contenté des réglages par défaut de Zenwalk (excellente distribution au demeurant), mais j'ai fini par créer mon propre fichier de préfs pour Xubuntu et le Bépo. Si les commentaires en anglais vous gênent, faites-moi un procès ! ;-)
" source the .vimrc file on save to apply all changes immediately
if has("autocmd")
autocmd! bufwritepost .vimrc source ~/.vimrc
endif
" ________________________________________________________
"
" Zenwalk's default settings
" ________________________________________________________
set nocompatible
set bs=2
set tw=72
set cindent
set mouse=a
set mousehide
set nowrapscan
set showmatch
set showmode
set uc=0
"set t_kD=^?
"map ^H X
map \e[3~ x
let c_comment_strings=1
" Color for xiterm, rxvt, nxterm, color-xterm:
if has("terminfo")
set t_Co=8
set t_Sf=\e[3%p1%dm
set t_Sb=\e[4%p1%dm
else
set t_Co=8
set t_Sf=\e[3%dm
set t_Sb=\e[4%dm
endif
syntax on
" ________________________________________________________
"
" Personal settings
" ________________________________________________________
colorscheme delek
set nu
set foldmethod=indent
" indent with two spaces (= Mozilla guidelines)
set tabstop=2
set shiftwidth=2
set expandtab
" search
set hlsearch
set ignorecase
set smartcase
set incsearch
" disable incrementation of octal numbers
set nrformats=hex
" use the current file's directory as Vim's working directory
set autochdir
" ???
"behave mswin
" au InsertEnter * :hi Normal ctermbg=white guibg=white
" au InsertLeave * :hi Normal ctermbg=gray guibg=gray
" ________________________________________________________
"
" Personal mappings
" ________________________________________________________
" I need another Esc key
inoremap <Tab> <Esc>
inoremap <S-Tab> <Tab>
inoremap <S-Return> <Esc>
inoremap <M-Return> <Esc>
" lazy scrolling
noremap <BS> <PageUp>
noremap <Space> <PageDown>
noremap <C-BS> <C-u>
noremap <C-Space> <C-d>
noremap <Return> zz
" lazy code folding / unfolding
noremap <Tab> za
noremap <S-Tab> zR
" switching / moving / creating tabs
noremap g<Tab> gt
noremap g<S-Tab> gT
noremap <C-Tab> gt
noremap <C-S-Tab> gT
noremap <C-PageUp> :exe "silent! tabmove " . (tabpagenr() - 2)<CR>
noremap <C-PageDown> :exe "silent! tabmove " . tabpagenr()<CR>
noremap <C-n> :exe "silent! tabnew"<CR>:exe "silent! Ex"<CR>
" ________________________________________________________
"
" Using Vim with non-QWERTY layouts
" ________________________________________________________
" AZERTY
"noremap ù %
"noremap ; .
"noremap '; '.
" BÉPO
source ~/.vimrc.bepo
Ce fichier fonctionne avec tous les layouts de clavier ; pour la partie spécifique au Bépo, j'utilise un fichier ~/.vimrc.bepo séparé, voir la page Vim.
Je n'utilise aucun plugin spécifique (Vim 7 en inclut déjà pas mal), mais il m'arrive d'en tester. Voilà quelques plugins très simples qui peuvent s'avérer utiles :
- comments.vim : Ctrl+C pour commenter une ligne, Ctrl+X pour la décommenter.
- browser.vim : inclut un navigateur web textuel dans Vim (Lynx par défaut, mais on peut le remplacer par w3m).
- sessions.vim : ajoute un menu « Sessions » dans gVim. À installer d'urgence si vous ne savez pas ce qu'est une session Vim.
Pour finir, quelques bons documents à propos de Vim :
- Seven habits of effective text editing (pdf) par Bram Moolenaar en personne (l'auteur de Vim)
- Vim for (PHP) programmers par Andrei Zmievski
- Aide-mémoire Vim de Laurent Grégoire, que Nemolivier a adapté au bépo (voir la page Vim)