Browse Source

Update vim configuration (mostly encoding and tab options).

Emmanuel Bouthenot 14 years ago
parent
commit
7629ccb3c7
1 changed files with 36 additions and 24 deletions
  1. 36 24
      .vim/vimrc

+ 36 - 24
.vim/vimrc

@@ -22,6 +22,15 @@ set backup "enable backups
 set backupdir=~/.vim/backups "backup directory
 set directory=~/.vim/tmp "directory to place swap files in
 
+"Encoding settings
+if has("multi_byte")
+	if &termencoding == ""
+		let &termencoding = &encoding
+	endif
+	set encoding=utf-8
+	setglobal fileencoding=utf-8 bomb
+	set fileencodings=ucs-bom,utf-8,default,latin1
+endif
 
 "Syntax highlight
 syntax on
@@ -134,7 +143,6 @@ set tabstop=4
 set shiftwidth=4
 set shiftround "round indent to shiftwidth
 set softtabstop=4
-set expandtab "no real tabs
 
 set showmatch "brace/parenthese/bracket matching
 set nowrap "wrap long lines
@@ -142,7 +150,11 @@ set showbreak="++++ "
 
 "show some not printable chars
 set list
-set listchars=tab:>.,trail:·,extends:>,precedes:<,nbsp:%
+if has("multi_byte")
+	set listchars=trail:·,extends:>,precedes:<,nbsp:•,tab:→\ 
+else
+	set listchars=tab:>.,trail:·,extends:>,precedes:<,nbsp:%
+endif
 
 "search settings
 set hlsearch "highlight searches
@@ -184,22 +196,22 @@ autocmd QuickFixCmdPre * botright cwindow 5
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 "set spellfile=~/.vim/spell/words
 
-function EnableSpellChecking()
-    setlocal spell spelllang=fr,en_us
-    let b:spell = 1
+function! EnableSpellChecking()
+	setlocal spell spelllang=fr,en_us
+	let b:spell = 1
 endfunction
 
-function DisableSpellChecking()
-    setlocal nospell
-    unlet b:spell
+function! DisableSpellChecking()
+	setlocal nospell
+	unlet b:spell
 endfunction
 
 function! ToggleSpell()
-    if !exists("b:spell")
-        execute 'call EnableSpellChecking()'
-    else
-        execute 'call DisableSpellChecking()'
-    endif
+	if !exists("b:spell")
+		execute 'call EnableSpellChecking()'
+	else
+		execute 'call DisableSpellChecking()'
+	endif
 endfunction
 
 nmap <F4> :call ToggleSpell()<CR>
@@ -231,16 +243,16 @@ nnoremap <silent> <F9> :Tlist<CR>
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 function! CleanClose()
-    let todelbufNr = bufnr("%")
-    let newbufNr = bufnr("#")
-    if ((newbufNr != -1) && (newbufNr != todelbufNr) && buflisted(newbufNr))
-        exe "b".newbufNr
-    else
-        bnext
-    endif
-    if (bufnr("%") == todelbufNr)
-        new
-    endif
-    exe "bd".todelbufNr
+	let todelbufNr = bufnr("%")
+	let newbufNr = bufnr("#")
+	if ((newbufNr != -1) && (newbufNr != todelbufNr) && buflisted(newbufNr))
+		exe "b".newbufNr
+	else
+		bnext
+	endif
+	if (bufnr("%") == todelbufNr)
+		new
+	endif
+	exe "bd".todelbufNr
 endfunction