Nvim-tree.lua: Open tree without moving the cursor to it

Created on 19 Apr 2021  路  2Comments  路  Source: kyazdani42/nvim-tree.lua

Is there a way to open (or toggle) the tree without moving the cursor to the tree window? It would be nice if there was an option. Thanks!

Most helpful comment

@litearc You can implement that yourself with something like this:

function! NvimTreeToggleNoFocus()
lua << EOF
  local lib = require'nvim-tree.lib'
  local view = require'nvim-tree.view'
  if view.win_open() then
    view.close()
  else
    lib.open()
    vim.cmd("wincmd p")
  end
EOF
endfunction

All 2 comments

@litearc You can implement that yourself with something like this:

function! NvimTreeToggleNoFocus()
lua << EOF
  local lib = require'nvim-tree.lib'
  local view = require'nvim-tree.view'
  if view.win_open() then
    view.close()
  else
    lib.open()
    vim.cmd("wincmd p")
  end
EOF
endfunction

i should start dropping default commands in favor of a better documentation :D I consider this as closed if you don't mind :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ziulev picture ziulev  路  8Comments

gmr458 picture gmr458  路  6Comments

cloggier picture cloggier  路  8Comments

GustavoPrietoP picture GustavoPrietoP  路  6Comments

ahmedkhalf picture ahmedkhalf  路  7Comments