local options = { backup = false, -- creates a backup file clipboard = "unnamedplus", -- allows neovim to access the system clipboard cmdheight = 2, -- more space in the neovim command line for displaying messages completeopt = { "menuone", "noselect" }, -- mostly just for cmp conceallevel = 0, -- so that `` is visible in markdown files fileencoding = "utf-8", -- the encoding written to a file hlsearch = true, -- highlight all matches on previous search pattern ignorecase = true, -- ignore case in search patterns mouse = "a", -- allow the mouse to be used in neovim pumheight = 10, -- pop up menu height showmode = false, -- we don't need to see things like -- INSERT -- anymore showtabline = 2, -- always show tabs smartcase = true, -- smart case smartindent = true, -- make indenting smarter again splitbelow = true, -- force all horizontal splits to go below current window splitright = true, -- force all vertical splits to go to the right of current window swapfile = false, -- creates a swapfile termguicolors = true, -- set term gui colors (most terminals support this) timeoutlen = 500, -- time to wait for a mapped sequence to complete (in milliseconds) undofile = true, -- enable persistent undo updatetime = 300, -- faster completion (4000ms default) writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited expandtab = true, -- convert tabs to spaces shiftwidth = 2, -- the number of spaces inserted for each indentation tabstop = 2, -- insert 2 spaces for a tab cursorline = true, -- highlight the current line cursorcolumn = false, -- cursor column. number = true, -- set numbered lines relativenumber = false, -- set relative numbered lines numberwidth = 4, -- set number column width to 2 {default 4} signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time wrap = false, -- display lines as one long line scrolloff = 8, -- is one of my fav sidescrolloff = 8, guifont = "monospace:h17", -- the font used in graphical neovim applications foldmethod = "expr", -- fold with nvim_treesitter foldexpr = "nvim_treesitter#foldexpr()", foldenable = false, -- no fold to be applied when open a file foldlevel = 99, -- if not set this, fold will be everywhere }
vim.opt.shortmess:append "c"
for k, v inpairs(options) do vim.opt[k] = v end
vim.cmd "set whichwrap+=<,>,[,],h,l" vim.cmd [[set iskeyword+=-]] vim.cmd [[set formatoptions-=cro]]-- TODO: this doesn't seem to work
-- WSL yank support vim.cmd [[ let s:clip = '/mnt/c/Windows/System32/clip.exe' if executable(s:clip) augroup WSLYank autocmd! autocmd TextYankPost * if v:event.operator ==# 'y' | call system(s:clip, @0) | endif augroup END endif ]]
这个配置有详细的注释,值得说的有两点:
fold相关,这个依赖后续的treesitter插件,现在可先注释掉, 否则重启nvim可能会报错
wsl相关,如果你在使用windows开发,想要通过 y 拷贝文本内容至系统剪切板,则需要加末尾处的代码。
-- Automatically install packer local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" if fn.empty(fn.glob(install_path)) > 0then PACKER_BOOTSTRAP = fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path, } print"Installing packer close and reopen Neovim..." vim.cmd [[packadd packer.nvim]] end
-- Autocommand that reloads neovim whenever you save the plugins.lua file vim.cmd [[ augroup packer_user_config autocmd! autocmd BufWritePost plugins.lua source <afile> | PackerSync augroup end ]]
-- Use a protected call so we don't error out on first use local status_ok, packer = pcall(require, "packer") ifnot status_ok then return end
-- Have packer use a popup window packer.init { display = { -- open_fn = function() -- return require("packer.util").float { border = "rounded" } -- end, }, }
-- useage -- use { -- "myusername/example", -- The plugin location string -- -- The following keys are all optional -- disable = boolean, -- Mark a plugin as inactive -- as = string, -- Specifies an alias under which to install the plugin -- installer = function, -- Specifies custom installer. See "custom installers" below. -- updater = function, -- Specifies custom updater. See "custom installers" below. -- after = string or list, -- Specifies plugins to load before this plugin. See "sequencing" below -- rtp = string, -- Specifies a subdirectory of the plugin to add to runtimepath. -- opt = boolean, -- Manually marks a plugin as optional. -- branch = string, -- Specifies a git branch to use -- tag = string, -- Specifies a git tag to use. Supports "*" for "latest tag" -- commit = string, -- Specifies a git commit to use -- lock = boolean, -- Skip updating this plugin in updates/syncs. Still cleans. -- run = string, function, or table, -- Post-update/install hook. See "update/install hooks". -- requires = string or list, -- Specifies plugin dependencies. See "dependencies". -- rocks = string or list, -- Specifies Luarocks dependencies for the plugin -- config = string or function, -- Specifies code to run after this plugin is loaded. -- -- The setup key implies opt = true -- setup = string or function, -- Specifies code to run before this plugin is loaded. -- -- The following keys all imply lazy-loading and imply opt = true -- cmd = string or list, -- Specifies commands which load this plugin. Can be an autocmd pattern. -- ft = string or list, -- Specifies filetypes which load this plugin. -- keys = string or list, -- Specifies maps which load this plugin. See "Keybindings". -- event = string or list, -- Specifies autocommand events which load this plugin. -- fn = string or list -- Specifies functions which load this plugin. -- cond = string, function, or list of strings/functions, -- Specifies a conditional test to load this plugin -- module = string or list -- Specifies Lua module names for require. When requiring a string which starts -- -- with one of these module names, the plugin will be loaded. -- module_pattern = string/list -- Specifies Lua pattern of Lua module names for require. When -- requiring a string which matches one of these patterns, the plugin will be loaded. -- }
-- Install your plugins here return packer.startup(function(use) -- My plugins here use "wbthomason/packer.nvim"-- Have packer manage itself use "nvim-lua/popup.nvim"-- An implementation of the Popup API from vim in Neovim use "nvim-lua/plenary.nvim"-- Useful lua functions used ny lots of plugins
-- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if PACKER_BOOTSTRAP then require("packer").sync() end end)
-- TODO: 改变theme不生效 local status_ok, onedark = pcall(require, "onedark") ifnot status_ok then vim.notify("onedark theme not found!") return end
-- NOTE: if use 'light' theme, you should change both backgournd and style to 'light' vim.o.background='dark' -- vim.o.background='light' onedark.setup { -- Main options -- style = 'dark', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light' transparent = false, -- Show/hide background term_colors = true, -- Change terminal color as per the selected theme style ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden -- toggle theme style --- toggle_style_list = {'light', 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer'}, -- List of styles to toggle between toggle_style_key = '<leader>ts', -- Default keybinding to toggle
-- Change code style --- -- Options are italic, bold, underline, none -- You can configure multiple style with comma seperated, For e.g., keywords = 'italic,bold' code_style = { comments = 'italic', keywords = 'none', functions = 'bold', strings = 'none', variables = 'none' },
-- Treesittetr use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", } use "nvim-treesitter/nvim-treesitter-textobjects" -- enhance texetobject selection use "romgrk/nvim-treesitter-context" -- show class/function at top use "andymass/vim-matchup"
local status_ok, configs = pcall(require, "nvim-treesitter.configs") if not status_ok then vim.notify("treesitter not found!") return end
configs.setup { ensure_installed = {"cpp", "lua", "c", "python", "go"}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) ignore_install = { "" }, -- List of parsers to ignore installing autopairs = { enable = true, }, highlight = { enable = true, -- false will disable the whole extension disable = { "" }, -- list of language that will be disabled additional_vim_regex_highlighting = true, }, indent = { enable = true, disable = { "yaml" } }, context_commentstring = { enable = true, enable_autocmd = false, },
-- textobjects extension settings -- https://github.com/nvim-treesitter/nvim-treesitter-textobjects textobjects = { select = { enable = true, -- Automatically jump forward to textobj, similar to targets.vim lookahead = true, keymaps = { -- You can use the capture groups defined in textobjects.scm ["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner", }, }, move = { enable = true, set_jumps = true, -- whether to set jumps in the jumplist goto_next_start = { ["]]"] = "@function.outer", -- ["]]"] = "@class.outer", }, -- goto_next_end = { -- ["jF"] = "@function.outer", -- ["]["] = "@class.outer", -- }, goto_previous_start = { ["[["] = "@function.outer", -- ["[["] = "@class.outer", }, -- goto_previous_end = { -- ["kF"] = "@function.outer", -- ["[]"] = "@class.outer", -- }, }, lsp_interop = { enable = true, border = 'none', peek_definition_code = { ["<leader>df"] = "@function.outer", ["<leader>dF"] = "@class.outer", }, }, }, -- matchup plugins -- https://github.com/andymass/vim-matchup matchup = { enable = true, -- mandatory, false will disable the whole extension -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled -- [options] }, }
对需要语法高亮的语言进行配置:
1
ensure_installed = {"cpp", "lua", "c", "python", "go"}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
use "hrsh7th/nvim-cmp"-- The completion plugin use "hrsh7th/cmp-buffer"-- buffer completions use "hrsh7th/cmp-path"-- path completions use "hrsh7th/cmp-cmdline"-- cmdline completions use "saadparwaiz1/cmp_luasnip"-- snippet completions use "hrsh7th/cmp-nvim-lsp"-- lsp support use "hrsh7th/cmp-nvim-lua"-- neovim api -- snippets use "L3MON4D3/LuaSnip"--snippet engine use "rafamadriz/friendly-snippets"-- a bunch of snippets to use
local check_backspace = function() local col = vim.fn.col "." - 1 return col == 0or vim.fn.getline("."):sub(col, col):match"%s" end
-- פּ ﯟ some other good icons local kind_icons = { Text = "", Method = "m", Function = "", Constructor = "", Field = "", Variable = "", Class = "", Interface = "", Module = "", Property = "", Unit = "", Value = "", Enum = "", Keyword = "", Snippet = "", Color = "", File = "", Reference = "", Folder = "", EnumMember = "", Constant = "", Struct = "", Event = "", Operator = "", TypeParameter = "", } -- find more here: https://www.nerdfonts.com/cheat-sheet
cmp.setup { snippet = { expand = function(args) luasnip.lsp_expand(args.body) -- For `luasnip` users. end, }, mapping = { ["<C-k>"] = cmp.mapping.select_prev_item(), ["<C-j>"] = cmp.mapping.select_next_item(), ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. ["<C-e>"] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close(), }, -- Accept currently selected item. If none selected, `select` first item. -- Set `select` to `false` to only confirm explicitly selected items. ["<CR>"] = cmp.mapping.confirm { select = true }, ["<Tab>"] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expandable() then luasnip.expand() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif check_backspace() then fallback() else fallback() end end, { "i", "s", }), ["<S-Tab>"] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { "i", "s", }), }, formatting = { fields = { "kind", "abbr", "menu" }, format = function(entry, vim_item) -- Kind icons vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind vim_item.menu = ({ nvim_lsp = "[LSP]", nvim_lua = "[NVIM_LUA]", luasnip = "[Snippet]", buffer = "[Buffer]", path = "[Path]", })[entry.source.name] return vim_item end, }, sources = { { name = "nvim_lsp" }, { name = "nvim_lua" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" }, }, confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false, }, documentation = { border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, }, experimental = { ghost_text = false, native_menu = false, }, }
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline('/', { sources = { { name = 'buffer' } } })
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(':', { sources = cmp.config.sources({ { name = 'cmdline' } }, { { name = 'path' } }) })
-- LSP use "neovim/nvim-lspconfig"-- enable LSP use "williamboman/nvim-lsp-installer"-- simple to use language server installer use "kosayoda/nvim-lightbulb"-- code action use "ray-x/lsp_signature.nvim"-- show function signature when typing
建立 lsp/init.lua 文件:
1 2 3 4 5 6 7 8 9
local status_ok, _ = pcall(require, "lspconfig") ifnot status_ok then return end
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer") ifnot status_ok then vim.notify("nvim-lspconfig not found!") return end
-- Register a handler that will be called for all installed servers. -- Alternatively, you may also register handlers on specific server instances instead (see example below). lsp_installer.on_server_ready(function(server) local opts = { on_attach = require("user.lsp.handlers").on_attach, capabilities = require("user.lsp.handlers").capabilities, }
-- This setup() function is exactly the same as lspconfig's setup function. -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md server:setup(opts) end)
require"lsp_signature".setup({ debug = false, -- set to true to enable debug logging log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on -- default is ~/.cache/nvim/lsp_signature.log verbose = false, -- show debug line number
bind = true, -- This is mandatory, otherwise border config won't get registered. -- If you want to hook lspsaga or other signature handler, pls set to false doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); -- set to 0 if you DO NOT want any API comments be shown -- This setting only take effect in insert mode, it does not affect signature help in normal -- mode, 10 by default
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note: -- will set to true when fully tested, set to false will use whichever side has more space -- this setting will be helpful if you do not want the PUM and floating win overlap
floating_window_off_x = 1, -- adjust float windows x position. floating_window_off_y = 1, -- adjust float windows y position.
fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters hint_enable = true, -- virtual hint enable hint_prefix = "🐼 ", -- Panda for parameter hint_scheme = "String", hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down -- to view the hiding contents max_width = 80, -- max_width of signature floating_window, line will be wrapped if exceed max_width handler_opts = { border = "rounded"-- double, rounded, single, shadow, none },
always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58
auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom
padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc
transparency = nil, -- disabled by default, allow floating win transparent value 1~100 shadow_blend = 36, -- if you using shadow as border use this set the opacity shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency toggle_key = nil-- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>' })
-- TODO: backfill this to template M.setup = function() local signs = { { name = "DiagnosticSignError", text = "" }, { name = "DiagnosticSignWarn", text = "" }, { name = "DiagnosticSignHint", text = "" }, { name = "DiagnosticSignInfo", text = "" }, }
for _, sign inipairs(signs) do vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) end
localfunctionlsp_highlight_document(client) -- Set autocommands conditional on server_capabilities if client.resolved_capabilities.document_highlight then vim.api.nvim_exec( [[ augroup lsp_document_highlight autocmd! * <buffer> autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references() augroup END ]], false ) end end
M.on_attach = function(client, bufnr) -- client.resolved_capabilities.document_formatting = false -- disable all server formating capabilities, use null-ls instead -- if client.name == "tsserver" or client.name == "clangd" then -- end lsp_keymaps(bufnr) lsp_highlight_document(client)
-- add outline support for evey lanuage -- require("aerial").on_attach(client, bufnr)
require"lsp_signature".on_attach() end
local capabilities = vim.lsp.protocol.make_client_capabilities()
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") ifnot status_ok then return end
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities) capabilities.offsetEncoding = { "utf-16" } return M
-- Debugger use "ravenxrz/DAPInstall.nvim"-- help us install several debuggers use "ravenxrz/nvim-dap" use "theHamsta/nvim-dap-virtual-text" use "rcarriga/nvim-dap-ui" use "nvim-telescope/telescope-dap.nvim"
local status_ok, dapui = pcall(require, 'dapui') ifnot status_ok then vim.notify("dapui not found") return end
dapui.setup ({ icons = { expanded = "▾", collapsed = "▸" }, mappings = { -- Use a table to apply multiple mappings expand = { "o", "<2-LeftMouse>", "<CR>" }, open = "O", remove = "d", edit = "e", repl = "r", toggle = "t", }, sidebar = { -- You can change the order of elements in the sidebar elements = { -- Provide as ID strings or tables with "id" and "size" keys { id = "scopes", size = 0.35, -- Can be float or integer > 1 }, { id = "stacks", size = 0.35 }, { id = "watches", size = 0.15 }, { id = "breakpoints", size = 0.15 }, }, size = 40, position = "left", -- Can be "left", "right", "top", "bottom" }, tray = { elements = { "repl" }, size = 5, position = "bottom", -- Can be "left", "right", "top", "bottom" }, floating = { max_height = nil, -- These can be integers or a float between 0 and 1. max_width = nil, -- Floats will be treated as percentage of your screen. border = "single", -- Border style. Can be "single", "double" or "rounded" mappings = { close = { "q", "<Esc>" }, }, }, windows = { indent = 1 }, })
新建 dap/dap-virtual-text.lua 文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
require("nvim-dap-virtual-text").setup { enabled = true, -- enable this plugin (the default) enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination) highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText highlight_new_as_changed = true, -- highlight new variables in the same way as changed variables (if highlight_changed_variables) show_stop_reason = true, -- show stop reason when stopped for exceptions commented = false, -- prefix virtual text with comment string -- experimental features: virt_text_pos = 'eol', -- position of virtual text, see `:h nvim_buf_set_extmark()` all_frames = false, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine. virt_lines = false, -- show virtual lines instead of virtual text (will flicker!) virt_text_win_col = nil-- position the virtual text at a fixed window column (starting from the first text column) , -- e.g. 80 to position at column 80, see `:h nvim_buf_set_extmark()` }
vim.fn.sign_define("DapBreakpoint", dap_breakpoint.error) vim.fn.sign_define("DapStopped", dap_breakpoint.stopped) vim.fn.sign_define("DapBreakpointRejected", dap_breakpoint.rejected) end
localfunctionconfig_dapui() -- dapui config local dap, dapui = require"dap", require"dapui" dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() vim.api.nvim_command("DapVirtualTextEnable") -- dapui.close("tray") end dap.listeners.before.event_terminated["dapui_config"] = function() vim.api.nvim_command("DapVirtualTextDisable") dapui.close() end dap.listeners.before.event_exited["dapui_config"] = function() vim.api.nvim_command("DapVirtualTextDisable") dapui.close() end -- for some debug adapter, terminate or exit events will no fire, use disconnect reuest instead dap.listeners.before.disconnect["dapui_config"] = function() vim.api.nvim_command("DapVirtualTextDisable") dapui.close() end -- TODO: wait dap-ui for fix temrinal layout -- the "30" of "30vsplit: doesn't work dap.defaults.fallback.terminal_win_cmd = '30vsplit new'-- this will be override by dapui end
use "kyazdani42/nvim-tree.lua"-- file explore -- Telescope use "nvim-telescope/telescope.nvim" use { "nvim-telescope/telescope-fzf-native.nvim", run = "make", } use "nvim-telescope/telescope-ui-select.nvim" use "nvim-telescope/telescope-live-grep-raw.nvim" use "BurntSushi/ripgrep"-- ripgrep
-- https://github.com/kyazdani42/nvim-tree.lua -- -- <CR> or o on the root folder will cd in the above directory -- <C-]> will cd in the directory under the cursor -- <BS> will close current opened directory or parent -- type a to add a file. Adding a directory requires leaving a leading / at the end of the path. -- you can add multiple directories by doing foo/bar/baz/f and it will add foo bar and baz directories and f as a file -- -- type r to rename a file -- type <C-r> to rename a file and omit the filename on input -- type x to add/remove file/directory to cut clipboard -- type c to add/remove file/directory to copy clipboard -- type y will copy name to system clipboard -- type Y will copy relative path to system clipboard -- type gy will copy absolute path to system clipboard -- type p to paste from clipboard. Cut clipboard has precedence over copy (will prompt for confirmation) -- type d to delete a file (will prompt for confirmation) -- type D to trash a file (configured in setup()) -- type ]c to go to next git item -- type [c to go to prev git item -- type - to navigate up to the parent directory of the current file/directory -- type s to open a file with default system application or a folder with default file manager (if you want to change the command used to do it see :h nvim-tree.setup under system_open) -- if the file is a directory, <CR> will open the directory otherwise it will open the file in the buffer near the tree -- if the file is a symlink, <CR> will follow the symlink (if the target is a file) -- <C-v> will open the file in a vertical split -- <C-x> will open the file in a horizontal split -- <C-t> will open the file in a new tab -- <Tab> will open the file as a preview (keeps the cursor in the tree) -- I will toggle visibility of hidden folders / files -- H will toggle visibility of dotfiles (files/folders starting with a .) -- R will refresh the tree -- Double left click acts like <CR> -- Double right click acts like <C-]> -- W will collapse the whole tree -- S will prompt the user to enter a path and then expands the tree to match the path -- . will enter vim command mode with the file the cursor is on -- C-k will toggle a popup with file infos about the file under the cursor -- -- following options are the default -- each of these are documented in `:help nvim-tree.OPTION_NAME` vim.g.nvim_tree_icons = { default = "", symlink = "", git = { unstaged = "", staged = "S", unmerged = "", renamed = "➜", deleted = "", untracked = "U", ignored = "◌", }, folder = { default = "", open = "", empty = "", empty_open = "", symlink = "", }, }
local status_ok, nvim_tree = pcall(require, "nvim-tree") ifnot status_ok then vim.notify("nvim-tree not found!") return end
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") ifnot config_status_ok then return end
local tree_cb = nvim_tree_config.nvim_tree_callback
-- Default configuration for builtin pickers goes here: -- picker_name = { -- picker_config_key = value, -- ... -- } -- Now the picker_config_key will be applied every time you call this -- builtin picker }, extensions = { -- Your extension configuration goes here: -- extension_name = { -- extension_config_key = value, -- }
-- fzf syntax -- Token Match type Description -- sbtrkt fuzzy-match Items that match sbtrkt -- 'wild' exact-match (quoted) Items that include wild -- ^music prefix-exact-match Items that start with music -- .mp3$ suffix-exact-match Items that end with .mp3 -- !fire inverse-exact-match Items that do not include fire -- !^music inverse-prefix-exact-match Items that do not start with music -- !.mp3$ inverse-suffix-exact-match Items that do not end with .mp3 fzf = { fuzzy = true, -- false will only do exact matching override_generic_sorter = true, -- override the generic sorter override_file_sorter = true, -- override the file sorter case_mode = "smart_case", -- or "ignore_case" or "respect_case" -- the default case_mode is "smart_case" }, ["ui-select"] = { require("telescope.themes").get_dropdown { -- even more opts } }, }, }