dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/.config/nvim/plugin/mappings/normal.vim

92 lines
2.6 KiB
VimL

" Ñ master race
nnoremap ñ ;
nnoremap Ñ ,
nnoremap {q :cprev
nnoremap }q :cnext
nnoremap {Q :cfirst
nnoremap }Q :clast
nnoremap <silent> {o :call append(line('.'), '')<CR>
nnoremap <silent> }o :call append(line('.')-1, '')<CR>
" Find
nnoremap <leader>F :find <C-R>=expand('%:h').'/*'<CR>
nnoremap <leader>S :sfind <C-R>=expand('%:h').'/*'<CR>
nnoremap <leader>V :vert sfind <C-R>=expand('%:h').'/*'<CR>
nnoremap <leader>T :tabfind <C-R>=expand('%:h').'/*'<CR>
nnoremap <leader>G :g/
" Rearrange Splits
nnoremap <silent> <S-Left> <C-W>H
nnoremap <silent> <S-Right> <C-W>L
nnoremap <silent> <S-Up> <C-W>K
nnoremap <silent> <S-Down> <C-W>J
" Resize splits
nnoremap <silent> <Left> :vertical resize -2<CR>
nnoremap <silent> <Right> :vertical resize +2<CR>
nnoremap <silent> <Up> :resize -1<CR>
nnoremap <silent> <Down> :resize +1<CR>
" Alt to switch windows
nnoremap <M-j> <C-W><C-J>
nnoremap <M-k> <C-W><C-K>
nnoremap <M-l> <C-W><C-L>
nnoremap <M-h> <C-W><C-H>
" Gotta Go Fast (save, buffers, quit, messages, newlines, SOF, EOF)
nnoremap <silent> <leader>g :w!<CR>
nnoremap <silent> <leader>b :ls<CR>:b<space>
nnoremap <silent> <leader>c :close<CR>
nnoremap <silent> <leader>q :q!<CR>
nnoremap <silent> <leader>Q :qa!<CR>
nnoremap <silent> <leader>m :messages<CR>
nnoremap <Bar> gg
nnoremap ¿ G
" Splits
nnoremap <silent> <leader>v :vnew<CR>
nnoremap <silent> <leader>h :new<CR><CR>
" Quote words under cursor
nnoremap <leader>" viW<esc>a"<esc>gvo<esc>i"<esc>gvo<esc>3l
nnoremap <leader>' viW<esc>a'<esc>gvo<esc>i'<esc>gvo<esc>3l
" Move a line of text using Shift+[jk]
nnoremap <silent> J mz:m+<cr>`z
nnoremap <silent> K mz:m-2<cr>`z
" Unhighlight search terms
nnoremap <silent> <leader><space> :noh<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
" j = gj :: k = gk while preserving numbered jumps ie. 12j or 30k
nnoremap <buffer><silent><expr>j v:count ? (v:count > 5 ? "m'" . v:count : '') . 'j' : 'gj'
nnoremap <buffer><silent><expr>k v:count ? (v:count > 5 ? "m'" . v:count : '') . 'k' : 'gk'
" Line movements
nnoremap <silent> <Home> g<Home>
nnoremap <silent> <End> g<End>
nnoremap <leader>y 0y$
nnoremap Y y$
" Tab movement
nnoremap <silent> tn :tabnew<cr>
nnoremap <silent> th :tabfirst<cr>
nnoremap <silent> tl :tablast<cr>
nnoremap <silent> tx :tabclose<cr>
" Prevent x from overriding what's in the clipboard.
nnoremap x "_x
nnoremap X "_x
" Global replace
nnoremap <Leader>sw
\ :let b:sub = input('global replacement: ') <Bar>
\ if b:sub !=? '' <Bar>
\ execute "%s/<C-r><C-w>/".b:sub.'/g' <Bar>
\ unlet b:sub <Bar>
\ endif <CR>
" What about the Q
nnoremap Q <nop>
map q <nop>