From 8d7de190f99790855baae6ddcb26d2dc2167fc56 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sat, 24 Feb 2024 18:37:43 +0900 Subject: [PATCH 1/7] nvim: new: add nvim-navic --- dotfiles/neovim/init.lua | 30 ++++++++++++++++++++++++++- dotfiles/neovim/lua/lualine_setup.lua | 12 ++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index 1ad05be..ba16d89 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -15,7 +15,18 @@ vim.opt.rtp:prepend(lazypath) -- Installing plugins require('lazy').setup({ - { "catppuccin/nvim", name = "catppuccin" }, -- Color scheme + { + "catppuccin/nvim", + name = "catppuccin", + config = function() + require("catppuccin").setup({ + flavour = "macchiato", + integrations = { + navic = true, + }, + }) + end + }, -- Color scheme { dir = "./lua/term_powershell.lua", event = "CmdlineEnter", @@ -140,6 +151,18 @@ require('lazy').setup({ 'folke/trouble.nvim', -- config = function }, + { + 'SmiteshP/nvim-navic', + -- event = 'BufReadPre', + dependencies = { + 'neovim/nvim-lspconfig', + }, + config = function() + require 'nvim-navic'.setup { + highlight = true, + } + end + }, { 'Julian/lean.nvim', event = { 'BufReadPre *.lean', 'BufNewFile *.lean' }, @@ -479,6 +502,7 @@ require 'nvim-treesitter.configs'.setup { -- LSP config local lspconfig = require 'lspconfig' +local navic = require 'nvim-navic' -- Mapping for language server -- See `:help vim.diagnostic.* for documentation on any of the below functions @@ -512,6 +536,10 @@ local on_attach = function(client, bufnr) vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'grf', vim.lsp.buf.references, bufopts) vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) + + if client.server_capabilities.documentSymbolProvider then + navic.attach(client, bufnr) + end end -- cmp_nvim_lsp supports additional LSP completion capabilities diff --git a/dotfiles/neovim/lua/lualine_setup.lua b/dotfiles/neovim/lua/lualine_setup.lua index 7f412d4..c88bb4a 100644 --- a/dotfiles/neovim/lua/lualine_setup.lua +++ b/dotfiles/neovim/lua/lualine_setup.lua @@ -7,6 +7,8 @@ local lsp_names = function () return ' ' .. table.concat(clients, ', ') end +local navic = require('nvim-navic') + require('lualine').setup { options = { icons_enabled = true, @@ -43,7 +45,15 @@ require('lualine').setup { lualine_z = {} }, tabline = {}, - winbar = {}, + winbar = { + lualine_c = { + { + "navic", + color_correction = nil, + navic_opts = nil, + }, + }, + }, inactive_winbar = {}, extensions = {} } From 4b2ca4b77e9992538593cb6b9bf083f8c32bb82d Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sat, 24 Feb 2024 18:37:43 +0900 Subject: [PATCH 2/7] nvim: new: add nvim-navic --- dotfiles/neovim/init.lua | 30 ++++++++++++++++++++++++++- dotfiles/neovim/lua/lualine_setup.lua | 12 ++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index e9b64cc..d4d0535 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -15,7 +15,18 @@ vim.opt.rtp:prepend(lazypath) -- Installing plugins require('lazy').setup({ - { "catppuccin/nvim", name = "catppuccin" }, -- Color scheme + { + "catppuccin/nvim", + name = "catppuccin", + config = function() + require("catppuccin").setup({ + flavour = "macchiato", + integrations = { + navic = true, + }, + }) + end + }, -- Color scheme { dir = "./lua/term_powershell.lua", event = "CmdlineEnter", @@ -144,6 +155,18 @@ require('lazy').setup({ 'folke/trouble.nvim', -- config = function }, + { + 'SmiteshP/nvim-navic', + -- event = 'BufReadPre', + dependencies = { + 'neovim/nvim-lspconfig', + }, + config = function() + require 'nvim-navic'.setup { + highlight = true, + } + end + }, { 'Julian/lean.nvim', event = { 'BufReadPre *.lean', 'BufNewFile *.lean' }, @@ -483,6 +506,7 @@ require 'nvim-treesitter.configs'.setup { -- LSP config local lspconfig = require 'lspconfig' +local navic = require 'nvim-navic' -- Mapping for language server -- See `:help vim.diagnostic.* for documentation on any of the below functions @@ -516,6 +540,10 @@ local on_attach = function(client, bufnr) vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'grf', vim.lsp.buf.references, bufopts) vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) + + if client.server_capabilities.documentSymbolProvider then + navic.attach(client, bufnr) + end end -- cmp_nvim_lsp supports additional LSP completion capabilities diff --git a/dotfiles/neovim/lua/lualine_setup.lua b/dotfiles/neovim/lua/lualine_setup.lua index 7f412d4..c88bb4a 100644 --- a/dotfiles/neovim/lua/lualine_setup.lua +++ b/dotfiles/neovim/lua/lualine_setup.lua @@ -7,6 +7,8 @@ local lsp_names = function () return ' ' .. table.concat(clients, ', ') end +local navic = require('nvim-navic') + require('lualine').setup { options = { icons_enabled = true, @@ -43,7 +45,15 @@ require('lualine').setup { lualine_z = {} }, tabline = {}, - winbar = {}, + winbar = { + lualine_c = { + { + "navic", + color_correction = nil, + navic_opts = nil, + }, + }, + }, inactive_winbar = {}, extensions = {} } From c9bfa1fb6d0e50a33778163084884bc172294763 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 9 Apr 2024 08:47:08 +0900 Subject: [PATCH 3/7] nvim: new: add tree-sitter injection query for julia(md_str) --- bin/install.ps1 | 2 ++ bin/install.sh | 3 +++ bin/neovim/update_julials.jl | 5 ++++- dotfiles/neovim/after/queries/julia/injections.scm | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 dotfiles/neovim/after/queries/julia/injections.scm diff --git a/bin/install.ps1 b/bin/install.ps1 index 99e8f8e..bcc5fce 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -62,6 +62,8 @@ mkdir $env:LOCALAPPDATA\nvim\after\queries\satysfi Invoke-WebRequest -Uri "https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/highlights.scm" -OutFile $env:LOCALAPPDATA\nvim\after\queries\satysfi\highlights.scm Invoke-WebRequest -Uri "https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/indents.scm" -OutFile $env:LOCALAPPDATA\nvim\after\queries\satysfi\indents.scm Invoke-WebRequest -Uri "https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/matchup.scm" -OutFile $env:LOCALAPPDATA\nvim\after\queries\satysfi\matchup.scm +mkdir $env:LOCALAPPDATA\nvim\after\queries\julia +New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\nvim\after\queries\julia\injections.scm -Target (Resolve-Path .\dotfiles\neovim\after\queries\julia\injections.scm) # pwsh New-Item -ItemType SymbolicLink -Path $PROFILE -Target (Resolve-Path .\dotfiles\pwsh\powershell_profile.ps1) -Force New-Item -ItemType SymbolicLink -Path ~\.config\powershell\chezmoi_completion.ps1 -Target (Resolve-Path .\dotfiles\pwsh\chezmoi_completion.ps1) -Force diff --git a/bin/install.sh b/bin/install.sh index 357d8a0..09fca0c 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -25,6 +25,7 @@ ln -sf $(pwd)/dotfiles/neovim/init.lua ~/.config/nvim/init.lua mkdir -p ~/.config/nvim/lua ln -sf $(pwd)/dotfiles/neovim/lua/lualine_setup.lua ~/.config/nvim/lua/lualine_setup.lua ln -sf $(pwd)/dotfiles/neovim/lua/term_powershell.lua ~/.config/nvim/lua/term_powershell.lua +ln -sf $(pwd)/dotfiles/neovim/lua/pluto_nvim.lua ~/.config/nvim/lua/pluto_nvim.lua mkdir -p ~/.config/nvim/lua/lspconfig/server_configurations ln -sf $(pwd)/dotfiles/neovim/lua/lspconfig/server_configurations/satysfi_ls.lua ~/.config/nvim/lua/lspconfig/server_configurations/satysfi_ls.lua mkdir -p ~/.config/nvim/after/ftplugin @@ -34,6 +35,8 @@ mkdir -p ~/.config/nvim/after/queries/satysfi curl -o ~/.config/nvim/after/queries/satysfi/highlights.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/highlights.scm curl -o ~/.config/nvim/after/queries/satysfi/indents.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/indents.scm curl -o ~/.config/nvim/after/queries/satysfi/matchup.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/matchup.scm +mkdir -p ~/.config/nvim/after/queries/julia +ln -sf $(pwd)/dotfiles/neovim/after/queries/julia/injections.scm ~/.config/nvim/after/queries/julia/injections.scm mkdir -p ~/.config/nvim/luasnippets ln -sf $(pwd)/dotfiles/neovim/luasnippets/all.lua ~/.config/nvim/luasnippets/all.lua mkdir -p ~/.config/nvim/luasnippets/satysfi diff --git a/bin/neovim/update_julials.jl b/bin/neovim/update_julials.jl index ffb3e1f..935848c 100644 --- a/bin/neovim/update_julials.jl +++ b/bin/neovim/update_julials.jl @@ -3,7 +3,10 @@ project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig") cd(project_path) @info "now at " pwd() run(`julia --project=. -e 'using Pkg; Pkg.update()'`) -read("precompile_exec_head.jl", String) * read("tracecompile.jl", String) |> (b -> write("precompile_exec.jl", b)) +compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line + !startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) +end |> join +read("precompile_exec_head.jl", String) * compile_traces |> (b -> write("precompile_exec.jl", b)) @info "compiling sysimage..." run(`julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path = "sys-ls.so", precompile_execution_file = ["precompile_exec.jl"])'`) @info "post precompile" diff --git a/dotfiles/neovim/after/queries/julia/injections.scm b/dotfiles/neovim/after/queries/julia/injections.scm new file mode 100644 index 0000000..60d3f24 --- /dev/null +++ b/dotfiles/neovim/after/queries/julia/injections.scm @@ -0,0 +1,7 @@ +;; extends + +((prefixed_string_literal + prefix: (identifier) @_prefix) @injection.content + (#eq? @_prefix "md") + (#set! injection.language "markdown") + (#offset! @injection.content 0 2 0 -1)) From e24fcfccdbacdfd9dfa86867e87ca6a2e591d568 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 9 Apr 2024 08:48:21 +0900 Subject: [PATCH 4/7] nvim: add: jsonls --- dotfiles/neovim/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index f53a480..9de4614 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -654,7 +654,7 @@ lspconfig.rust_analyzer.setup { } local lss = { "pyright", "texlab", "ccls", "clangd", "tsserver", --[["tailwindcss"]] "hls", "cmake", - "csharp_ls", "html", "r_language_server", "ruff_lsp", "cssls" } + "csharp_ls", "html", "r_language_server", "ruff_lsp", "cssls", "jsonls" } for _, ls in pairs(lss) do lspconfig[ls].setup { on_attach = on_attach, From 90d82e399866083d4360371d5db639bdbad946ee Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 9 Apr 2024 17:31:58 +0900 Subject: [PATCH 5/7] add: nvim: sqls --- dotfiles/neovim/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index 9de4614..923cbad 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -654,7 +654,7 @@ lspconfig.rust_analyzer.setup { } local lss = { "pyright", "texlab", "ccls", "clangd", "tsserver", --[["tailwindcss"]] "hls", "cmake", - "csharp_ls", "html", "r_language_server", "ruff_lsp", "cssls", "jsonls" } + "csharp_ls", "html", "r_language_server", "ruff_lsp", "cssls", "jsonls", "sqls" } for _, ls in pairs(lss) do lspconfig[ls].setup { on_attach = on_attach, From bb7d1b917f1beec0a5fda4c21b99a39dfa695ee2 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Mon, 15 Apr 2024 18:00:06 +0900 Subject: [PATCH 6/7] update: nvim: remove auto appended setup script by PDM --- dotfiles/pwsh/powershell_profile.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index d7e9a0f..b9e0ae5 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -231,7 +231,3 @@ Import-Module WSLTabCompletion Get-ChildItem ~\.config\powershell\completions\ | % { . $_ } -# Automatically appended by pdm scoop package -Get-ChildItem "$PROFILE\..\Completions\" | ForEach-Object { - . $_.FullName -} From 7ece410458a49e3d00ef6f5604fb06756ecc6637 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Wed, 1 May 2024 18:32:06 +0900 Subject: [PATCH 7/7] nvim: add support for powershell_es on linux --- dotfiles/neovim/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index 923cbad..395a70e 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -625,8 +625,10 @@ lspconfig.bashls.setup { capabilities = capabilities, } -- pwsh +local win_pwsh_es_path = '~/scoop/apps/powershell-editorservice/current' +local arch_pwsh_es_path = "/opt/powershell-editor-services/" lspconfig.powershell_es.setup { - bundle_path = '~/scoop/apps/powershell-editorservice/current', + bundle_path = vim.fn.has('win32') == 1 and win_pwsh_es_path or arch_pwsh_es_path, capabilities = capabilities, } -- ccls