~havi/nvim.d

ef6905f64ad0e26baa87c3e922596709bb827786 — havi 2 months ago ba47fc4
feat: add `text-case-nvim`
2 files changed, 59 insertions(+), 0 deletions(-)

M lua/plugins.lua
A lua/plugins/editing-support/text-case-nvim.lua
M lua/plugins.lua => lua/plugins.lua +17 -0
@@ 400,6 400,23 @@ packer.startup(function(use)
      event = { "BufWinEnter" },
      config = [[require("plugins.editing-support.substitute-nvim").config()]],
   })
   use({
      "johmsalas/text-case.nvim",
      requires = {
         "nvim-telescope/telescope.nvim",
         "nvim-lua/plenary.nvim",
         "nvim-treesitter/nvim-treesitter",
         "folke/which-key.nvim",
      },
      after = {
         "telescope.nvim",
         "plenary.nvim",
         "nvim-treesitter",
         "which-key.nvim",
      },
      event = { "InsertEnter" },
      config = [[require("plugins.editing-support.text-case-nvim").config()]],
   })
   -- ╭────────────────────────────────────────────────────────────────────╮
   -- │                              register                              │
   -- ╰────────────────────────────────────────────────────────────────────╯

A lua/plugins/editing-support/text-case-nvim.lua => lua/plugins/editing-support/text-case-nvim.lua +42 -0
@@ 0,0 1,42 @@
-- vim: filetype=lua syntax=lua softtabstop=3 tabstop=3 shiftwidth=3 fileencoding=utf-8 smartindent autoindent expandtab
-- code: language=lua insertSpaces=true tabSize=3
-- ────────────────────────────────────────────────────────────
local pluginman = require("lib.plugin-manager")
local logger = require("lib.logger")()
local msg = ""
-- ────────────────────────────────────────────────────────────
local M = {}
function M.setup() end
function M.config()
   local to_require_map = {
      ["text-case.nvim"] = { ["textcase"] = {} },
   }
   for plugin_name, modules in pairs(to_require_map) do
      for module_name, _ in pairs(modules) do
         local plug = pluginman:load_plugin(plugin_name, module_name)
         if not plug then
            msg = string.format("module < %s > from plugin <%s> could not get loaded", module_name, plugin_name)
               -- stylua: ignore start
               if logger then logger:warn(msg)  end
            -- stylua: ignore end
         end
         to_require_map[plugin_name][module_name] = plug
      end
   end
   local text_case = to_require_map["text-case.nvim"]["text-case"]
   assert(
      text_case ~= nil,
      string.format(
         "module < %s > from plugin <%s> could not get loaded  [ %s ]",
         "text-case",
         "text-case.nvim",
         debug.getinfo(1, "S").source:sub(2)
      )
   )
   text_case.setup({})
   -- [ TODO ] => move to telescope extensions
   require("telescope").load_extension("textcase")
   vim.api.nvim_set_keymap("n", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
   vim.api.nvim_set_keymap("v", "ga.", "<cmd>TextCaseOpenTelescope<CR>", { desc = "Telescope" })
end
return M