Created
September 9, 2013 09:49
-
-
Save actionshrimp/6493611 to your computer and use it in GitHub Desktop.
A vim-fugitive status window toggle (mapped to F3). Seems to work nicely
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! ToggleGStatus() | |
if buflisted(bufname('.git/index')) | |
bd .git/index | |
else | |
Gstatus | |
endif | |
endfunction | |
command ToggleGStatus :call ToggleGStatus() | |
nmap <F3> :ToggleGStatus<CR> |
@Fymyte thank you very much!
side note - experimenting both with and without the '$'; while i appreciate that it mimics the original behavior closer with it, i actually kind of like it without.
@Fymyte Thanks for the lua snippet! (p.s. there is a typo, it should be if vim.fn.buflisted(vim.fn.bufname('fugitive:///*/.git//$')) ~= 0 then
)
@disselkamp thanks for the report 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kenichi
bufname
accepts a file pattern, you could useto match the fugitive
Git
bufferand then you can use
to delete the buffer
EDIT:
Fugitive adds a second
/
at the end, useFor thos who wants this in lua for neovim
EDIT: fixed typo