From abf2a17474ec53e45687cde630e11613f695b20b Mon Sep 17 00:00:00 2001 From: qwjyh Date: Tue, 9 Apr 2024 08:47:08 +0900 Subject: [PATCH] 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))