diff options
Diffstat (limited to 'lua/config')
| -rw-r--r-- | lua/config/lsp.lua | 39 | ||||
| -rw-r--r-- | lua/config/options.lua | 3 | ||||
| -rw-r--r-- | lua/config/plugins/completion.lua | 9 | ||||
| -rw-r--r-- | lua/config/plugins/extra.lua | 69 | ||||
| -rw-r--r-- | lua/config/plugins/formatting.lua | 2 | ||||
| -rw-r--r-- | lua/config/plugins/init.lua | 1 | ||||
| -rw-r--r-- | lua/config/plugins/snippets.lua | 13 | ||||
| -rw-r--r-- | lua/config/plugins/ui.lua | 28 |
8 files changed, 145 insertions, 19 deletions
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 413e06f..71f3dba 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -6,12 +6,20 @@ vim.diagnostic.config({ }) vim.lsp.enable({ + "clangd", + "lua-language-server", "nixd", + "basedpyright", + + "qmlls", + "rust-analyzer", + "verible", + "angular-language-server", "biome", "typescript-language-server", @@ -27,3 +35,34 @@ vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { vim.treesitter.start(nil, "angular") end, }) + +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local buffer = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client then + -- Keybindings + local map = vim.keymap.set + local opts = { buffer = buffer } + + map("n", "<leader>cr", vim.lsp.buf.rename, opts) + map("n", "gd", vim.lsp.buf.definition, opts) + map("n", "gD", vim.lsp.buf.declaration, opts) + map("n", "gI", vim.lsp.buf.implementation, opts) + map("n", "gy", vim.lsp.buf.type_definition, opts) + map("n", "gr", vim.lsp.buf.references, opts) + + map("n", "K", function() + return vim.lsp.buf.hover() + end, opts) + + map("n", "gK", function() + return vim.lsp.buf.signature_help() + end, opts) + + map({ "n", "i" }, "<C-;>", function() + return vim.lsp.buf.signature_help() + end, opts) + end + end, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua index 43bf110..6208be7 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -60,6 +60,9 @@ map("n", "N", "Nzzzv", { desc = "Previous Search Result" }) -- Reset search highlight on ESC map("n", "<Esc>", "<cmd>nohlsearch<CR>", { desc = "Reset search highlight" }) +-- Window related binds +map("n", "<C-w>d", "<C-w>c", { desc = "[D]elete [W]indow" }) + -- Buffer related binds map("n", "<leader>bd", "<cmd>bdelete<CR>", { desc = "[D]elete [B]uffer" }) 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, }, |
