mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +00:00
Compare commits
3 commits
5fb8cb8785
...
3965ab15c3
Author | SHA1 | Date | |
---|---|---|---|
|
3965ab15c3 | ||
|
250b503ef5 | ||
|
73cc5edd31 |
2 changed files with 12 additions and 5 deletions
|
@ -38,11 +38,11 @@
|
||||||
},
|
},
|
||||||
"mnw": {
|
"mnw": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731182209,
|
"lastModified": 1731821965,
|
||||||
"narHash": "sha256-yftvwv8bHEKjmSKREdkGLWTDhf7vA2Ssvl/XMpykigg=",
|
"narHash": "sha256-QiGi/HBQRnIRGY4gQPuH7T3hr7NznOpEO7qNpF5ldmE=",
|
||||||
"owner": "Gerg-L",
|
"owner": "Gerg-L",
|
||||||
"repo": "mnw",
|
"repo": "mnw",
|
||||||
"rev": "0a5e50286ca9f1b70eb4fa29ce84304cad657700",
|
"rev": "5fe5c41975ed0af55f55dc37cd28ba906a5d015e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -58,6 +58,9 @@ in {
|
||||||
-- buffer is a real file on the disk
|
-- buffer is a real file on the disk
|
||||||
local real_file = vim.fn.filereadable(data.file) == 1
|
local real_file = vim.fn.filereadable(data.file) == 1
|
||||||
|
|
||||||
|
-- buffer is a directory
|
||||||
|
local directory = vim.fn.isdirectory(data.file) == 1
|
||||||
|
|
||||||
-- buffer is a [No Name]
|
-- buffer is a [No Name]
|
||||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||||
|
|
||||||
|
@ -65,7 +68,7 @@ in {
|
||||||
local filetype = vim.bo[data.buf].ft
|
local filetype = vim.bo[data.buf].ft
|
||||||
|
|
||||||
-- only files please
|
-- only files please
|
||||||
if not real_file and not no_name then
|
if not real_file and not directory and not no_name then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -74,6 +77,10 @@ in {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- cd if buffer is a directory
|
||||||
|
if directory then
|
||||||
|
vim.cmd.cd(data.file)
|
||||||
|
end
|
||||||
-- open the tree but don't focus it
|
-- open the tree but don't focus it
|
||||||
require("nvim-tree.api").tree.toggle({ focus = false })
|
require("nvim-tree.api").tree.toggle({ focus = false })
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue