Преглед на файлове

feat: update setup tables (#3693)

* feat(nvim-tree): update setup table

* chore: lint

* fix: move option to correct place

* feat(illuminate): update setup table

* feat(which-key): update setup table

* feat(project.nvim): update setup table

* feat(gitsigns): update setup table

* chore: lint

* feat(lir): update setup table
opalmay преди 2 години
родител
ревизия
5ae42b0c44
променени са 6 файла, в които са добавени 215 реда и са изтрити 96 реда
  1. 9 16
      lua/lvim/core/gitsigns.lua
  2. 4 0
      lua/lvim/core/illuminate.lua
  3. 3 7
      lua/lvim/core/lir.lua
  4. 159 65
      lua/lvim/core/nvimtree.lua
  5. 18 6
      lua/lvim/core/project.lua
  6. 22 2
      lua/lvim/core/which-key.lua

+ 9 - 16
lua/lvim/core/gitsigns.lua

@@ -37,15 +37,14 @@ M.config = function()
           linehl = "GitSignsChangeLn",
         },
       },
+      signcolumn = true,
       numhl = false,
       linehl = false,
-      keymaps = {
-        -- Default keymap options
-        noremap = true,
-        buffer = true,
-      },
-      signcolumn = true,
       word_diff = false,
+      watch_gitdir = {
+        interval = 1000,
+        follow_files = true,
+      },
       attach_to_untracked = true,
       current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
       current_line_blame_opts = {
@@ -54,9 +53,10 @@ M.config = function()
         delay = 1000,
         ignore_whitespace = false,
       },
-      current_line_blame_formatter_opts = {
-        relative_time = false,
-      },
+      current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
+      sign_priority = 6,
+      status_formatter = nil, -- Use default
+      update_debounce = 200,
       max_file_length = 40000,
       preview_config = {
         -- Options passed to nvim_open_win
@@ -66,13 +66,6 @@ M.config = function()
         row = 0,
         col = 1,
       },
-      watch_gitdir = {
-        interval = 1000,
-        follow_files = true,
-      },
-      sign_priority = 6,
-      update_debounce = 200,
-      status_formatter = nil, -- Use default
       yadm = { enable = false },
     },
   }

+ 4 - 0
lua/lvim/core/illuminate.lua

@@ -13,6 +13,10 @@ M.config = function()
       },
       -- delay: delay in milliseconds
       delay = 120,
+      -- filetype_overrides: filetype specific overrides.
+      -- The keys are strings to represent the filetype while the values are tables that
+      -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
+      filetype_overrides = {},
       -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
       filetypes_denylist = {
         "dirvish",

+ 3 - 7
lua/lvim/core/lir.lua

@@ -18,6 +18,7 @@ M.config = function()
 
   lvim.builtin.lir = vim.tbl_extend("force", lvim.builtin.lir, {
     show_hidden_files = false,
+    ignore = {}, -- { ".DS_Store" "node_modules" } etc.
     devicons_enable = true,
     mappings = {
       ["l"] = actions.edit,
@@ -52,8 +53,8 @@ M.config = function()
         highlight_dirname = true,
       },
 
-      -- -- You can define a function that returns a table to be passed as the third
-      -- -- argument of nvim_open_win().
+      -- You can define a function that returns a table to be passed as the third
+      -- argument of nvim_open_win().
       win_opts = function()
         local width = math.floor(vim.o.columns * 0.7)
         local height = math.floor(vim.o.lines * 0.7)
@@ -61,8 +62,6 @@ M.config = function()
           border = "rounded",
           width = width,
           height = height,
-          -- row = 1,
-          -- col = math.floor((vim.o.columns - width) / 2),
         }
       end,
     },
@@ -76,9 +75,6 @@ M.config = function()
         ':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
         { noremap = true, silent = true }
       )
-
-      -- echo cwd
-      -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {})
     end,
   })
 end

+ 159 - 65
lua/lvim/core/nvimtree.lua

@@ -6,55 +6,61 @@ function M.config()
     active = true,
     on_config_done = nil,
     setup = {
-      ignore_ft_on_setup = {
-        "startify",
-        "dashboard",
-        "alpha",
-      },
       auto_reload_on_write = false,
-      hijack_directories = {
-        enable = false,
-      },
-      update_cwd = true,
-      diagnostics = {
-        enable = lvim.use_icons,
-        show_on_dirs = false,
-        icons = {
-          hint = lvim.icons.diagnostics.BoldHint,
-          info = lvim.icons.diagnostics.BoldInformation,
-          warning = lvim.icons.diagnostics.BoldWarning,
-          error = lvim.icons.diagnostics.BoldError,
-        },
-      },
-      update_focused_file = {
-        enable = true,
-        update_cwd = true,
-        ignore_list = {},
-      },
-      system_open = {
-        cmd = nil,
-        args = {},
-      },
-      git = {
-        enable = true,
-        ignore = false,
-        timeout = 200,
-      },
+      disable_netrw = false,
+      hijack_cursor = false,
+      hijack_netrw = true,
+      hijack_unnamed_buffer_when_opening = false,
+      ignore_buffer_on_setup = false,
+      open_on_setup = false,
+      open_on_setup_file = false,
+      sort_by = "name",
+      root_dirs = {},
+      prefer_startup_root = false,
+      sync_root_with_cwd = true,
+      reload_on_bufenter = false,
+      respect_buf_cwd = false,
+      on_attach = "disable",
+      remove_keymaps = false,
+      select_prompts = false,
       view = {
+        adaptive_size = false,
+        centralize_selection = false,
         width = 30,
         hide_root_folder = false,
         side = "left",
+        preserve_window_proportions = false,
+        number = false,
+        relativenumber = false,
+        signcolumn = "yes",
         mappings = {
           custom_only = false,
           list = {},
         },
-        number = false,
-        relativenumber = false,
-        signcolumn = "yes",
+        float = {
+          enable = false,
+          quit_on_focus_loss = true,
+          open_win_config = {
+            relative = "editor",
+            border = "rounded",
+            width = 30,
+            height = 30,
+            row = 1,
+            col = 1,
+          },
+        },
       },
       renderer = {
+        add_trailing = false,
+        group_empty = false,
+        highlight_git = true,
+        full_name = false,
+        highlight_opened_files = "none",
+        root_folder_label = ":t",
+        indent_width = 2,
         indent_markers = {
           enable = false,
+          inline_arrows = true,
           icons = {
             corner = "└",
             edge = "│",
@@ -64,57 +70,92 @@ function M.config()
         },
         icons = {
           webdev_colors = lvim.use_icons,
+          git_placement = "before",
+          padding = " ",
+          symlink_arrow = " ➛ ",
           show = {
-            git = lvim.use_icons,
-            folder = lvim.use_icons,
             file = lvim.use_icons,
+            folder = lvim.use_icons,
             folder_arrow = lvim.use_icons,
+            git = lvim.use_icons,
           },
           glyphs = {
             default = lvim.icons.ui.Text,
             symlink = lvim.icons.ui.FileSymlink,
-            git = {
-              deleted = lvim.icons.git.FileDeleted,
-              ignored = lvim.icons.git.FileIgnored,
-              renamed = lvim.icons.git.FileRenamed,
-              staged = lvim.icons.git.FileStaged,
-              unmerged = lvim.icons.git.FileUnmerged,
-              unstaged = lvim.icons.git.FileUnstaged,
-              untracked = lvim.icons.git.FileUntracked,
-            },
+            bookmark = lvim.icons.ui.BookMark,
             folder = {
+              arrow_closed = lvim.icons.ui.TriangleShortArrowRight,
+              arrow_open = lvim.icons.ui.TriangleShortArrowDown,
               default = lvim.icons.ui.Folder,
+              open = lvim.icons.ui.FolderOpen,
               empty = lvim.icons.ui.EmptyFolder,
               empty_open = lvim.icons.ui.EmptyFolderOpen,
-              open = lvim.icons.ui.FolderOpen,
               symlink = lvim.icons.ui.FolderSymlink,
+              symlink_open = lvim.icons.ui.FolderOpen,
+            },
+            git = {
+              unstaged = lvim.icons.git.FileUnstaged,
+              staged = lvim.icons.git.FileStaged,
+              unmerged = lvim.icons.git.FileUnmerged,
+              renamed = lvim.icons.git.FileRenamed,
+              untracked = lvim.icons.git.FileUntracked,
+              deleted = lvim.icons.git.FileDeleted,
+              ignored = lvim.icons.git.FileIgnored,
             },
           },
         },
-        highlight_git = true,
-        group_empty = false,
-        root_folder_modifier = ":t",
+        special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
+        symlink_destination = true,
+      },
+      hijack_directories = {
+        enable = false,
+        auto_open = true,
+      },
+      update_focused_file = {
+        enable = true,
+        debounce_delay = 15,
+        update_root = true,
+        ignore_list = {},
+      },
+      ignore_ft_on_setup = {
+        "startify",
+        "dashboard",
+        "alpha",
+      },
+      diagnostics = {
+        enable = lvim.use_icons,
+        show_on_dirs = false,
+        show_on_open_dirs = true,
+        debounce_delay = 50,
+        severity = {
+          min = vim.diagnostic.severity.HINT,
+          max = vim.diagnostic.severity.ERROR,
+        },
+        icons = {
+          hint = lvim.icons.diagnostics.BoldHint,
+          info = lvim.icons.diagnostics.BoldInformation,
+          warning = lvim.icons.diagnostics.BoldWarning,
+          error = lvim.icons.diagnostics.BoldError,
+        },
       },
       filters = {
         dotfiles = false,
+        git_clean = false,
+        no_buffer = false,
         custom = { "node_modules", "\\.cache" },
         exclude = {},
       },
-      trash = {
-        cmd = "trash",
-        require_confirm = true,
+      filesystem_watchers = {
+        enable = true,
+        debounce_delay = 50,
+        ignore_dirs = {},
       },
-      log = {
-        enable = false,
-        truncate = false,
-        types = {
-          all = false,
-          config = false,
-          copy_paste = false,
-          diagnostics = false,
-          git = false,
-          profile = false,
-        },
+      git = {
+        enable = true,
+        ignore = false,
+        show_on_dirs = true,
+        show_on_open_dirs = true,
+        timeout = 200,
       },
       actions = {
         use_system_clipboard = true,
@@ -123,11 +164,25 @@ function M.config()
           global = false,
           restrict_above_cwd = false,
         },
+        expand_all = {
+          max_folder_discovery = 300,
+          exclude = {},
+        },
+        file_popup = {
+          open_win_config = {
+            col = 1,
+            row = 1,
+            relative = "cursor",
+            border = "shadow",
+            style = "minimal",
+          },
+        },
         open_file = {
           quit_on_open = false,
           resize_window = false,
           window_picker = {
             enable = true,
+            picker = "default",
             chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
             exclude = {
               filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
@@ -135,6 +190,45 @@ function M.config()
             },
           },
         },
+        remove_file = {
+          close_window = true,
+        },
+      },
+      trash = {
+        cmd = "trash",
+        require_confirm = true,
+      },
+      live_filter = {
+        prefix = "[FILTER]: ",
+        always_show_folders = true,
+      },
+      tab = {
+        sync = {
+          open = false,
+          close = false,
+          ignore = {},
+        },
+      },
+      notify = {
+        threshold = vim.log.levels.INFO,
+      },
+      log = {
+        enable = false,
+        truncate = false,
+        types = {
+          all = false,
+          config = false,
+          copy_paste = false,
+          dev = false,
+          diagnostics = false,
+          git = false,
+          profile = false,
+          watcher = false,
+        },
+      },
+      system_open = {
+        cmd = nil,
+        args = {},
       },
     },
   }

+ 18 - 6
lua/lvim/core/project.lua

@@ -21,18 +21,30 @@ function M.config()
     -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
     detection_methods = { "pattern" },
 
-    ---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods
+    -- All the patterns used to detect root dir, when **"pattern"** is in
+    -- detection_methods
     patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "pom.xml" },
 
-    ---@ Show hidden files in telescope when searching for files in a project
+    -- Table of lsp clients to ignore by name
+    -- eg: { "efm", ... }
+    ignore_lsp = {},
+
+    -- Don't calculate root dir on specific directories
+    -- Ex: { "~/.cargo/*", ... }
+    exclude_dirs = {},
+
+    -- Show hidden files in telescope
     show_hidden = false,
 
-    ---@usage When set to false, you will get a message when project.nvim changes your directory.
-    -- When set to false, you will get a message when project.nvim changes your directory.
+    -- When set to false, you will get a message when project.nvim changes your
+    -- directory.
     silent_chdir = true,
 
-    ---@usage list of lsp client names to ignore when using **lsp** detection. eg: { "efm", ... }
-    ignore_lsp = {},
+    -- What scope to change the directory, valid options are
+    -- * global (default)
+    -- * tab
+    -- * win
+    scope_chdir = "global",
 
     ---@type string
     ---@usage path to store the project history for use in telescope

+ 22 - 2
lua/lvim/core/which-key.lua

@@ -8,6 +8,10 @@ M.config = function()
       plugins = {
         marks = false, -- shows a list of your marks on ' and `
         registers = false, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
+        spelling = {
+          enabled = true,
+          suggestions = 20,
+        }, -- use which-key for spelling hints
         -- the presets plugin, adds help for a bunch of default keybindings in Neovim
         -- No actual key bindings are created
         presets = {
@@ -19,7 +23,16 @@ M.config = function()
           z = false, -- bindings for folds, spelling and others prefixed with z
           g = false, -- bindings for prefixed with g
         },
-        spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints
+      },
+      -- add operators that will trigger motion and text object completion
+      -- to enable all native operators, set the preset / operators plugin above
+      operators = { gc = "Comments" },
+      key_labels = {
+        -- override the label used to display some keys. It doesn't effect WK in any other way.
+        -- For example:
+        -- ["<space>"] = "SPC",
+        -- ["<cr>"] = "RET",
+        -- ["<tab>"] = "TAB",
       },
       icons = {
         breadcrumb = lvim.icons.ui.DoubleChevronRight, -- symbol used in the command line area that shows your active key combo
@@ -43,9 +56,10 @@ M.config = function()
         spacing = 3, -- spacing between columns
         align = "left", -- align columns left, center or right
       },
-      hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
       ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
+      hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
       show_help = true, -- show help message on the command line when the popup is visible
+      show_keys = true, -- show the currently pressed key and its label as a message in the command line
       triggers = "auto", -- automatically setup triggers
       -- triggers = {"<leader>"} -- or specify a list manually
       triggers_blacklist = {
@@ -55,6 +69,12 @@ M.config = function()
         i = { "j", "k" },
         v = { "j", "k" },
       },
+      -- disable the WhichKey popup for certain buf types and file types.
+      -- Disabled by deafult for Telescope
+      disable = {
+        buftypes = {},
+        filetypes = { "TelescopePrompt" },
+      },
     },
 
     opts = {