Skip to content

Commit

Permalink
vimrc,gibrc: remove kj -> Esc mappings
Browse files Browse the repository at this point in the history
Use <kbd>Esc</kbd><kbd>Esc</kbd> to go to normal mode in terminal mode,
and a single <kbd>Esc</kbd> to go to normal mode in the shell (inside
vim).

Answer to the <kbd>Esc</kbd> key being too far away is to map it nearer,
having to press two keys every time is a pain, and it makes typing
commands that end in `k` annoying.
  • Loading branch information
gibfahn committed Dec 14, 2018
1 parent bccc9dd commit fd5ab30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
13 changes: 2 additions & 11 deletions dotfiles/.config/nvim/init.vim
Expand Up @@ -121,14 +121,9 @@ endtry
" {{{ Key mappings (see http://vim.wikia.com/wiki/Unused_keys for unused keys)
" Available (normal): <C-Space>, +, _, <C-q/s/[/_>, <leader>b/e/h/m/n/u/v

inoremap kj <ESC>| " kj = Esc in insert mode.
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"| " Tab is next entry if completion menu open.
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"| " Shift-Tab is previous entry if completion menu open.
nnoremap k gk| " Move up visually , don't skip wrapped lines,
nnoremap j gj| " ↳ down visually , don't skip wrapped lines.
nnoremap Q <nop>| " ↳ accidental triggering).
nnoremap gk k| " Move up logically, do skip wrapped lines,
nnoremap gj j| " ↳ down logically, do skip wrapped lines.
nnoremap Y y$| " Make Y work like C and D (yank to end of line, not whole line).
" To open vim's current directory, use `:e .`.
nnoremap - :e %:h<CR>| " - open current buffer directory in file browser (repeat for `cd ..`).
Expand Down Expand Up @@ -305,9 +300,7 @@ if has("nvim") " NeoVim specific settings.
tnoremap <C-k> <C-\><C-n><C-w>k| " ↳ up a window in terminal,
tnoremap <C-l> <C-\><C-n><C-w>l| " ↳ right a window in terminal.
tnoremap <C-n> <C-l>| " Ctrl-n is Ctrl-l in a terminal.
tnoremap <Esc> <C-\><C-n>| " Make Escape work in terminal,
tnoremap kj <C-\><C-n>| " ↳ kj work in terminal.
tnoremap KJ kj| " Use KJ for a literal kj in the terminal.
tnoremap <Esc><Esc> <C-\><C-n>| " Double escape in the terminal goes to normal mode.
augroup gibTermGroup " Autocommands for nvim only
au TermOpen * setlocal nonumber norelativenumber " No line numbers in terminal
Expand All @@ -322,9 +315,7 @@ else
tnoremap <C-k> <C-w>k| " ↳ up a window in terminal,
tnoremap <C-l> <C-w>l| " ↳ right a window in terminal.
tnoremap <C-n> <C-l>| " Ctrl-n is Ctrl-l in a terminal.
tnoremap <Esc> <C-W>N| " Make Escape work in terminal,
tnoremap kj <C-W>N| " ↳ kj work in terminal.
tnoremap KJ kj| " Use KJ for a literal kj in the terminal.
tnoremap <Esc><Esc> <C-W>N| " Make Escape work in terminal.
augroup gibTermGroup " Autocommands for nvim only
au TerminalOpen * if &buftype == 'terminal'| setlocal nonumber norelativenumber| endif " No line numbers in terminal
Expand Down
1 change: 0 additions & 1 deletion dotfiles/.config/zsh/completion-keybindings.zsh
Expand Up @@ -70,7 +70,6 @@ KEYTIMEOUT=10 # Key delay of 0.1s (Esc in vim mode is quicker).

bindkey -v # Enable vim mode in zsh.

bindkey -M viins 'kj' vi-cmd-mode # Map kj -> Esc in vim mode.
bindkey -M viins "^?" backward-delete-char # Make backspace work properly.
bindkey -M viins "^H" backward-delete-char # <Ctrl>-H = Backspace (Emacs default).
bindkey -M viins "^W" backward-kill-word # <Ctrl>-W = Delete word (Emacs default).
Expand Down

0 comments on commit fd5ab30

Please sign in to comment.