diff --git a/.config/nvim/lua/tovi/plugins/formatting.lua b/.config/nvim/lua/tovi/plugins/formatting.lua index 12bd447..78bb100 100644 --- a/.config/nvim/lua/tovi/plugins/formatting.lua +++ b/.config/nvim/lua/tovi/plugins/formatting.lua @@ -19,14 +19,14 @@ return { shell = { "shfmt", "shellcheck" }, python = { "isort", "black" }, }, - format_on_save = { - lsp_fallback = true, - async = false, - timeout_ms = 500, - }, - format_after_save = { - lsp_fallback = true, - }, + -- format_on_save = { + -- lsp_fallback = true, + -- async = false, + -- timeout_ms = 500, + -- }, + -- format_after_save = { + -- lsp_fallback = true, + -- }, log_level = vim.log.levels.WARN, notify_on_error = false, }) diff --git a/.config/nvim/lua/tovi/plugins/fugitive.lua b/.config/nvim/lua/tovi/plugins/fugitive.lua index c20c4ef..773b1dc 100644 --- a/.config/nvim/lua/tovi/plugins/fugitive.lua +++ b/.config/nvim/lua/tovi/plugins/fugitive.lua @@ -9,5 +9,21 @@ return { vim.api.nvim_set_keymap("n", "gl", ":GBrowse", { noremap = true }) vim.cmd([[ let g:fugitive_gitlab_domains = {"ssh://code.codium.com.au": "https://code.codium.com.au"} ]]) + + local function gitBlame(lines) + local current_file = vim.fn.expand('%:p') + local range = lines[1] .. "," .. lines[2] + local cmd = string.format("git -C %s blame -L %s %s | awk '{print $1}'", vim.fn.shellescape(vim.fn.fnamemodify(current_file, ':h')), range, vim.fn.fnamemodify(current_file, ':t')) + + local handle = io.popen(cmd) + local result = handle:read("*a") + handle:close() + + return result + end + + vim.keymap.set('n', 'gc', function () + vim.cmd(string.format('Git show %s', gitBlame({vim.fn.line('.'), vim.fn.line('.')}))) + end) end, }