Utilisateur:Kaze/vimrc

De Disposition de clavier bépo

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
set hlsearch

" search
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 <S-Return> <Esc>
inoremap <M-Return> <Esc>
inoremap <S-Space> <Esc>
inoremap <M-Space> <Esc>

" lazy scrolling
noremap <BS> <PageUp>
noremap <Space> <PageDown>
noremap <C-BS> <C-u>
noremap <C-Space> <C-d>
noremap <Return> zz

" lazy 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.

Pour finir, deux très bons documents à propos de Vim :