From bfc603a1da3d665dee64abbaddc3266c549186fa Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Sat, 12 Oct 2013 11:18:05 +0200 Subject: [PATCH] vim: restructuring vimrc --- dotfiles/vim/.vimrc | 93 ++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 52 deletions(-) diff --git a/dotfiles/vim/.vimrc b/dotfiles/vim/.vimrc index 27e8d3f..edee013 100644 --- a/dotfiles/vim/.vimrc +++ b/dotfiles/vim/.vimrc @@ -9,41 +9,41 @@ set nocompatible - -" Pathogen runtime path manipulation -"call pathogen#infect() "Using the infect method breaks ft detection -filetype off -call pathogen#runtime_append_all_bundles() -call pathogen#helptags() - set encoding=utf8 - -"Activate syntax highlighting -syntax on -"Activate filetype plugins: syntax highlighting, indentation, and more -filetype plugin indent on - set modeline set number set backspace=indent,eol,start -"vim-7 and newer has vimspell (spell checker) built in +set tagstack +set grepprg=grep\ -nH\ $* +set foldcolumn=1 + +set incsearch +set hlsearch + +set cursorline +set laststatus=2 + +set listchars=tab:»­,trail:·,eol:$ + +set autoindent +set tabstop=4 +set shiftwidth=4 + if version >= 703 set spelllang=de_at,en set tabpagemax=20 - "set colorcolumn=80,+1 set colorcolumn=+1 endif -"Set some properties for ctags, grep and the size of the -"most-left column for foldings -set tagstack -set grepprg=grep\ -nH\ $* -set foldcolumn=1 +" Pathogen runtime path manipulation +"call pathogen#infect() "Using the infect method breaks ft detection +filetype off +call pathogen#runtime_append_all_bundles() +call pathogen#helptags() -"Set incremental search and highlighted search results -set incsearch -set hlsearch +syntax on +filetype plugin indent on "Power saving tip: powertop-homepage @@ -51,11 +51,10 @@ let &guicursor = &guicursor . ",a:blinkon0" "According to vim help -- enable mouse in xterm... set mouse=a - -"Open current file with a specific program -function OpenIn(prog) - execute ":!" . a:prog . " % &" -endfunction +" Use 256 colors +set t_Co=256 +let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' } +colorscheme shuber-wombat " Use the below highlight group when displaying bad whitespace is desired. @@ -63,37 +62,35 @@ highlight BadWhitespace ctermbg=red guibg=red " Make trailing whitespace be flagged as bad. au Filetype python,tex,c,cpp,cs,objc,java syn match BadWhitespace /\s\+$/ containedin=ALL -set listchars=tab:»­,trail:·,eol:$ - -set autoindent -set tabstop=4 -set shiftwidth=4 if exists(":DetectIndent") au BufReadPost * :DetectIndent endif -"au Filetype python,tex,c,cpp,cs,objc,java :DetectIndent -"let g:detectindent_preferred_expandtab = 1 -"let g:detectindent_preferred_indent = 4 let g:syntastic_mode_map = { 'mode' : 'active', 'active_filetypes' : [], 'passive_filetypes' : ['html'] } -" Use 256 colors -set t_Co=256 -let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' } -colorscheme shuber-wombat +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Some macros +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -set cursorline -set laststatus=2 +"Open current file with a specific program +function OpenIn(prog) + execute ":!" . a:prog . " % &" +endfunction """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " key bindings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -map NERDCommenterToggle +map NERDCommenterToggle + +nmap :q +nmap :w +vmap gv +imap """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -128,7 +125,6 @@ function AddNamespaceDeclTo(ns, id) execute ":%s!^\\(\\s*[^#/].*[^:]\\)\\<" . a:id . "\\>!\\1" . a:ns . "::" . a:id . "!ge" endfunction - "Adds STL prefix 'std::' to several identifiers function AddSTLNamespaceDecl() call AddNamespaceDeclTo("std","cin") @@ -155,7 +151,6 @@ function AddSTLNamespaceDecl() call AddNamespaceDeclTo("std","vector") endfunction - function EscapeHexToChar() echo 'Call "x/Nxb addr" in GDB to print N bytes at addr' execute '%s/^.*://' @@ -172,6 +167,7 @@ endfunction au Filetype text set textwidth=80 "According to thunderbirds settings au Filetype mail set textwidth=72 +au Filetype mail set expandtab "a and w reformat the paragraph automatically and a new paragraph "is indicated by lines not ending with white-space @@ -184,7 +180,6 @@ au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/ au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/ - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " PHP """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -198,8 +193,6 @@ au Filetype php set textwidth=80 "au Filetype php set cindent - - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " LaTeX """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -219,14 +212,12 @@ function TexTransUmlaute() execute ':%s/²/\^2/&' endfunction - function FindWordRepeatings() execute '/\(\<\S\+\>\)\s\+\1\>' " let pos = search('\(\<\S\+\>\)\s\+\1\>', "cw") " call cursor(pos) endfunction - let g:tex_flavor = "latex" let g:LatexBox_viewer="okular" let g:LatexBox_latexmk_options="-pvc" @@ -238,14 +229,12 @@ if version >= 700 endif - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " python """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" au Filetype python map :!python % - " vimrc file for following the coding standards specified in PEP 7 & 8. " Number of spaces that a pre-existing tab is equal to. -- 2.30.2