Dan
Dan

Reputation: 2804

Vim ignore pathname in file completion

Let's say I'm in /tmp and I have two files open in vim: test.txt and tmpfile.txt. Now I want to remove the tmpfile.txt buffer. I type :bd tmTAB. The behavior I want is for it to autocomplete tmpfile.txt; the behavior I get is a list of tmpfile.txt and /tmp/test.log, as it's autocompleting on the directory name as well as the filename. How can I make vim behave like I want?

Upvotes: 0

Views: 174

Answers (2)

idbrii
idbrii

Reputation: 11946

Use ^tm instead to match at the beginning of the file name. (You have to be in /tmp for this to work so that the relative path is just the filename.)

Upvotes: 1

Rodrigo Gurgel
Rodrigo Gurgel

Reputation: 1736

That is not possible, the list comes from what's on the buffer list, not from your local path, you could be at any place (:pwd), it doesn't matter, when you press tab the result comes from the in memory list, thats why /tmp appears because if you're on /tmp, /tmp shouldn't appear again.

if you look at :help :bd it takes bufname as param, not fname as :badd

Upvotes: 1

Related Questions