2020-08-08 20:27:01 +02:00
|
|
|
" Keep cursor centered as much as possible
|
|
|
|
nnoremap j jzz
|
|
|
|
nnoremap k kzz
|
|
|
|
nnoremap gg ggzz
|
|
|
|
nnoremap G Gzz
|
|
|
|
|
|
|
|
" Navigate between ctags
|
|
|
|
" Jump to definition
|
|
|
|
nnoremap gd <C-]>
|
|
|
|
" Go back up stack
|
|
|
|
nnoremap gb <C-t>
|
|
|
|
|
|
|
|
" Remap split navigation keybindings
|
|
|
|
nnoremap <silent> <leader>h :wincmd h<CR>
|
|
|
|
nnoremap <silent> <leader>j :wincmd j<CR>
|
|
|
|
nnoremap <silent> <leader>k :wincmd k<CR>
|
|
|
|
nnoremap <silent> <leader>l :wincmd l<CR>
|
|
|
|
|
|
|
|
" Write using <leader>+w
|
|
|
|
nnoremap <silent> <leader>w :w<CR>
|
|
|
|
" Quit using <leader>+q
|
|
|
|
nnoremap <silent> <leader>q :q<CR>
|
|
|
|
|
|
|
|
" Use arrow keys for split resizing in normal mode
|
|
|
|
nnoremap <silent> <Up> :resize +3<CR>
|
|
|
|
nnoremap <silent> <Down> :resize -3<CR>
|
|
|
|
nnoremap <silent> <Right> :vertical resize +3<CR>
|
|
|
|
nnoremap <silent> <Left> :vertical resize -3<CR>
|
|
|
|
|
|
|
|
" Disable arrow keys in editing & visual mode
|
|
|
|
inoremap <Right> <nop>
|
|
|
|
inoremap <Left> <nop>
|
|
|
|
inoremap <Up> <nop>
|
|
|
|
inoremap <Down> <nop>
|
|
|
|
vnoremap <Right> <nop>
|
|
|
|
vnoremap <Left> <nop>
|
|
|
|
vnoremap <Up> <nop>
|
|
|
|
vnoremap <Down> <nop>
|
|
|
|
|
|
|
|
" Tabs bindings
|
|
|
|
" Create tab
|
|
|
|
nnoremap <silent> <leader>o :tabnew<CR>
|
|
|
|
" Close current tab
|
|
|
|
nnoremap <silent> <leader>p :tabclose<CR>
|
|
|
|
" Go to next tab
|
|
|
|
nnoremap <silent> <leader>i :tabnext<CR>
|
|
|
|
" Go to previous tab
|
|
|
|
nnoremap <silent> <leader>u :tabprevious<CR>
|
|
|
|
|
|
|
|
" Make commands
|
|
|
|
nnoremap <silent> <leader>mr :make! run<CR>
|
|
|
|
nnoremap <silent> <leader>mt :make! test<CR>
|
|
|
|
|
|
|
|
" Built-in Terminal
|
|
|
|
" Remap <Esc> in terminal
|
|
|
|
tnoremap <silent> <Esc> <C-\><C-n>
|
|
|
|
" Open terminal in horizontal split
|
|
|
|
nnoremap <silent> <leader>s :split<CR>:terminal<CR>
|
|
|
|
|
|
|
|
" Keybinding for switching between light/dark colorschemes
|
|
|
|
function! ColorschemeToggle()
|
|
|
|
if g:colors_name == 'flattened_dark'
|
|
|
|
colorscheme flattened_light
|
|
|
|
else
|
|
|
|
colorscheme flattened_dark
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
nnoremap <silent> <leader>c :call ColorschemeToggle()<CR>
|
|
|
|
|
|
|
|
" Quick config editing
|
|
|
|
" Re-source vimrc/init.vim
|
|
|
|
nnoremap <silent> <leader>vs :source $MYVIMRC<CR>
|
|
|
|
" Open CtrlP in config directory
|
|
|
|
nnoremap <silent> <leader>ve :split<CR>:exec 'CtrlP ' . fnamemodify($MYVIMRC, ':h')<CR>
|
2020-08-09 07:49:51 +02:00
|
|
|
|
|
|
|
" Overwrite Esc (experiment)
|
|
|
|
inoremap jk <Esc>
|
|
|
|
inoremap <Esc> <nop>
|