vim-config/vimrc

164 lines
4.3 KiB
VimL

""""""""""
" Colors "
""""""""""
syn on
set background=dark
" Theme configurable et reposant
" Select colormap: 'soft', 'softlight', 'standard' or 'allblue'
let xterm16_colormap = 'allblue'
" Select brightness: 'low', 'med', 'high', 'default' or custom levels.
let xterm16_brightness = 'high'
" Curseur vert => beurk
let g:xterm16fg_Cursor = 'black'
let g:xterm16bg_Cursor = 'white'
colorscheme xterm16
"set lazyredraw
""""""""""""""""""""""""""""
" Some basic configuration "
""""""""""""""""""""""""""""
set wildmode=list:longest,full
set wildignore+=*~,*.info,*.aux,*.log,*.dvi,*.bbl,*.out,*.o,*.lo
set suffixes+=~,.info,.aux,.log,.dvi,.bbl,.out,.o,.lo
" disable mouse
set mouse=
" tune leader (used by comment plugin)
let mapleader="_"
set timeout timeoutlen=1500
set numberwidth=3
set number
if !isdirectory($HOME."/.vim/undo-dir")
call mkdir($HOME."/.vim/undo-dir", "", 0700)
endif
set undodir=~/.vim/undo-dir
set undofile
set modeline
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif
if &term =~ '^screen'
" tmux will send xterm-style keys when its xterm-keys option is on
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
endif
""""""""""""""""""""
" ftplugin tunning "
""""""""""""""""""""
filetype on
filetype plugin on
filetype indent on
" le html, c'est en fait du xhtml
autocmd FileType html setlocal filetype=xhtml
" shelldap hook
autocmd BufEnter /tmp/shelldap* setlocal filetype=ldif
""""""""""""""""""""""""""""""
" Tab and formatting options "
""""""""""""""""""""""""""""""
set shiftwidth=4
set tabstop=4
" par defaut, en autocmd
autocmd FileType * set shiftwidth=4
autocmd FileType * set tabstop=4
" HTML indenté à 2
autocmd FileType xml,html,xhtml,smarty setlocal shiftwidth=2
autocmd FileType xml,html,xhtml,smarty setlocal tabstop=2
" smarty indenté comme du xhtml
autocmd FileType smarty runtime! indent/xhtml.vim
set smartindent
set smarttab
set expandtab
" display non-breaking spaces and trailling spaces
set listchars=trail,nbsp,tab:»\ ,precedes:<,extends:>
set list
""""""""""""""""""
" Nice statusbar "
""""""""""""""""""
set laststatus=2
set statusline=
set statusline+=%-3.3n\ " buffer number
set statusline+=%f\ " file name
set statusline+=%h%m%r%w " flags
set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{&encoding}, " encoding
set statusline+=%{&fileformat}] " file format
set statusline+=%= " right align
set statusline+=0x%-8B\ " current char
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
""""""""""""""""""
" Search options "
""""""""""""""""""
set ignorecase
set infercase
set showmatch
"""""""""""""""""""""
" buffers shortcuts "
"""""""""""""""""""""
map <A-Right> :bnext!<CR>
map <A-Left> :bprevious!<CR>
nmap <A-Right> :bnext!<CR>
nmap <A-Left> :bprevious!<CR>
imap <A-Right> <ESC>:bnext!<CR>a
imap <A-Left> <ESC>:bprevious!<CR>a
"""""""""""""""""""""""""""""""""""""
" spell checking and autocompletion "
"""""""""""""""""""""""""""""""""""""
if exists('+omnifunc')
"set spell
set spelllang=fr,en
set completeopt=menuone,preview
set omnifunc=syntaxcomplete#Complete
let g:SuperTabDefaultCompletionType = "context"
autocmd FileType *
\ if &omnifunc != '' |
\ call SuperTabChain(&omnifunc, "<C-n>") |
\ endif
let g:SuperTabCompleteCase = "match"
endif
""""""""""""""""""""""""""
" Some usefull mappings "
""""""""""""""""""""""""""
nnoremap <silent> <F9> :w!<CR>:!aspell check %<CR>:e %<CR>
nnoremap <silent> <F8> :Tlist<CR>
map <F7> mzgg=G'z<CR>
"""""""""""""""""""""
" Encoding settings "
"""""""""""""""""""""
" If we have a BOM, always honour that rather than trying to guess.
if &fileencodings !~? "ucs-bom"
set fileencodings^=ucs-bom
endif
" Always check for UTF-8 when trying to determine encodings.
if &fileencodings !~? "utf-8"
set fileencodings+=utf-8
endif
" Make sure we have a sane fallback for encoding detection
set fileencodings+=default