From a5b6985f46b2cbde302a9d4b9384321d9945a89e Mon Sep 17 00:00:00 2001 From: nicholasdominici Date: Fri, 14 Mar 2025 11:13:41 -0700 Subject: [PATCH] Open neo-tree on directory open in netrw style --- init.lua | 28 ---------------------------- lua/custom/plugins/init.lua | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/init.lua b/init.lua index bc0ced22..61817ac9 100644 --- a/init.lua +++ b/init.lua @@ -917,35 +917,7 @@ require('lazy').setup({ }, indent = { enable = true, disable = { 'ruby' } }, }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects }, - - -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the - -- init.lua. If you want these files, they are in the repository, so you can just download them and - -- place them in the correct locations. - - -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart - -- - -- Here are some example plugins that I've included in the Kickstart repository. - -- Uncomment any of the lines below to enable them (you will need to restart nvim). - -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps - - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- This is the easiest way to modularize your config. - -- - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` { import = 'custom.plugins' }, }, { ui = { diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 062c8a5e..6b79a23e 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -264,6 +264,26 @@ return { 'MunifTanjim/nui.nvim', -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information }, + config = function() + require('neo-tree').setup { + source_selector = { + winbar = true, + statusline = true, + }, + } + end, + init = function() + if vim.fn.argc(-1) == 1 then + local stat = vim.loop.fs_stat(vim.fn.argv(0)) + if stat and stat.type == 'directory' then + require('neo-tree').setup { + filesystem = { + hijack_netrw_behavior = 'open_current', + }, + } + end + end + end, }, { 'SmiteshP/nvim-navic',