Updated config

This commit is contained in:
2024-03-05 13:28:48 +01:00
parent 307d253d9e
commit eca02857ec
11 changed files with 150 additions and 78 deletions

View File

@ -33,8 +33,9 @@ on({ "VimEnter" }, {
callback = function()
-- Change file to its directory if needed
local name = vim.api.nvim_buf_get_name(0)
local is_directory = vim.fn.isdirectory(name)
if vim.fn.isdirectory(name) == 0 then
if is_directory == 0 then
name = vim.fs.dirname(name)
end
@ -50,18 +51,22 @@ on({ "VimEnter" }, {
else
vim.api.nvim_set_current_dir(name)
end
end,
})
on({ "VimEnter" }, {
desc = "Open file explorer if there is enough horizontal space",
group = group,
callback = function()
local files = require("nvim-tree.api")
local width = vim.go.columns
if width > 120 then
files.tree.toggle({ focus = false })
if is_directory ~= 0 then
require("telescope.builtin").find_files()
end
end,
})
-- on({ "VimEnter" }, {
-- desc = "Open file explorer if there is enough horizontal space",
-- group = group,
-- callback = function()
-- local files = require("nvim-tree.api")
-- local width = vim.go.columns
--
-- if width > 120 then
-- files.tree.toggle({ focus = false })
-- end
-- end,
-- })