15 May 2024
vim Text-Editor: meine .vimrc
Meine .vimrc als Beispiel, mit Backupfiles-Erzeugung. Dies kann lebensrettend sein!
Verzeichnisse mu”ssen natu”rlich existieren.
Die .vimrc
" Backup - a life saver!
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/swp
set undodir=~/.vim/undo
au BufWritePre * let &bex = '-' . strftime("%Y%m%d-%H%M%S") . '.vimbackup'
" modeline used for inline document settings
" set to 10 to search within first 10 lines of document
" set modelines=10
"
set modeline
"hi Statement ctermfg=blue
"hi NonText ctermfg=7 guifg=gray
syntax off
"set nohlsearch
"set t_Co=0
set tabstop=8
set autoindent
set noerrorbells visualbell t_vb=
"Use F12 to toggle between displaying whitespace characters or not:
noremap <F12> :set list!<CR>
"How to show whitespace characters when list is set:
set listchars=eol:$,tab:>~,trail:.,extends:>,precedes:<,nbsp:_
"Suppose you want to reverse some text. This mapping will reverse visually selected text.
"Visually select the word or words, and type ;rv - really only works with selections on one line:
"also mirrors multi line selections
vnoremap ;rv c<C-O>:set revins<CR><C-R>"<Esc>:set norevins<CR>
"Before doing anything like this (particularly with Python files!),
"I usually set 'list', so that I can see the whitespace and change.
nnoremap <F11> :<C-U>setlocal lcs=tab:>-,trail:-,eol:$ list! list? <CR>
Verwendung der Modelines
Im Source-File vim-Kommandos in die Kommentare schreiben
#
# vim: tabstop=4 shiftwidth=4 expandtab
#