From 9e11a79fd7804fcaa4dca20ac818a09b8f77e99b 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 672e7f9..3afe224 100644 --- a/plugin/gv.vim +++ b/plugin/gv.vim @@ -250,6 +250,8 @@ function! s:list(fugitive_repo, log_opts) let git_log_cmd = call(a:fugitive_repo.git_command, 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 0127bbb5ae5c2fcc1e54d455179246f81c6c5927 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 3afe224..18f9ad6 100644 --- a/plugin/gv.vim +++ b/plugin/gv.vim @@ -249,7 +249,7 @@ function! s:list(fugitive_repo, log_opts) let git_args = ['log'] + default_opts + a:log_opts let git_log_cmd = call(a:fugitive_repo.git_command, 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 a85c1e43928ad2dad1d0a1b73f4a2531aa6a91c3 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 18f9ad6..09a6d81 100644 --- a/plugin/gv.vim +++ b/plugin/gv.vim @@ -250,8 +250,10 @@ function! s:list(fugitive_repo, log_opts) let git_log_cmd = call(a:fugitive_repo.git_command, 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)