Feat(nvim): replace telescope-file-browser by nvimtree
This commit is contained in:
parent
06b30a5c3e
commit
ba48178f00
14
nvim/.config/nvim/lua/config/nvimtree.lua
Normal file
14
nvim/.config/nvim/lua/config/nvimtree.lua
Normal 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({
|
||||
})
|
||||
|
@ -23,7 +23,6 @@ local new_maker = function(filepath, bufnr, opts)
|
||||
}):sync()
|
||||
end
|
||||
|
||||
local fb_actions = require "telescope".extensions.file_browser.actions
|
||||
local function telescope_buffer_dir()
|
||||
return vim.fn.expand('%:p:h')
|
||||
end
|
||||
@ -49,22 +48,10 @@ telescope.setup {
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_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('file_browser')
|
||||
|
||||
|
||||
-- keymaps
|
||||
@ -85,15 +72,3 @@ end)
|
||||
-- vim.keymap.set('n', '<leader>d', function()
|
||||
-- builtin.diagnostics()
|
||||
-- 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)
|
||||
|
@ -107,6 +107,15 @@ return packer.startup(function(use)
|
||||
"nvim-telescope/telescope-file-browser.nvim"
|
||||
}
|
||||
|
||||
use {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
requires = {
|
||||
'nvim-tree/nvim-web-devicons', -- optional
|
||||
},
|
||||
config = [[require('config.nvimtree')]],
|
||||
}
|
||||
|
||||
|
||||
use {
|
||||
'lervag/vimtex',
|
||||
config = [[require('config.vimtex')]],
|
||||
|
Loading…
Reference in New Issue
Block a user