summaryrefslogtreecommitdiff
path: root/lua/config/plugins/extra.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/config/plugins/extra.lua')
-rw-r--r--lua/config/plugins/extra.lua69
1 files changed, 51 insertions, 18 deletions
diff --git a/lua/config/plugins/extra.lua b/lua/config/plugins/extra.lua
index 2f7bf9c..19a7042 100644
--- a/lua/config/plugins/extra.lua
+++ b/lua/config/plugins/extra.lua
@@ -11,29 +11,19 @@ return {
-- Keybindings would be a lot better as <localleader>
local map = vim.keymap.set
- -- NOTE: this required for "repeatable" commands
- -- I'd like to use `2<localleader>cn` for example (and that doesn't work out of box)
- local map_rep = function(modes, bind, action)
- map(modes, bind, function()
- for _ = 1, vim.v.count1, 1 do
- action()
- end
- end)
- end
-
-- stylua: ignore start
map({ "n", "x" }, "<localleader><localleader>", function() mc.clearCursors() end)
map({ "n", "x" }, "<localleader>R", function() mc.restoreCursors() end)
- map_rep({ "n", "x" }, "<localleader>j", function() mc.lineAddCursor(1) end)
- map_rep({ "n", "x" }, "<localleader>k", function() mc.lineAddCursor(-1) end)
- map_rep({ "n", "x" }, "<localleader>J", function() mc.lineSkipCursor(1) end)
- map_rep({ "n", "x" }, "<localleader>K", function() mc.lineSkipCursor(-1) end)
+ map({ "n", "x" }, "<localleader>j", function() mc.lineAddCursor(1) end)
+ map({ "n", "x" }, "<localleader>k", function() mc.lineAddCursor(-1) end)
+ map({ "n", "x" }, "<localleader>J", function() mc.lineSkipCursor(1) end)
+ map({ "n", "x" }, "<localleader>K", function() mc.lineSkipCursor(-1) end)
- map_rep({ "n", "x" }, "<localleader>cn", function() mc.matchAddCursor(1) end)
- map_rep({ "n", "x" }, "<localleader>cN", function() mc.matchAddCursor(-1) end)
- map_rep({ "n", "x" }, "<localleader>cs", function() mc.matchSkipCursor(1) end)
- map_rep({ "n", "x" }, "<localleader>cS", function() mc.matchSkipCursor(-1) end)
+ map({ "n", "x" }, "<localleader>cn", function() mc.matchAddCursor(1) end)
+ map({ "n", "x" }, "<localleader>cN", function() mc.matchAddCursor(-1) end)
+ map({ "n", "x" }, "<localleader>cs", function() mc.matchSkipCursor(1) end)
+ map({ "n", "x" }, "<localleader>cS", function() mc.matchSkipCursor(-1) end)
map({ "n", "x" }, "<localleader>cM", mc.matchAllAddCursors)
map("x", "<localleader>m", mc.matchCursors)
map("x", "<localleader>s", mc.splitCursors)
@@ -108,6 +98,9 @@ return {
{ "<leader>gh", group = "hunk" },
{ "<leader>S", group = "surround" },
},
+
+ { "<leader>x", group = "extra" },
+ { "<leader>xS", group = "supercollider" },
})
end,
},
@@ -122,4 +115,44 @@ return {
{ "-", "<CMD>Oil<CR>", { desc = "Open parent directory" } },
},
},
+ {
+ "scnvim",
+ -- NOTE: this plugin is broken when try to lazyload
+ lazy = false,
+ after = function(_)
+ local scnvim = require("scnvim")
+ local map = scnvim.map
+ local map_expr = scnvim.map_expr
+
+ scnvim.setup({
+ ensure_installed = true,
+ keymaps = {
+ ["<M-CR>"] = {
+ map("editor.send_block", { "i", "n" }),
+ map("editor.send_selection", "x"),
+ },
+ ["<C-CR>"] = map("editor.send_line", { "i", "n" }),
+ ["<C-k>"] = map("signature.show", { "i", "n" }),
+
+ ["<F12>"] = map("sclang.hard_stop", { "i", "n", "x" }),
+ },
+ })
+
+ vim.api.nvim_create_augroup("my.scnvim", { clear = true })
+ vim.api.nvim_create_autocmd("InsertEnter", {
+ pattern = "*.scd",
+ group = "my.scnvim",
+ once = true,
+ callback = function()
+ -- Loading snippets to LuaSnip
+ require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets())
+ end,
+ })
+ end,
+ keys = {
+ { "<leader>xSs", "<CMD>SCNvimStart<CR>", desc = "Start SuperCollider" },
+ { "<leader>xSS", "<CMD>SCNvimStop<CR>", desc = "Stop SuperCollider" },
+ { "<leader>xSr", "<CMD>SCNvimRecompile<CR>", desc = "Recompile SuperCollider sclang" },
+ },
+ },
}