diff --git a/nvim/init.vim b/nvim/init.vim index d7fde8e..124f4b6 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -9,6 +9,7 @@ set smartcase set list set listchars=tab:▸\ ,trail:·,nbsp:.,extends:❯,precedes:❮ set visualbell +set termguicolors set number set relativenumber set backspace=indent,eol,start " Intuitive backspacing @@ -59,18 +60,22 @@ set dictionary+=~/.config/nvim/dictionary/en_us.txt set thesaurus+=~/.config/nvim/thesaurus/de_user.txt set thesaurus+=~/.config/nvim/thesaurus/de_openthesaurus.txt - " *** *** *** Key Mappings *** *** *** " ************************************ + let mapleader = "\" " Quick toggle between buffers noremap j :b# " Add semicolon or comma to the end of the line -nnoremap ; A; -nnoremap , A, +nnoremap ;; A; +nnoremap ,, A, + +" Maintain the cursor position when yanking a visual selection +vnoremap y myy`y +vnoremap Y myY`y " Delete last character of line nnoremap x $x @@ -80,7 +85,14 @@ nnoremap ve :e $MYVIMRC nnoremap vr :source $MYVIMRC " Delete all buffers -nnoremap da :exec "1," . bufnr('$') . "bd" +nnoremap da :bufdo bdelete + +" Allow gf to open non-existent files +map gf :edit + +" Reselect visual selection after indenting +vnoremap < >gv " Set spell checker to `s` " zg (good), zG (good temp), zw (wrong), zW (wrong temp) @@ -103,6 +115,10 @@ nnoremap ` ' nnoremap gp `[v`] nnoremap gy `[v`]y +" When text is wrapped, move by terminal rows, not lines, unless a count is provided +noremap j (v:count == 0 ? 'gj' : 'j') +noremap k (v:count == 0 ? 'gk' : 'k') + " Open a quickfix window for the last search nnoremap ? :execute 'vimgrep /'.@/.'/g %':copen @@ -131,12 +147,8 @@ nnoremap cf :cd %:p:h:pwd nnoremap qo :copen nnoremap qc :cclose -" Navigation of buffers -nnoremap n :bnext -nnoremap p :bprev - " Exit INSERT MODE with 'jk' -inoremap jk +inoremap jj " Reformat a line into a block nnoremap q gqip