Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to mimic the functionality of bash readline in vim. Is there an easy way to do that? Currently in vim Ctrl+W "cuts" from cursor back to special char or whitespace.

ie. In bash Ctrl+W "cuts" from cursor back to whitespace (paste with Ctrl+Y).

share|improve this question
1  
bash readline defaults to emacs key bindings. You're using the wrong editor :). –  jordanm Mar 1 '13 at 18:33
    
I never knew that! I'm so used to everything else in vi though hahaha –  h3rrmiller Mar 1 '13 at 18:43
1  
@jw013 d'oh.. :inoremap <c-w> <c-o>dB –  Kevin Mar 1 '13 at 20:46

3 Answers 3

up vote 2 down vote accepted

In a comment to your question you say that you are so accustomed to vim.

In this case you probably don't like working with long statements in vim's command-line mode. I don't like it either.

Thankfully we can edit command's not only in the command line but also in the command-line window. You can open it with q:. After the window opened you have access to the whole modal power of vim to enter/edit a new command and execute it with a simple <CR>.

It took some time to get used to it, but in the meantime i use it regularly and i don't want to miss it anymore.

share|improve this answer
1  
Also, while already in the command-line, you can switch to the command-line window with <C-f>. –  Ingo Karkat Mar 2 '13 at 11:44

If you're a die-hard VIM user you can try this plugin for VIM that provides emacs keybindings in edit mode:

http://www.vim.org/scripts/script.php?script_id=300

(never tried it myself)

But you might just want to consider making the switch to emacs:

http://www.gnu.org/software/emacs/

share|improve this answer

Ctrl-w deletes backward following the definition of a word as the active filetype plugin may see fit. If you want to change a word meaning, just append the special characters you consider to be part of a word into the iskeyword option as below.

:set iskeyword+=;

-1 for everyone telling to change the editor, this does not help the issue at all.

share|improve this answer
    
Changing the definition of word will have far-reaching side-effects and consequences. So many other commands in vim use this definition that I could not tell you the changes in behavior to expect. What the OP really wants is a way to tell i_Ctrl-w to use a Vim WORD instead. I don't know of any way to do this unfortunately as there is no insert mode command that I know of to do that. –  jw013 Mar 1 '13 at 20:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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