sponsor Vim development Vim logo Vim Book Ad

readline.vim : Readline-style mappings for command-line mode

 script karma  Rating 505/176, Downloaded by 7593  Comments, bugs, improvements  Vim wiki

created by
Elias Åström
script type
To get the latest version it is recommended to download from Github instead: https://github.com/ryvnf/readline.vim

Readline is a library used for implementing line editing across many command-line tools (including `bash` and other shells and interpreters).  Readline ships with a default set of key-bindings that you are probably already familiar with.  The Readline default bindings is a mixture of traditional UNIX and EMACS bindings.

This plugins implements a subset of Readline's default keyboard commands to Vim's command-line mode.  Mappings available include deletion and navigation by words and other useful stuff.

What makes this plugin different from similar plugins is that it implements a larger subset of the Readline mappings, and each command is carefully implemented to behave exactly like in Readline.

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.

Following is a summary of the mappings implemented by this plugin:

C-b                                  Move backward
C-f                                   Move forward
M-b                                  Move one word backward
M-f                                   Move one word forward
C-a                                  Move to start of line
C-e                                  Move to end of line
C-d                                  Delete character
M-Backspace                   Rubout word
M-d                                  Delete word
C-w                                  Rubout space-delimited word
C-u, C-x Backspace          Delete to start of line
C-k                                   Deleted to end of line (can be disabled with g:readline_ctrl_k)
C-y                                   Yank (paste) previously deleted text
C-t                                    Transpose characters
M-t                                    Transpose words
M-u                                   Make word UPPERCASE
M-l                                    Make word lowercase
M-c                                   Make word Capitalized
M-#                                   Comment out and execute the command-line
M-=, M-?                           List possible completions
M-*                                    Insert possible completions
C-x C-e                              Open command-line window (like default Vim C-f)

The word boundaries for movement and deletion differ 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 behaivor for word movement and deletion commands.

This plugin does not use the Meta-key directly, because it causes conflicts with inserting accented characters on some keyboard layouts.  Instead Meta-key mappings can only be accessed by prefixing the keys with Esc.  Meta mappings using modifiers can be explicitly enabled using g:readline_meta. Most terminal emulators can be configured to send keys prefixed with Esc when the Alt modifier is held.
install details
Extract the files to ~/.vim using the `unzip' command:

    $ unzip readline.zip -d ~/.vim

After doing that. Open Vim and run the `helptags' to generate tags for documentation:

    :helptags ~/.vim/doc

If using a plug-in manager, refer to its documentation.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
readline.zip 20191228 2019-12-29 7.0 Elias Åström - Allow for backwards compatibility of strchars pre vim 8
- Simplify script
readline.zip 20190824 2019-08-25 7.0 Elias Åström - Add option to disable C-t in incremental searches
- To preserve Vim 8's command to go to previous match
readline.zip 20190609 2019-06-10 7.0 Elias Åström - Change default behavior for escape
- Add option g:readline_esc to get the old behavior back
readline.zip 20190510 2019-05-15 7.0 Elias Åström - Fix plugin compatibility with Vim version 7.0
- Switch to date based versioning
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
OSDN.net Logo