fix: replace nvim-tree properly with file browser

This commit is contained in:
Nydragon 2024-09-21 06:35:52 +02:00
parent 4737f707b4
commit a5d8f1e277
Signed by: nydragon
SSH key fingerprint: SHA256:iQnIC12spf4QjWSbarmkD2No1cLMlu6TWoV7K6cYF5g
3 changed files with 21 additions and 6 deletions

View file

@ -33,7 +33,7 @@ local function open_nvim_tree(data)
end
-- Using VimEnter is crucial, other autocmds will break the "focus = false" behaviour
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
--vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
-- From https://github.com/nvim-tree/nvim-tree.lua/issues/1368#issuecomment-1512248492
vim.api.nvim_create_autocmd("QuitPre", {

View file

@ -20,10 +20,14 @@ require("lazy").setup({
dependencies = {
"nvim-tree/nvim-web-devicons", -- optional, for file icons
},
init = function()
require("nvim-tree-config")
end,
--[[ init = function()
require("nvim-tree-config")
end,]]
opts = {
hijack_directories = {
enable = false,
auto_open = false,
},
renderer = {
highlight_modified = "name",
},
@ -33,7 +37,7 @@ require("lazy").setup({
diagnostics = {
enable = true,
},
update_focused_file = { enable = true },
--update_focused_file = { enable = true },
filters = {
dotfiles = false,
git_ignored = false,
@ -117,6 +121,9 @@ require("lazy").setup({
file_browser = {
theme = "ivy",
hijack_netrw = true,
auto_depth = true,
no_ignore = false,
hidden = { file_browser = true, folder_browser = true },
},
},
},
@ -327,3 +334,11 @@ vim.diagnostic.config({
})
vim.cmd("colorscheme catppuccin")
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function(data)
if vim.fn.isdirectory(data.file) == 1 then
require("telescope").extensions.file_browser.file_browser()
end
end,
})

View file

@ -23,5 +23,5 @@ wk.add({
{ "<leader>xr", "<cmd>Trouble lsp_references toggle<cr>", desc = "" },
{ "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", desc = "Open Trouble" },
{ "<leader>tt", require("telescope").extensions.file_browser.file_browser, desc = "Open the file browser" },
{ "/", require("telescope.builtin").grep_string, desc = "Search for a string in the current buffer" },
{ "/", require("telescope.builtin").current_buffer_fuzzy_find, desc = "Search for a string in the current buffer" },
})