From db4b8ad12cb065e86357710ca3ada9a5dc5074d2 Mon Sep 17 00:00:00 2001 From: David Ibia Date: Sun, 3 Mar 2024 12:02:53 +0100 Subject: [PATCH] refactor(gitignore.lua): replace GetProjectRoot function with require statement for absolute.utils.get-git-root module to improve code organization and readability feat(gitignore.lua): update keymap description to include GitIgnore prefix for clarity and consistency with functionality provided by the keymap --- lua/absolute/after/gitignore.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lua/absolute/after/gitignore.lua b/lua/absolute/after/gitignore.lua index 72f91de..74afccd 100644 --- a/lua/absolute/after/gitignore.lua +++ b/lua/absolute/after/gitignore.lua @@ -1,19 +1,11 @@ local gitignore = require("gitignore") - -function GetProjectRoot() - local git_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1] - if git_root == nil then - return vim.fn.getcwd() - else - return git_root - end -end +local GetProjectRoot = require("absolute.utils.get-git-root") -- Keymaps local opts = { noremap = true, silent = true } -opts.desc = "Generate .gitignore" +opts.desc = "GitIgnore: Generate .gitignore" vim.keymap.set("n", "gi", function() local path = GetProjectRoot()