Adds automatic reopening
This commit is contained in:
parent
88bda96496
commit
6dd971b541
2 changed files with 30 additions and 4 deletions
|
|
@ -1,12 +1,21 @@
|
|||
local fs = {}
|
||||
|
||||
local function startswith(string, start)
|
||||
return string:sub(1, #start) == start
|
||||
end
|
||||
|
||||
function fs.getCurrentPath()
|
||||
local currentBuffer = vim.fn.expand("%")
|
||||
print(currentBuffer)
|
||||
end
|
||||
|
||||
function fs.getRootPath()
|
||||
local initialArguments = vim.v.argv
|
||||
local requestedFile = initialArguments[#initialArguments]
|
||||
|
||||
local path = vim.fs.abspath(requestedFile)
|
||||
|
||||
if vim.fn.isdirectory(path) == 1 then
|
||||
return path
|
||||
end
|
||||
|
||||
return LazyVim.root()
|
||||
end
|
||||
|
||||
return fs
|
||||
|
|
|
|||
17
.config/nvim/lua/plugins/snacks_explorer.lua
Normal file
17
.config/nvim/lua/plugins/snacks_explorer.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
local fs = require("functions.fs")
|
||||
|
||||
return {
|
||||
"folke/snacks.nvim",
|
||||
keys = {
|
||||
{
|
||||
"<leader>e",
|
||||
function()
|
||||
local rootdirectory = fs.getRootPath()
|
||||
|
||||
Snacks.explorer({ cwd = rootdirectory })
|
||||
end,
|
||||
desc = "Explorer Snacks (root directory)",
|
||||
remap = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue