mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat(dashboard): added new dashboard snack (#77)
## Description A new dashboard plugin that comes with sane defaults, and can be fully customized to your liking. ## Screenshots     
This commit is contained in:
parent
063525196a
commit
d540fa607c
19 changed files with 2506 additions and 43 deletions
|
|
@ -17,8 +17,14 @@ function M.get_root(path)
|
|||
path = path or 0
|
||||
path = type(path) == "number" and vim.api.nvim_buf_get_name(path) or path --[[@as string]]
|
||||
path = vim.fs.normalize(path)
|
||||
local git_root = vim.fs.find(".git", { path = path, upward = true })[1]
|
||||
return git_root and vim.fn.fnamemodify(git_root, ":h") or nil
|
||||
local git_root ---@type string?
|
||||
for dir in vim.fs.parents(path) do
|
||||
if vim.fn.isdirectory(dir .. "/.git") == 1 then
|
||||
git_root = dir
|
||||
break
|
||||
end
|
||||
end
|
||||
return git_root and vim.fs.normalize(git_root) or nil
|
||||
end
|
||||
|
||||
--- Show git log for the current line.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue