Delete word and preceding whitespace

Natjo

When I edit a text, I often find myself removing one word from an existing sentence. I use diw for this, the problem is only, between the surrounding words of the just deleted word will remain two whitespaces, the one before and the one after the just deleted word. Is there an easy trick to remove a word and all preceding whitespaces?

I want to achieve this:

This is just an example

to

This is an example

With diw I am always left with

This is  an example

Maybe there is a cool trick I haven't found yet!

padawin

Yes, diw deletes inside a word. You can also delete around a word with daw.

You can find more information about those here: :help aw.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Delete duplicate word, comma and whitespace

Program to remove preceding whitespace

Capturing preceding whitespace in Julia

Preceding Word Length

Extracting numbers preceding a word

grep for word, whitespace word

Can I restore previous IntelliJ IDEA "Delete to Word End" behavior to delete leading whitespace on the next line?

Word break on whitespace pre

delete whitespace in regular expression

Excel: find a word in a cell, then return the preceding word and the found word

Regex to Take into Account Preceding Word in Python

Regex to check if some word not preceding by some other

How to print the string preceding a specific word in shell?

Multiply word by preceding number in text file

How to delete just the preceding space in a text file?

A Regular Expression to make acronyms with word boundaries and remove characters preceding a word

RE treat whitespace as one word

Not printing single word after whitespace

Word, Regex for brackets, word, whitespace or lf

Clojure regex delete whitespace in (?<=) pattern

Delete specific whitespace backward with sed

delete characters that are not letters, numbers, whitespace?

Mandatory last word with optional preceding words/phrases in Java regular expression

How to match a word without any following or preceding character with RegExp?

Microsoft Word 2007: different spacing when certain style is preceding

Copy rows of text preceding a table in word using VBA

xpath - grab content only if preceding div has certain word

Regex to match word preceding parentheses, inside an specific XML tag

how to count the frequency of a specific word(not the string) regardless of preceding strings?