Skip to content

Commit

Permalink
refactor(nvim): move nvim tree autocmd inside nvim configs
Browse files Browse the repository at this point in the history
  • Loading branch information
kutsan committed Oct 2, 2024
1 parent 69ba5f2 commit ccb36c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .config/nvim/lua/specs/nvim_tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ Plugin.config = function()
}
end

vim.api.nvim_create_autocmd('BufEnter', {
group = vim.api.nvim_create_augroup(
'NvimTreeWinFixBuf',
{ clear = true }
),
callback = function()
if vim.list_contains({ 'NvimTree' }, vim.bo.filetype) then
vim.opt_local.winfixbuf = true
end
end,
})

keymap.set('n', 'l', nvim_tree_api.node.open.edit, opts('Open'))
keymap.set('n', '<CR>', nvim_tree_api.node.open.edit, opts('Open'))
keymap.set('n', '<2-LeftMouse>', nvim_tree_api.node.open.edit, opts('Open'))
Expand Down
8 changes: 0 additions & 8 deletions .config/nvim/plugin/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,3 @@ api.nvim_create_autocmd('BufWritePre', {
buffer.trim_trailing_spaces()
end,
})

vim.api.nvim_create_autocmd('BufEnter', {
callback = function()
if vim.list_contains({ 'NvimTree' }, vim.bo.filetype) then
vim.opt_local.winfixbuf = true
end
end,
})

0 comments on commit ccb36c1

Please sign in to comment.