我现在从TextMate切换到VIM。我发现^+W在插入模式下非常有用。但是,我不仅要删除游标之前的单词,还要删除游标之后或周围的单词。
我做了一些谷歌搜索,但我唯一能找到的是^+W删除单词前光标。
我现在从TextMate切换到VIM。我发现^+W在插入模式下非常有用。但是,我不仅要删除游标之前的单词,还要删除游标之后或周围的单词。
我做了一些谷歌搜索,但我唯一能找到的是^+W删除单词前光标。
当前回答
正常模式:
daw : delete the word under the cursor
caw : delete the word under the cursor and put you in insert mode
其他回答
不太清楚“之前”和“之后”的用法,但你试过了吗
dw
?
编辑:我猜你在寻找在插入模式中使用的东西。奇怪的是,在文档中什么也找不到,似乎只有ctrl-w。
你应该做的是创建一个特定键的imap到一系列的命令,在这种情况下,命令会让你进入正常模式,删除当前的单词,然后把你放回插入:
:imap <C-d> <C-[>diwi
正常模式:
daw : delete the word under the cursor
caw : delete the word under the cursor and put you in insert mode
重复删除单词时,接受的答案失败,请尝试以下解决方案:
" delete current word, insert and normal modes
inoremap <C-BS> <C-O>b<C-O>dw
noremap <C-BS> bdw
它映射CTRL-BackSpace,也在正常模式下工作。
你是说像?
dw