diff --git a/.vimrc b/.vimrc index 6d4f8cd..b797c6c 100644 --- a/.vimrc +++ b/.vimrc @@ -36,8 +36,21 @@ """"""""""" " disable vi-compatible mode set nocompatible -syntax on + +" Switch syntax highlighting on when the terminal has colors or when using the +" GUI (which always has colors). +if &t_Co > 2 || has("gui_running") + " Revert with ":syntax off". + syntax on + + " I like highlighting strings inside C comments. + " Revert with ":unlet c_comment_strings". + let c_comment_strings=1 +endif + filetype plugin on +" enable file type detection and do language-dependent indenting +filetype plugin indent on "set clipboard=unnamed """""""" " SAVE " @@ -46,15 +59,23 @@ filetype plugin on set nobackup " save before compilation set autowrite -" jump to last known position when reopening a file -if has("autocmd") - autocmd BufReadPost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ execute "normal! g`\"" | - \ endif -endif +" Put these in an autocmd group, so that you can revert them with: +" ":augroup vimStartup | au! | augroup END" +augroup vimStartup + au! + + " When editing a file, always jump to the last known cursor position. + " Don't do it when the position is invalid or when inside an event handler + " (happens when dropping a file on gvim). + autocmd BufReadPost * + \ if line("'\"") >= 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + +augroup END + " command line history -set history=50 +set history=200 " Check that file have not been changed " CursorHold : after cursor move @@ -98,6 +119,8 @@ set number set statusline=%<%f\ %h%w%m%r%3.(\ %)%{fugitive#statusline()}%=%([%{Tlist_Get_Tagname_By_Line()}]%)%3.(\ %)%-14.(%l,%c%V%)\ %P " always display status line set laststatus=2 +set showcmd " display incomplete commands +set wildmenu " display completion matches in a status line " show bad white spaces let c_space_errors = 1 @@ -158,8 +181,6 @@ augroup Binary augroup END if has("autocmd") - " enable file type detection and do language-dependent indenting - " filetype plugin indent on " detect indentation see http://www.freehackers.org/Indent_Finder if has('python') autocmd BufReadPost /* execute system ('python2 ~/.vim/indent_finder/indent_finder.py --vim-output "' . expand('%') . '"' ) @@ -335,7 +356,9 @@ imap " show current changes with F10 command! DiffOrig \ vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis + \ | wincmd p | diffthis map :DiffOrig + imap a " show git diff when committing let g:git_diff_spawn_mode = 1