"
" 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
" 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 \en :tabnew<CR>
"noremap \et :OpenNERDTree<CR>
"inoremap \ee <ESC>:tabclose<CR>
"inoremap \em <ESC>:q!<CR>
"inoremap \ew <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>
"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>
nnoremap \e8 8gt
nnoremap \e9 9gt
nnoremap \e0 10gt
+" }}}
-" Buffer navigation: Alt-{Up,Down}
+" Buffer navigation: Alt-{Up,Down} {{{
noremap \eOd :bprevious<CR>
noremap \eOc :bnext<CR>
+" }}}
-" Window navigation
+" Window navigation {{{
"noremap <C-Left> <C-w><Left>
"noremap <C-Right> <C-w><Right>
"noremap <C-Down> <C-w><Down>
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 = '*'
" 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>
+" }}}
" Author: Silvio Rhatto <rhatto@riseup.net>
"
-" Fix NERDTree width
+" Fix NERDTree width {{{
"
" Useful after restoring sessions between screen size changes (such
" as when you share sessions between different computers).
" In case you want to invoke FixWindowWidths explicitly
command! -bang FixWindowWidths :call FixWindowWidths()
+" }}}
-" Fix window widths on all tabs
+" Fix window widths on all tabs {{{
function FixAllWindowWidths()
" Make sure to run this only once
if exists("did_fixed_window_widths")
let did_fixed_window_widths=1
endfunction
+" }}}
-" Ensure the window has maximized height
+" Ensure the window has maximized height {{{
"
" This helps restoring the window size after reopening sessions after
" switching monitors (like from laptop screen to external HDMI monitor).
" execute ':set lines=' . winheight(0) - 3
endif
endfunction
+" }}}
-" Restore all window sizes
+" Restore all window sizes {{{
function RestoreWindowSizes()
call FixWindowHeights()
call FixAllWindowWidths()
endfunction
+" }}}
-" Fix all window sizes
+" Fix all window sizes {{{
augroup workaround
autocmd!
" This tends to fire for every buffer
" restored.
"autocmd workaround VimEnter * call FixAllWindowWidths()
augroup END
+" }}}