Vim Tips Wiki
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
Vim Tips Wiki
1,649
pages
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
Editing
Remove up to the nth slash to clean file lists
(section)
Back to page
Edit
Edit source
View history
Talk (0)
We recommend that you
log in
before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your
Watchlist
.
Creating an account
is quick and free.
Anti-spam check. Do
not
fill this in!
==Comments== Why not use: <pre> :r !find /path/to/search -name pattern_to_find </pre> and skip the '-ls' parameter completely? That will do away with the extraneous listing fields in the first place. Or am I missing something really subtle? ---- The really subtle part was how to delete all the stuff before the first slash. One could ask "Why not use <code>:r !locate filename</code>?" That would have given us the data we needed with no manipulation necessary. However that is beyond the scope of this tip. ---- Why not the shorter: <pre> :%s:[^/]*:: </pre> ----
Summary:
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel
Editing help
(opens in new window)
Follow on IG
TikTok
Join Fan Lab