mihaicristiantanase / vim-husk

Mappings that boost vim's command line.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

husk.vim

Mappings that boost vim command line mode.

The goal is to have mappings similar to bash emacs mode. You can read more about this idea in vim's docs :h tcsh-style.

Plugin killer feature are convenient M-f and M-b CLI mappings that move one "word" right or left (notice the lowercase "word").

This is an enhancement from vanilla vim that enables only "WORD" (uppercase) left or right with
<S-Left> and <S-Right>.

Works in NeoVim too.

Mappings

All mappings work only in vim command line mode.

  • C-p find the previous history command with the same prefix
  • C-n find the next history command with the same prefix
  • C-a go to the beginning of the line
  • C-f go one character right or fall back to c_CTRL-F at the end of the line
  • C-b go one character left
  • C-d delete character or fall back to c_CTRL-D at the end of the line
  • C-k clear line after the cursor, overrides c_CTRL-K (if you're using C-k for digraphs check the docs how to disable)
  • C-x C-e open the command-line window, same as c_CTRL-f
  • M-f (Alt-f) go one "word" right
  • M-b (Alt-b) go one "word" left
  • M-d (Alt-d) delete "word" after the cursor
  • M-BS (Alt-Backspace) delete "word" before the cursor, same as c_CTRL-W
  • M-# (Alt-shift-3) insert comment at the beginning of the line and execute it. Useful for discarding the line, but still keeping it in the command-line history for later retrieval.

Installation

  • Vundle
    Plugin 'vim-utils/vim-husk'

  • vim-plug
    Plug 'vim-utils/vim-husk'

  • Pathogen
    git clone git://github.com/vim-utils/vim-husk.git ~/.vim/bundle/vim-husk

Note: In order to enable alt mappings (M-f, M-b etc) Mac OS users using Terminal.app may need to go to Preferences > Profiles > Keyboard and tick "Use Option as Meta key".

About

vim-husk grew out from Tim Pope's vim-rsi plugin. C-f, C-d and M-BS mappings are directly copied.

Differences:

  • vim-husk has proper M-f, M-b and M-d mapping implementation
  • with vim-husk there's no risk of breaking vim's macros. Link to related vim-rsi issue.
  • vim-rsi has a broader scope and provides insert and normal mode mappings while vim-husk focuses only on vim's CLI.

Licence

MIT

About

Mappings that boost vim's command line.

License:MIT License


Languages

Language:Vim Script 100.0%