From ddb9a620c97548a78c1bae3144c143fca8d3b4a0 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Thu, 30 Jan 2025 18:05:17 +0900 Subject: [PATCH 01/10] fix(julials): remove sysimage to fix too old LanguageServer.jl version being resolved --- bin/neovim/add_dependencies.jl | 15 ++++++++------- bin/neovim/update_julials.jl | 18 +++++++++--------- dotfiles/neovim/init.lua | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/bin/neovim/add_dependencies.jl b/bin/neovim/add_dependencies.jl index f4560c5..6d0f710 100644 --- a/bin/neovim/add_dependencies.jl +++ b/bin/neovim/add_dependencies.jl @@ -6,24 +6,25 @@ using Pkg # add LanguageServer.jl Pkg.add("LanguageServer") -# add dependencies of LanguageServer.jl -pkg_ls = Pkg.project().dependencies["LanguageServer"] -pkg_ls_deps = Pkg.dependencies()[pkg_ls].dependencies |> keys -foreach(Pkg.add, pkg_ls_deps) +# add PackageCompiler.jl +Pkg.add("PackageCompiler") # add extra dependencies # these packages are manually collected pkg_extra = ["Logging", "Sockets", "DataStructures", "Tar", "ArgTools", "Dates", "Downloads", "TOML"] -foreach(Pkg.add, pkg_extra) -@info "dependency added" +Pkg.add(pkg_extra) +@info "added dependencies" + +# Extra package to be executed in precompiled code +pkg_precompiled = ["SymbolServer"] # save pkgs to be used for precompile functions with traced script out_path = joinpath(Pkg.project().path |> dirname, "precompile_exec_head.jl") @info "writing $(out_path)" open(out_path, "w") do io println(io, "using LanguageServer") - println(io, "using " * join(pkg_ls_deps, ", ")) println(io, "using " * join(pkg_extra, ", ")) + # println(io, "using " * join(pkg_precompiled, ", ")) if Sys.iswindows() println(io, "import FileWatching") end diff --git a/bin/neovim/update_julials.jl b/bin/neovim/update_julials.jl index 713c00b..a09971c 100644 --- a/bin/neovim/update_julials.jl +++ b/bin/neovim/update_julials.jl @@ -3,14 +3,14 @@ project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig") cd(project_path) do @info "now at " pwd() run(`julia --project=. -e 'using Pkg; Pkg.update()'`) - compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line - # Remove anonymous functions from compile trace - !startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", 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" - run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`) + # compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line + # # Remove anonymous functions from compile trace + # !startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", 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" + # run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`) end diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index e4f7b46..415e042 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -686,7 +686,7 @@ lspconfig.julials.setup { on_attach = on_attach, capabilities = capabilities, cmd = { "julia", "--startup-file=no", "--history-file=no", - julials_so_option[1], julials_so_option[2], + -- julials_so_option[1], julials_so_option[2], -- use below 2 lines to collect script to be included in sysimage -- '--trace-compile', -- vim.env.HOME .. "/.julia/environments/nvim-lspconfig/tracecompile.jl", From 77df4f2c4fd213fd9f0006ecbf948f4f82671a29 Mon Sep 17 00:00:00 2001 From: testuser Date: Mon, 3 Feb 2025 13:05:35 +0900 Subject: [PATCH 02/10] fix: julials env (with sysimage) --- bin/neovim/add_dependencies.jl | 4 ++-- bin/neovim/update_julials.jl | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/neovim/add_dependencies.jl b/bin/neovim/add_dependencies.jl index 6d0f710..46c7d44 100644 --- a/bin/neovim/add_dependencies.jl +++ b/bin/neovim/add_dependencies.jl @@ -11,12 +11,12 @@ Pkg.add("PackageCompiler") # add extra dependencies # these packages are manually collected -pkg_extra = ["Logging", "Sockets", "DataStructures", "Tar", "ArgTools", "Dates", "Downloads", "TOML"] +pkg_extra = ["Logging", "Sockets", "DataStructures", "Tar", "ArgTools", "Dates", "Downloads", "TOML", "JSONRPC", "SymbolServer"] Pkg.add(pkg_extra) @info "added dependencies" # Extra package to be executed in precompiled code -pkg_precompiled = ["SymbolServer"] +pkg_precompiled = [] # save pkgs to be used for precompile functions with traced script out_path = joinpath(Pkg.project().path |> dirname, "precompile_exec_head.jl") diff --git a/bin/neovim/update_julials.jl b/bin/neovim/update_julials.jl index a09971c..713c00b 100644 --- a/bin/neovim/update_julials.jl +++ b/bin/neovim/update_julials.jl @@ -3,14 +3,14 @@ project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig") cd(project_path) do @info "now at " pwd() run(`julia --project=. -e 'using Pkg; Pkg.update()'`) - # compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line - # # Remove anonymous functions from compile trace - # !startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", 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" - # run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`) + compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line + # Remove anonymous functions from compile trace + !startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", 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" + run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`) end From 3491aed70b40bb11431a33b4441cb78cd28c3bad Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 4 Feb 2025 00:56:35 +0900 Subject: [PATCH 03/10] update(julia): call Pkg --- bin/neovim/setup_julials.jl | 7 ++++--- bin/neovim/update_julials.jl | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/neovim/setup_julials.jl b/bin/neovim/setup_julials.jl index f6107bd..dbd44f3 100644 --- a/bin/neovim/setup_julials.jl +++ b/bin/neovim/setup_julials.jl @@ -5,7 +5,8 @@ if !ispath(project_path) @info "Created $(project_path)" touch(joinpath(project_path, "tracecompile.jl")) end -cmd = `julia --project=$(project_path) $(@__DIR__)/add_dependencies.jl` -@info cmd -run(cmd) + +using Pkg +Pkg.activate(project_path) +include("$(@__DIR__)/add_dependencies.jl") diff --git a/bin/neovim/update_julials.jl b/bin/neovim/update_julials.jl index 713c00b..cfdc4cf 100644 --- a/bin/neovim/update_julials.jl +++ b/bin/neovim/update_julials.jl @@ -2,14 +2,17 @@ project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig") cd(project_path) do @info "now at " pwd() - run(`julia --project=. -e 'using Pkg; Pkg.update()'`) + using Pkg + Pkg.activate(".") + Pkg.update() compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line # Remove anonymous functions from compile trace !startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", 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"])'`) + using PackageCompiler; + create_sysimage(["LanguageServer"], sysimage_path = "sys-ls.so", precompile_execution_file = ["precompile_exec.jl"])' @info "post precompile" run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`) end From 16903271a5e9d1f9126affa6967c60e7f34269fc Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 4 Feb 2025 02:43:04 +0900 Subject: [PATCH 04/10] update(pwsh): update Enable-SshAgent for new "sudo" introduced in 24H2 --- dotfiles/pwsh/powershell_profile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/pwsh/powershell_profile.ps1 b/dotfiles/pwsh/powershell_profile.ps1 index b9e0ae5..096a09a 100644 --- a/dotfiles/pwsh/powershell_profile.ps1 +++ b/dotfiles/pwsh/powershell_profile.ps1 @@ -139,7 +139,7 @@ function Enable-SshAgent { .OUTPUTS no outputs #> - sudo Set-Service -Name ssh-agent -StartupType Manual && Start-Service ssh-agent + sudo run pwsh -c "Set-Service -Name ssh-agent -StartupType Manual && Start-Service ssh-agent" } # auto start ssh-agent and do ssh-add function Invoke-SshAdd { From da0c5d8dec78728cc4cfe0811270a5514f985141 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sun, 23 Feb 2025 03:13:23 +0900 Subject: [PATCH 05/10] new(neovim): add nvim-treesitter-context --- dotfiles/neovim/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index 415e042..f53468b 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -114,6 +114,9 @@ require('lazy').setup({ build = ":TSUpdate", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", + { + "nvim-treesitter/nvim-treesitter-context" + } }, }, { From 6c60650872c90abff6d4ea689fab41a96c92959a Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sun, 23 Feb 2025 03:13:48 +0900 Subject: [PATCH 06/10] new(nvim): add telescope current_buffer_fuzzy_find binding --- dotfiles/neovim/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index f53468b..8857ac9 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -498,6 +498,7 @@ vim.keymap.set('n', 'fli', builtin.lsp_incoming_calls, { desc = "lsp inc vim.keymap.set('n', 'flo', builtin.lsp_outgoing_calls, { desc = "lsp outgoing calls" }) vim.keymap.set('n', 'fll', builtin.lsp_implementations, { desc = "lsp implementations" }) vim.keymap.set('n', 'fb', builtin.buffers, { desc = "buffers" }) +vim.keymap.set('n', 'fz', builtin.current_buffer_fuzzy_find, { desc = "current buffer fuzzy find" }) vim.keymap.set('n', 'fg', builtin.live_grep, { desc = "grep" }) vim.keymap.set('n', 'fh', builtin.help_tags, { desc = "help tags" }) vim.keymap.set('n', 'fc', builtin.git_commits, { desc = "git commit" }) From 4f2f2187f341558a8aef8638ad9d519a22b84f39 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sun, 23 Feb 2025 03:14:15 +0900 Subject: [PATCH 07/10] new(nvim): add lsp goto type_definition --- dotfiles/neovim/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index 8857ac9..f6e2d1e 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -633,6 +633,7 @@ local on_attach = function(client, bufnr) local bufopts = { noremap = true, silent = true, buffer = bufnr } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'gT', vim.lsp.buf.type_definition, bufopts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) vim.keymap.set('n', 'g1', vim.lsp.buf.implementation, bufopts) vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) From 29ad5b91bf1d53dd02cab3a18a82b2e81d0d8467 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sun, 23 Feb 2025 03:15:04 +0900 Subject: [PATCH 08/10] update(nvim): enable inlay hints in rust_analyzer and add cargo.features = "all" --- dotfiles/neovim/init.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index f6e2d1e..f577e28 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -769,15 +769,21 @@ lspconfig.tinymist.setup { } lspconfig.rust_analyzer.setup { - on_attach = on_attach, + on_attach = function(client, bufnr) + on_attach(client, bufnr) + vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) + end, capabilities = capabilities, settings = { ['rust-analyzer'] = { + cargo = { + features = "all", + }, check = { command = "clippy", - } - } - } + }, + }, + }, } local lss = { "pyright", "texlab", --[[ "ccls", ]] "clangd", "ts_ls", --[["tailwindcss"]] "hls", "cmake", From ed9fafdc764a19a5c3eacf65c7a4db51b7fef036 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sun, 23 Feb 2025 03:15:52 +0900 Subject: [PATCH 09/10] new(neovim): add tinymist format option --- dotfiles/neovim/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index f577e28..1e27109 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -766,6 +766,10 @@ lspconfig.tinymist.setup { on_attach = on_attach, capabilities = capabilities, single_file_support = true, + -- offset_encoding = "utf-8", + settings = { + formatterMode = "typstyle", + }, } lspconfig.rust_analyzer.setup { From c9026eb8429c38f0d76c1b8a26ba22aa8cf7e949 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Wed, 26 Feb 2025 19:36:07 +0900 Subject: [PATCH 10/10] new(fish): add rga fzf integrated func https://github.com/phiresky/ripgrep-all/blob/c97fa3a491f37a782fdcf95b505b56c866121006/README.md --- dotfiles/fish/config.fish | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish index 37148a4..f549acb 100644 --- a/dotfiles/fish/config.fish +++ b/dotfiles/fish/config.fish @@ -24,6 +24,25 @@ if status is-interactive # opam #source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true + + function rga-fzf + set RG_PREFIX 'rga --files-with-matches' + if test (count $argv) -gt 1 + set RG_PREFIX "$RG_PREFIX $argv[1..-2]" + end + set -l file $file + set file ( + FZF_DEFAULT_COMMAND="$RG_PREFIX '$argv[-1]'" \ + fzf --sort \ + --preview='test ! -z {} && \ + rga --pretty --context 5 {q} {}' \ + --phony -q "$argv[-1]" \ + --bind "change:reload:$RG_PREFIX {q}" \ + --preview-window='50%:wrap' + ) && \ + echo "opening $file" && \ + open "$file" + end end # starship