Feat: add focus on tree functionality (#563)
This commit is contained in:
@@ -115,7 +115,7 @@ let g:nvim_tree_icons = {
|
|||||||
nnoremap <C-n> :NvimTreeToggle<CR>
|
nnoremap <C-n> :NvimTreeToggle<CR>
|
||||||
nnoremap <leader>r :NvimTreeRefresh<CR>
|
nnoremap <leader>r :NvimTreeRefresh<CR>
|
||||||
nnoremap <leader>n :NvimTreeFindFile<CR>
|
nnoremap <leader>n :NvimTreeFindFile<CR>
|
||||||
" NvimTreeOpen and NvimTreeClose are also available if you need them
|
" NvimTreeOpen, NvimTreeClose and NvimTreeFocus are also available if you need them
|
||||||
|
|
||||||
set termguicolors " this variable must be enabled for colors to be applied properly
|
set termguicolors " this variable must be enabled for colors to be applied properly
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,10 @@ closes the tree
|
|||||||
|
|
||||||
open or close the tree
|
open or close the tree
|
||||||
|
|
||||||
|
|:NvimTreeFocus| *:NvimTreeFocus*
|
||||||
|
|
||||||
|
open the tree if it is closed, and then focus on the tree
|
||||||
|
|
||||||
|:NvimTreeRefresh| *:NvimTreeRefresh*
|
|:NvimTreeRefresh| *:NvimTreeRefresh*
|
||||||
|
|
||||||
refresh the tree
|
refresh the tree
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ local api = vim.api
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
function M.focus()
|
||||||
|
if not view.win_open() then
|
||||||
|
lib.open()
|
||||||
|
end
|
||||||
|
view.focus();
|
||||||
|
end
|
||||||
|
|
||||||
function M.toggle()
|
function M.toggle()
|
||||||
if view.win_open() then
|
if view.win_open() then
|
||||||
view.close()
|
view.close()
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ augroup end
|
|||||||
command! NvimTreeOpen lua require'nvim-tree'.open()
|
command! NvimTreeOpen lua require'nvim-tree'.open()
|
||||||
command! NvimTreeClose lua require'nvim-tree'.close()
|
command! NvimTreeClose lua require'nvim-tree'.close()
|
||||||
command! NvimTreeToggle lua require'nvim-tree'.toggle()
|
command! NvimTreeToggle lua require'nvim-tree'.toggle()
|
||||||
|
command! NvimTreeFocus lua require'nvim-tree'.focus()
|
||||||
command! NvimTreeRefresh lua require'nvim-tree'.refresh()
|
command! NvimTreeRefresh lua require'nvim-tree'.refresh()
|
||||||
command! NvimTreeClipboard lua require'nvim-tree'.print_clipboard()
|
command! NvimTreeClipboard lua require'nvim-tree'.print_clipboard()
|
||||||
command! NvimTreeFindFile lua require'nvim-tree'.find_file(true)
|
command! NvimTreeFindFile lua require'nvim-tree'.find_file(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user