feat: add NvimTreeFindFileToggle (#735)
This commit is contained in:
@@ -181,7 +181,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, NvimTreeClose, NvimTreeFocus and NvimTreeResize are also available if you need them
|
" NvimTreeOpen, NvimTreeClose, NvimTreeFocus, NvimTreeFindFileToggle, and NvimTreeResize 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
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ It will also open the leafs of the tree leading to the file in the buffer
|
|||||||
(if you opened a file with something else than the NvimTree, like `fzf` or
|
(if you opened a file with something else than the NvimTree, like `fzf` or
|
||||||
`:split`)
|
`:split`)
|
||||||
|
|
||||||
|
|:NvimTreeFindFileToggle| *:NvimTreeFindFileToggle*
|
||||||
|
|
||||||
|
close the tree or change the cursor in the tree for the current bufname,
|
||||||
|
similar to combination of |:NvimTreeToggle| and |:NvimTreeFindFile|
|
||||||
|
|
||||||
|:NvimTreeClipboard| *:NvimTreeClipboard*
|
|:NvimTreeClipboard| *:NvimTreeClipboard*
|
||||||
|
|
||||||
Print clipboard content for both cut and copy
|
Print clipboard content for both cut and copy
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ function M.focus()
|
|||||||
view.focus();
|
view.focus();
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.toggle()
|
function M.toggle(find_file)
|
||||||
if view.win_open() then
|
if view.win_open() then
|
||||||
view.close()
|
view.close()
|
||||||
else
|
else
|
||||||
if _config.update_focused_file.enable then
|
if _config.update_focused_file.enable or find_file then
|
||||||
M.find_file(true)
|
M.find_file(true)
|
||||||
end
|
end
|
||||||
if not view.win_open() then
|
if not view.win_open() then
|
||||||
@@ -356,11 +356,12 @@ local function setup_vim_commands()
|
|||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
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(false)
|
||||||
command! NvimTreeFocus lua require'nvim-tree'.focus()
|
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)
|
||||||
|
command! NvimTreeFindFileToggle lua require'nvim-tree'.toggle(true)
|
||||||
command! -nargs=1 NvimTreeResize lua require'nvim-tree'.resize(<args>)
|
command! -nargs=1 NvimTreeResize lua require'nvim-tree'.resize(<args>)
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user