kyazdani42 / nvim-tree.lua

A file explorer tree for neovim written in lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help: Changing some default keybindings

agentzhao opened this issue · comments

Hi! I seem to have some trouble changing keybinds for nvim-tree. is already mapped to paste in windows terminal so i would like to be mapped to vsplit instead.

local tree_cb = require("nvim-tree.config").nvim_tree_callback
vim.g.nvim_tree_bindings = {
  { key = "<C-v>", cb = tree_cb("split") },
  { key = "<C-x>", cb = tree_cb("vsplit") },
}

Tried doing this but it didn't work. Could someone help me with this? Much appreciated!

Hi! I seem to have some trouble changing keybinds for nvim-tree. is already mapped to paste in windows terminal so i would like to be mapped to vsplit instead.

local tree_cb = require("nvim-tree.config").nvim_tree_callback
vim.g.nvim_tree_bindings = {
  { key = "<C-v>", cb = tree_cb("split") },
  { key = "<C-x>", cb = tree_cb("vsplit") },
}

Tried doing this but it didn't work. Could someone help me with this? Much appreciated!

change like this in your nvim-tree.lua config file:

...
  view = {
    width = 30,
    height = 30,
    hide_root_folder = false,
    side = 'left',
    auto_resize = false,
    mappings = {
      custom_only = false,
      list = {
          { key = {"<CR>", "<2-LeftMouse>"}, cb = tree_cb("edit") },
          { key = "v",                        cb = tree_cb("vsplit") },
          { key = "s",                        cb = tree_cb("split") },
          { key = "o",                            cb = tree_cb("system_open") },
      }
    },
    number = true,
    relativenumber = false,
    signcolumn = "yes"
  },
...

And you can refer to my nvim-tree.lua file: https://github.com/AGou-ops/dotfiles/blob/master/neovim-with-lua/lua/AGou/nvim-tree.lua#L50

@AGou-ops Works! Thank you so much!

ezoic increase your site revenue