diff --git a/init.lua b/init.lua index 4942b55..f033e43 100644 --- a/init.lua +++ b/init.lua @@ -45,6 +45,53 @@ vim.g.clipboard = { }, } +if vim.g.vscode then + require("lazy").setup({ + { + "terrortylor/nvim-comment", + config = function() + require("nvim_comment").setup() + end + }, + { + "kylechui/nvim-surround", + version = "*", + event = "VeryLazy", + opts = {} + }, + }) + local vscode = require('vscode') + + local opts = { noremap = true, silent = true } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', function() + vscode.call("editor.action.revealDefinition") + end, opts) + vim.keymap.set('n', '', function() + vscode.call("workbench.action.closeActiveEditor") + end, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'k', vim.diagnostic.open_float, opts) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) + vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) + vim.keymap.set('n', 'ca', function() + vscode.call("editor.action.quickFix") + end + , opts) + return +end + ------------------------------------------------------------------------------- -- Plugins ------------------------------------------------------------------------------- @@ -419,18 +466,18 @@ require 'lspconfig'.gdscript.setup {} require 'lspconfig'.rust_analyzer.setup({ settings = { ['rust-analyzer'] = { - cargo = { - target = "xtensa-esp32-none-elf", - extraEnv = { - RUSTUP_TOOLCHAIN = "esp", - } - }, - check = { - allTargets = false, - extraEnv = { - RUSTUP_TOOLCHAIN = "esp" - } - } + -- cargo = { + -- target = "xtensa-esp32-none-elf", + -- extraEnv = { + -- RUSTUP_TOOLCHAIN = "esp", + -- } + -- }, + -- check = { + -- allTargets = false, + -- extraEnv = { + -- RUSTUP_TOOLCHAIN = "esp" + -- } + -- } } } })