1 " Filename: /etc/vim/vimrc
2 " Purpose: configuration file for vim
3 " Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
4 " Bug-Reports: see http://grml.org/bugs/
5 " License: This file is licensed under the GPL v2.
6 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
8 " All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
9 " /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime you
10 " can find below. If you wish to change any of those settings, you should do it
11 " in the file /etc/vim/vimrc.local, since debian.vim will be overwritten
12 " everytime an upgrade of the vim packages is performed and this file
13 " (/etc/vim/vimrc) every time the package grml-etc-core is upgraded. It is
14 " recommended to make changes after sourcing debian.vim since it alters the
15 " value of the 'compatible' option.
17 " This line should not be removed as it ensures that various options are
18 " properly set to work with the Vim-related packages available in Debian.
21 " Uncomment the next line to make Vim more Vi-compatible
22 " NOTE: debian.vim sets 'nocompatible', but only if debian.vim is available,
23 " so let's make sure we run in nocompatible mode:
26 " Setting 'compatible' changes numerous
27 " options, so any other options should be set AFTER setting 'compatible'.
30 set backspace=indent,eol,start " more powerful backspacing
32 " Now we set some defaults for the editor
33 set autoindent " always set autoindenting on
34 " set linebreak " Don't wrap words by default
35 set textwidth=0 " Don't wrap lines by default
36 set nobackup " Don't keep a backup file
37 set backupcopy=no " grml: Overwrite files/links with w!
38 " set backupcopy=yes " Keep a backup file
39 set viminfo='20,\"50 " read/write a .viminfo file, don't store more than
40 " 50 lines of registers
41 set history=50 " keep 50 lines of command line history
42 set ruler " show the cursor position all the time
44 " Suffixes that get lower priority when doing tab completion for filenames.
45 " These are files we are not likely to want to edit or read.
46 set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
48 " Vim5 and later versions support syntax highlighting.
49 " Just load the main syntax file when Vim was compiled with "+syntax".
54 " Debian uses compressed helpfiles. We must inform vim that the main
55 " helpfiles is compressed. Other helpfiles are stated in the tags-file.
56 " set helpfile=$VIMRUNTIME/doc/help.txt.gz
58 " If using a dark background within the editing area and syntax highlighting
59 " turn on this option as well
62 " begin of grml specials:
63 " set list listchars=tab:»·
64 " set listchars=eol:$,precedes:«,extends:»,tab:··,trail:·
65 " end of grml specials
67 " Uncomment the following to have Vim jump to the last position when
70 " au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
71 " \| exe "normal g'\"" | endif
74 " Uncomment the following to have Vim load indentation rules according to the
75 " detected filetype. Per default Debian Vim only load filetype specific
81 " The following are commented out as they cause vim to behave a lot
82 " differently from regular Vi. They are highly recommended though.
83 set showcmd " Show (partial) command in status line.
84 set showmatch " Show matching brackets.
85 " set ignorecase " Do case insensitive matching
86 " set smartcase " Do smart case matching
87 " set incsearch " Incremental search
88 " set autowrite " Automatically save before commands like :next and :make
89 " When switching between different buffers you can't use undo without 'set hidden':
90 set hidden " Hide buffers when they are abandoned
91 " set mouse=a " Enable mouse usage (all modes) in terminals
92 set wildmenu " command-line completion operates in an enhanced mode
94 set pastetoggle=<f11> " don't change text when copy/pasting
95 set dictionary=/usr/share/dict/word " used with CTRL-X CTRL-K
97 """ set the screen hardstatus to vim(filename.ext)
98 if ((&term =~ '^screen') && ($VIM_PLEASE_SET_TITLE =~ '^yes$') || has('gui_running'))
102 autocmd BufEnter * let &titlestring = "vim(" . expand("%:t") . ")"
103 let &titleold = fnamemodify(&shell, ":t")
107 set ek hidden ruler sc vb wmnu
109 " turn these OFF ("no" prefix):
110 set nodigraph noeb noet nosol
112 set bs=2 fo=cqrt ls=2 shm=at ww=<,>,h,l
113 " set bs=2 fo=cqrt ls=2 shm=at tw=72 ww=<,>,h,l
114 set comments=b:#,:%,fb:-,n:>,n:)
115 " set list listchars=tab:»·,trail:·
116 set listchars=eol:$,precedes:«,extends:»,tab:»·,trail:·
117 set viminfo=%,'50,\"100,:100,n~/.viminfo
118 set tags=./tags,./TAGS,tags,TAGS,../tags,../../tags,../../../tags,../../../../tags
121 " when the file type is "mail" then set the textwidth to "70":
123 au FileType mail set tw=70
124 " When editing a file, always jump to the last cursor position
125 " au BufReadPost * if line("'\"") | exe "'\"" | endif
126 autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif
129 " some colors - as an example "white on black" [use bold fonts]:
130 " hi normal ctermfg=white ctermbg=black guifg=white guibg=black
131 " hi nontext ctermfg=blue ctermbg=black guifg=blue guibg=black
135 " set t_Co=256 " number of colors
137 " some useful mappings:
138 set pastetoggle=<f11>
140 " with F7 copy all current buffer to clipboard, or a selection.
141 " with shift-F7, paste all clipboard contents
142 " see: http://www.vim.org/tips/tip.php?tip_id=964
143 map <F7> :w !xclip<CR><CR>
145 map <S-F7> :r!xclip -o<CR>
147 " remove/delete trailing whitespace:
151 " execute the command in the current line (minus the first word, which
152 " is intended to be a shell prompt) and insert the output in the buffer
156 iab YDATE <C-R>=strftime("%a %b %d %T %Z %Y")<CR>
157 map ,L 1G/Latest change:\s*/e+1<CR>CYDATE<ESC>
159 " the shell in a box mode. found in posting by Stefan `Sec` Zehl
160 " in newsgroup de.alt.sysadmin.recovery, msgid: <df7lhe$2hup$1@ice.42.org>
161 " Requires zsh for "print -P $PS1" / replace if needed.
162 " Your prompt should end in > (and only contain one)
163 " so run something like:
164 " % export PS1='%n@%m > '
165 " in your zsh, press ',l' and <enter> for running commands, end mode via <esc>
166 map __start :imap <C-V><C-M> <C-O>__cmd<C-V>\|imap <C-V><ESC> <C-V><ESC>__end<C-M>
167 noremap __end :iunmap <C-V><CR>\|iunmap <C-V><ESC><C-M>:"Vish ended.<C-M>
168 noremap __cmd 0<ESC>f>ly$:r !<C-R>";print -P $PS1<C-M>A
169 noremap __scmd :r !print -P $PS1<c-M>A
172 " Kill quote spaces (when quoting a quote)
173 map ,kqs mz:%s/^> >/>>/<cr>
175 " Interface to Mercurial Version Control
176 if filereadable( "/usr/share/doc/mercurial/examples/vim/hg-menu.vim" )
177 source /usr/share/doc/mercurial/examples/vim/hg-menu.vim
180 " Vim 7 brings cool new features - see ':he version7'!
181 " The coolest features of Vim7 by mika
182 " ====================================
183 " 1) omni/intellisense completion: use CTRL-X CTRL-O in insert mode to start it [:he compl-omni]
184 " 2) internal grep: vimgrep foo bar [:he vimgrep]
185 " 3) tab pages: vim -p file1 file2 - then use the :tab command [:he tabpage]
188 " 4) undo branches: :undolist / :earlier 2h / :later 2h
189 " instead of using u (undo) and CTRL-R (redo), you might experiment with g-
190 " and g+ to move through the text state [:he undolist]
191 " 5) browse remote directories via scp using netrw plugin: :edit scp://host//path/to/ [:he netrw.vim]
192 " 6) start editing the filename under the cursor and jump to the line
193 " number following the file name: press gF [:he gF]
194 " 7) press 'CTRL-W F' to start editing the filename under the cursor in a new
195 " window and jump to the line number following the file name. [:he CTRL-W_F]
196 " 8) spelling correction (see later for its configuration) [:he spell]:
197 " ]s -> Move to next misspelled word after the cursor.
198 " zg -> Add word under the cursor as a good word to the first name in 'spellfile'
199 " zw -> Like "zg" but mark the word as a wrong (bad) word.
200 " z= -> For the word under/after the cursor suggest correctly spelled words.
201 " 9) highlight active cursor line using 'set cursorline' [:he cursorline]
202 " 10) delete inner quotes inside HTML-code using <C-O>cit (see its mapping later) [:he tag-blocks]
205 " Thanks for some ideas to Christian 'strcat' Schneider and Julius Plenz
206 " turn spelling on by default:
208 " toggle spelling with F12 key:
209 map <F12> :set spell!<CR><Bar>:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)<CR>
210 set spellfile=~/.vim/spellfile.add
211 " change language - get spell files from http://ftp.vim.org/pub/vim/runtime/spell/ =>
212 " cd ~/.vim/spell && wget http://ftp.vim.org/pub/vim/runtime/spell/de.{latin1,utf-8}.spl
215 " highlight spelling correction:
216 " highlight SpellBad term=reverse ctermbg=12 gui=undercurl guisp=Red " badly spelled word
217 " highlight SpellCap term=reverse ctermbg=9 gui=undercurl guisp=Blue " word with wrong caps
218 " highlight SpellRare term=reverse ctermbg=13 gui=undercurl guisp=Magenta " rare word
219 " highlight SpellLocale term=underline ctermbg=11 gui=undercurl guisp=DarkCyan " word only exists in other region
221 " set maximum number of suggestions listed to top 10 items:
224 " highlight matching parens:
225 " set matchpairs=(:),[:],{:},< :>
226 " let loaded_matchparen = 1
227 " highlight MatchParen term=reverse ctermbg=7 guibg=cornsilk
229 " highlight the cursor line and column:
231 " highlight CursorLine term=reverse ctermbg=7 guibg=#333333
232 " highlight CursorColumn guibg=#333333
234 " change inner tag - very useful e.g. within HTML-code!
235 " ci" will remove the text between quotes, also works for ' and `
238 " use the popup menu also when there is only one match:
239 " set completeopt=menuone
240 " determine the maximum number of items to show in the popup menu for:
242 " set completion highlighting:
243 " highlight Pmenu ctermbg=13 guifg=Black guibg=#BDDFFF " normal item
244 " highlight PmenuSel ctermbg=7 guifg=Black guibg=Orange " selected item
245 " highlight PmenuSbar ctermbg=7 guifg=#CCCCCC guibg=#CCCCCC " scrollbar
246 " highlight PmenuThumb cterm=reverse gui=reverse guifg=Black guibg=#AAAAAA " thumb of the scrollbar
249 " Source a global configuration file if available
250 " Deprecated by Debian but still supported by grml
251 if filereadable("/etc/vim/vimrc.local")
252 source /etc/vim/vimrc.local
255 " source user-specific local configuration file
256 if filereadable(expand("$HOME/.vimrc.local"))
257 source $HOME/.vimrc.local
259 "# END OF FILE #################################################################