Vim keybindings

Set leader key.
Add bindings for jumping on the same indentation level.
Add bindings for more comfortable split view navigation.
This commit is contained in:
2020-07-31 18:02:13 +02:00
parent be570a4564
commit 780dcce32c

View File

@@ -1,4 +1,6 @@
" Keybinds ##########################################################################
" Set leader key
let mapleader = "\<Space>"
" Disable arrow keys
noremap <Up> ""
noremap! <Up> <Esc>
@@ -11,6 +13,17 @@ noremap! <Right> <Esc>
" Stop highlighting search result when pressing Return
nnoremap <silent> <CR> :nohlsearch<CR><CR>
" Indentation jump
" https://vim.fandom.com/wiki/Move_to_next/previous_line_with_same_indentation
noremap <silent> <C-k> :call search('^'. matchstr(getline('.'), '\(^\s*\)') .'\%<' . line('.') . 'l\S', 'be')<CR>
noremap <silent> <C-j> :call search('^'. matchstr(getline('.'), '\(^\s*\)') .'\%>' . line('.') . 'l\S', 'e')<CR>
" Split view navigation
nnoremap <leader>h <C-w><C-h>
nnoremap <leader>j <C-w><C-j>
nnoremap <leader>k <C-w><C-k>
nnoremap <leader>l <C-w><C-l>
" Settings ##########################################################################
" hybrid linenumbers
set number relativenumber