From 94f357049aae7a41f0751b3910d476c1b1400a7d Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Wed, 20 Jul 2022 07:05:49 +0200 Subject: [PATCH] vim: relative Zeilennummern --- .vimrc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index 595b197..8cb1c94 100644 --- a/.vimrc +++ b/.vimrc @@ -163,8 +163,6 @@ nnoremap :bprev " Saner CTRL-L " https://github.com/mhinz/vim-galore#saner-ctrl-l nnoremap dh :nohlsearch:diffupdate:syntax sync fromstart -" toggle linenumbers -nnoremap z :set nonu! " toggle cursorline nnoremap h :set nocursorline! " strg+f sucht fuzzy nach dateien @@ -189,3 +187,12 @@ vnoremap sr y:%s/"//gc " ### Abbreviations iabbrev ncicht nicht iabbrev nciht nicht + +" linenumbers +nnoremap z :set nonumber! norelativenumber! +" https://jeffkreeftmeijer.com/vim-number/ +:augroup numbertoggle +: autocmd! +: autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif +: autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif +:augroup END