mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 05:10:44 +00:00
Merge 73cc5edd31
into 8a827f92c9
This commit is contained in:
commit
5fb8cb8785
1 changed files with 9 additions and 2 deletions
|
@ -58,6 +58,9 @@ in {
|
|||
-- buffer is a real file on the disk
|
||||
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]
|
||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
|
||||
|
@ -65,7 +68,7 @@ in {
|
|||
local filetype = vim.bo[data.buf].ft
|
||||
|
||||
-- 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
|
||||
end
|
||||
|
||||
|
@ -74,6 +77,10 @@ in {
|
|||
return
|
||||
end
|
||||
|
||||
-- cd if buffer is a directory
|
||||
if directory then
|
||||
vim.cmd.cd(data.file)
|
||||
end
|
||||
-- open the tree but don't focus it
|
||||
require("nvim-tree.api").tree.toggle({ focus = false })
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue