dotfiles/home/.config/nvim/rc/mappings.vim

73 lines
1.8 KiB
VimL
Raw Normal View History

2021-07-23 16:33:12 +00:00
" Unmap arrow keys in normal mode to remove bad habits
nnoremap <Down> <nop>
nnoremap <Left> <nop>
nnoremap <Right> <nop>
nnoremap <Up> <nop>
2021-07-23 16:08:03 +00:00
2021-10-11 11:43:11 +00:00
" Stop search highlight with Esc in normal mode (until next search)
nnoremap <silent> <esc> :noh<CR>
2021-07-23 16:08:03 +00:00
" System clipboard interactions
map <C-c> "+y
vnoremap <C-v> "+p
2021-08-16 01:19:56 +00:00
" Start spell-check
map <leader>s :setlocal spell! spelllang=en_us<CR>
2021-07-23 16:08:03 +00:00
2021-09-25 00:42:36 +00:00
" Use space for folding/unfolding sections
nnoremap <space> za
vnoremap <space> zf
2021-07-23 16:08:03 +00:00
" Use shift to move 10 lines up/down quickly
noremap <silent> K 10k
noremap <silent> J 10j
2021-08-16 01:19:56 +00:00
" Enable/Disable auto comment
map <leader>c :setlocal formatoptions-=cro<CR>
map <leader>C :setlocal formatoptions=cro<CR>
2021-07-23 16:33:12 +00:00
" Tab navigation
nnoremap <Tab> gt
nnoremap <S-Tab> gT
nnoremap <silent> <A-t> :tabnew<CR>
nnoremap <silent> <A-2> :tabmove +<CR>
nnoremap <silent> <A-1> :tabmove -<CR>
nnoremap <A-p> :tabp<CR>
nnoremap <A-n> :tabn<CR>
" Remap splits navigation to just CTRL + hjkl
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Make adjusting split sizes a bit more friendly
2021-09-15 16:46:29 +00:00
noremap <silent> <C-Right> :vertical resize +3<CR>
noremap <silent> <C-left> :vertical resize -3<CR>
2021-07-23 16:33:12 +00:00
noremap <silent> <C-Up> :resize +3<CR>
noremap <silent> <C-Down> :resize -3<CR>
2021-08-16 01:19:56 +00:00
" Alias replace all
nnoremap <A-s> :%s//gI<Left><Left><Left>
" Save file as sudo when no write permissions
cmap w!! w !sudo tee > /dev/null %
" Don't leave visual mode after indenting
vmap < <gv
vmap > >gv
2021-08-16 01:19:56 +00:00
" Compile opened file (using custom comp script)
nnoremap <A-c> :w \| !comp <c-r>%<CR>
" Shell check
nnoremap <leader>p :!shellcheck %<CR>
2021-09-25 00:42:36 +00:00
2021-10-11 11:43:11 +00:00
" Redefine the incredibely annoying mappings that trigger
" dynamic SQL completion with dbext and keeps on freezing
" vim whenever pressed with a message saying that
" dbext plugin isn't installed...
" See :h ft-sql.txt
let g:omni_sql_no_default_maps = 1