aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin/key_mappings.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim.dot.link/plugin/key_mappings.vim')
-rw-r--r--vim.dot.link/plugin/key_mappings.vim38
1 files changed, 30 insertions, 8 deletions
diff --git a/vim.dot.link/plugin/key_mappings.vim b/vim.dot.link/plugin/key_mappings.vim
index 026f503..2b0f2e7 100644
--- a/vim.dot.link/plugin/key_mappings.vim
+++ b/vim.dot.link/plugin/key_mappings.vim
@@ -41,10 +41,14 @@
"
" The sollution is to decrease ESC timeout.
"
+
+" Decrease ESC delays {{{
" See https://www.johnhawthorn.com/2012/09/vi-escape-delays/
"set timeoutlen=1000 ttimeoutlen=0
set timeoutlen=0 ttimeoutlen=0
+" }}}
+" ESC-based shortcuts {{{
" Write, quit and close shortcuts using Esc <key> notation (works also with <Alt-key>)
nnoremap <ESC>n :tabnew<CR>
nnoremap <ESC>t :NERDTree
@@ -74,7 +78,9 @@ inoremap <ESC>c <ESC>:tabclose<CR>
" We're closing the buffer instead of just the window to avoid slowness due to too many opened buffers
inoremap <ESC>m <ESC>:bd<CR>
inoremap <ESC>w <ESC>:w<CR>
+" }}}
+" Alt-based shortcuts {{{
" Write, quit and close shortcuts using Alt-key combo notation
"noremap n :tabnew<CR>
"noremap t :OpenNERDTree<CR>
@@ -98,7 +104,9 @@ inoremap <ESC>w <ESC>:w<CR>
"inoremap e <ESC>:tabclose<CR>
"inoremap m <ESC>:q!<CR>
"inoremap w <ESC>:w<CR>
+" }}}
+" Crtl-based shortcuts {{{
" Write, quit and close shortcuts using Ctrl-key combos
" We're using these due to a conflict with wyrd(1)
"nnoremap <C-n> :tabnew<CR>
@@ -122,16 +130,18 @@ inoremap <ESC>w <ESC>:w<CR>
"inoremap <C-e> <ESC>:tabclose<CR>
"inoremap <C-m> <ESC>:q!<CR>
"inoremap <C-w> <ESC>:w<CR>
+" }}}
-" Write, quit and close shortcuts
+" Write, quit and close shortcuts {{{
noremap q :Wipeout<CR>:wqa <CR>
"noremap f :wq <CR>
"noremap t :tabclose <CR>
"noremap m :q! <CR>
"noremap w :w <CR>
noremap h :tabnew<CR>
+" }}}
-" Tab navigation
+" Tab navigation {{{
" See http://vim.wikia.com/wiki/Alternative_tab_navigation
" http://comments.gmane.org/gmane.os.cygwin.xfree/16419
nnoremap <ESC>[5^ <C-PageUp>
@@ -148,12 +158,14 @@ nnoremap 7 7gt
nnoremap 8 8gt
nnoremap 9 9gt
nnoremap 0 10gt
+" }}}
-" Buffer navigation: Alt-{Up,Down}
+" Buffer navigation: Alt-{Up,Down} {{{
noremap Od :bprevious<CR>
noremap Oc :bnext<CR>
+" }}}
-" Window navigation
+" Window navigation {{{
"noremap <C-Left> <C-w><Left>
"noremap <C-Right> <C-w><Right>
"noremap <C-Down> <C-w><Down>
@@ -178,21 +190,29 @@ inoremap <ESC><Left> <ESC><C-w><Left>
inoremap <ESC><Right> <ESC><C-w><Right>
inoremap <ESC><Down> <ESC><C-w><Down>
inoremap <ESC><Up> <ESC><C-w><Up>
+" }}}
-" Recording
+" Recording {{{
nnoremap Q q
+" }}}
+" Copy and paste {{{
+"
" See http://superuser.com/questions/10588/how-to-make-cut-copy-paste-in-gvim-on-ubuntu-work-with-ctrlx-ctrlc-ctrlv
"imap <C-v> <C-r><C-o>+
"vmap <C-v> c<ESC>"+p
vnoremap <C-c> "+yi
vnoremap <C-x> "+c
+" }}}
-" For email: unfold and delete to your signature
+" Email {{{
+"
+" Unfold and delete to your signature
" See https://hroy.eu/tips/vim/email-delete-til-signature/
noremap ,dd zi:.;/^-- $/d<CR>O-- <UP><End><CR><CR><UP><CR><C-O>zi
+" }}}
-" Simple TODO lists
+" Task lists {{{
" https://github.com/vitalk/vim-simple-todo/
let g:simple_todo_map_keys = 0
let g:simple_todo_list_symbol = '*'
@@ -215,11 +235,13 @@ vmap <Leader>s <Plug>(simple-todo-mark-switch)
" From lib.vim
"nnoremap <Leader>c :call ToggleCheckbox()<CR>
+" }}}
-" Insert the current date in ISO format
+" Insert the current date in ISO format {{{
"
" Thanks https://vimtricks.com/p/insert-the-current-date-or-time/
"map <leader>d :0put =strftime('%Y-%m-%d')<CR>
nnoremap <leader>d i<C-R>=strftime('%Y-%m-%d')<CR>
inoremap <leader>d <C-R>=strftime('%Y-%m-%d')<CR>
map <leader>e :put =strftime('## %Y-%m-%d')<CR>
+" }}}