From 82fd91c691f39c437072119a4d579400053512d5 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Mon, 23 Oct 2023 20:22:19 +1030 Subject: [PATCH] more changes, c# working now? --- .config/bash/.bashrc | 8 +- .config/lf/lfrc | 2 +- .config/nvim/lua/lazyvim/plugins/cmp.lua | 4 - .config/nvim/lua/lazyvim/plugins/lsp/init.lua | 74 +++++++++---------- .../nvim/lua/lazyvim/plugins/telescope.lua | 1 + .config/nvim/lua/lazyvim/utils/init.lua | 2 +- 6 files changed, 45 insertions(+), 46 deletions(-) diff --git a/.config/bash/.bashrc b/.config/bash/.bashrc index c4e1304..d86187d 100644 --- a/.config/bash/.bashrc +++ b/.config/bash/.bashrc @@ -6,7 +6,7 @@ case $- in esac export GOPATH="$HOME/go" -export PATH="$HOME/.local/bin:$PATH:$GOPATH/bin:$HOME/scripts:$HOME/.dotnet/" +export PATH="$HOME/.local/bin:$PATH:$GOPATH/bin:$HOME/scripts:$HOME/.dotnet/:$HOME/.dotnet/tools/" # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options @@ -98,7 +98,11 @@ PROMPT_COMMAND=set_prompt # direnv for go # eval "$(direnv hook bash)" +# cargo +[[ -s "$HOME/.local/share/cargo/env" ]] && source "/home/solomon/.local/share/cargo/env" + #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" -. "/home/solomon/.local/share/cargo/env" + + diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 237eadb..4f256ff 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -21,7 +21,7 @@ cmd open ${{ application/vnd.oasis.opendocument.text) lowriter $fs ;; application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; - text/*|application/json|inode/x-empty) $EDITOR $fx;; + text/*|application/json|application/javascript|inode/x-empty) $EDITOR $fx;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/svg+xml) display -- $f ;; image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | diff --git a/.config/nvim/lua/lazyvim/plugins/cmp.lua b/.config/nvim/lua/lazyvim/plugins/cmp.lua index 573d065..5af0f3a 100644 --- a/.config/nvim/lua/lazyvim/plugins/cmp.lua +++ b/.config/nvim/lua/lazyvim/plugins/cmp.lua @@ -4,9 +4,7 @@ return { event = "InsertEnter", dependencies = { "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", "hrsh7th/cmp-emoji", "saadparwaiz1/cmp_luasnip", }, @@ -33,9 +31,7 @@ return { sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "luasnip" }, - { name = "buffer" }, { name = "path" }, - { name = "cmdline" }, { name = "emoji" }, }), formatting = { diff --git a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua index 7c2f52f..b0f2949 100644 --- a/.config/nvim/lua/lazyvim/plugins/lsp/init.lua +++ b/.config/nvim/lua/lazyvim/plugins/lsp/init.lua @@ -34,6 +34,7 @@ return { }, }, ltex = { + mason = true, settings = { ltex = { language = "en-AU", @@ -41,25 +42,43 @@ return { }, }, rust_analyzer = { - capabilities = capabilities, - on_attach = on_attach, + mason = false, cmd = { - "rustup", "run", "stable", "rust-analyzer", }, }, + omnisharp = {}, }, setup = { -- additional setup can be added here. + omnisharp = function(_, _) + require("lazyvim.utils").on_attach(function(client, _) + if client.name == "omnisharp" then + ---@type string[] + local tokenModifiers = + client.server_capabilities.semanticTokensProvider.legend.tokenModifiers + for i, v in ipairs(tokenModifiers) do + tokenModifiers[i] = v:gsub(" ", "_") + end + ---@type string[] + local tokenTypes = client.server_capabilities.semanticTokensProvider.legend.tokenTypes + for i, v in ipairs(tokenTypes) do + tokenTypes[i] = v:gsub(" ", "_") + end + end + end) + return false + end, }, }, - config = function(plugin, opts) + config = function(_, opts) local Util = require("lazyvim.utils") -- setup autoformat require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat + -- setup formatting and keymaps Util.on_attach(function(client, buffer) require("lazyvim.plugins.lsp.format").on_attach(client, buffer) @@ -139,37 +158,7 @@ return { end, }, - -- formatters - -- { - -- "jose-elias-alvarez/null-ls.nvim", - -- event = "BufReadPre", - -- dependencies = { "mason.nvim" }, - -- opts = function() - -- local nls = require("null-ls") - -- return { - -- root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"), - -- debug = false, - -- sources = { - -- nls.builtins.formatting.stylua, - -- nls.builtins.formatting.prettier.with({ - -- filetypes = { - -- "javascript", - -- "typescript", - -- "css", - -- "scss", - -- "html", - -- "json", - -- "yaml", - -- }, - -- }), - -- nls.builtins.formatting.black.with({ extra_args = { "--fast" } }), - -- nls.builtins.formatting.bibclean, - -- nls.builtins.formatting.beautysh, - -- nls.builtins.diagnostics.shellcheck, - -- }, - -- } - -- end, - -- }, + -- formatting { "stevearc/conform.nvim", opts = { @@ -178,7 +167,14 @@ return { -- Conform will run multiple formatters sequentially python = { "isort", "black" }, -- Use a sub-list to run only the first available formatter - javascript = { { "prettierd", "prettier" } }, + typescript = { { "prettierd", "prettier" } }, + cs = { "csharpier" }, + }, + formatters = { + csharpier = { + command = "dotnet-csharpier", + args = { "--write-stdout" }, + }, }, }, }, @@ -189,13 +185,14 @@ return { cmd = "Mason", keys = { { "lM", "Mason", desc = "Mason" } }, opts = { + automatic_istallation = false, ensure_installed = { "stylua", "shellcheck", "shfmt", }, }, - config = function(plugin, opts) + config = function(_, opts) require("mason").setup() local mr = require("mason-registry") for _, tool in ipairs(opts.ensure_installed) do @@ -206,6 +203,8 @@ return { end end, }, + + -- language specific tooling { "simrat39/rust-tools.nvim", opts = { @@ -220,5 +219,4 @@ return { }, }, }, - require("lazyvim.plugins.lsp.lang.c_sharp"), } diff --git a/.config/nvim/lua/lazyvim/plugins/telescope.lua b/.config/nvim/lua/lazyvim/plugins/telescope.lua index 04806fc..f8e1bd2 100644 --- a/.config/nvim/lua/lazyvim/plugins/telescope.lua +++ b/.config/nvim/lua/lazyvim/plugins/telescope.lua @@ -11,6 +11,7 @@ return { { "ff", util.telescope("find_files"), desc = "Find Files (root dir)" }, { "fF", util.telescope("find_files", { cwd = false }), desc = "Find Files (cwd)" }, { "fr", "Telescope oldfiles", desc = "Recent" }, + { "fp", "Telescope projects", desc = "Find Projects" }, { "gc", "Telescope git_commits", desc = "commits" }, { "gs", "Telescope git_status", desc = "status" }, { "gb", "Telescope git_branches", desc = "branches" }, diff --git a/.config/nvim/lua/lazyvim/utils/init.lua b/.config/nvim/lua/lazyvim/utils/init.lua index 4f885ac..87651f6 100644 --- a/.config/nvim/lua/lazyvim/utils/init.lua +++ b/.config/nvim/lua/lazyvim/utils/init.lua @@ -26,7 +26,7 @@ function M.get_root() ---@type string[] local roots = {} if path then - for _, client in pairs(vim.lsp.get_clients({ bufnr = 0 })) do + for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do local workspace = client.config.workspace_folders local paths = workspace and vim.tbl_map(function(ws)