From 132423e5a1f2d883a2d3bc420a3edd7036b4b0dd Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Wed, 28 Sep 2022 20:43:05 +0200 Subject: Cooler deno plugin and terminal shortcut for neovim --- .config/nvim/lua/general.lua | 12 ++++++--- .config/nvim/lua/keybinds.lua | 2 ++ .config/nvim/lua/lsp.lua | 58 +++++++++++++++++++++++-------------------- .config/nvim/lua/plugins.lua | 1 + .profile | 4 +-- bootstrap.sh | 2 +- 6 files changed, 46 insertions(+), 33 deletions(-) diff --git a/.config/nvim/lua/general.lua b/.config/nvim/lua/general.lua index 6732d38..ab386b9 100644 --- a/.config/nvim/lua/general.lua +++ b/.config/nvim/lua/general.lua @@ -16,13 +16,19 @@ vim.opt.listchars:append("eol:↴") vim.opt.listchars:append("tab:-->") vim.cmd [[colorscheme dracula]] -vim.opt.spell = true +vim.opt.spell = false vim.opt.spelllang = "en" vim.g.markdown_fenced_languages = { "ts=typescript"; - "xml=xml"; - "mermaid=mermaid"; + "xml"; + "mermaid"; + "yaml"; + "sql"; + "sh"; + "console"; + "cs"; + "ini"; } if vim.fn.has("wsl") == 1 then diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua index ac3b9d3..8be4c7f 100644 --- a/.config/nvim/lua/keybinds.lua +++ b/.config/nvim/lua/keybinds.lua @@ -25,6 +25,7 @@ vim.keymap.set("n", "", telescope.buffers) vim.keymap.set("n", "m", ":MinimapToggle") vim.keymap.set("n", ",", ":TroubleToggle") +vim.keymap.set("n", "t", ":belowright split | resize 5 | terminal") vim.keymap.set("n", "[", ufo.openAllFolds) vim.keymap.set("n", "]", ufo.closeAllFolds) @@ -46,5 +47,6 @@ wk.register({ ["n"] = "Show file tree"; ["m"] = "Toggle Minimap"; ["d"] = "Show diagnostics"; + ["t"] = "Open terminal"; }, { prefix = "" }); diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 82bed0c..11059ff 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -45,15 +45,15 @@ cmp.setup.cmdline(":", { }) -- Setup lspconfig. -local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp - .protocol - .make_client_capabilities()) +local cmplsp = require("cmp_nvim_lsp") +local capabilities = vim.lsp.protocol.make_client_capabilities() +cmplsp.update_capabilities(vim.lsp.protocol.make_client_capabilities()) +-- Enable (broadcasting) snippet capability for completion +capabilities.textDocument.completion.completionItem.snippetSupport = true -require("lspconfig")["denols"].setup { capabilities = capabilities } -local lspkind = require("lspkind") -cmp.setup { +cmp.setup({ formatting = { - format = lspkind.cmp_format({ + format = require("lspkind").cmp_format({ mode = "symbol"; -- show only symbol annotations maxwidth = 50; -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) @@ -62,32 +62,33 @@ cmp.setup { before = function(entry, vim_item) return vim_item end; }); }; -} +}) + local on_attach = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - require("lsp-inlayhints").setup() - require("lsp-inlayhints").on_attach(client, bufnr) + local inlayhints = require("lsp-inlayhints") + inlayhints.setup() + inlayhints.on_attach(client, bufnr) end --- Enable (broadcasting) snippet capability for completion -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true local lsputils = require("lspconfig").util require("lspconfig").tsserver.setup({ on_attach = on_attach; - root_dir = lsputils.root_pattern("package.json", "tsconfig.json", - "jsconfig.json"); + root_dir = lsputils.root_pattern("package.json", "tsconfig.json"); }) -require("lspconfig").denols.setup { - on_attach = on_attach; - init_options = { enable = true; unstable = true; config = "./deno.jsonc" }; - root_dir = vim.loop.cwd; -} +require("deno-nvim").setup({ + server = { + root_dir = vim.loop.cwd; + capabilities = capabilities; + on_attach = on_attach; + settings = { enable = true; unstable = true; config = "./deno.jsonc" }; + }; +}); require("lspconfig").rust_analyzer.setup({ - root_dir = vim.loop.cwd; + capabilities = capabilities; on_attach = on_attach; }) @@ -96,12 +97,14 @@ require("lspconfig").sqls.setup({ require("sqls").on_attach(client, bufnr) on_attach(client, bufnr) end; + capabilities = capabilities; }) --- neovim-bin -require"lspconfig".omnisharp.setup { + +require("lspconfig").omnisharp.setup({ cmd = { "omnisharp" }; on_attach = on_attach; + capabilities = capabilities; -- Enables support for reading code style, naming convention and analyzer -- settings from .editorconfig. enable_editorconfig_support = true; @@ -115,11 +118,11 @@ require"lspconfig".omnisharp.setup { enable_ms_build_load_projects_on_demand = false; -- Enables support for roslyn analyzers, code fixes and rulesets. - enable_roslyn_analyzers = false; + enable_roslyn_analyzers = true; -- Specifies whether 'using' directives should be grouped and sorted during -- document formatting. - organize_imports_on_format = false; + organize_imports_on_format = true; -- Enables support for showing unimported types and unimported extension -- methods in completion lists. When committed, the appropriate using @@ -127,7 +130,7 @@ require"lspconfig".omnisharp.setup { -- have a negative impact on initial completion responsiveness, -- particularly for the first few completion sessions after opening a -- solution. - enable_import_completion = false; + enable_import_completion = true; -- Specifies whether to include preview versions of the .NET SDK when -- determining which version to use for project loading. @@ -136,11 +139,12 @@ require"lspconfig".omnisharp.setup { -- Only run analyzers against open files when 'enableRoslynAnalyzers' is -- true analyze_open_documents_only = false; -} +}) require("lspconfig").marksman.setup({ root_dir = vim.loop.cwd; on_attach = on_attach; + capabilities = capabilities; }) require("lspconfig").jsonls.setup({ diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 8ea0f91..3ba6799 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -55,6 +55,7 @@ local PKGS = { { url = "https://github.com/folke/lsp-colors.nvim.git" }; { url = "https://github.com/nanotee/sqls.nvim.git" }; { url = "https://github.com/lvimuser/lsp-inlayhints.nvim.git" }; + { url = "https://github.com/sigmaSd/deno-nvim.git" }; -- Dev container { url = "https://codeberg.org/esensar/nvim-dev-container.git" }; diff --git a/.profile b/.profile index 31be1bb..b4664cf 100644 --- a/.profile +++ b/.profile @@ -8,7 +8,7 @@ if [ -z "${XDG_RUNTIME_DIR}" ]; then fi DENO_INSTALL="$HOME/.deno"; export DENO_INSTALL; -BUN_INSTALL="/home/luca/.bun" +BUN_INSTALL="/home/luca/.bun"; EDITOR="nvim"; export EDITOR; MANPAGER="sh -c 'col -bx | bat -l man -p'"; export MANPAGER; @@ -22,6 +22,6 @@ XDG_CURRENT_DESKTOP=sway; export XDG_CURRENT_DESKTOP; XDG_SESSION_DESKTOP=sway; export XDG_SESSION_DESKTOP; GPG_TTY="$(tty)" export GPG_TTY; -PATH="$PATH:$HOME/go/bin:$DENO_INSTALL/bin:$BUN_INSTALL/bin:$HOME/.cargo/bin"; +PATH="$HOME/go/bin:$DENO_INSTALL/bin:$BUN_INSTALL/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH"; diff --git a/bootstrap.sh b/bootstrap.sh index 5a0e117..c6fb031 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -26,7 +26,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then fi; -git pull origin main; +git pull; function doIt() { git submodule update --init --recursive -- cgit v1.2.3