Эх сурвалжийг харах

Some improvements in vim configiuration

Emmanuel Bouthenot 13 жил өмнө
parent
commit
76da15869d
1 өөрчлөгдсөн 50 нэмэгдсэн , 22 устгасан
  1. 50 22
      .vim/vimrc

+ 50 - 22
.vim/vimrc

@@ -76,13 +76,13 @@ set modelines=3 "number of lines to check for modelines
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 " keep ctrl-a/ctrl-e for begining/end of line
-nmap <C-a> 0i
-imap <C-a> <esc>0i
-vmap <C-a> 0i
+nmap <C-a> <C-o>I
+imap <C-a> <C-o>I
+vmap <C-a> <C-o>I
 
-nmap <C-e> $i<right>
-imap <C-e> <esc>$i<right>
-vmap <C-e> $i<right>
+nmap <C-e> <C-o>A
+imap <C-e> <C-o>A
+vmap <C-e> <C-o>A
 
 "reopen current file
 map <F5> :e!<CR>
@@ -98,7 +98,7 @@ imap <F2> <ESC>:bn<CR>a
 
 "imap <C-Space> <C-X><C-O> "smart completion
 nmap <C-u> :u<CR>
-imap <C-u> <esc>:u<CR>
+imap <C-u> <ESC>:u<CR>
 
 nmap <C-i> :tabnext<CR>
 "nmap <C-S-i> :tabprevious<CR>
@@ -146,7 +146,11 @@ set softtabstop=4
 
 set showmatch "brace/parenthese/bracket matching
 set nowrap "wrap long lines
-set showbreak="++++ "
+if has("multi_byte")
+	set showbreak="…"
+else
+	set showbreak="+++"
+endif
 
 "show some not printable chars
 set list
@@ -166,10 +170,12 @@ set infercase "smart case support
 " Email Settings
 "
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-autocmd BufRead ~/.mutt/tmp/mutt-* set filetype=mail
-autocmd FileType mail set autoindent expandtab formatoptions=tcqn
-autocmd FileType mail vmap D dO[...]<CR>
-autocmd FileType mail call EnableSpellChecking()
+if has('autocmd')
+	autocmd BufRead ~/.mutt/tmp/mutt-* set filetype=mail
+	autocmd FileType mail set autoindent expandtab formatoptions=tcqna
+	autocmd FileType mail vmap D dO[...]<CR>
+	autocmd FileType mail call EnableSpellChecking()
+endif
 
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Filetypes Settings
@@ -181,21 +187,19 @@ filetype plugin indent on
 " Global Triggers
 "
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-"reload Vim config file after saving
-autocmd BufWritePost ~/.vimrc :source ~/.vimrc
-
-"always limit the width for text files
-autocmd BufRead *.txt set tw=78
-
-autocmd QuickFixCmdPre * botright cwindow 5
+if has('autocmd')
+	"reload Vim config file after saving
+	autocmd BufWritePost $MYVIMRC :source $MYVIMRC
+	"always limit the width for text files
+	autocmd BufRead *.txt set tw=78
+	autocmd QuickFixCmdPre * botright cwindow 5
+endif
 
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Spell Checking
 "
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 "set spellfile=~/.vim/spell/words
-
 function! EnableSpellChecking()
 	setlocal spell spelllang=fr,en_us
 	let b:spell = 1
@@ -237,11 +241,11 @@ let Tlist_Use_SingleClick=1
 let Tlist_Ctags_Cmd="~/.vim/bin/ctags-exuberant"
 nnoremap <silent> <F9> :Tlist<CR>
 
+
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Useful functions
 "
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
 function! CleanClose()
 	let todelbufNr = bufnr("%")
 	let newbufNr = bufnr("#")
@@ -256,3 +260,27 @@ function! CleanClose()
 	exe "bd".todelbufNr
 endfunction
 
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Pathogen plugin
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+call pathogen#runtime_append_all_bundles()
+call pathogen#helptags()
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Gundo plugin
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let g:gundo_right = 1
+let g:gundo_width = 80
+let g:gundo_preview_height = 35
+nnoremap <F3> :GundoToggle<CR>
+
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" NetRW setup
+"
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+let g:netrw_liststyle=3 " Use tree-mode as default view
+let g:netrw_browse_split=4 " Open file in previous buffer
+let g:netrw_preview=1 " preview window shown in a vertically split
+