From 64b30052568e20cae101d25a66a314e5fb643e62 Mon Sep 17 00:00:00 2001 From: somini Date: Sat, 23 Jun 2018 17:35:23 +0100 Subject: [PATCH 1/3] Add buffer variables for statusline settings --- plugin/gv.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin/gv.vim b/plugin/gv.vim index b59a12d..4c66563 100644 --- a/plugin/gv.vim +++ b/plugin/gv.vim @@ -251,6 +251,8 @@ function! s:list(fugitive_repo, log_opts) let git_log_cmd = FugitiveShellCommand(git_args, a:fugitive_repo) let repo_short_name = fnamemodify(substitute(a:fugitive_repo.dir(), '[\\/]\.git[\\/]\?$', '', ''), ':t') + let b:gv_opts = a:log_opts + let b:gv_repo_short_name = repo_short_name let bufname = repo_short_name.' '.join(a:log_opts) silent exe (bufexists(bufname) ? 'buffer' : 'file') fnameescape(bufname) From f981eedbb3fdd15f15def4681f5d7c38559fab6b Mon Sep 17 00:00:00 2001 From: somini Date: Sat, 23 Jun 2018 17:45:14 +0100 Subject: [PATCH 2/3] Use the correct Fugitive API --- plugin/gv.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/gv.vim b/plugin/gv.vim index 4c66563..7fbff6d 100644 --- a/plugin/gv.vim +++ b/plugin/gv.vim @@ -250,7 +250,7 @@ function! s:list(fugitive_repo, log_opts) let git_args = ['log'] + default_opts + a:log_opts let git_log_cmd = FugitiveShellCommand(git_args, a:fugitive_repo) - let repo_short_name = fnamemodify(substitute(a:fugitive_repo.dir(), '[\\/]\.git[\\/]\?$', '', ''), ':t') + let repo_short_name = fnamemodify(a:fugitive_repo.tree(), ':t') let b:gv_opts = a:log_opts let b:gv_repo_short_name = repo_short_name let bufname = repo_short_name.' '.join(a:log_opts) From b750bfafae30b06a2dd5b415ec137d5dfe0cdcab Mon Sep 17 00:00:00 2001 From: somini Date: Tue, 18 Aug 2020 18:32:30 +0100 Subject: [PATCH 3/3] Use a dictionary instead of many small variables See https://github.com/junegunn/gv.vim/pull/48#issuecomment-674687071 --- plugin/gv.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/gv.vim b/plugin/gv.vim index 7fbff6d..2a12289 100644 --- a/plugin/gv.vim +++ b/plugin/gv.vim @@ -251,8 +251,10 @@ function! s:list(fugitive_repo, log_opts) let git_log_cmd = FugitiveShellCommand(git_args, a:fugitive_repo) let repo_short_name = fnamemodify(a:fugitive_repo.tree(), ':t') - let b:gv_opts = a:log_opts - let b:gv_repo_short_name = repo_short_name + let b:gv = { + \ 'opts': a:log_opts, + \ 'repo_short_name': repo_short_name, + \ } let bufname = repo_short_name.' '.join(a:log_opts) silent exe (bufexists(bufname) ? 'buffer' : 'file') fnameescape(bufname)