Skip to content

Question: Why don't fugitive buffers have acwrite 'buftype'? #2159

Answered by tpope
tmillr asked this question in Q&A
Discussion options

You must be logged in to vote

All buftype=acwrite does is tell Vim that the buffer name is "unrelated to a file". That is, it's identical to buftype=nofile, except it doesn't block :write from working. This means, for example, that the buffer name won't be written to a session file, because if it's not related to a file, then you wouldn't be able to :edit it. But you can edit fugitive:// file names. As far as Vim is concerned, they are related to a (virtual) file.

An alternative you might find helpful (depending on your use case) is to look for buffer names that look like URLs. Try @% =~# '^\a\+:[\/][\/]' (the backslashes are necessary to match on Windows).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tmillr
Comment options

Answer selected by tpope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants