Friday, February 10, 2012

Re: C-w dw

On 02/10/12 11:30, David Gomes wrote:
> I use C-w on terminal to delete a word, and tried to bind C-BS to do the
> same, but failed.
>
> Later on, I got used to C-w, and I want to use it on gvim too, but only
> C-BS works, how can I make C-w work?
>
> Basically, I need to make C-w do the same as dw.

Are you talking about in normal mode, or insert/command-line
mode? Masking control+W in normal mode masks almost all the
window-management sub-commands, which I'd consider a Bad Idea™.
In insert/command-line mode, C-w behaves as it does in my various
shells: deleting from the cursor backwards to the beginning of
the current word (or previous word if you're in whitespace). So
if you're not seeing this, you likely have a mapping for C-w that
breaks the default behavior. Check the output of ":map" to see
if anything is mapped in normal/command mode to C-w. Or you can
test it by starting vim with "vim -u NONE testfile.txt"

If you really want it to do in insert-mode what "dw" does in
normal mode, I suppose you could create a mapping like

:inoremap <c-w> <c-o>dw

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment