Feat(nvim): replace telescope-file-browser by nvimtree

This commit is contained in:
Bertrand Benjamin 2023-04-04 11:44:23 +02:00
parent 06b30a5c3e
commit ba48178f00
3 changed files with 23 additions and 25 deletions

View File

@ -0,0 +1,14 @@
local nvimtree_status_ok, nvimtree = pcall(require, "nvim-tree")
if not nvimtree_status_ok then
return
end
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
vim.keymap.set("n", "<leader>f", ":NvimTreeToggle<cr>", {silent = true, noremap = true})
nvimtree.setup({
})

View File

@ -23,7 +23,6 @@ local new_maker = function(filepath, bufnr, opts)
}):sync() }):sync()
end end
local fb_actions = require "telescope".extensions.file_browser.actions
local function telescope_buffer_dir() local function telescope_buffer_dir()
return vim.fn.expand('%:p:h') return vim.fn.expand('%:p:h')
end end
@ -49,22 +48,10 @@ telescope.setup {
case_mode = "smart_case", -- or "ignore_case" or "respect_case" case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case" -- the default case_mode is "smart_case"
}, },
file_browser = {
theme = "dropdown",
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = true,
mappings = {
["n"] = {
-- your custom normal mode mappings
["h"] = fb_actions.goto_parent_dir,
},
},
},
} }
} }
telescope.load_extension('fzf') telescope.load_extension('fzf')
telescope.load_extension('file_browser')
-- keymaps -- keymaps
@ -85,15 +72,3 @@ end)
-- vim.keymap.set('n', '<leader>d', function() -- vim.keymap.set('n', '<leader>d', function()
-- builtin.diagnostics() -- builtin.diagnostics()
-- end) -- end)
vim.keymap.set("n", "<leader>fb", function()
telescope.extensions.file_browser.file_browser({
path = "%:p:h",
cwd = telescope_buffer_dir(),
respect_gitignore = false,
hidden = true,
grouped = true,
previewer = false,
initial_mode = "normal",
layout_config = { height = 40 }
})
end)

View File

@ -107,6 +107,15 @@ return packer.startup(function(use)
"nvim-telescope/telescope-file-browser.nvim" "nvim-telescope/telescope-file-browser.nvim"
} }
use {
'nvim-tree/nvim-tree.lua',
requires = {
'nvim-tree/nvim-web-devicons', -- optional
},
config = [[require('config.nvimtree')]],
}
use { use {
'lervag/vimtex', 'lervag/vimtex',
config = [[require('config.vimtex')]], config = [[require('config.vimtex')]],