Deleting
A fair field full of folk ← → I O
You can delete characters to the left or the right of the cursor with:
- I:
delete left character (Backspace)
- O:
delete right character (Delete)
You can also delete a complete line with:
- c:
delete line under the cursor or visual selection
Like e and d, which copy and cut the current line or the active selection, c will delete the current selection if there is one active.
Changing text
The following actions allow you to delete text and enter insert mode directly after that. This is very useful when you want to replace some text with something that you will type instead. The action of deleting and starting insert mode straight away is usually referred as changing text in Vim:
- f:
change word under the cursor or the current selection
- F:
change from the current position of the cursor to the end of line
- Ctrl-f:
change the content of the closest enclosing pair of symbols {[(<"'>)]}
- Space f:
change a camel-case or underscore delimited word
The following examples highlight the text that will be changed depending on the action and the position of the cursor:
# Text changed with f A fair field full of folk # Text changed with F A fair field full of folk # Text changed with Ctrl-f foobar({'key': 'val'}) foobar({'key':█'val'}) foobar({'key': 'val'}) foobar({'key': 'val'}) # Text changed with Space f ThisLongIdentifier this_long_identifier