From 28547d2d07413b63919074354934ad18abcc8b79 Mon Sep 17 00:00:00 2001 From: Elias Gill Date: Wed, 28 Sep 2022 12:18:45 -0400 Subject: [PATCH] changed the behavior to make the plugin follow the current repository of the current buffer --- doc/tags | 7 +++++++ lua/openingh/init.lua | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 doc/tags diff --git a/doc/tags b/doc/tags new file mode 100644 index 0000000..1d9cdb9 --- /dev/null +++ b/doc/tags @@ -0,0 +1,7 @@ +openingh openingh.txt /*openingh* +openingh-commands openingh.txt /*openingh-commands* +openingh-introduction openingh.txt /*openingh-introduction* +openingh-license openingh.txt /*openingh-license* +openingh-requirements openingh.txt /*openingh-requirements* +openingh-usage openingh.txt /*openingh-usage* +openingh.txt openingh.txt /*openingh.txt* diff --git a/lua/openingh/init.lua b/lua/openingh/init.lua index 45cb8df..4a02daa 100644 --- a/lua/openingh/init.lua +++ b/lua/openingh/init.lua @@ -2,7 +2,9 @@ local utils = require("openingh.utils") local M = {} function M.setup() - local repo_url = vim.fn.system("git config --get remote.origin.url") + -- get the current working directory and set the url + local current_buffer = vim.fn.expand('%:p:h') + local repo_url = vim.fn.system("git -C " ..current_buffer.. " config --get remote.origin.url" ) if repo_url:len() == 0 then M.is_no_git_origin = true @@ -19,6 +21,8 @@ function M.setup() end function M.openFile() + -- make sure to update the current directory + M.setup() if M.is_no_git_origin then utils.print_no_remote_message() return @@ -45,6 +49,8 @@ function M.openFile() end function M.openRepo() + -- make sure to update the current directory + M.setup() if M.is_no_git_origin then utils.print_no_remote_message() return