diff --git a/bash/.bashrc b/bash/.bashrc index 2c6d6b2..876898a 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -43,3 +43,6 @@ export PATH="$HOME/.local/bin:$PATH" # Nix export PATH="$HOME/.nix-profile/bin:$PATH" + +# Rust +export PATH="$HOME/.cargo/bin/:$PATH" diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 3dd2d89..49d4214 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,35 +1,36 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, - "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, - "haskell-tools.nvim": { "branch": "master", "commit": "217cb7958ebbebf360f7c43efd5129e66d748042" }, - "kanagawa.nvim": { "branch": "master", "commit": "bfa818c7bf6259152f1d89cf9fbfba3554c93695" }, - "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, - "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" }, - "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, - "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, - "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, + "gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" }, + "haskell-tools.nvim": { "branch": "master", "commit": "35ac2d964b004d0d0e0cc9bab039b70be36ca0f7" }, + "kanagawa.nvim": { "branch": "master", "commit": "860e4f80df71221d18bf2cd9ef1deb4d364274d2" }, + "lazy.nvim": { "branch": "main", "commit": "d3974346b6cef2116c8e7b08423256a834cb7cbc" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" }, + "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, + "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, + "nvim-cmp": { "branch": "main", "commit": "cd2cf0c124d3de577fb5449746568ee8e601afc8" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, - "nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" }, - "nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" }, - "nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" }, - "nvim-lspconfig": { "branch": "master", "commit": "9553725789be682ecd945a527ec552e489ea8534" }, + "nvim-dap": { "branch": "master", "commit": "615a1b2046e1eaf7995e0ba8e8a65f344201349d" }, + "nvim-dap-ui": { "branch": "master", "commit": "5934302d63d1ede12c0b22b6f23518bb183fc972" }, + "nvim-lspconfig": { "branch": "master", "commit": "a3d9395455f2b2e3b50a0b0f37b8b4c23683f44a" }, + "nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, - "nvim-treesitter": { "branch": "master", "commit": "a47540fd737eb5c03ee21ee69eb8134ce5568fb6" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "95933e762e28f9d38b572d65e7e4da9d2f4d90cb" }, - "nvim-web-devicons": { "branch": "master", "commit": "4adea17610d140a99c313e3f79a9dc01825d59ae" }, - "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "nvim-surround": { "branch": "main", "commit": "6d0dc3dbb557bcc6a024969da461df4ba803fc48" }, + "nvim-treesitter": { "branch": "master", "commit": "fa1515b015ab9894aa9866410b1c23e03d2be4af" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "dfa4178c0cadb44f687603d72ad0908474c28dd9" }, + "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, + "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, "rustaceanvim": { "branch": "master", "commit": "bc8c4b8f7606d5b7c067cd8369e25c1a7ff77bd0" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, - "vscode-js-debug": { "branch": "main", "commit": "19cd30297dc05b7a7fa9d1d02a8e9dfc1749362e" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, + "trouble.nvim": { "branch": "dev", "commit": "b4b9a11b3578d510963f6f681fecb4631ae992c3" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index 29a9fb7..98390ef 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -69,6 +69,16 @@ do vim.lsp.buf.format({ async = true }) end + local function format_selection() + vim.lsp.buf.format({ + async = true, + range = { + ["start"] = vim.api.nvim_buf_get_mark(0, "<"), + ["end"] = vim.api.nvim_buf_get_mark(0, ">"), + } + }) + end + local function workspaces_list() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end @@ -84,6 +94,7 @@ do n 'lr' (vim.lsp.buf.rename) {'LSP: rename identifier', buffer} nv 'la' (vim.lsp.buf.code_action) {'LSP: code actions', buffer} n 'lf' (format) {'LSP: format file', buffer} + v 'lf' (format_selection) {'LSP: format file', buffer} n 'wa' (vim.lsp.buf.add_workspace_folder) {'LSP: add workspace folder', buffer} n 'wr' (vim.lsp.buf.remove_workspace_folder) {'LSP: remove workspace folder', buffer} n 'wl' (workspaces_list) {'LSP: list workspace folders', buffer} diff --git a/nvim/lua/config/plugins.lua b/nvim/lua/config/plugins.lua index 220b922..a4562f0 100644 --- a/nvim/lua/config/plugins.lua +++ b/nvim/lua/config/plugins.lua @@ -73,10 +73,22 @@ return { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects' + -- 'nvim-treesitter/nvim-treesitter-textobjects' }, config = function() local configs = require 'nvim-treesitter.configs' + local parsers = require('nvim-treesitter.parsers').get_parser_configs() + + -- parsers['rescript'] = { + -- install_info = { + -- url = 'https://github.com/rescript-lang/tree-sitter-rescript', + -- branch = 'main', + -- files = { 'src/parser.c', 'src/scanner.c' }, + -- generate_requires_npm = false, + -- requires_generate_from_grammar = true, + -- use_makefile = true, + -- }, + -- } configs.setup { modules = {}, @@ -166,6 +178,24 @@ return { end }, + -- Project errors + { + "folke/trouble.nvim", + branch = "dev", + config = function () + local trouble = require 'trouble' + + n 'tt' 'Trouble diagnostics toggle' 'Trouble: Diagnostics' + n 'tT' 'Trouble diagnostics toggle filter.buf=0' 'Trouble: Diagnostics (buffer)' + n 'ts' 'Trouble symbols toggle focus=false' 'Trouble: Symbols' + -- n 'cl' 'Trouble lsp toggle focus=false win.position=right' 'LSP Definitions / references / ... (Trouble)' + -- n 'xL' 'Trouble loclist toggle' 'Location List (Trouble)' + -- n 'xQ' 'Trouble qflist toggle' 'Quickfix List (Trouble)' + + trouble.setup {} + end, + }, + -- Comments { 'numToStr/Comment.nvim', @@ -271,6 +301,7 @@ return { 'mfussenegger/nvim-dap', enabled = is { 'standalone', 'linux' }, dependencies = { + 'nvim-neotest/nvim-nio', 'rcarriga/nvim-dap-ui', }, config = function() @@ -327,22 +358,22 @@ return { config.setup { automatic_installation = true, - -- NOTE - -- Haskell: Managed by GHCup + -- NOTE: Haskell is managed via GHCup ensure_installed = { 'lua_ls', -- Lua 'rust_analyzer', -- Rust - 'clangd', -- C + -- 'clangd', -- C -- 'bashls', -- Bash 'html', -- HTML 'cssls', -- CSS / SCSS 'tsserver', -- TypeScript -- 'astro', -- Astro - 'svelte', -- Svelte + -- 'svelte', -- Svelte -- 'pyright', -- Python -- 'rnix', -- Nix -- 'purescriptls', -- Purescript 'ltex', -- Literate - LaTeX, Markdown, etc. + 'rescriptls', -- ReScript }, } @@ -437,49 +468,49 @@ return { }, -- JS debugger - { - 'mxsdev/nvim-dap-vscode-js', - dependencies = { - 'microsoft/vscode-js-debug', - version = '1.x', - build = 'npm i && npm run compile vsDebugServerBundle && mv dist out', - }, - config = function() - local dap = require 'dap' - --local utils = require 'dap.utils' - local dap_js = require 'dap-vscode-js' - --local mason = require 'mason-registry' - - ---@diagnostic disable-next-line: missing-fields - dap_js.setup { - -- debugger_path = mason.get_package('js-debug-adapter'):get_install_path(), - debugger_path = vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug', - adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, - } - - local langs = { 'javascript', 'typescript', 'svelte', 'astro' } - for _, lang in ipairs(langs) do - dap.configurations[lang] = { - { - type = 'pwa-node', - request = 'attach', - name = 'Attach debugger to existing `node --inspect` process', - cwd = '${workspaceFolder}', - skipFiles = { - '${workspaceFolder}/node_modules/**/*.js', - '${workspaceFolder}/packages/**/node_modules/**/*.js', - '${workspaceFolder}/packages/**/**/node_modules/**/*.js', - '/**', - 'node_modules/**', - }, - sourceMaps = true, - resolveSourceMapLocations = { - '${workspaceFolder}/**', - '!**/node_modules/**', - }, - }, - } - end - end, - }, + -- { + -- 'mxsdev/nvim-dap-vscode-js', + -- dependencies = { + -- 'microsoft/vscode-js-debug', + -- version = '1.x', + -- build = 'npm i && npm run compile vsDebugServerBundle && mv dist out', + -- }, + -- config = function() + -- local dap = require 'dap' + -- --local utils = require 'dap.utils' + -- local dap_js = require 'dap-vscode-js' + -- --local mason = require 'mason-registry' + -- + -- ---@diagnostic disable-next-line: missing-fields + -- dap_js.setup { + -- -- debugger_path = mason.get_package('js-debug-adapter'):get_install_path(), + -- debugger_path = vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug', + -- adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }, + -- } + -- + -- local langs = { 'javascript', 'typescript', 'svelte', 'astro' } + -- for _, lang in ipairs(langs) do + -- dap.configurations[lang] = { + -- { + -- type = 'pwa-node', + -- request = 'attach', + -- name = 'Attach debugger to existing `node --inspect` process', + -- cwd = '${workspaceFolder}', + -- skipFiles = { + -- '${workspaceFolder}/node_modules/**/*.js', + -- '${workspaceFolder}/packages/**/node_modules/**/*.js', + -- '${workspaceFolder}/packages/**/**/node_modules/**/*.js', + -- '/**', + -- 'node_modules/**', + -- }, + -- sourceMaps = true, + -- resolveSourceMapLocations = { + -- '${workspaceFolder}/**', + -- '!**/node_modules/**', + -- }, + -- }, + -- } + -- end + -- end, + -- }, } diff --git a/nvim/lua/config/plugins/haskell-tools.lua b/nvim/lua/config/plugins/haskell-tools.lua index d7b0e8b..4c0770a 100644 --- a/nvim/lua/config/plugins/haskell-tools.lua +++ b/nvim/lua/config/plugins/haskell-tools.lua @@ -23,10 +23,11 @@ local function on_attach(_, buffer, ht) -- ht.dap.discover_configurations(bufnr) end +---@type HTConfig +local config = { + hls = { on_attach = on_attach } +} return function() - vim.g.haskell_tools = { - ---@type HaskellLspClientOpts` - hls = { on_attach = on_attach } - } + vim.g.haskell_tools = config end diff --git a/nvim/lua/config/plugins/rustaceanvim.lua b/nvim/lua/config/plugins/rustaceanvim.lua index 30c7f18..ca2ea67 100644 --- a/nvim/lua/config/plugins/rustaceanvim.lua +++ b/nvim/lua/config/plugins/rustaceanvim.lua @@ -19,6 +19,17 @@ vim.g.rustaceanvim = function() n 'a' (tools.code_action_group.code_action_group) {buffer=bufnr} end, }, + default_settings = { + ['rust-analyzer'] = { + -- checkOnSave = { + -- allFeatures = true, + -- overrideCommand = { + -- 'cargo', 'clippy', '--workspace', '--message-format=json', + -- '--all-targets', '--all-features' + -- } + -- }, + }, + }, dap = { adapter = config.get_codelldb_adapter(lsp_path, lib_path), },