update plugin
This commit is contained in:
@@ -5,6 +5,10 @@ local fn = vim.fn
|
|||||||
-- store all git repositories visited in this session
|
-- store all git repositories visited in this session
|
||||||
local lazygit_visited_git_repos = {}
|
local lazygit_visited_git_repos = {}
|
||||||
local function append_git_repo_path(repo_path)
|
local function append_git_repo_path(repo_path)
|
||||||
|
if repo_path == nil or not fn.isdirectory(repo_path) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for _, path in ipairs(lazygit_visited_git_repos) do
|
for _, path in ipairs(lazygit_visited_git_repos) do
|
||||||
if path == repo_path then
|
if path == repo_path then
|
||||||
return
|
return
|
||||||
@@ -180,7 +184,9 @@ local function lazygit(path)
|
|||||||
path = project_root_dir()
|
path = project_root_dir()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
cmd = cmd .. ' -p ' .. path
|
if fn.isdirectory(path) then
|
||||||
|
cmd = cmd .. ' -p ' .. path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
exec_lazygit_command(cmd)
|
exec_lazygit_command(cmd)
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ local lazygit = require("lazygit")
|
|||||||
local function open_lazygit(prompt_buf)
|
local function open_lazygit(prompt_buf)
|
||||||
local entry = action_state.get_selected_entry()
|
local entry = action_state.get_selected_entry()
|
||||||
local cmd = [[lua require"lazygit".lazygit('%s')]]
|
local cmd = [[lua require"lazygit".lazygit('%s')]]
|
||||||
local path = entry.value
|
cmd = cmd:format(entry.value:gsub("%s", ""))
|
||||||
cmd = cmd:format(path:gsub("%s", ""))
|
|
||||||
vim.api.nvim_command(cmd)
|
vim.api.nvim_command(cmd)
|
||||||
|
vim.cmd('stopinsert')
|
||||||
|
vim.cmd([[execute "normal i"]])
|
||||||
vim.api.nvim_buf_set_keymap(0, 't', '<Esc>', '<Esc>', {noremap = true, silent = true})
|
vim.api.nvim_buf_set_keymap(0, 't', '<Esc>', '<Esc>', {noremap = true, silent = true})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ local lazygit_repos = function(opts)
|
|||||||
local repos = {}
|
local repos = {}
|
||||||
for _, v in pairs(lazygit.lazygit_visited_git_repos) do
|
for _, v in pairs(lazygit.lazygit_visited_git_repos) do
|
||||||
local index = #repos + 1
|
local index = #repos + 1
|
||||||
-- retrieve the git repo name
|
-- retrieve git repo name
|
||||||
local entry =
|
local entry =
|
||||||
{
|
{
|
||||||
idx = index,
|
idx = index,
|
||||||
|
|||||||
Reference in New Issue
Block a user