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'))