C-w dw

11 views
Skip to first unread message

David Gomes

unread,
Feb 10, 2012, 12:30:39 PM2/10/12
to v...@vim.org
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.

Thanks!

--
David Gomes

Tim Chase

unread,
Feb 10, 2012, 2:24:43 PM2/10/12
to vim...@googlegroups.com, David Gomes, v...@vim.org

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


Christian Brabandt

unread,
Feb 11, 2012, 3:36:45 AM2/11/12
to v...@vim.org
Hi David!

On Fr, 10 Feb 2012, 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.

Please read the faq for terminal vim:
http://vimhelp.appspot.com/vim_faq.txt.html#faq-20.4
http://vimhelp.appspot.com/vim_faq.txt.html#faq-20.5

>
> 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?

Don't understand that question. C-W in insert work should also work in
gvim. Have you possibly mapped away Ctrl-W?

Mit freundlichen Gr��en
Christian
--

David Gomes

unread,
Feb 11, 2012, 6:56:30 AM2/11/12
to vim...@googlegroups.com, v...@vim.org
Hey guys, I er, I fixed it, I had C-w mapped (close tab, the rc was a mess). Now, is there a way to map C-BS to C-w on terminal? I am using Terminator, which uses Vte (virtual terminal emulator).

Thanks!

Mit freundlichen Grüßen
Christian
--

--
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



--
David Gomes

Taylor Hedberg

unread,
Feb 11, 2012, 7:18:21 AM2/11/12
to vim...@googlegroups.com, v...@vim.org
David Gomes, Sat 2012-02-11 @ 11:56:30+0000:

> Now, is there a way to map C-BS to C-w on terminal?

Probably not. In most terminals, backspace is equivalent to ^H (Ctrl+H).
So Ctrl+BS would be "Ctrl+Ctrl+H", which is nonsensical.

When working in the terminal, you have to get used to working with a
restricted set of key combinations. Terminal software receives a stream
of characters as input, rather than keycodes, so it doesn't have full
access to the wide array of modifiers and combinations that, say, an X
GUI application does.

Christian Brabandt

unread,
Feb 11, 2012, 7:20:22 AM2/11/12
to vim...@googlegroups.com, v...@vim.org
Hi David!

On Sa, 11 Feb 2012, David Gomes wrote:

> Hey guys, I er, I fixed it, I had C-w mapped (close tab, the rc was a
> mess). Now, is there a way to map C-BS to C-w on terminal? I am using
> Terminator, which uses Vte (virtual terminal emulator).

I might repeat myself, but please read the faq.

regards,
Christian
--

Reply all
Reply to author
Forward
0 new messages