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 viminfo='20,\"50 " read/write a .viminfo file, don't store more than
38 " 50 lines of registers
39 set history=50 " keep 50 lines of command line history
40 set ruler " show the cursor position all the time
42 " Suffixes that get lower priority when doing tab completion for filenames.
43 " These are files we are not likely to want to edit or read.
44 set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
46 " Vim5 and later versions support syntax highlighting.
47 " Just load the main syntax file when Vim was compiled with "+syntax".
52 " Debian uses compressed helpfiles. We must inform vim that the main
53 " helpfiles is compressed. Other helpfiles are stated in the tags-file.
54 " set helpfile=$VIMRUNTIME/doc/help.txt.gz
56 " If using a dark background within the editing area and syntax highlighting
57 " turn on this option as well
60 " begin of grml specials:
61 " set list listchars=tab:»·
62 " set listchars=eol:$,precedes:«,extends:»,tab:··,trail:·
63 " end of grml specials
65 " Uncomment the following to have Vim jump to the last position when
68 " au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
69 " \| exe "normal g'\"" | endif
72 " Uncomment the following to have Vim load indentation rules according to the
73 " detected filetype. Per default Debian Vim only load filetype specific
79 " The following are commented out as they cause vim to behave a lot
80 " differently from regular Vi. They are highly recommended though.
81 set showcmd " Show (partial) command in status line.
82 set showmatch " Show matching brackets.
83 " set ignorecase " Do case insensitive matching
84 " set smartcase " Do smart case matching
85 " set incsearch " Incremental search
86 " set autowrite " Automatically save before commands like :next and :make
87 " When switching between different buffers you can't use undo without 'set hidden':
88 set hidden " Hide buffers when they are abandoned
89 " set mouse=a " Enable mouse usage (all modes) in terminals
90 set wildmenu " command-line completion operates in an enhanced mode
92 set pastetoggle=<f11> " don't change text when copy/pasting
93 set dictionary=/usr/share/dict/word " used with CTRL-X CTRL-K
95 """ set the screen hardstatus to vim(filename.ext)
96 if ((&term =~ '^screen') && ($VIM_PLEASE_SET_TITLE =~ '^yes$') || has('gui_running'))
100 autocmd BufEnter * let &titlestring = "vim(" . expand("%:t") . ")"
101 let &titleold = fnamemodify(&shell, ":t")
105 set ek hidden ruler sc vb wmnu
107 " turn these OFF ("no" prefix):
108 set nodigraph noeb noet nosol
110 set bs=2 fo=cqrt ls=2 shm=at ww=<,>,h,l
111 " set bs=2 fo=cqrt ls=2 shm=at tw=72 ww=<,>,h,l
112 set comments=b:#,:%,fb:-,n:>,n:)
113 " set list listchars=tab:»·,trail:·
114 set listchars=eol:$,precedes:«,extends:»,tab:»·,trail:·
115 set viminfo=%,'50,\"100,:100,n~/.viminfo
116 set tags=./tags,./TAGS,tags,TAGS,../tags,../../tags,../../../tags,../../../../tags
119 " when the file type is "mail" then set the textwidth to "70":
121 au FileType mail set tw=70
122 " When editing a file, always jump to the last cursor position
123 " au BufReadPost * if line("'\"") | exe "'\"" | endif
124 autocmd BufReadPost * if line("'\"") && line("'\"") <= line("$") | exe "normal `\"" | endif
127 " some colors - as an example "white on black" [use bold fonts]:
128 " hi normal ctermfg=white ctermbg=black guifg=white guibg=black
129 " hi nontext ctermfg=blue ctermbg=black guifg=blue guibg=black
133 " set t_Co=256 " number of colors
135 " some useful mappings:
136 set pastetoggle=<f11>
138 " with F7 copy all current buffer to clipboard, or a selection.
139 " with shift-F7, paste all clipboard contents
140 " see: http://www.vim.org/tips/tip.php?tip_id=964
141 map <F7> :w !xclip<CR><CR>
143 map <S-F7> :r!xclip -o<CR>
145 " remove/delete trailing whitespace:
149 " execute the command in the current line (minus the first word, which
150 " is intended to be a shell prompt) and insert the output in the buffer
154 iab YDATE <C-R>=strftime("%a %b %d %T %Z %Y")<CR>
155 map ,L 1G/Latest change:\s*/e+1<CR>CYDATE<ESC>
157 " the shell in a box mode. found in posting by Stefan `Sec` Zehl
158 " in newsgroup de.alt.sysadmin.recovery, msgid: <df7lhe$2hup$1@ice.42.org>
159 " Requires zsh for "print -P $PS1" / replace if needed.
160 " Your prompt should end in > (and only contain one)
161 " so run something like:
162 " % export PS1='%n@%m > '
163 " in your zsh, press ',l' and <enter> for running commands, end mode via <esc>
164 map __start :imap <C-V><C-M> <C-O>__cmd<C-V>\|imap <C-V><ESC> <C-V><ESC>__end<C-M>
165 noremap __end :iunmap <C-V><CR>\|iunmap <C-V><ESC><C-M>:"Vish ended.<C-M>
166 noremap __cmd 0<ESC>f>ly$:r !<C-R>";print -P $PS1<C-M>A
167 noremap __scmd :r !print -P $PS1<c-M>A
170 " Kill quote spaces (when quoting a quote)
171 map ,kqs mz:%s/^> >/>>/<cr>
173 " Interface to Mercurial Version Control
174 if filereadable( "/usr/share/doc/mercurial/examples/vim/hg-menu.vim" )
175 source /usr/share/doc/mercurial/examples/vim/hg-menu.vim
178 " Vim 7 brings cool new features - see ':he version7'!
179 " The coolest features of Vim7 by mika
180 " ====================================
181 " 1) omni/intellisense completion: use CTRL-X CTRL-O in insert mode to start it [:he compl-omni]
182 " 2) internal grep: vimgrep foo bar [:he vimgrep]
183 " 3) tab pages: vim -p file1 file2 - then use the :tab command [:he tabpage]
186 " 4) undo branches: :undolist / :earlier 2h / :later 2h
187 " instead of using u (undo) and CTRL-R (redo), you might experiment with g-
188 " and g+ to move through the text state [:he undolist]
189 " 5) browse remote directories via scp using netrw plugin: :edit scp://host//path/to/ [:he netrw.vim]
190 " 6) start editing the filename under the cursor and jump to the line
191 " number following the file name: press gF [:he gF]
192 " 7) press 'CTRL-W F' to start editing the filename under the cursor in a new
193 " window and jump to the line number following the file name. [:he CTRL-W_F]
194 " 8) spelling correction (see later for its configuration) [:he spell]:
195 " ]s -> Move to next misspelled word after the cursor.
196 " zg -> Add word under the cursor as a good word to the first name in 'spellfile'
197 " zw -> Like "zg" but mark the word as a wrong (bad) word.
198 " z= -> For the word under/after the cursor suggest correctly spelled words.
199 " 9) highlight active cursor line using 'set cursorline' [:he cursorline]
200 " 10) delete inner quotes inside HTML-code using <C-O>cit (see its mapping later) [:he tag-blocks]
203 " Thanks for some ideas to Christian 'strcat' Schneider and Julius Plenz
204 " turn spelling on by default:
206 " toggle spelling with F12 key:
207 map <F12> :set spell!<CR><Bar>:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)<CR>
208 set spellfile=~/.vim/spellfile.add
209 " change language - get spell files from http://ftp.vim.org/pub/vim/runtime/spell/ =>
210 " cd ~/.vim/spell && wget http://ftp.vim.org/pub/vim/runtime/spell/de.{latin1,utf-8}.spl
213 " highlight spelling correction:
214 " highlight SpellBad term=reverse ctermbg=12 gui=undercurl guisp=Red " badly spelled word
215 " highlight SpellCap term=reverse ctermbg=9 gui=undercurl guisp=Blue " word with wrong caps
216 " highlight SpellRare term=reverse ctermbg=13 gui=undercurl guisp=Magenta " rare word
217 " highlight SpellLocale term=underline ctermbg=11 gui=undercurl guisp=DarkCyan " word only exists in other region
219 " set maximum number of suggestions listed to top 10 items:
222 " highlight matching parens:
223 " set matchpairs=(:),[:],{:},< :>
224 " let loaded_matchparen = 1
225 " highlight MatchParen term=reverse ctermbg=7 guibg=cornsilk
227 " highlight the cursor line and column:
229 " highlight CursorLine term=reverse ctermbg=7 guibg=#333333
230 " highlight CursorColumn guibg=#333333
232 " change inner tag - very useful e.g. within HTML-code!
233 " ci" will remove the text between quotes, also works for ' and `
236 " use the popup menu also when there is only one match:
237 " set completeopt=menuone
238 " determine the maximum number of items to show in the popup menu for:
240 " set completion highlighting:
241 " highlight Pmenu ctermbg=13 guifg=Black guibg=#BDDFFF " normal item
242 " highlight PmenuSel ctermbg=7 guifg=Black guibg=Orange " selected item
243 " highlight PmenuSbar ctermbg=7 guifg=#CCCCCC guibg=#CCCCCC " scrollbar
244 " highlight PmenuThumb cterm=reverse gui=reverse guifg=Black guibg=#AAAAAA " thumb of the scrollbar
248 " To enable persistent undo uncomment following section.
249 " The undo files will be stored in $HOME/.cache/vim
252 " " enable persistent-undo
255 " " store the persistent undo file in ~/.cache/vim
256 " set undodir=~/.cache/vim/
258 " " create undodir directory if possible and does not exist yet
259 " let targetdir=$HOME . "/.cache/vim"
260 " if isdirectory(targetdir) != 1 && getftype(targetdir) == "" && exists("*mkdir")
261 " call mkdir(targetdir, "p", 0700)
265 " Source a global configuration file if available
266 " Deprecated by Debian but still supported by grml
267 if filereadable("/etc/vim/vimrc.local")
268 source /etc/vim/vimrc.local
271 " source user-specific local configuration file
272 if filereadable(expand("$HOME/.vimrc.local"))
273 source $HOME/.vimrc.local
275 "# END OF FILE #################################################################