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

feat(luasnip): add virtual text to signal current insert point

Danielo Rodriguez преди 2 години
родител
ревизия
ca73f0ae11
променени са 2 файла, в които са добавени 18 реда и са изтрити 0 реда
  1. 6 0
      lua/lvim/config/init.lua
  2. 12 0
      lua/lvim/plugins.lua

+ 6 - 0
lua/lvim/config/init.lua

@@ -33,6 +33,12 @@ function M:init()
     sources = {
       friendly_snippets = true,
     },
+    config = {
+      updateevents = "TextChanged,TextChangedI",
+      ext_opts = {
+        -- Will be populated within config function
+      },
+    },
   }
 
   lvim.builtin.bigfile = {

+ 12 - 0
lua/lvim/plugins.lua

@@ -90,6 +90,18 @@ local core_plugins = {
         paths = paths,
       }
       require("luasnip.loaders.from_snipmate").lazy_load()
+      local luasnip = require "luasnip"
+      local types = require "luasnip.util.types"
+
+      local ext_opts = {
+        [types.insertNode] = {
+          active = {
+            virt_text = { { "<-- snip insert", "BufferInactiveIndex" } },
+          },
+        },
+      }
+      vim.tbl_deep_extend(lvim.builtin.config.ext_opts, ext_opts)
+      luasnip.config.set_config(lvim.builtin.luasnip.config)
     end,
     event = "InsertEnter",
     dependencies = {