From 9c3126bbf2ee852f3552b28f86c514ed6379da07 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 22 Sep 2023 19:08:58 +0800 Subject: Update nvim config. Add omnisharp. --- .editerconfig | 5 ++ configs/nvim/init.lua | 70 +++++++++++++++++++++++----- configs/nvim/lazy-lock.json | 24 +++++----- configs/nvim/lua/plugins/tokyonight-nvim.lua | 8 ++-- 4 files changed, 80 insertions(+), 27 deletions(-) create mode 100644 .editerconfig diff --git a/.editerconfig b/.editerconfig new file mode 100644 index 0000000..edb912e --- /dev/null +++ b/.editerconfig @@ -0,0 +1,5 @@ +root = true + +[*] +end_of_line = lf + diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index 1412a61..fd6a66e 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -2,13 +2,17 @@ vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 -vim.cmd([[ +local is_win = vim.fn.has("win32") ~= 0 + +if is_win then + vim.cmd([[ let &shell = executable('pwsh') ? 'pwsh' : 'powershell' let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode' set shellquote= shellxquote= ]]) +end vim.cmd.cd("~") @@ -22,7 +26,7 @@ vim.opt.number = true; vim.keymap.set('t', '', [[]]) if vim.g.neovide then - vim.opt.guifont = "FiraCode Nerd Font"; + vim.opt.guifont = "CaskaydiaCove Nerd Font"; vim.g.neovide_transparency = 0.95; vim.g.neovide_input_ime = false; vim.g.neovide_cursor_vfx_mode = "ripple"; @@ -86,7 +90,7 @@ require("toggleterm").setup { require("nvim-autopairs").setup {} -- setup formatter -local prettier_formatter = function () +local prettier_formatter = function() local current_buffer = vim.api.nvim_buf_get_name(0) local prettier_exe = require("crupest.system").find_npm_exe(current_buffer, "prettier") or "prettier" @@ -133,7 +137,7 @@ require("formatter").setup { local lint = require("lint") local linter_eslint = require("lint.linters.eslint") -linter_eslint.cmd = function () +linter_eslint.cmd = function() local current_buffer = vim.api.nvim_buf_get_name(0) return require("crupest.system").find_npm_exe(current_buffer, "eslint") or "eslint" end @@ -227,9 +231,9 @@ lspconfig.html.setup { capabilities = capabilities } -lspconfig.tsserver.setup{ +lspconfig.tsserver.setup { capabilities = capabilities, - on_new_config = function (new_config, new_root_dir) + on_new_config = function(new_config, new_root_dir) local local_tsserver = require("crupest-util").find_npm_exe(new_root_dir, "typescript-language-server"); if local_tsserver then new_config.cmd = { local_tsserver, "--stdio" } @@ -237,6 +241,53 @@ lspconfig.tsserver.setup{ end, } +local omnisharp_cmd = nil + +if is_win then + omnisharp_cmd = { "C:/Users/crupest/Programs/omnisharp-win-x64/OmniSharp.exe" } +end + +if omnisharp_cmd then + require 'lspconfig'.omnisharp.setup { + cmd = omnisharp_cmd, + + -- Enables support for reading code style, naming convention and analyzer + -- settings from .editorconfig. + enable_editorconfig_support = true, + + -- If true, MSBuild project system will only load projects for files that + -- were opened in the editor. This setting is useful for big C# codebases + -- and allows for faster initialization of code navigation features only + -- for projects that are relevant to code that is being edited. With this + -- setting enabled OmniSharp may load fewer projects and may thus display + -- incomplete reference lists for symbols. + enable_ms_build_load_projects_on_demand = false, + + -- Enables support for roslyn analyzers, code fixes and rulesets. + enable_roslyn_analyzers = true, + + -- Specifies whether 'using' directives should be grouped and sorted during + -- document formatting. + organize_imports_on_format = false, + + -- Enables support for showing unimported types and unimported extension + -- methods in completion lists. When committed, the appropriate using + -- directive will be added at the top of the current file. This option can + -- have a negative impact on initial completion responsiveness, + -- particularly for the first few completion sessions after opening a + -- solution. + enable_import_completion = true, + + -- Specifies whether to include preview versions of the .NET SDK when + -- determining which version to use for project loading. + sdk_include_prereleases = true, + + -- Only run analyzers against open files when 'enableRoslynAnalyzers' is + -- true + analyze_open_documents_only = false, + } +end + -- setup trouble require("trouble").setup() @@ -271,11 +322,7 @@ vim.api.nvim_create_autocmd('LspAttach', { end, }) -require("catppuccin").setup{ - flavour = "mocha" -} - -vim.cmd.colorscheme "catppuccin" +vim.cmd [[colorscheme tokyonight-night]] -- custom keymaps -- @@ -348,4 +395,3 @@ end, { nargs = "+", complete = "file" }) - diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json index f0af740..5f3ba60 100644 --- a/configs/nvim/lazy-lock.json +++ b/configs/nvim/lazy-lock.json @@ -1,24 +1,24 @@ { - "LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" }, - "bufferline.nvim": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" }, - "catppuccin": { "branch": "main", "commit": "85e93601e0f0b48aa2c6bbfae4d0e9d7a1898280" }, + "LuaSnip": { "branch": "master", "commit": "c5fb16a934892086d4ba01bac48b77c65435025e" }, + "bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" }, - "gitsigns.nvim": { "branch": "main", "commit": "907ae8636016aab2f283576fc60d46ca3427e579" }, + "formatter.nvim": { "branch": "master", "commit": "34dcdfa0c75df667743b2a50dd99c84a557376f0" }, + "gitsigns.nvim": { "branch": "main", "commit": "bce4576a9047085a528c479a7fe1e2f6b787b6c1" }, "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "nvim-autopairs": { "branch": "master", "commit": "defad64afbf19381fe31488a7582bbac421d6e38" }, + "nvim-autopairs": { "branch": "master", "commit": "7b3eb9b5813a22188c4dbb248475fcbaf9f4d195" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, - "nvim-lint": { "branch": "master", "commit": "73682da41b74c9c35f33b1b2dbd0cc02cc59452f" }, - "nvim-lspconfig": { "branch": "master", "commit": "5efcd06dc9c45c1654d3f84655fd4ee2f5328f3b" }, - "nvim-tree.lua": { "branch": "master", "commit": "94c7c810af205c0f00c8f105dcf490c8eb17658a" }, - "nvim-web-devicons": { "branch": "master", "commit": "925e2aa30dc9fe9332060199c19f132ec0f3d493" }, - "plenary.nvim": { "branch": "master", "commit": "4cd4c29e39dd02efd906f98c03d2879237f50956" }, - "telescope.nvim": { "branch": "master", "commit": "a19770625aed49ad2a9f591a5e3946707f7359f6" }, + "nvim-lint": { "branch": "master", "commit": "67f74e630a84ecfa73a82783c487bdedd8cecdc3" }, + "nvim-lspconfig": { "branch": "master", "commit": "4266f9bb36b4fb09edd19b67d95043cf7ff88ddf" }, + "nvim-tree.lua": { "branch": "master", "commit": "a3aa3b47eac8b6289f028743bef4ce9eb0f6782e" }, + "nvim-web-devicons": { "branch": "master", "commit": "973ab742f143a796a779af4d786ec409116a0d87" }, + "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "telescope.nvim": { "branch": "master", "commit": "40c8d2fc2b729dd442eda093cf8c9496d6e23732" }, "toggleterm.nvim": { "branch": "main", "commit": "0427b908ebefcb3701c7f2cfbdafa37d11afe71a" }, + "tokyonight.nvim": { "branch": "main", "commit": "9a01eada39558dc3243278e6805d90e8dff45dc0" }, "trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" } } \ No newline at end of file diff --git a/configs/nvim/lua/plugins/tokyonight-nvim.lua b/configs/nvim/lua/plugins/tokyonight-nvim.lua index fc6d6cb..11c8b15 100644 --- a/configs/nvim/lua/plugins/tokyonight-nvim.lua +++ b/configs/nvim/lua/plugins/tokyonight-nvim.lua @@ -1,5 +1,7 @@ return { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + opts = {}, } + -- cgit v1.2.3