X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=vimrc;h=9dc6bdfa3d1b1e74f9fbdfc0b3eedeffa7698772;hb=7907b469979fa223fc69a13af850c7a82d7d44b7;hp=040dad1286c37be94e92062ea81ef471b6e034da;hpb=6a44ab1cf2b37c6954e53b9336a76f6e1ac26130;p=config%2Fdotfiles.git diff --git a/vimrc b/vimrc index 040dad1..9dc6bdf 100644 --- a/vimrc +++ b/vimrc @@ -3,6 +3,18 @@ " 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 + + +" Reset all options (except 'term, 'lines' and 'columns'). This makes sure a +" system wide configuration file doesn't change default values. +set all& + " Make sure Vim (and not Vi) settings are used. set nocompatible @@ -99,7 +111,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 +130,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 @@ -273,8 +304,7 @@ if has('autocmd') " may contain one which could change the filetype or other settings of the " commit buffer. Also make sure we use only 72 characters per line which is " the recommendation for git commit messages (http://tpope.net/node/106). - autocmd FileType gitcommit setlocal nomodeline | - \ let g:secure_modelines_allowed_items = [] | + autocmd FileType gitcommit let g:secure_modelines_allowed_items = [] | \ setlocal textwidth=72 " Allow folding in perl. autocmd FileType perl let perl_fold = 1 |