From 53369217cff33612e858b7a027ee65eb71d50745 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 25 Oct 2017 15:56:28 -0200 Subject: Try a non-conflict key combo setup --- vimrc.dot.link | 136 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 39 deletions(-) diff --git a/vimrc.dot.link b/vimrc.dot.link index c207242..499ac81 100644 --- a/vimrc.dot.link +++ b/vimrc.dot.link @@ -101,32 +101,15 @@ let g:syntastic_mode_map={ 'mode': 'passive', \ 'active_filetypes': [], \ 'passive_filetypes': [] } -" See https://www.johnhawthorn.com/2012/09/vi-escape-delays/ -set timeoutlen=1000 ttimeoutlen=0 - -" Write, quit and close shortcuts using Esc-key combos -" ESC keys have the advantage over Alt shortcuts as they -" are difficult to be mistaken for the Meta key -nmap n :tabnew -nmap t :OpenNERDTree -nmap q :wqa -"map c :wqa -"map f :wq -nmap c :tabclose -"map e :tabclose -nmap m :q! -nmap w :w -imap n :tabnew -imap t :OpenNERDTree -imap q :wqa -"map c :wqa -"map f :wq -imap c :tabclose -"map e :tabclose -imap m :q! -imap w :w - -" Write, quit and close shortcuts using Alt-key combos +" +" Key Mappings +" https://stackoverflow.com/questions/7501092/can-i-map-alt-key-in-vim +" https://stackoverflow.com/questions/45244245/why-alt-and-esc-keys-behave-differently-in-emacs +" http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim +" https://github.com/vim-utils/vim-alt-mappings +" https://github.com/drmikehenry/vim-fixkey +" +" Notes: " " Keys were chosen not to conflict of to be close to window manager combos " Like Awesome has a combo (Meta-q) which could be confused with a VIM quit @@ -143,24 +126,87 @@ imap w :w " this event would be triggered by the window manager when killing VIM window, " but this does not seem to be the case. Anyway there's interesting discussion at " https://stackoverflow.com/questions/5142099/how-to-auto-save-vim-session-on-quit-and-auto-reload-on-start-including-split-wi -"map q :wqa -"map c :wqa -"map f :wq -"map c :tabclose -"map e :tabclose -"map m :q! -"map w :w +" +" Pressing Alt- simultaneously is equivalent to pressing ESC and then , +" so the big difference between the ESC combos and Alt combos are mainly of +" config file notation. +" +" Typing ESC keys combos have the advantage over Alt combos as they are +" difficult to be mistaken for the Meta key, but thats mainly a user and not +" config convention since they're almost the same in VIM. +" +" In the other hand, there's an disadvantage of using ESC simultaneously for +" going to normal mode and doing other stuff, with can be in ambiguous. +" +" The sollution is to decrease ESC timeout. +" +" See https://www.johnhawthorn.com/2012/09/vi-escape-delays/ +"set timeoutlen=1000 ttimeoutlen=0 +set timeoutlen=0 ttimeoutlen=0 + +" Write, quit and close shortcuts using Esc notation (works also with ) +nmap n :tabnew +nmap t :OpenNERDTree +"nmap q :wqa +map c :wqa +map f :wq +nmap c :tabclose +"map e :tabclose +nmap m :q! +nmap w :w +imap n :tabnew +imap t :OpenNERDTree +"imap q :wqa +map c :wqa +map f :wq +imap c :tabclose +"map e :tabclose +imap m :q! +imap w :w + +" Write, quit and close shortcuts using Alt-key combo notation +"map n :tabnew +"map t :OpenNERDTree +"map q :wqa +"map c :wqa +"map f :wq +"map c :tabclose +"map e :tabclose +"map m :q! +"map w :w +"imap n :tabnew +"imap t :OpenNERDTree +"imap q :wqa +"imap c :wqa +"imap f :wq +"imap c :tabclose +"imap e :tabclose +"imap m :q! +"imap w :w " Write, quit and close shortcuts using Ctrl-key combos " We're using these due to a conflict with wyrd(1) -"map :wqa -"map :wq -"map :tabclose -"map :q! -"map :w +"map :tabnew +"map :OpenNERDTree +"map :wqa +"map :wqa +"map :wq +"map :tabclose +"map :tabclose +"map :q! +"map :w +"imap :tabnew +"imap :OpenNERDTree +"imap :wqa +"imap :wqa +"imap :wq +"imap :tabclose +"imap :tabclose +"imap :q! +"imap :w " Write, quit and close shortcuts -"map q :wqa +map q :wqa "map f :wq "map t :tabclose "map m :q! @@ -189,10 +235,22 @@ map Od :bprevious map Oc :bnext " Window navigation +"map +"map +"map +"map +"imap +"imap +"imap +"imap "map  "map  "map  "map  +"imap  +"imap  +"imap  +"imap  nmap nmap nmap -- cgit v1.2.3