Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show project name when editing COMMIT_EDITMSG #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions lua/neocord/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,13 @@ function neocord:get_project_name(file_path)
return nil
end

-- Escape quotes in the file path
file_path = file_path:gsub([["]], [[\"]])

-- TODO: Only checks for a git repository, could add more checks here
-- Might want to run this in a background process depending on performance
local project_path_cmd = "git rev-parse --show-toplevel"
if self.os.name == "windows" then
project_path_cmd = string.format([[cmd /c "cd "%s" && %s"]], file_path, project_path_cmd)
project_path_cmd = string.format([[cmd /c "%s"]], project_path_cmd)
else
project_path_cmd = string.format([[bash -c 'cd "%s" && %s']], file_path, project_path_cmd)
project_path_cmd = string.format([[bash -c '%s']], project_path_cmd)
end

local project_path = vim.fn.system(project_path_cmd)
Expand Down
Loading