summaryrefslogtreecommitdiff
path: root/.vim/mappings.vim
diff options
context:
space:
mode:
Diffstat (limited to '.vim/mappings.vim')
-rw-r--r--.vim/mappings.vim143
1 files changed, 53 insertions, 90 deletions
diff --git a/.vim/mappings.vim b/.vim/mappings.vim
index 406c112..c620b69 100644
--- a/.vim/mappings.vim
+++ b/.vim/mappings.vim
@@ -1,123 +1,86 @@
-" Ctrl-C, Ctrl-V, ... {{{
- " Partly taken from: https://gist.github.com/jshih/3423345
- inoremap <C-S> <C-O>:w<CR>
- inoremap <C-V> <C-R>+
- inoremap <C-A> <Esc>ggVG
- inoremap <C-R> <C-O><C-r>
- inoremap <C-U> <C-O>u
-
- nnoremap <C-S> :w<CR>
- nnoremap <C-A> ggVG
-
- xnoremap <C-V> c<C-R>+
- xnoremap <C-A> ggVG
- xnoremap <C-C> "+y
- xnoremap <C-X> "+d
-" }}}
-
-" Move lines with Alt-J, Alt-K {{{
- execute "set <M-j>=\ej"
- nnoremap <M-j> <ESC>:m+1<CR>
- execute "set <M-k>=\ek"
- nnoremap <M-k> <ESC>:m-2<CR>
-
- xnoremap <A-j> :m '>+1<CR>gv=gv
- xnoremap <A-k> :m '<-2<CR>gv=gv
-" }}}
-
-" Omni completion (really needs a rework) {{{
- " Omni completion supports C, HTML, CSS, JavaScript, PHP, Python, Ruby, SQL, XML
- set omnifunc=syntaxcomplete#Complete " Completion for all supported languages
-
- " Do omni completion from Ctrl+Space
- inoremap <C-@> <C-X><C-O>
-
- " Thanks to: https://vim.fandom.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE
- " set completeopt=longest,menuone
- " [ The following are disabled, because they conflict with delimitMate's autobracket feature ]
- " inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
- " inoremap <expr> <C-n> pumvisible() ? '<C-n>' : '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
-
- " "Disables" arrow navigation in completion menu
- inoremap <expr> <up> pumvisible() ? '<c-y><up>' : '<up>'
- inoremap <expr> <down> pumvisible() ? '<c-y><down>' : '<down>'
-
- " Pressing tab goes from top to bottom
- let g:SuperTabContextDefaultCompletionType = "<c-n>"
-" }}}
-
-" When line is wrapped, going up or down will also go into the wrapped part
-" move in wrapped lines when no count prefix
+"""
+""" Single key
+"""
+
+nnoremap <F1> <ESC>:mksession! .vim-session<CR>
+ noremap <F2> <ESC>:ALERename<CR>
+nnoremap <F5> :UndotreeToggle<CR>
+nnoremap <F8> :<C-u>call gitblame#echo()<CR>
+
+nnoremap <Tab> :NERDTreeToggle<CR>
+
nnoremap <expr> k (v:count == 0 ? 'gk' : 'k')
-xnoremap <expr> k (v:count == 0 ? 'gk' : 'k')
nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
+xnoremap <expr> k (v:count == 0 ? 'gk' : 'k')
xnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
-" Don't move cursor one character back on esc key press
-" inoremap <silent> <Esc> <C-O>:stopinsert<CR>
+nnoremap <silent> \| :tab ter ++close lazygit<CR>
+
+"""
+""" Shift + key
+"""
-" Don't get into insert mode after adding a line with o/O
-" nnoremap o o<Esc>
-" nnoremap O O<Esc>
+let g:tabman_toggle = '<S-Tab>'
-" Thanks https://github.com/drzel/vim-split-line
-nnoremap K :keep s/\s*\%#\s*/\r/e <bar> noh<CR>
+"""
+""" Control + key
+"""
+
+inoremap <C-S> <C-O>:w<CR>
+inoremap <C-V> <C-O>"+p<CR>
+inoremap <C-A> <Esc>ggVG
+inoremap <C-R> <C-O><C-R>
+inoremap <C-U> <C-O>u
+
+nnoremap <C-S> :w<CR>
+nnoremap <C-A> ggVG
+
+xnoremap <C-V> "+p
+xnoremap <C-C> "+y
+xnoremap <C-X> "+d
-" Better resizing when navigating splits
nnoremap <C-L> <C-W>l<C-W>=
nnoremap <C-H> <C-W>h<C-W>=
nnoremap <C-J> <C-W>j<C-W>=
nnoremap <C-K> <C-W>k<C-W>=
+
tnoremap <C-L> <C-W>l<C-W>=
tnoremap <C-H> <C-W>h<C-W>=
tnoremap <C-J> <C-W>j<C-W>=
tnoremap <C-K> <C-W>k<C-W>=
-" Ctrl-Backspace deletes the previous word in insert mode.
inoremap <C-h> <C-w>
cnoremap <C-h> <C-w>
inoremap <C-BS> <C-w>
cnoremap <C-BS> <C-w>
-" Make session file
-nnoremap <F1> <ESC>:mksession! .vim-session<CR>
+"""
+""" Alt + key
+"""
-" Show who edited the current line from git history
-nnoremap <F8> :<C-u>call gitblame#echo()<CR>
+" Move lines up/down with Alt-J/K
+execute "set <M-j>=\ej"
+nnoremap <M-j> <ESC>:m+1<CR>
+execute "set <M-k>=\ek"
+nnoremap <M-k> <ESC>:m-2<CR>
-" Open lazygit in a new tab with =
-nnoremap <silent> \| :tab ter ++close lazygit<CR>
+xnoremap <A-j> :m '>+1<CR>gv=gv
+xnoremap <A-k> :m '<-2<CR>gv=gv
-" Tab navigtion
execute "set <M-o>=\eo"
nnoremap <M-o> gT
inoremap <M-o> <C-O>gT
tnoremap <M-o> <C-W>gT
+
execute "set <M-p>=\ep"
nnoremap <M-p> gt
inoremap <M-p> <C-O>gt
tnoremap <M-p> <C-W>gt
-" Arrows = bad
-inoremap <Up> <Nop>
-inoremap <Down> <Nop>
-inoremap <Left> <Nop>
-inoremap <Right> <Nop>
-nnoremap <Up> <Nop>
-nnoremap <Down> <Nop>
-nnoremap <Left> <Nop>
-nnoremap <Right> <Nop>
-
-" Cyrillic (Bulgarian yawerty layout) support
-ca в w
-ca ва wa
-ca ь x
-ca ьа xa
-
-" Make x and xa just save and quit without saving. This allows for closing all tabs and terminals.
-ca x w <bar> q!
-ca xa wa <bar> qa!
-
-" Open a terminal vim tab with tt and open a blank tab with te
-ca tt tab ter
-ca te tabe
+"""
+""" Two keys
+"""
+
+nnoremap gd <Plug>(ale_go_to_definition)
+nnoremap gi <Plug>(ale_go_to_implementation)
+nnoremap ff <Plug>(ale_hover)