tp/vim/vimrc

85 lines
2.4 KiB
VimL
Raw Normal View History

2019-09-05 19:27:39 +02:00
" Appliquer automatiquement les modifications de ~/.vimrc
if has("autocmd")
autocmd! bufwritepost .vimrc source ~/.vimrc
endif
2019-10-31 13:54:28 +01:00
if ((!empty(system("setxkbmap -print|grep bepo"))) || ($USER == "root"))
2019-09-05 19:27:39 +02:00
source ~/.vimrc.bepo
endif
2020-01-19 00:04:37 +01:00
"Better tab completion in commandline
set wildmenu
"Show partial command in bottom-right corner
set showcmd
2019-09-05 19:27:39 +02:00
" Visualise les tabs
set list
set listchars=tab:▸ 
" [Esc] sur Tab
"" Tab fait un Esc, Maj+Tab fait un Tab
inoremap <Tab> <Esc>
inoremap &lt;S-Tab> <Tab>
"" Même chose, mais en mode visuel
vnoremap <Tab> <Esc>
vnoremap &lt;S-Tab> <Tab>
" encodage et coloration syntaxique
set encoding=utf-8
set fileencoding=utf-8
syntax on
set number "affiche les numéros de ligne
set relativenumber "affiche les numéros de ligne (relatif)
" python ident
filetype indent plugin on
set autoindent
set modeline
" Maintain undo history between sessions
set undofile
if ($XDG_DATA_HOME != '')
2019-09-06 18:22:58 +02:00
silent !mkdir $XDG_DATA_HOME/vim/undodir -p > /dev/null 2>&1
2019-09-05 19:27:39 +02:00
set undodir=$XDG_DATA_HOME/vim/undodir
if has("autocmd")
2019-10-31 13:54:28 +01:00
autocmd bufwritepost * silent ! chmod 600 $XDG_DATA_HOME/vim/undodir/* > /dev/null 2>&1 && rm $XDG_DATA_HOME/vim/undodir/*\%.git\%COMMIT_EDITMSG > /dev/null 2>&1
endif
2019-09-05 19:27:39 +02:00
else
if ($HOME != '')
2019-09-06 18:22:58 +02:00
silent !mkdir $HOME/.local/share/vim/undodir -p > /dev/null 2>&1
2019-09-05 19:27:39 +02:00
set undodir=$HOME/.local/share/vim/undodir
if has("autocmd")
2019-09-06 18:22:58 +02:00
autocmd bufwritepost * silent ! chmod 600 $HOME/.local/share/vim/undodir/* > /dev/null 2>&1 && rm $HOME/.local/share/vim/undodir/*\%.git\%COMMIT_EDITMSG > /dev/null 2>&1
endif
2019-09-05 19:27:39 +02:00
else
echo "Error: environment variable $HOME not set"
endif
endif
if has("autocmd")
if &term =~ "xterm\\|rxvt"
" use an orange cursor in insert mode
let &t_SI = "\<Esc>]12;orange\x7"
" use a red cursor otherwise
let &t_EI = "\<Esc>]12;red\x7"
silent !echo -ne "\033]12;red\007"
" reset cursor when vim exits
autocmd VimLeave * silent !echo -ne "\033]112\007"
" use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21
endif
2019-09-05 19:27:39 +02:00
endif
" Colorise les nbsp
colorscheme koehler
highlight NbSp ctermbg=lightgray guibg=lightred
match NbSp /\%xa0/
2020-01-19 00:15:15 +01:00
" Colorise les recherches
set hlsearch
hi Search ctermbg=Yellow
hi Search ctermfg=DarkBlue
"" Shortcut uncolorize search on C-l
nnoremap <silent> <C-l> :nohlsearch<CR><C-l>
"" Recherche dun mot avec C-f sur ce mot
nnoremap <C-f> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>