Rafid
Rafid

Reputation: 20189

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

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

Upvotes: 6

Views: 760

Answers (2)

Ned Batchelder
Ned Batchelder

Reputation: 375634

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.

Upvotes: 4

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

Upvotes: 4

Related Questions