X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=vimrc;h=2823246d4cec2a54d449c3801756f7fa8f5bf85e;hb=da7ed32dc51735766944436c96d03a7d6822f659;hp=35d84d5edc52a3005b9beb45471ed05fcb0a011f;hpb=f55d57134e0291304f623bb5e863781448705445;p=config%2Fdotfiles.git diff --git a/vimrc b/vimrc index 35d84d5..2823246 100644 --- a/vimrc +++ b/vimrc @@ -3,6 +3,13 @@ " EDITOR SETTINGS +" Prevent editing as root as it may cause security problems. Use sudoedit +" instead. Thanks to godlygeek in #vim on Freenode (2009-06-19 22:21). +if $HOME == '/root' || exists('$SUDO_USER') + echomsg 'Running as root is forbidden! Use sudoedit.' + qa +endif + " Make sure Vim (and not Vi) settings are used. set nocompatible @@ -99,7 +106,8 @@ set background=dark " Display line numbers. set number -" Display the ruler with current line/file position. +" Display the ruler with current line/file position. If 'statusline' is used +" then this only affects . set ruler " Display partial commands in the status line. set showcmd @@ -117,9 +125,27 @@ if v:version >= 700 set listchars+=nbsp:! endif -" Always display the status line even if there is only one window. if has('statusline') + " Always display the status line even if there is only one window. set laststatus=2 + + set statusline= + " on the left + set statusline+=%02n: " buffer number + set statusline+=%f\ " path to current file in buffer + set statusline+=%h " [help] if buffer is help file + set statusline+=%w " [Preview] if buffer is preview buffer + set statusline+=%m " [+] if buffer was modified, + " [-] if 'modifiable' is off + set statusline+=%r " [RO] if buffer is read only + + " on the right + set statusline+=%= " right align + set statusline+=%-12.(%l,%c%V%)\ " line number (%l), + " column number (%c), + " virtual column number if different + " than %c (%V) + set statusline+=%P " position in file in percent endif @@ -249,6 +275,17 @@ if has('autocmd') " But not for Git commits, go to beginning of the file. autocmd BufReadPost COMMIT_EDITMSG normal! gg +" Make sure 'list' and 'number' is disabled in help files. This is necessary +" when switching to a help buffer which is in the background with :buffer as +" these options are local to windows (and not only to buffers). This happens +" because I often want to use only one window and thus the help buffer is in +" the background. + autocmd BufWinEnter *.txt + \ if &filetype == 'help' | + \ setlocal nolist | + \ setlocal nonumber | + \ endif + " AFTER/FTPLUGIN AUTO COMMANDS " Disable spell checking for files which don't need it.