From ab67bd553e529225fb025aa250736a0add35a1af Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Tue, 15 Sep 2020 00:37:02 +0200 Subject: [PATCH] Add vim keybindings Add binding for the substitute command. Add bindings for interacting with the system clipboard with y/p. Change the keybindings header to use the full word. --- .config/vim/vimrc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.config/vim/vimrc b/.config/vim/vimrc index da6c953..24bf137 100644 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -43,7 +43,7 @@ else nmap cW dWi endif -" Keybinds ##################################################################### +" Keybindings ################################################################## " Set leader key let mapleader = "\" " Stop highlighting search result when pressing Return @@ -60,6 +60,27 @@ nnoremap j nnoremap k nnoremap l +" Substitute command +if (exists('+inccommand') && &inccommand != '') + nnoremap S :%s/ +else + " This does not work with live previewing commands (inccommand) since the + " replace pattern is already defined and thus everything matching the search + " pattern is just deleted. + nnoremap S :%s//gc +endif + +" Interact with the system clipboard +if (has('clipboard') || has('nvim')) + nnoremap y "+y + nnoremap p "+p + nnoremap P "+P + + vnoremap y "+y + vnoremap p "+p + vnoremap P "+P +endif + " Aesthetics ################################################################### " Use 24-bit (true-color) mode if (has('termguicolors'))