add tree.lua nvim
This commit is contained in:
parent
2ed375d0c2
commit
43d77841b3
@ -66,6 +66,7 @@ nnoremap <C-n> :NvimTreeToggle<CR>
|
||||
nnoremap <leader>r :NvimTreeRefresh<CR>
|
||||
nnoremap <leader>n :NvimTreeFindFile<CR>
|
||||
nnoremap <silent> <C-s> :BufferPick<CR>
|
||||
noremap <silent> <C-n> :lua require'tree'.toggle()<CR>
|
||||
lua require('init')
|
||||
" Allow saving of files as sudo when I forgot to start vim using sudo.
|
||||
cmap w!! w !sudo tee > /dev/null %
|
||||
|
16
nvim/.config/nvim/lua/tree.lua
Normal file
16
nvim/.config/nvim/lua/tree.lua
Normal file
@ -0,0 +1,16 @@
|
||||
local tree ={}
|
||||
local g = vim.g
|
||||
-- Explicitly set the nvim tree width
|
||||
g.nvim_tree_width = 30
|
||||
local tree_width = g.nvim_tree_width
|
||||
tree.toggle = function()
|
||||
require('nvim-tree').toggle()
|
||||
if require('nvim-tree.view').win_open() then
|
||||
require('bufferline.state').set_offset(tree_width + 1, 'FileTree')
|
||||
require('nvim-tree').find_file(true)
|
||||
else
|
||||
require('bufferline.state').set_offset(0)
|
||||
end
|
||||
end
|
||||
|
||||
return tree
|
Loading…
Reference in New Issue
Block a user