When I'm editing a Vim command, I would like to use the same shortcuts as in Bash and every other REPL: M-b to go back a word, M-Backspace to delete a previous word, M-u to convert the word to uppercase, C-k to cut until the end of the line, etc. I have been able to configure some of the commands, using :cmap, but not all.

Is there a plugin or setting which provides this?

I know about cedit, but I find it cumbersome when all I need is to enter a quick command.

  • Waitaminute, are you saying you use Bash in Emacs mode even though you use Vim as your editor? Jan 5, 2016 at 20:14
  • 4
    @KyleStrand I've yet to see someone who used Bash in vi mode. It seems like most of the benefits of modal editors disappear when you're only limited to one line.
    – Mihai
    Jan 5, 2016 at 20:41
  • 2
    Interesting. I only ever use Bash in Vi mode, though it does seem like Emacs mode supports some things that Vi mode doesn't. I just happen to know Vi keybindings while remaining almost completely ignorant of Emacs bindings, and I've never thought it a pressing enough issue to learn the defaults. Jan 5, 2016 at 20:46

4 Answers 4


Is there a plugin or setting which provides this?

Yes, rsi.vim plugin:


  • Readline mappings are provided in insert mode and command line mode. Normal mode is deliberately omitted.
  • Important Vim key bindings (like insert mode's C-n and C-p completion) are not overridden.
  • Meta key bindings are provided in a way that works in the terminal without the perils of remapping escape.
  • C-d, C-e, and C-f are mapped such that they perform the Readline behavior in the middle of the line and the Vim behavior at the end. (Think about it.)

Is there a plugin or setting which provides this?

There is also readline.vim.

It is a newer plug-in which focuses purely on the command-line. It also implements a larger subset of the Readline shortcuts and has the goal of implementing each shortcut exactly like in Readline.

What makes this plugin different from similar plugins is that it implements a larger subset of the Readline mappings, and that it does a better job of mimicking the Readline behavior for each command.

The word movement and deletion commands have different behavior between Vim and Readline. The biggest difference is that in Readline punctuation is always skipped when searching for a word boundary. Another difference is that _ (underscore) is treated as a word delimiter. This plugin implements the Readline behavior for word movement and deletion commands.

  • 1
    I'm surprised there's anyone looking for this kind of thing. It's so easy to use readline's vim mode that I'd think every regular vim user would do it. (I don't find the extra commands in emacs mode all that compelling.) But maybe the "how" is not that widely known (...and maybe I'm lucky that the very first bashrc I saw/copied...many more years ago than I care to admit...had set -o vim :)
    – B Layer
    May 11, 2019 at 13:41

I’ll add my most common alternatives:

  • Use the default :-editing bindings (:help commandline-editing or something similar, if anyone has the reference offhand feel free to edit). <C-b> is beginning, <C-e> is end, and there are others
  • Use the wonderful <C-f> if you started a :, ?, or / and want to edit like it’s a normal vim buffer.
  • Use q:, q?, or q/ if you know you need this when you start.

I have <leader>; mapped to q: so a vim-edited command-line is very quick access. (I prefer not to switch ; and : in my everyday editing, but I’m considering it.)


For Neovim users, there is also https://github.com/linty-org/readline.nvim.

Disclaimer: I'm the author.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.