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

WIP - Handle user commentChar #321

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion lua/neogit/buffers/commit_editor/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ function M:open()
config.values.disable_commit_confirmation
or input.get_confirmation("Are you sure you want to commit?")
then
-- TODO: Get rid of my personal hardcoded char
-- TODO: Handle possible need of escaping users char
vim.cmd([[
silent g/^#/d
silent g/^\;/d
silent w!
]])
end
Expand Down
4 changes: 3 additions & 1 deletion lua/neogit/popups/commit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ end, 2)
-- This flag should be true when the file already exists
local function prompt_commit_message(args, msg, skip_gen)
local msg_template_path = cli.config.get("commit.template").show_popup(false).call()[1]
local comment_char = cli.config.get("core.commentChar").show_popup(false).call()[1] or "#"
local output = {}

if msg and #msg > 0 then
Expand All @@ -46,8 +47,9 @@ local function prompt_commit_message(args, msg, skip_gen)
table.insert(output, "")
end
local lines = cli.commit.dry_run.args(unpack(args)).call()
print(vim.inspect(lines))
for _, line in ipairs(lines) do
table.insert(output, "# " .. line)
table.insert(output, comment_char .. " " .. line)
end
end

Expand Down