summaryrefslogtreecommitdiff
path: root/lua/config/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lua/config/plugins')
-rw-r--r--lua/config/plugins/completion.lua9
-rw-r--r--lua/config/plugins/extra.lua69
-rw-r--r--lua/config/plugins/formatting.lua2
-rw-r--r--lua/config/plugins/init.lua1
-rw-r--r--lua/config/plugins/snippets.lua13
-rw-r--r--lua/config/plugins/ui.lua28
6 files changed, 103 insertions, 19 deletions
diff --git a/lua/config/plugins/completion.lua b/lua/config/plugins/completion.lua
index 2b7e69d..7acef49 100644
--- a/lua/config/plugins/completion.lua
+++ b/lua/config/plugins/completion.lua
@@ -37,6 +37,13 @@ return {
},
completion = {
+ list = {
+ selection = {
+ auto_insert = false,
+ preselect = false,
+ },
+ },
+
documentation = {
auto_show = true,
auto_show_delay_ms = 500,
@@ -45,6 +52,8 @@ return {
ghost_text = { enabled = true },
},
+ snippets = { preset = "luasnip" },
+
cmdline = {
completion = {
ghost_text = { enabled = false },
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" },
+ },
+ },
}
diff --git a/lua/config/plugins/formatting.lua b/lua/config/plugins/formatting.lua
index 98bbe06..93b7db7 100644
--- a/lua/config/plugins/formatting.lua
+++ b/lua/config/plugins/formatting.lua
@@ -10,6 +10,8 @@ return {
lua = { "stylua" },
nix = { "nixfmt" },
rust = { "rustfmt", lsp_format = "fallback" },
+ verilog = { "verible" },
+ systemverilog = { "verible" },
html = { "prettierd" },
htmlangular = { "prettierd" },
diff --git a/lua/config/plugins/init.lua b/lua/config/plugins/init.lua
index f7c44fd..3c372a0 100644
--- a/lua/config/plugins/init.lua
+++ b/lua/config/plugins/init.lua
@@ -54,6 +54,7 @@ require("lze").load({
{ import = "config.plugins.treesitter" },
{ import = "config.plugins.mini" },
{ import = "config.plugins.completion" },
+ { import = "config.plugins.snippets" },
{ import = "config.plugins.formatting" },
{ import = "config.plugins.git" },
{ import = "config.plugins.debug" },
diff --git a/lua/config/plugins/snippets.lua b/lua/config/plugins/snippets.lua
new file mode 100644
index 0000000..5a37b0c
--- /dev/null
+++ b/lua/config/plugins/snippets.lua
@@ -0,0 +1,13 @@
+return {
+ {
+ "luasnip",
+ dep_of = { "blink.cmp" },
+ load = function(name)
+ vim.cmd.packadd(name)
+ vim.cmd.packadd("friendly-snippets")
+ end,
+ after = function(_)
+ require("luasnip.loaders.from_vscode").lazy_load()
+ end,
+ },
+}
diff --git a/lua/config/plugins/ui.lua b/lua/config/plugins/ui.lua
index e552f0e..593efc7 100644
--- a/lua/config/plugins/ui.lua
+++ b/lua/config/plugins/ui.lua
@@ -4,7 +4,7 @@ return {
event = "DeferredUIEnter",
after = function(_)
require("bufferline").setup({
- highlights = require("catppuccin.groups.integrations.bufferline").get(),
+ highlights = require("catppuccin.special.bufferline").get_theme(),
})
end,
},
@@ -17,6 +17,32 @@ return {
options = {
theme = "catppuccin",
},
+
+ sections = {
+ lualine_a = { "mode" },
+ lualine_b = { "branch", "diff", "diagnostics" },
+ lualine_c = { "filename" },
+
+ lualine_x = {
+ -- SuperCollider status bar (server status)
+ {
+ function()
+ -- NOTE: for some reason LuaLS doesn't find `gsub` in string o.O
+ ---@diagnostic disable-next-line
+ return require("scnvim.statusline").get_server_status():gsub("%%", "%%%%")
+ end,
+ cond = function()
+ return vim.bo.filetype == "supercollider"
+ end,
+ },
+
+ "filetype",
+ "encoding",
+ "fileformat",
+ },
+ lualine_y = { "progress" },
+ lualine_z = { "location" },
+ },
})
end,
},