Преглед изворни кода

feat(neovim): neovim 0.8 compatibility (#2544)

Abouzar Parvan пре 3 година
родитељ
комит
10449b4e09
5 измењених фајлова са 44 додато и 45 уклоњено
  1. 1 0
      lua/lvim/core/info.lua
  2. 0 18
      lua/lvim/core/telescope.lua
  3. 18 2
      lua/lvim/core/which-key.lua
  4. 1 1
      lua/lvim/plugins.lua
  5. 24 24
      snapshots/default.json

+ 1 - 0
lua/lvim/core/info.lua

@@ -69,6 +69,7 @@ end
 local function tbl_set_highlight(terms, highlight_group)
   for _, v in pairs(terms) do
     vim.cmd('let m=matchadd("' .. highlight_group .. '", "' .. v .. "[ ,│']\")")
+    vim.cmd('let m=matchadd("' .. highlight_group .. '", ", ' .. v .. '")')
   end
 end
 

+ 0 - 18
lua/lvim/core/telescope.lua

@@ -91,24 +91,6 @@ function M.config()
   })
 end
 
-function M.code_actions()
-  local opts = {
-    winblend = 15,
-    layout_config = {
-      prompt_position = "top",
-      width = 80,
-      height = 12,
-    },
-    borderchars = lvim.builtin.telescope.defaults.borderchars,
-    border = {},
-    previewer = false,
-    shorten_path = false,
-  }
-  local builtin = require "telescope.builtin"
-  local themes = require "telescope.themes"
-  builtin.lsp_code_actions(themes.get_dropdown(opts))
-end
-
 function M.setup()
   local previewers = require "telescope.previewers"
   local sorters = require "telescope.sorters"

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

@@ -15,7 +15,7 @@ M.config = function()
           operators = false, -- adds help for operators like d, y, ...
           motions = false, -- adds help for motions
           text_objects = false, -- help for text objects triggered after entering an operator
-          windows = true, -- default bindings on <c-w>
+          windows = false, -- default bindings on <c-w>
           nav = true, -- misc bindings to work with windows
           z = true, -- bindings for folds, spelling and others prefixed with z
           g = true, -- bindings for prefixed with g
@@ -27,19 +27,35 @@ M.config = function()
         separator = "➜", -- symbol used between a key and it's label
         group = "+", -- symbol prepended to a group
       },
+      popup_mappings = {
+        scroll_down = "<c-d>", -- binding to scroll down inside the popup
+        scroll_up = "<c-u>", -- binding to scroll up inside the popup
+      },
       window = {
         border = "single", -- none, single, double, shadow
         position = "bottom", -- bottom, top
         margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
         padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
+        winblend = 0,
       },
       layout = {
         height = { min = 4, max = 25 }, -- min and max height of the columns
         width = { min = 20, max = 50 }, -- min and max width of the columns
         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
       show_help = true, -- show help message on the command line when the popup is visible
+      triggers = "auto", -- automatically setup triggers
+      -- triggers = {"<leader>"} -- or specify a list manually
+      triggers_blacklist = {
+        -- list of mode / prefixes that should never be hooked by WhichKey
+        -- this is mostly relevant for key maps that start with a native binding
+        -- most people should not need to change this
+        i = { "j", "k" },
+        v = { "j", "k" },
+      },
     },
 
     opts = {
@@ -140,7 +156,7 @@ M.config = function()
 
       l = {
         name = "LSP",
-        a = { "<cmd>lua require('lvim.core.telescope').code_actions()<cr>", "Code Action" },
+        a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
         d = { "<cmd>Telescope diagnostics bufnr=0 theme=get_ivy<cr>", "Buffer Diagnostics" },
         w = { "<cmd>Telescope diagnostics<cr>", "Diagnostics" },
         f = { "<cmd>lua vim.lsp.buf.formatting()<cr>", "Format" },

+ 1 - 1
lua/lvim/plugins.lua

@@ -148,7 +148,7 @@ local core_plugins = {
 
   -- Whichkey
   {
-    "folke/which-key.nvim",
+    "max397574/which-key.nvim",
     config = function()
       require("lvim.core.which-key").setup()
     end,

+ 24 - 24
snapshots/default.json

@@ -1,6 +1,6 @@
 {
   "Comment.nvim": {
-    "commit": "8f37791"
+    "commit": "cb0de89"
   },
   "DAPInstall.nvim": {
     "commit": "bbda2b0"
@@ -9,10 +9,10 @@
     "commit": "1bfb32e"
   },
   "LuaSnip": {
-    "commit": "6b67cb1"
+    "commit": "1dbafec"
   },
   "alpha-nvim": {
-    "commit": "6655228"
+    "commit": "4781fcf"
   },
   "bufferline.nvim": {
     "commit": "f02e19b"
@@ -21,61 +21,61 @@
     "commit": "d66c4c2"
   },
   "cmp-nvim-lsp": {
-    "commit": "ebdfc20"
+    "commit": "e6b5feb"
   },
   "cmp-path": {
     "commit": "466b6b8"
   },
   "cmp_luasnip": {
-    "commit": "b108297"
+    "commit": "a9de941"
   },
   "friendly-snippets": {
-    "commit": "5fd8b92"
+    "commit": "6e0881a"
   },
   "gitsigns.nvim": {
-    "commit": "f83a2e1"
+    "commit": "b800663"
   },
   "lua-dev.nvim": {
-    "commit": "4717c36"
+    "commit": "54149d1"
   },
   "lualine.nvim": {
-    "commit": "18a07f7"
+    "commit": "030eb62"
   },
   "nlsp-settings.nvim": {
     "commit": "fc3007e"
   },
   "null-ls.nvim": {
-    "commit": "d871b41"
+    "commit": "3dbded7"
   },
   "nvim-autopairs": {
-    "commit": "38d486a"
+    "commit": "63779ea"
   },
   "nvim-cmp": {
-    "commit": "433af3d"
+    "commit": "baa8646"
   },
   "nvim-dap": {
     "commit": "d6d8317"
   },
   "nvim-lsp-installer": {
-    "commit": "090c8a8"
+    "commit": "3068a47"
   },
   "nvim-lspconfig": {
-    "commit": "86df1c8"
+    "commit": "21102d5"
   },
   "nvim-notify": {
-    "commit": "2c8f744"
+    "commit": "ebe78be"
   },
   "nvim-tree.lua": {
-    "commit": "fd2332a"
+    "commit": "483f155"
   },
   "nvim-treesitter": {
-    "commit": "bd2f5d7"
+    "commit": "4067351"
   },
   "nvim-ts-context-commentstring": {
     "commit": "8834375"
   },
   "nvim-web-devicons": {
-    "commit": "4febe73"
+    "commit": "bdd4342"
   },
   "onedarker.nvim": {
     "commit": "b00dd21"
@@ -90,24 +90,24 @@
     "commit": "b7404d3"
   },
   "project.nvim": {
-    "commit": "cef52b8"
+    "commit": "612443b"
   },
   "schemastore.nvim": {
-    "commit": "be624ba"
+    "commit": "57bb4e1"
   },
   "structlog.nvim": {
     "commit": "6f1403a"
   },
   "telescope-fzf-native.nvim": {
-    "commit": "8ec164b"
+    "commit": "281b07a"
   },
   "telescope.nvim": {
-    "commit": "92019d5"
+    "commit": "544c5ee"
   },
   "toggleterm.nvim": {
-    "commit": "dca8f4d"
+    "commit": "6c7f5db"
   },
   "which-key.nvim": {
-    "commit": "a3c19ec"
+    "commit": "03de564"
   }
 }