From e6e8d9e2e5a47e7ee6e41c92ad8b568e9f4f72c8 Mon Sep 17 00:00:00 2001 From: pynappo Date: Sun, 26 Jan 2025 03:04:47 -0800 Subject: [PATCH 1/3] trim whitespace, format readme, and update to lazy.nvim --- README.md | 694 +++++++++++++++++++++++------------------------ doc/neo-tree.txt | 88 +++--- 2 files changed, 388 insertions(+), 394 deletions(-) diff --git a/README.md b/README.md index 986a248fe..84d2a8fe0 100644 --- a/README.md +++ b/README.md @@ -59,29 +59,29 @@ so we can fix it. #### Minimal Example for Lazy: ```lua { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information - } + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information + } } ``` #### Minimal Example for Packer: ```lua -use { +use({ "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - requires = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information - } + branch = "v3.x", + requires = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information } +}) ``` After installing, run: @@ -94,370 +94,364 @@ Press `?` in the Neo-tree window to view the list of mappings. ## Quickstart -#### Longer Example for Packer: +#### Longer Example for lazy.nvim:
- Click to view longer example for Packer.nvim + Click to view longer example for lazy.nvim - + ```lua -use { +return { "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - requires = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information - { - 's1n7ax/nvim-window-picker', - version = '2.*', - config = function() - require 'window-picker'.setup({ - filter_rules = { - include_current_win = false, - autoselect_one = true, - -- filter using buffer options - bo = { - -- if the file type is one of following, the window will be ignored - filetype = { 'neo-tree', "neo-tree-popup", "notify" }, - -- if the buffer type is one of following, the window will be ignored - buftype = { 'terminal', "quickfix" }, - }, + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information + { + "s1n7ax/nvim-window-picker", + version = "2.*", + config = function() + require("window-picker").setup({ + filter_rules = { + include_current_win = false, + autoselect_one = true, + -- filter using buffer options + bo = { + -- if the file type is one of following, the window will be ignored + filetype = { "neo-tree", "neo-tree-popup", "notify" }, + -- if the buffer type is one of following, the window will be ignored + buftype = { "terminal", "quickfix" }, }, + }, }) - end, - }, + end, }, - config = function () - -- If you want icons for diagnostic errors, you'll need to define them somewhere: - vim.fn.sign_define("DiagnosticSignError", - {text = " ", texthl = "DiagnosticSignError"}) - vim.fn.sign_define("DiagnosticSignWarn", - {text = " ", texthl = "DiagnosticSignWarn"}) - vim.fn.sign_define("DiagnosticSignInfo", - {text = " ", texthl = "DiagnosticSignInfo"}) - vim.fn.sign_define("DiagnosticSignHint", - {text = "󰌵", texthl = "DiagnosticSignHint"}) - - require("neo-tree").setup({ - close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab - popup_border_style = "rounded", - enable_git_status = true, - enable_diagnostics = true, - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes - open_files_using_relative_paths = false, - sort_case_insensitive = false, -- used when sorting files and directories in the tree - sort_function = nil , -- use a custom function for sorting files and directories in the tree - -- sort_function = function (a,b) - -- if a.type == b.type then - -- return a.path > b.path - -- else - -- return a.type > b.type - -- end - -- end , -- this sorts files and directories descendantly - default_component_configs = { - container = { - enable_character_fade = true - }, - indent = { - indent_size = 2, - padding = 1, -- extra padding on left hand side - -- indent guides - with_markers = true, - indent_marker = "│", - last_indent_marker = "└", - highlight = "NeoTreeIndentMarker", - -- expander config, needed for nesting files - with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - icon = { - folder_closed = "", - folder_open = "", - folder_empty = "󰜌", - provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available - if node.type == "file" or node.type == "terminal" then - local success, web_devicons = pcall(require, "nvim-web-devicons") - local name = node.type == "terminal" and "terminal" or node.name - if success then - local devicon, hl = web_devicons.get_icon(name) - icon.text = devicon or icon.text - icon.highlight = hl or icon.highlight - end + }, + config = function() + -- If you want icons for diagnostic errors, you'll need to define them somewhere: + vim.fn.sign_define("DiagnosticSignError", { text = " ", texthl = "DiagnosticSignError" }) + vim.fn.sign_define("DiagnosticSignWarn", { text = " ", texthl = "DiagnosticSignWarn" }) + vim.fn.sign_define("DiagnosticSignInfo", { text = " ", texthl = "DiagnosticSignInfo" }) + vim.fn.sign_define("DiagnosticSignHint", { text = "󰌵", texthl = "DiagnosticSignHint" }) + + require("neo-tree").setup({ + close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes + open_files_using_relative_paths = false, + sort_case_insensitive = false, -- used when sorting files and directories in the tree + sort_function = nil, -- use a custom function for sorting files and directories in the tree + -- sort_function = function (a,b) + -- if a.type == b.type then + -- return a.path > b.path + -- else + -- return a.type > b.type + -- end + -- end , -- this sorts files and directories descendantly + default_component_configs = { + container = { + enable_character_fade = true, + }, + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰜌", + provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available + if node.type == "file" or node.type == "terminal" then + local success, web_devicons = pcall(require, "nvim-web-devicons") + local name = node.type == "terminal" and "terminal" or node.name + if success then + local devicon, hl = web_devicons.get_icon(name) + icon.text = devicon or icon.text + icon.highlight = hl or icon.highlight end - end, - -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there - -- then these will never be used. - default = "*", - highlight = "NeoTreeFileIcon" + end + end, + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon", + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = "", -- or "", but this is redundant info if you use git_status_colors on the name + deleted = "✖", -- this can only be used in the git_status source + renamed = "󰁕", -- this can only be used in the git_status source + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", }, - modified = { - symbol = "[+]", - highlight = "NeoTreeModified", + }, + -- If you don't want to use these columns, you can set `enabled = false` for each of them individually + file_size = { + enabled = true, + width = 12, -- width of the column + required_width = 64, -- min width of window required to show this column + }, + type = { + enabled = true, + width = 10, -- width of the column + required_width = 122, -- min width of window required to show this column + }, + last_modified = { + enabled = true, + width = 20, -- width of the column + required_width = 88, -- min width of window required to show this column + }, + created = { + enabled = true, + width = 20, -- width of the column + required_width = 110, -- min width of window required to show this column + }, + symlink_target = { + enabled = false, + }, + }, + -- A list of functions, each representing a global custom command + -- that will be available in all sources (if not overridden in `opts[source_name].commands`) + -- see `:h neo-tree-custom-commands-global` + commands = {}, + window = { + position = "left", + width = 40, + mapping_options = { + noremap = true, + nowait = true, + }, + mappings = { + [""] = { + "toggle_node", + nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use }, - name = { - trailing_slash = false, - use_git_status_colors = true, - highlight = "NeoTreeFileName", + ["<2-LeftMouse>"] = "open", + [""] = "open", + [""] = "cancel", -- close preview or floating neo-tree window + ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, + -- Read `# Preview Mode` for more information + ["l"] = "focus_preview", + ["S"] = "open_split", + ["s"] = "open_vsplit", + -- ["S"] = "split_with_window_picker", + -- ["s"] = "vsplit_with_window_picker", + ["t"] = "open_tabnew", + -- [""] = "open_drop", + -- ["t"] = "open_tab_drop", + ["w"] = "open_with_window_picker", + --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing + ["C"] = "close_node", + -- ['C'] = 'close_all_subnodes', + ["z"] = "close_all_nodes", + --["Z"] = "expand_all_nodes", + ["a"] = { + "add", + -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details + -- some commands may take optional config options, see `:h neo-tree-mappings` for details + config = { + show_path = "none", -- "none", "relative", "absolute" + }, }, - git_status = { - symbols = { - -- Change type - added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "✖",-- this can only be used in the git_status source - renamed = "󰁕",-- this can only be used in the git_status source - -- Status type - untracked = "", - ignored = "", - unstaged = "󰄱", - staged = "", - conflict = "", - } + ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. + ["d"] = "delete", + ["r"] = "rename", + ["b"] = "rename_basename", + ["y"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": + -- ["c"] = { + -- "copy", + -- config = { + -- show_path = "none" -- "none", "relative", "absolute" + -- } + --} + ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". + ["q"] = "close_window", + ["R"] = "refresh", + ["?"] = "show_help", + ["<"] = "prev_source", + [">"] = "next_source", + ["i"] = "show_file_details", + -- ["i"] = { + -- "show_file_details", + -- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`) + -- -- both options accept a string or a function that takes in the date in seconds and returns a string to display + -- -- config = { + -- -- created_format = "%Y-%m-%d %I:%M %p", + -- -- modified_format = "relative", -- equivalent to the line below + -- -- modified_format = function(seconds) return require('neo-tree.utils').relative_date(seconds) end + -- -- } + -- }, + }, + }, + nesting_rules = {}, + filesystem = { + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + --"node_modules" }, - -- If you don't want to use these columns, you can set `enabled = false` for each of them individually - file_size = { - enabled = true, - width = 12, -- width of the column - required_width = 64, -- min width of window required to show this column + hide_by_pattern = { -- uses glob style patterns + --"*.meta", + --"*/src/*/tsconfig.json", }, - type = { - enabled = true, - width = 10, -- width of the column - required_width = 122, -- min width of window required to show this column + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", }, - last_modified = { - enabled = true, - width = 20, -- width of the column - required_width = 88, -- min width of window required to show this column + always_show_by_pattern = { -- uses glob style patterns + --".env*", }, - created = { - enabled = true, - width = 20, -- width of the column - required_width = 110, -- min width of window required to show this column + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db" }, - symlink_target = { - enabled = false, + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", }, }, - -- A list of functions, each representing a global custom command - -- that will be available in all sources (if not overridden in `opts[source_name].commands`) - -- see `:h neo-tree-custom-commands-global` - commands = {}, + follow_current_file = { + enabled = false, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = false, -- when true, empty folders will be grouped together + hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree + -- in whatever position is specified in window.position + -- "open_current", -- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes + -- instead of relying on nvim autocmd events. window = { - position = "left", - width = 40, - mapping_options = { - noremap = true, - nowait = true, - }, mappings = { - [""] = { - "toggle_node", - nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use - }, - ["<2-LeftMouse>"] = "open", - [""] = "open", - [""] = "cancel", -- close preview or floating neo-tree window - ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, - -- Read `# Preview Mode` for more information - ["l"] = "focus_preview", - ["S"] = "open_split", - ["s"] = "open_vsplit", - -- ["S"] = "split_with_window_picker", - -- ["s"] = "vsplit_with_window_picker", - ["t"] = "open_tabnew", - -- [""] = "open_drop", - -- ["t"] = "open_tab_drop", - ["w"] = "open_with_window_picker", - --["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing - ["C"] = "close_node", - -- ['C'] = 'close_all_subnodes', - ["z"] = "close_all_nodes", - --["Z"] = "expand_all_nodes", - ["a"] = { - "add", - -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details - -- some commands may take optional config options, see `:h neo-tree-mappings` for details - config = { - show_path = "none" -- "none", "relative", "absolute" - } - }, - ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. - ["d"] = "delete", - ["r"] = "rename", - ["b"] = "rename_basename", - ["y"] = "copy_to_clipboard", - ["x"] = "cut_to_clipboard", - ["p"] = "paste_from_clipboard", - ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": - -- ["c"] = { - -- "copy", - -- config = { - -- show_path = "none" -- "none", "relative", "absolute" - -- } - --} - ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". - ["q"] = "close_window", - ["R"] = "refresh", - ["?"] = "show_help", - ["<"] = "prev_source", - [">"] = "next_source", - ["i"] = "show_file_details", - -- ["i"] = { - -- "show_file_details", - -- -- format strings of the timestamps shown for date created and last modified (see `:h os.date()`) - -- -- both options accept a string or a function that takes in the date in seconds and returns a string to display - -- -- config = { - -- -- created_format = "%Y-%m-%d %I:%M %p", - -- -- modified_format = "relative", -- equivalent to the line below - -- -- modified_format = function(seconds) return require('neo-tree.utils').relative_date(seconds) end - -- -- } - -- }, - } - }, - nesting_rules = {}, - filesystem = { - filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items - hide_dotfiles = true, - hide_gitignored = true, - hide_hidden = true, -- only works on Windows for hidden files/directories - hide_by_name = { - --"node_modules" - }, - hide_by_pattern = { -- uses glob style patterns - --"*.meta", - --"*/src/*/tsconfig.json", - }, - always_show = { -- remains visible even if other settings would normally hide it - --".gitignored", - }, - always_show_by_pattern = { -- uses glob style patterns - --".env*", - }, - never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show - --".DS_Store", - --"thumbs.db" - }, - never_show_by_pattern = { -- uses glob style patterns - --".null-ls_*", - }, + [""] = "navigate_up", + ["."] = "set_root", + ["H"] = "toggle_hidden", + ["/"] = "fuzzy_finder", + ["D"] = "fuzzy_finder_directory", + ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm + -- ["D"] = "fuzzy_sorter_directory", + ["f"] = "filter_on_submit", + [""] = "clear_filter", + ["[g"] = "prev_git_modified", + ["]g"] = "next_git_modified", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["og"] = { "order_by_git_status", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, + -- [''] = function(state) ... end, }, - follow_current_file = { - enabled = false, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` - }, - group_empty_dirs = false, -- when true, empty folders will be grouped together - hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current", -- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs - use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. - window = { - mappings = { - [""] = "navigate_up", - ["."] = "set_root", - ["H"] = "toggle_hidden", - ["/"] = "fuzzy_finder", - ["D"] = "fuzzy_finder_directory", - ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm - -- ["D"] = "fuzzy_sorter_directory", - ["f"] = "filter_on_submit", - [""] = "clear_filter", - ["[g"] = "prev_git_modified", - ["]g"] = "next_git_modified", - ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, - ["oc"] = { "order_by_created", nowait = false }, - ["od"] = { "order_by_diagnostics", nowait = false }, - ["og"] = { "order_by_git_status", nowait = false }, - ["om"] = { "order_by_modified", nowait = false }, - ["on"] = { "order_by_name", nowait = false }, - ["os"] = { "order_by_size", nowait = false }, - ["ot"] = { "order_by_type", nowait = false }, - -- [''] = function(state) ... end, - }, - fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode - [""] = "move_cursor_down", - [""] = "move_cursor_down", - [""] = "move_cursor_up", - [""] = "move_cursor_up", - [""] = "close", - -- [''] = function(state, scroll_padding) ... end, - }, + fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode + [""] = "move_cursor_down", + [""] = "move_cursor_down", + [""] = "move_cursor_up", + [""] = "move_cursor_up", + [""] = "close", + -- [''] = function(state, scroll_padding) ... end, }, + }, - commands = {} -- Add a custom command or override a global one using the same function name + commands = {}, -- Add a custom command or override a global one using the same function name + }, + buffers = { + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` }, - buffers = { - follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + group_empty_dirs = true, -- when true, empty folders will be grouped together + show_unloaded = true, + window = { + mappings = { + ["bd"] = "buffer_delete", + [""] = "navigate_up", + ["."] = "set_root", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, }, - group_empty_dirs = true, -- when true, empty folders will be grouped together - show_unloaded = true, - window = { - mappings = { - ["bd"] = "buffer_delete", - [""] = "navigate_up", - ["."] = "set_root", - ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, - ["oc"] = { "order_by_created", nowait = false }, - ["od"] = { "order_by_diagnostics", nowait = false }, - ["om"] = { "order_by_modified", nowait = false }, - ["on"] = { "order_by_name", nowait = false }, - ["os"] = { "order_by_size", nowait = false }, - ["ot"] = { "order_by_type", nowait = false }, - } + }, + }, + git_status = { + window = { + position = "float", + mappings = { + ["A"] = "git_add_all", + ["gu"] = "git_unstage_file", + ["ga"] = "git_add_file", + ["gr"] = "git_revert_file", + ["gc"] = "git_commit", + ["gp"] = "git_push", + ["gg"] = "git_commit_and_push", + ["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } }, + ["oc"] = { "order_by_created", nowait = false }, + ["od"] = { "order_by_diagnostics", nowait = false }, + ["om"] = { "order_by_modified", nowait = false }, + ["on"] = { "order_by_name", nowait = false }, + ["os"] = { "order_by_size", nowait = false }, + ["ot"] = { "order_by_type", nowait = false }, }, }, - git_status = { - window = { - position = "float", - mappings = { - ["A"] = "git_add_all", - ["gu"] = "git_unstage_file", - ["ga"] = "git_add_file", - ["gr"] = "git_revert_file", - ["gc"] = "git_commit", - ["gp"] = "git_push", - ["gg"] = "git_commit_and_push", - ["o"] = { "show_help", nowait=false, config = { title = "Order by", prefix_key = "o" }}, - ["oc"] = { "order_by_created", nowait = false }, - ["od"] = { "order_by_diagnostics", nowait = false }, - ["om"] = { "order_by_modified", nowait = false }, - ["on"] = { "order_by_name", nowait = false }, - ["os"] = { "order_by_size", nowait = false }, - ["ot"] = { "order_by_type", nowait = false }, - } - } - } - }) + }, + }) - vim.cmd([[nnoremap \ :Neotree reveal]]) - end + vim.cmd([[nnoremap \ :Neotree reveal]]) + end, } ```
- + _The above configuration is not everything that can be changed, it's just the parts you might want to change first._ - See `:h neo-tree` for full documentation. You can also preview that online at [doc/neo-tree.txt](doc/neo-tree.txt), although it's best viewed within vim. - To see all of the default config options with commentary, you can view it online at [lua/neo-tree/defaults.lua](lua/neo-tree/defaults.lua). You can also paste it -into a buffer after installing Neo-tree by running: +into a buffer after installing Neo-tree by running: ``` :lua require("neo-tree").paste_default_config() @@ -466,7 +460,7 @@ into a buffer after installing Neo-tree by running: ## The `:Neotree` Command The single `:Neotree` command accepts a range of arguments that give you full -control over the details of what and where it will show. For example, the following +control over the details of what and where it will show. For example, the following command will open a file browser on the right hand side, "revealing" the currently active file: @@ -489,7 +483,7 @@ without any arguments, it will use default values for everything. For example: :Neotree ``` -will open the filesystem source on the left hand side and focus it, if you are using +will open the filesystem source on the left hand side and focus it, if you are using the default config. ### Tab Completion @@ -556,7 +550,7 @@ current file. For example: The base that is used to calculate the git status for each dir/file. By default it uses `HEAD`, so it shows all changes that are not yet committed. You can for example work on a feature branch, and set it to `main`. It will -show all changes that happened on the feature branch and main since you +show all changes that happened on the feature branch and main since you branched off. Any git ref, commit, tag, or sha will work. @@ -569,7 +563,7 @@ Any git ref, commit, tag, or sha will work. ``` #### `reveal` -This is a boolean flag. Adding this will make Neotree automatically find and +This is a boolean flag. Adding this will make Neotree automatically find and focus the current file when it opens. #### `reveal_file` @@ -656,7 +650,7 @@ the same list you would see from `:ls`. To show with the `buffers` list, use: This view take the results of the `git status` command and display them in a tree. It includes commands for adding, unstaging, reverting, and committing. -The screenshot below shows the result of `:Neotree float git_status` while the +The screenshot below shows the result of `:Neotree float git_status` while the filesystem is open in a sidebar: ![Neo-tree git_status](https://github.com/nvim-neo-tree/resources/raw/main/images/Neo-tree-git_status.png) @@ -685,7 +679,7 @@ following features: - [x] Rename symbols (`rename`) - [x] Preview symbol (`preview` and friends) - [ ] Hover docs - - [ ] Call hierarchy + - [ ] Call hierarchy - [x] LSP - [x] LSP Support - [x] LSP server selection (ignore, allow_only, use first, use all, etc.) @@ -693,7 +687,7 @@ following features: See #879 for the tracking issue of these features. -This source is currently experimental, so in order to use it, you need to first +This source is currently experimental, so in order to use it, you need to first add `"document_symbols"` to `config.sources` and open it with the command ``` :Neotree document_symbols @@ -720,7 +714,7 @@ To do so, set one of these options to `true`: }) ``` -There are many configuration options to change the style of these tabs. +There are many configuration options to change the style of these tabs. See [lua/neo-tree/defaults.lua](lua/neo-tree/defaults.lua) for details. ### Preview Mode @@ -775,11 +769,11 @@ However, if you do not want this feature, you can disable it by changing the opt This is designed to be flexible. The way that is achieved is by making everything a function, or a string that identifies a built-in function. All of the -built-in functions can be replaced with your own implementation, or you can +built-in functions can be replaced with your own implementation, or you can add new ones. Each node in the tree is created from the renderer specified for the given node -type, and each renderer is a list of component configs to be rendered in order. +type, and each renderer is a list of component configs to be rendered in order. Each component is a function, either built-in or specified in your config. Those functions simply return the text and highlight group for the component. diff --git a/doc/neo-tree.txt b/doc/neo-tree.txt index 29e5e30e5..7f7ef6ed9 100644 --- a/doc/neo-tree.txt +++ b/doc/neo-tree.txt @@ -64,7 +64,7 @@ above can also be specified as: >vim :Neotree action=show source=buffers position=right toggle=true < -These arguments can be specified in any order. Here is the full list of +These arguments can be specified in any order. Here is the full list of arguments you can use: action~ @@ -72,7 +72,7 @@ What to do. Can be one of: focus : Show and/or switch focus to the specified Neotree window. DEFAULT show : Show the window, but keep focus on your current window. - close : Close the window(s) specified. Can be combined with "position" + close : Close the window(s) specified. Can be combined with "position" and/or "source" to specify which window(s) to close. source~ @@ -105,13 +105,13 @@ git_base~ The base that is used to calculate the git status for each dir/file. By default it uses `HEAD`, so it shows all changes that are not yet committed. You can for example work on a feature branch, and set it to `main`. It will -show all changes that happened on the feature branch and main since you +show all changes that happened on the feature branch and main since you branched off. Any git ref, commit, tag, or sha will work. reveal~ -This is a boolean flag. Adding this will make Neotree automatically find and +This is a boolean flag. Adding this will make Neotree automatically find and focus the current file when it opens. reveal_file~ @@ -188,7 +188,7 @@ HELP *neo-tree-help* NAVIGATION *neo-tree-navigation* Within the neo-tree window, for the filesystem source, the following mappings -are defined by default. All built-in commands are listed here but some are not +are defined by default. All built-in commands are listed here but some are not mapped by default. See |neo-tree-custom-commands| for details on how to use them in a custom mapping. @@ -200,7 +200,7 @@ Note: The "selected" item is the line the cursor is currently on. = navigate_up: Moves the root directory up one level. -. = set_root: Changes the root directory to the currently +. = set_root: Changes the root directory to the currently selected folder. = toggle_node Expand or collapse a node with children, which @@ -220,15 +220,15 @@ z = close_all_nodes: Close all nodes in the tree. expand_all_nodes: Expand all directory nodes in the tree recursively. -P = toggle_preview: Toggles "preview mode", see |neo-tree-preview-mode| +P = toggle_preview: Toggles "preview mode", see |neo-tree-preview-mode| l = focus_preview: Focus the active preview window = scroll_preview: Scrolls preview window down (without focusing it) - see |neo-tree-preview-mode| for params + see |neo-tree-preview-mode| for params = scroll_preview: Scrolls preview window up (without focusing it) - see |neo-tree-preview-mode| for params + see |neo-tree-preview-mode| for params = revert_preview: Ends "preview_mode" if it is enabled, and reverts any preview windows to what was being shown before @@ -246,10 +246,10 @@ s = open_vsplit: Same as open, but opens in a vertical split. t = open_tabnew: Same as open, but opens in a new tab. - open_drop: Same as open, but opens with the |:drop| command. + open_drop: Same as open, but opens with the |:drop| command. - open_tab_drop: Same as open, but opens in a new tab with the - |:drop| command with the |:tab| modifier. + open_tab_drop: Same as open, but opens in a new tab with the + |:drop| command with the |:tab| modifier. w = open_with_window_picker: Uses the `window-picker` plugin to select a window to open the selected node in. Requires that @@ -345,7 +345,7 @@ m = move: Move the selected file or directory. VIEW CHANGES *neo-tree-view-changes* H = toggle_hidden: Toggle whether hidden (filtered items) are shown or not. -R = refresh: Rescan the filesystem and redraw the tree. Changes made +R = refresh: Rescan the filesystem and redraw the tree. Changes made within nvim should be detected automatically, but this is useful for changes made elsewhere. @@ -373,7 +373,7 @@ option: >lua require("neo-tree").setup({ filesystem = { - find_by_full_path_words = false, + find_by_full_path_words = false, } }) < @@ -384,7 +384,7 @@ option: / = fuzzy_finder: Filter the tree recursively, searching for files and folders that contain the specified term as - you type. This will use fd if it is installed, or + you type. This will use fd if it is installed, or find, or which if you are on Windows. As of v1.28, this acts like a fuzzy finder, @@ -417,9 +417,9 @@ f = filter_on_submit: Same as above, but does not search until you hit PREVIEW MODE *neo-tree-preview-mode* -Preview mode will temporarily show whatever file the cursor is on without -switching focus from the Neo-tree window. By default, files will be previewed -in a new floating window. This can also be configured to automatically choose +Preview mode will temporarily show whatever file the cursor is on without +switching focus from the Neo-tree window. By default, files will be previewed +in a new floating window. This can also be configured to automatically choose an existing split by configuring the command like this: >lua @@ -439,7 +439,7 @@ Anything that causes Neo-tree to lose focus will end preview mode. When back to whatever was shown in that window before preview mode began. If you want to work with the floating preview mode window in autocmds or other -custom code, the window will have the `neo-tree-preview` filetype. +custom code, the window will have the `neo-tree-preview` filetype. When preview mode is not using floats, the window will have the window local variable `neo_tree_preview` set to `1` to indicate that it is being used as a @@ -456,7 +456,7 @@ CUSTOM MAPPINGS *neo-tree-custom-mappings* If you want to change the mappings, you can do so in two places. Mappings defined in `window.mappings` apply to all sources, and mappings defined at the source level, such as `filesystem.window.mappings` will override and extend -those global mappings for that particular source. +those global mappings for that particular source. For example: >lua @@ -604,10 +604,10 @@ the config options are in a table bound to the `config` key: window = { mappings = { ["/"] = { - "fuzzy_finder", - config = { - title = "Filter" -- An empty string hides the title - } + "fuzzy_finder", + config = { + title = "Filter" -- An empty string hides the title + } }, ["a"] = { "add", @@ -782,7 +782,7 @@ NOTE: SOME OPTIONS ARE ONLY DOCUMENTED IN THE DEFAULT CONFIG!~ Run `:lua require("neo-tree").paste_default_config()` to dump the fully commented default config in your current file. Even if you don't want to use that config as your starting point, you still may want to dump it to a blank -lua file just to read it as documentation. +lua file just to read it as documentation. SOURCE SELECTOR *neo-tree-source-selector* @@ -940,7 +940,7 @@ The `filesystem` source has a `filtered_items` section in it's config that allows you to specify what files and folders should be hidden. By default, any item identified by these filters will not be visible, but that visibility can be toggled on and off with a command. Each type of filter has a corresponding -highlight group which will be applied when they are visible, see +highlight group which will be applied when they are visible, see |neo-tree-highlights| for details. The following options are available: >lua @@ -995,11 +995,11 @@ hidden. This is an exact match. The `hide_by_pattern` option uses glob syntax, which is converted to lua patterns. No guarantees on how it handles advanced patterns. -The `always_show` option is a list of file/folder names that will always be +The `always_show` option is a list of file/folder names that will always be visible, even if other settings would normally hide it. This section takes precedence over all other options except for `never_show`. -the `always_show_by_pattern` option is a list of file/folder patterns that +the `always_show_by_pattern` option is a list of file/folder patterns that always will be visible. This section takes precedence over all other options except `never_show`. @@ -1032,7 +1032,7 @@ open_current Netrw disabled, opening a directory opens within the filesystem = { hijack_netrw_behavior = "open_default", -- "open_current", - -- "disabled", + -- "disabled", }) < @@ -1294,10 +1294,10 @@ This will render: FILENAME.js.map A more advanced usage are rules with patterns. Those can be mixed with file -extension based rules. In this case the rule key is not evaluated but a -pattern which is defined in a subkey. The pattern is a Lua pattern and can +extension based rules. In this case the rule key is not evaluated but a +pattern which is defined in a subkey. The pattern is a Lua pattern and can have captures which can be used for file matching via globs. -If the matching should be case insensitive, add an option ignore_case to the +If the matching should be case insensitive, add an option ignore_case to the config: >lua require("neo-tree").setup({ @@ -1317,7 +1317,7 @@ config: ["docker"] = { pattern = "^dockerfile$", ignore_case = true, - files = { ".dockerignore", "docker-compose.*", "dockerfile*" }, + files = { ".dockerignore", "docker-compose.*", "dockerfile*" }, } } }) @@ -1504,15 +1504,15 @@ The event argument for all window events is a table with the following keys: `position` = the position of the window, i.e. "left", "bottom", "right". "neo_tree_window_after_open"~ -Fired after opening a new Neo-tree window. Called with +Fired after opening a new Neo-tree window. Called with |neo-tree-window-event-args|. "neo_tree_window_before_close"~ -Fired before closing a Neo-tree window. Called with +Fired before closing a Neo-tree window. Called with |neo-tree-window-event-args|. "neo_tree_window_after_close"~ -Fired after closing a Neo-tree window. Called with +Fired after closing a Neo-tree window. Called with |neo-tree-window-event-args|. NOTE: The following events are used internally and not intended for end user @@ -1675,13 +1675,13 @@ Each component in the content list can use these additional properties: > "1234efg" < - + align~ If align is right, then it will be pushed to the right edge of the available space. This makes the most sense when the container width is set to a number or `"100%"`. Components that are right aligned will automatically overlap left aligned components with the same zindex if there is not enough space. - + Continuing with the example from above, if there was a `"right"` aligned component with a zindex of 20 that outputs: > @@ -1747,7 +1747,7 @@ For example, here is the simplest possible component: components = { name = function(config, node) - return { + return { text = node.name, highlight = "NeoTreeFileName" } @@ -1877,7 +1877,7 @@ specific commands: DOCUMENT SYMBOLS *neo-tree-document-symbols* The document_symbols source lists the symbols in the current document obtained -by the LSP request "textDocument/documentSymbols". +by the LSP request "textDocument/documentSymbols". Its configuration includes the following options: @@ -1886,15 +1886,15 @@ If set to `true`, will automatically focus on the symbol under the cursor. kinds~ A table specifying how LSP kinds should be rendered. Each entry should map the -LSP kind name to an icon and a highlight group, for example +LSP kind name to an icon and a highlight group, for example `Class = { icon = "󰌗", hl = "Include" }` custom_kinds~ A table mapping the LSP kind id (an integer) to the LSP kind name that is used -for `kinds`, for example +for `kinds`, for example `[252] = 'TypeAlias'` -For the list of kinds (id and name), please refer to +For the list of kinds (id and name), please refer to https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_documentSymbol client_filters~ @@ -1911,7 +1911,7 @@ symbols. This accepts one of the following values For example: (NOTE: here only `fn` will be taken into account) >lua - { + { fn = function(name) return name ~= "null-ls" end, allow_only = { "clangd", "lua_ls" }, ignore = { "pyright" }, From b31815185eeee8299098e5e750a72d109ec943dc Mon Sep 17 00:00:00 2001 From: pynappo Date: Sun, 26 Jan 2025 03:08:38 -0800 Subject: [PATCH 2/3] align comment --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 84d2a8fe0..c848e7ec0 100644 --- a/README.md +++ b/README.md @@ -350,10 +350,10 @@ return { }, group_empty_dirs = false, -- when true, empty folders will be grouped together hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current", -- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + -- in whatever position is specified in window.position + -- "open_current", -- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes -- instead of relying on nvim autocmd events. window = { From 17c2ee8de049bb50d8024a397d9b0b57d29009ca Mon Sep 17 00:00:00 2001 From: pynappo Date: Sun, 26 Jan 2025 03:13:39 -0800 Subject: [PATCH 3/3] clarify window-picker inclusion --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c848e7ec0..88e6d6501 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ return { "MunifTanjim/nui.nvim", -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information { - "s1n7ax/nvim-window-picker", + "s1n7ax/nvim-window-picker", -- for open_with_window_picker keymaps version = "2.*", config = function() require("window-picker").setup({