diff --git a/hm-imports/nvim/config/lua/keybindings.lua b/hm-imports/nvim/config/lua/keybindings.lua index 49bf2785..19de72e6 100644 --- a/hm-imports/nvim/config/lua/keybindings.lua +++ b/hm-imports/nvim/config/lua/keybindings.lua @@ -47,10 +47,17 @@ map { 'n', '', ':NnnExplorer %:p:h', noremap = true, silent = tr -- plugins - terminal map {"n", "gg", "lua _lazygit_toggle()", {noremap = true, silent = true}} -map {"n", "gp", "lua _pipeline_toggle()", {noremap = true, silent = true}} +map {"n", "gl", "lua _glab_toggle()", {noremap = true, silent = true}} +map {"n", "gh", "lua _ghub_toggle()", {noremap = true, silent = true}} -- diagnostic map {"n", "e", "lua require\'telescope.builtin\'.lsp_diagnostics{}", { noremap = true, silent = true}} map {"n", "q", "lua vim.diagnostic.setloclist()", { noremap = true, silent = true}} map {"n", "]g", "lua vim.diagnostic.goto_next()", { noremap = true, silent = true}} map {"n", "[g", "lua vim.diagnostic.goto_prev()", { noremap = true, silent = true}} +-- dap +map {"n", "db", "lua require'dap'.toggle_breakpoint()", { noremap = true, silent = true}} +map {"n", "du", "lua require'dapui'.toggle()", { noremap = true, silent = true}} +map {"n", "dc", "lua require'dap'.continue()", { noremap = true, silent = true}} +map {"n", "dr", "lua require'dap'.repl.open()", { noremap = true, silent = true}} +map {"n", "di", "lua require'dap'.step_into()", { noremap = true, silent = true}} diff --git a/hm-imports/nvim/config/lua/plugin/dap.lua b/hm-imports/nvim/config/lua/plugin/dap.lua new file mode 100644 index 00000000..e5a4cf7f --- /dev/null +++ b/hm-imports/nvim/config/lua/plugin/dap.lua @@ -0,0 +1,25 @@ +local dap = require('dap') +dap.adapters.coreclr = { + type = 'executable', + command = '/nix/var/nix/profiles/per-user/ragon/home-manager/home-path/bin/netcoredbg', -- TODO this is a gross hack, please fix + args = {'--interpreter=vscode'} +} +dap.configurations.cs = { + { + type = "coreclr", + name = "launch - netcoredbg", + request = "launch", + program = function() + return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file') + end, + }, + { + type = "coreclr", + name = "attach - netcoredbg", + mode = "local", + request = "attach", + processId = require("dap.utils").pick_process, + }, +} + +require'dapui'.setup {} diff --git a/hm-imports/nvim/config/lua/plugin/lsp.lua b/hm-imports/nvim/config/lua/plugin/lsp.lua index 0328e944..bf974765 100644 --- a/hm-imports/nvim/config/lua/plugin/lsp.lua +++ b/hm-imports/nvim/config/lua/plugin/lsp.lua @@ -2,28 +2,28 @@ local lspconfig = require 'lspconfig' local capabilities = require('cmp_nvim_lsp').default_capabilities() -- lsp keymaps local lsp_attach_keymappings = { - ['gD'] = 'vim.lsp.buf.declaration()', - ['gd'] = 'vim.lsp.buf.definition()', - ['K'] = 'vim.lsp.buf.hover()', - ['gi'] = 'vim.lsp.buf.implementation()', - [''] = 'vim.lsp.buf.signature_help()', - ['wa'] = 'vim.lsp.buf.add_workspace_folder()', - ['wr'] = 'vim.lsp.buf.remove_workspace_folder()', - ['ws'] = 'vim.lsp.buf.workspace_symbol()', - ['wl'] = 'print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', - ['D'] = 'vim.lsp.buf.type_definition()', - ['rn'] = 'vim.lsp.buf.rename()', - ['ca'] = 'vim.lsp.buf.code_action()', - ['gr'] = 'vim.lsp.buf.references()', - ['f'] = 'vim.lsp.buf.format()' + ['gD'] = 'vim.lsp.buf.declaration()', + ['gd'] = 'vim.lsp.buf.definition()', + ['K'] = 'vim.lsp.buf.hover()', + ['gi'] = 'require\'telescope.builtin\'.lsp_implementations()', + ['k'] = 'vim.lsp.buf.signature_help()', + ['wa'] = 'vim.lsp.buf.add_workspace_folder()', + ['wr'] = 'vim.lsp.buf.remove_workspace_folder()', + ['ws'] = 'require\'telescope.builtin\'.lsp_workspace_symbols()', + ['wl'] = 'print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', + ['D'] = 'require\'telescope.builtin\'.lsp_type_definitions()', + ['rn'] = 'vim.lsp.buf.rename()', + ['ca'] = 'vim.lsp.buf.code_action()', + ['gr'] = 'require\'telescope.builtin\'.lsp_references()', + ['f'] = 'vim.lsp.buf.format()' } local buf_nnoremap_lua = function(bufnr, keys, command) - vim.api.nvim_buf_set_keymap(bufnr, 'n', keys, 'lua ' .. command .. '', { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap(bufnr, 'n', keys, 'lua ' .. command .. '', { noremap = true, silent = true }) end local on_lsp_attach = function(_, bufnr) - -- Enable completion triggered by : - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - for key, cmd in pairs(lsp_attach_keymappings) do buf_nnoremap_lua(bufnr, key, cmd) end + -- Enable completion triggered by : + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + for key, cmd in pairs(lsp_attach_keymappings) do buf_nnoremap_lua(bufnr, key, cmd) end end lspconfig.gopls.setup { capabilities = capabilities, on_attach = on_lsp_attach } @@ -33,15 +33,15 @@ lspconfig.nil_ls.setup { capabilities = capabilities, on_attach = on_lsp_attach lspconfig.terraformls.setup { capabilities = capabilities, on_attach = on_lsp_attach } lspconfig.tsserver.setup { capabilities = capabilities, on_attach = on_lsp_attach } lspconfig.vimls.setup { - capabilities = capabilities, - on_attach = on_lsp_attach, - isNeovim = true, + capabilities = capabilities, + on_attach = on_lsp_attach, + isNeovim = true, } lspconfig.csharp_ls.setup { - capabilities = capabilities, - on_attach = on_lsp_attach, - cmd = {vim.env.HOME .. "/.dotnet/tools/csharp-ls"}, + capabilities = capabilities, + on_attach = on_lsp_attach, + cmd = { vim.env.HOME .. "/.dotnet/tools/csharp-ls" }, } lspconfig.ltex.setup { capabilities = capabilities, on_attach = on_lsp_attach } -- start vscode included language servers @@ -51,52 +51,54 @@ lspconfig.cssls.setup { capabilities = capabilities, on_attach = on_lsp_attach } lspconfig.jsonls.setup { capabilities = capabilities, on_attach = on_lsp_attach } -- end vscode included language servers lspconfig.texlab.setup { capabilities = capabilities, on_attach = on_lsp_attach, settings = { texlab = { - build = { - executable = "tectonic", - args = { "%f", "--keep-logs", "--synctex"}, - onSave = true, - forwardSearchAfter = true, - }, - chktex = { onOpenAndSave = true, }, - forwardSearch = { - executable = "/Applications/Skim.app/Contents/SharedSupport/displayline", - args = {"-r", "-d", "%l","%p","%f"}, - }, -}} } + build = { + executable = "tectonic", + args = { "%f", "--keep-logs", "--synctex" }, + onSave = true, + forwardSearchAfter = true, + }, + chktex = { onOpenAndSave = true, }, + forwardSearch = { + executable = "/Applications/Skim.app/Contents/SharedSupport/displayline", + args = { "-r", "-d", "%l", "%p", "%f" }, + }, +} } } lspconfig.sumneko_lua.setup { - capabilities = capabilities, on_attach = on_lsp_attach, - settings = { - Lua = { - runtime = { - version = 'LuaJIT' - }, - diagnostics = { globals = { 'vim' } }, - workspace = { - -- Make the LSP aware of Neovim runtime files: - checkThirdParty = false, - library = vim.api.nvim_get_runtime_file('', true) - }, - format = { - enable = true, - defaultConfig = { - indent_style = 'space', - indent_size = '2', - } - }, + capabilities = capabilities, on_attach = on_lsp_attach, + settings = { + Lua = { + runtime = { + version = 'LuaJIT' + }, + diagnostics = { globals = { 'vim' } }, + workspace = { + -- Make the LSP aware of Neovim runtime files: + checkThirdParty = false, + library = vim.api.nvim_get_runtime_file('', true) + }, + format = { + enable = true, + defaultConfig = { + indent_style = 'space', + indent_size = '2', } + }, } + } } local rt = require("rust-tools") rt.setup({ - tools = { - inlay_hints = { - auto = true, - }, - }, - server = { - capabilities = capabilities, on_attach = on_lsp_attach, + tools = { + inlay_hints = { + auto = true, }, + }, + server = { + capabilities = capabilities, on_attach = on_lsp_attach, + }, }) +local ft = require('flutter-tools') +ft.setup {} diff --git a/hm-imports/nvim/config/lua/plugin/telescope.lua b/hm-imports/nvim/config/lua/plugin/telescope.lua index 9b86a9e1..adb3f7c4 100644 --- a/hm-imports/nvim/config/lua/plugin/telescope.lua +++ b/hm-imports/nvim/config/lua/plugin/telescope.lua @@ -8,4 +8,5 @@ telescope.setup { } } } + telescope.load_extension('ui-select') diff --git a/hm-imports/nvim/config/lua/plugin/terminal.lua b/hm-imports/nvim/config/lua/plugin/terminal.lua index 675b815b..9dec0789 100644 --- a/hm-imports/nvim/config/lua/plugin/terminal.lua +++ b/hm-imports/nvim/config/lua/plugin/terminal.lua @@ -14,12 +14,22 @@ function _lazygit_toggle() lazygit:toggle() end -local pipeline = Terminal:new { +local glab = Terminal:new { cmd = "glab ci view", hidden = true, direction = 'float' } -function _pipeline_toggle() - pipeline:toggle() +function _glab_toggle() + glab:toggle() +end + +local ghub = Terminal:new { + cmd = "gh run view", + hidden = true, + direction = 'float' +} + +function _ghub_toggle() + ghub:toggle() end diff --git a/hm-imports/nvim/config/nvim.lua b/hm-imports/nvim/config/nvim.lua index 4bab0d9b..8c47223f 100644 --- a/hm-imports/nvim/config/nvim.lua +++ b/hm-imports/nvim/config/nvim.lua @@ -51,5 +51,6 @@ require('plugin.noice') require('plugin.telescope') require('plugin.cmp') require('plugin.lsp') +require('plugin.dap') require('plugin.lualine') require('plugin.gitsigns') diff --git a/hm-imports/nvim/default.nix b/hm-imports/nvim/default.nix index 9e01154e..5d234faf 100644 --- a/hm-imports/nvim/default.nix +++ b/hm-imports/nvim/default.nix @@ -6,6 +6,7 @@ # embedded terminal lazygit glab + gh # language servers nil # nix @@ -26,7 +27,8 @@ rustc rustfmt rust-analyzer - + # c# debugging + (pkgs.writeShellScriptBin "netcoredbg" ''exec ${pkgs.unstable.netcoredbg}/bin/netcoredbg "$@"'') # don't fill $path with dlls # other stuff neovim-remote @@ -79,8 +81,11 @@ # completion nvim-lspconfig # lsp - vimspector # dap + nvim-dap # dap + nvim-dap-ui # dap stuffzies + nvim-dap-go pkgs.unstable.vimPlugins.rust-tools-nvim # rust special sauce + pkgs.unstable.vimPlugins.flutter-tools-nvim # completion - nvim-cmp cmp-nvim-lsp cmp-buffer @@ -91,6 +96,7 @@ # completion-snippets luasnip cmp_luasnip + friendly-snippets # some premade snippets toggleterm-nvim # embed terminals (for lazygit,...)