mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 11:40:36 +00:00
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
This commit is contained in:
@@ -1,19 +1,11 @@
|
|||||||
local gitignore = require("gitignore")
|
local gitignore = require("gitignore")
|
||||||
|
local GetProjectRoot = require("absolute.utils.get-git-root")
|
||||||
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
|
|
||||||
|
|
||||||
-- Keymaps
|
-- Keymaps
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
opts.desc = "Generate .gitignore"
|
opts.desc = "GitIgnore: Generate .gitignore"
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>gi", function()
|
vim.keymap.set("n", "<leader>gi", function()
|
||||||
local path = GetProjectRoot()
|
local path = GetProjectRoot()
|
||||||
|
|||||||
Reference in New Issue
Block a user