Nvim : Filetree cd by <Leader><Tab>.
This commit is contained in:
parent
5280231a07
commit
c28bd075c9
|
@ -2,11 +2,26 @@
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
|
local function my_on_attach(bufnr)
|
||||||
|
local api = require "nvim-tree.api"
|
||||||
|
|
||||||
|
local function opts(desc)
|
||||||
|
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Default mappings.
|
||||||
|
api.config.mappings.default_on_attach(bufnr)
|
||||||
|
|
||||||
|
-- Custom mappings.
|
||||||
|
vim.keymap.set('n', '<Leader><Tab>', api.tree.change_root_to_node, opts('Cd into'))
|
||||||
|
end
|
||||||
|
|
||||||
-- Set termguicolors to enable highlight groups.
|
-- Set termguicolors to enable highlight groups.
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
-- Setup nvim-tree.
|
-- Setup nvim-tree.
|
||||||
require("nvim-tree").setup({
|
require("nvim-tree").setup({
|
||||||
|
on_attach = my_on_attach,
|
||||||
sort_by = "case_sensitive",
|
sort_by = "case_sensitive",
|
||||||
view = {
|
view = {
|
||||||
width = 30,
|
width = 30,
|
||||||
|
|
|
@ -48,9 +48,9 @@ return require("packer").startup(function(use)
|
||||||
local treesitter = true
|
local treesitter = true
|
||||||
|
|
||||||
-- Plugin setup. Order is important.
|
-- Plugin setup. Order is important.
|
||||||
|
require("plugin/Filetree")
|
||||||
require("plugin/Mason")
|
require("plugin/Mason")
|
||||||
require("plugin/lsp/Init")
|
require("plugin/lsp/Init")
|
||||||
require("plugin/Filetree")
|
|
||||||
require("plugin/Bufferline")
|
require("plugin/Bufferline")
|
||||||
require("plugin/Lualine")
|
require("plugin/Lualine")
|
||||||
require("plugin/Autoclose")
|
require("plugin/Autoclose")
|
||||||
|
|
Reference in a new issue