]> git.rmz.io Git - dotfiles.git/blob - nvim/lua/plugins/coding.lua
985ccf077398c5b9c508d3508d76f146b51d6e48
[dotfiles.git] / nvim / lua / plugins / coding.lua
1 ---@type LazyPluginSpec
2 return {
3 -- snippets
4 {
5 "L3MON4D3/LuaSnip",
6 -- disable luasnip bindings for <tab> and <s-tab>
7 dependencies = {
8 {
9 "honza/vim-snippets",
10 config = function()
11 require("luasnip.loaders.from_snipmate").lazy_load()
12 require("luasnip.loaders.from_lua").load({ paths = vim.fn.stdpath("config") .. "/lua/snippets" })
13 end,
14 },
15 },
16 keys = function()
17 return {}
18 end,
19 opts = {
20 store_selection_keys = "<Tab>",
21 },
22 },
23
24 -- auto pairs
25 {
26 "echasnovski/mini.pairs",
27 },
28
29 -- surround
30 {
31 "echasnovski/mini.surround",
32 keys = function()
33 -- HACK: use function to disable merging with LazyVim's keys definition
34 return {
35 { "ys", desc = "Add surrounding", "n" },
36 { "S", desc = "Add surrounding", "x" },
37 { "ds", desc = "Delete surrounding" },
38 { "cs", desc = "Change surrounding" },
39 { "yss", "ys_", remap = true },
40 }
41 end,
42 opts = {
43 mappings = {
44 -- TODO: this is tpope/surround like, but should consider using vim-sandwich mappings
45 -- see: :h MiniSurround-vim-surround-config
46 add = "ys",
47 delete = "ds",
48 find = "",
49 find_left = "",
50 highlight = "",
51 replace = "cs",
52 update_n_lines = "",
53 },
54 },
55 config = function(_, opts)
56 require("mini.surround").setup(opts)
57 -- remap visual
58 vim.keymap.del("x", "ys", { silent = true })
59 vim.keymap.set("x", "S", [[:<C-u>lua MiniSurround.add('visual')<CR>]], { silent = true })
60 end,
61 },
62 -- comments
63 {
64 "numToStr/Comment.nvim",
65 opts = {
66 toggler = {
67 line = "gcc",
68 block = "gbb",
69 },
70 mappings = {
71 basic = true,
72 extra = true,
73 },
74 },
75 },
76 { "JoosepAlviste/nvim-ts-context-commentstring", enabled = false },
77 { "echasnovski/mini.comment", enabled = false },
78 }