Skip to content

How to set a keymap to get directly to a log of the current file? #1179

Closed Answered by georgeguimaraes
georgeguimaraes asked this question in Q&A
Discussion options

You must be logged in to vote

Got it working!

vim.keymap.set("n", "<leader>gl", function()
  local file = vim.fn.expand("%")
  require("neogit").action("log", "log_current", { "--", file })()
end, { desc = "Neogit Log for this file" })

I had to move the expansion out of neogit's function.

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@georgeguimaraes
Comment options

@georgeguimaraes
Comment options

@CKolkey
Comment options

@georgeguimaraes
Comment options

Answer selected by georgeguimaraes
@georgeguimaraes
Comment options

@CKolkey
Comment options

@georgeguimaraes
Comment options

@CKolkey
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants