From 2a41c795bd36a3f8637d1074019de4a668fddfde Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sat, 26 Sep 2020 16:48:00 +0100 Subject: [PATCH] VIM: Adds check around clipboard mappings and auto correct spelling --- nvim/.config/nvim/.netrwhist | 3 +++ nvim/.config/nvim/plugin/mappings.vim | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 nvim/.config/nvim/.netrwhist diff --git a/nvim/.config/nvim/.netrwhist b/nvim/.config/nvim/.netrwhist new file mode 100644 index 00000000..c43d5605 --- /dev/null +++ b/nvim/.config/nvim/.netrwhist @@ -0,0 +1,3 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhistcnt =1 +let g:netrw_dirhist_1='/home/jonathan/.dotfiles/nvim/.config/nvim/plugin' diff --git a/nvim/.config/nvim/plugin/mappings.vim b/nvim/.config/nvim/plugin/mappings.vim index 891f0760..22bb8ce2 100644 --- a/nvim/.config/nvim/plugin/mappings.vim +++ b/nvim/.config/nvim/plugin/mappings.vim @@ -15,7 +15,20 @@ nnoremap j nnoremap k nnoremap l -" Make Ctrl C and Ctrl V work on system clipboard -" if in visual or insert mode respectively -vnoremap "+y -inoremap "+pa +if has('clipboard') + " Make Ctrl C and Ctrl V work on system clipboard + " if in visual or insert mode respectively + vnoremap "+y + inoremap "+pa +endif + +" Fix previous spelling mistake in insert mode +" Shamelessly taken from https://castel.dev/post/lecture-notes-1/ +" u - break undo sequence (new change) +" - go into normal mode +" [s - go to previous spelling mistake +" 1z= - change to the top spelling suggestion +" `] - go to the end of the last changed word +" a - enter insert mode +" u - break undo sequence (new change) +inoremap u[s1z=`]au