Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VI (VIM): delete/change right to left?

Tags:

vim

vi

I often use "c-t-$char" change-till-character and "d-t-$char" and would love to be able to do the same thing in reverse.

An example:

cobbler reposync --only=puppetlabs-6Server-x86_64

If my cursor is at the end of the line and I want to delete backwards to the = char. What brought this on is my wanting to move from BASH emacs mode to vi mode.

like image 583
CarpeNoctem Avatar asked Feb 05 '12 23:02

CarpeNoctem


People also ask

How do you delete in vi?

To delete one character, position the cursor over the character to be deleted and type x . The x command also deletes the space the character occupied—when a letter is removed from the middle of a word, the remaining letters will close up, leaving no gap. You can also delete blank spaces in a line with the x command.

How do you delete a word backwards in Vim?

d^ will delete from current backward to first non-white-space character. d0 will delete from current backward to beginning of line. dw deletes current to end of current word (including trailing space) db deletes current to beginning of current word.


2 Answers

You can use T and F for that. For example cT= or dF= etc.

like image 173
cnicutar Avatar answered Sep 22 '22 23:09

cnicutar


d-T-$char deletes from the cursor position backwards without deleting $char, d-F-$char with deleting $char

like image 37
epsilonhalbe Avatar answered Sep 24 '22 23:09

epsilonhalbe