nvim: add new nvim-tree mapping options
Prithu Goswami pg@prithu.dev
Mon, 12 Jun 2023 14:49:01 +0530
2 files changed,
12 insertions(+),
9 deletions(-)
M
config/nvim/init.lua
→
config/nvim/init.lua
@@ -5,8 +5,19 @@ require 'completion'
require 'lsp' -- TODO move each plugin setup to own file +local function nvim_tree_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 + api.config.mappings.default_on_attach(bufnr) + vim.keymap.set('n', 't', api.node.open.tab, opts('Open: New Tab')) + vim.keymap.set('n', '<C-s>', api.node.open.horizontal, opts('Open: Horizontal Split')) +end + require("nvim-tree").setup({ + on_attach = nvim_tree_on_attach, sort_by = "case_sensitive", filters = { custom = {"__pycache__"}@@ -34,14 +45,6 @@ untracked = "★",
deleted = "✗", ignored = "◌", } - } - } - }, - view = { - mappings = { - list = { - { key = "t", action = "tabnew"}, - { key = "<C-s>", action = "split"} } } },
M
config/nvim/lua/options.lua
→
config/nvim/lua/options.lua
@@ -8,7 +8,7 @@ vim.opt.undofile = true
--o.colorcolumn = '80' vim.opt.scrolloff = 10 vim.opt.sidescrolloff = 10 -vim.opt.wrap = false +vim.opt.wrap = true vim.opt.mouse = 'a' vim.opt.wildmenu = true vim.opt.showmatch = true