Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: Eclipse-like Ctrl-Backspace and Ctrl-Del

Tags:

vim

In Eclipse, there is the nice feature of deleting the word until the next capital letter when you press Ctrl+Backspace. For example:

ThisIsSomeText

If you press Ctrl+Backspace, only "Text" will be deleted, where as in VS all the "ThisIsSomeText" will be deleted.

Is there anyway to implement the same in VIM?

If yes, is there similar method for Ctrl-Del also? That as, pressing Ctrl-Del at the beginning of the previous example will only delete "This", rather than all the "ThisIsSomeText".

like image 818
Rafid Avatar asked Aug 27 '10 17:08

Rafid


2 Answers

I don't think it's a native vim feature, but I think this script might help (note: I haven't actually used it myself): http://www.vim.org/scripts/script.php?script_id=1356&rating=life_changing

Update:

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

like image 185
FrustratedWithFormsDesigner Avatar answered Oct 11 '22 23:10

FrustratedWithFormsDesigner


This might do what you want:

nnoremap <C-BS> d?[A-Z]

There may be some fiddliness with the last character in the word. Also, you didn't mention whether you wanted it for Normal mode or Insert mode.

like image 22
Ned Batchelder Avatar answered Oct 11 '22 23:10

Ned Batchelder