Skip to content

Commit

Permalink
feat(plugins): add nvim-scissors plugin for snippet management
Browse files Browse the repository at this point in the history
  • Loading branch information
ecosse3 committed Feb 25, 2024
1 parent 4bd17f6 commit 0e970d9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
spell
.DS_Store
snippets
48 changes: 48 additions & 0 deletions lua/config/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,54 @@ return {
},

-- Snippets & Language & Syntax
{
"chrisgrieser/nvim-scissors",
dependencies = "nvim-telescope/telescope.nvim", -- optional
opts = {
snippetDir = vim.fn.stdpath("config") .. "/snippets",
},
keys = {
"<Leader>asa",
"<Leader>ase",
},
config = function()
local present, wk = pcall(require, "which-key")
if not present then
return
end

wk.register({
a = {
s = {
name = "Snippets",
a = { '<cmd>lua require("scissors").addNewSnippet()<CR>', 'Add new snippet' },
e = { '<cmd>lua require("scissors").editSnippet()<CR>', 'Edit snippet' },
}
}
}, {
mode = "n", -- NORMAL mode
prefix = "<leader>",
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = false, -- use `nowait` when creating keymaps
})

wk.register({
a = {
s = {
name = "Snippets",
a = { '<cmd>lua require("scissors").addNewSnippet()<CR>', 'Add new snippet from selection' },
}
}
}, {
mode = "x", -- VISUAL mode
prefix = "<leader>",
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = false, -- use `nowait` when creating keymaps
})
end
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
Expand Down

0 comments on commit 0e970d9

Please sign in to comment.