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.
This commit is contained in:
2020-09-15 00:37:02 +02:00
parent efd5df4f24
commit ab67bd553e

View File

@@ -43,7 +43,7 @@ else
nmap cW dWi
endif
" Keybinds #####################################################################
" Keybindings ##################################################################
" Set leader key
let mapleader = "\<Space>"
" Stop highlighting search result when pressing Return
@@ -60,6 +60,27 @@ nnoremap <leader>j <C-w><C-j>
nnoremap <leader>k <C-w><C-k>
nnoremap <leader>l <C-w><C-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<Left><Left><Left>
endif
" Interact with the system clipboard
if (has('clipboard') || has('nvim'))
nnoremap <leader>y "+y
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>y "+y
vnoremap <leader>p "+p
vnoremap <leader>P "+P
endif
" Aesthetics ###################################################################
" Use 24-bit (true-color) mode
if (has('termguicolors'))