Compare commits
3 commits
main
...
pluto_nvim
Author | SHA1 | Date | |
---|---|---|---|
f1cc8f9210 | |||
3efaba3135 | |||
b6a05b9ad7 |
30 changed files with 413 additions and 553 deletions
23
README.md
23
README.md
|
@ -7,18 +7,16 @@ my dotfiles
|
|||
- AHK macro
|
||||
- wezterm
|
||||
- etc
|
||||
- Arch
|
||||
- Ubuntu 20.04 on WSL
|
||||
- fish
|
||||
- Arch/Manjaro
|
||||
- fish
|
||||
- tmux
|
||||
- neovim
|
||||
- keyboard config(xremap)
|
||||
- wezterm
|
||||
- Ubuntu 22.04 on WSL
|
||||
- fish
|
||||
- Termux
|
||||
|
||||
## extra
|
||||
- qpdfview
|
||||
- okular
|
||||
|
||||
# Installing
|
||||
|
@ -31,20 +29,11 @@ my dotfiles
|
|||
6. run `bin/install.ps1`
|
||||
|
||||
### note
|
||||
* manually install lean
|
||||
* manual install lean
|
||||
|
||||
## Linux
|
||||
1. run install.sh
|
||||
|
||||
# Neovim
|
||||
|
||||
## Julia
|
||||
### Initial setup
|
||||
- `./bin/neovim/setup_julials.jl` to set up environment with LanguageServer.jl
|
||||
<!-- - Edit `init.lua` not to use sysimage and edit some julia code -->
|
||||
- `./bin/neovim/update_julials.jl` to generate sysimage for faster startup time
|
||||
|
||||
Edit `init.lua` to change arguments for julials.
|
||||
1. install fish
|
||||
2. run install.sh
|
||||
|
||||
# TODO
|
||||
- Iron.nvim doesn't work for julia on Windows
|
||||
|
|
|
@ -54,13 +54,10 @@ scoop import .\bin\windows\scoop_apps\scoop_minimal_apps.json
|
|||
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.lua -Target (Resolve-Path .\dotfiles\neovim\init.lua) -Force
|
||||
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lualine_setup.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lualine_setup.lua) -Force
|
||||
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\term_powershell.lua -Target (Resolve-Path .\dotfiles\neovim\lua\term_powershell.lua) -Force
|
||||
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lsp_config.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lsp_config.lua) -Force
|
||||
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\local_settings.lua -Target (Resolve-Path .\dotfiles\neovim\lua\local_settings.lua) -Force
|
||||
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lspconfig\server_configurations\satysfi_ls.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lspconfig\server_configurations\satysfi_ls.lua) -Force
|
||||
mkdir $env:LOCALAPPDATA\nvim\after\ftplugin
|
||||
New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\nvim\after\ftplugin\satysfi.lua -Target (Resolve-Path .\dotfiles\neovim\after\ftplugin\satysfi.lua)
|
||||
New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\nvim\after\ftplugin\tex.lua -Target (Resolve-Path .\dotfiles\neovim\after\ftplugin\tex.lua)
|
||||
New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\nvim\after\ftplugin\typst.lua -Target (Resolve-Path .\dotfiles\neovim\after\ftplugin\typst.lua)
|
||||
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
|
||||
|
@ -79,7 +76,4 @@ New-Item -ItemType SymbolicLink -Path ~\.config\wezterm\wezterm.lua -Target (Res
|
|||
# julia
|
||||
mkdir ~\.config\julia\config
|
||||
New-Item -ItemType SymbolicLink -Path ~\.julia\config\startup.jl -Target (Resolve-Path .\dotfiles\startup_windows.jl) -Force
|
||||
# lf
|
||||
mkdir $env:LOCALAPPDATA\lf
|
||||
New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\lf\lfrc -Target (Resolve-Path .\dotfiles\lf\lfrc) -Force
|
||||
|
||||
|
|
|
@ -25,15 +25,12 @@ 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/lsp_config.lua ~/.config/nvim/lua/lsp_config.lua
|
||||
ln -sf $(pwd)/dotfiles/neovim/lua/pluto_nvim.lua ~/.config/nvim/lua/pluto_nvim.lua
|
||||
ln -sf $(pwd)/dotfiles/neovim/lua/local_settings.lua ~/.config/nvim/lua/local_settings.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
|
||||
ln -sf $(pwd)/dotfiles/neovim/after/ftplugin/satysfi.lua ~/.config/nvim/after/ftplugin/satysfi.lua
|
||||
ln -sf $(pwd)/dotfiles/neovim/after/ftplugin/tex.lua ~/.config/nvim/after/ftplugin/tex.lua
|
||||
ln -sf $(pwd)/dotfiles/neovim/after/ftplugin/typst.lua ~/.config/nvim/after/ftplugin/typst.lua
|
||||
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
|
||||
|
@ -47,9 +44,3 @@ ln -sf $(pwd)/dotfiles/neovim/luasnippets/satysfi/math.lua ~/.config/nvim/luasni
|
|||
|
||||
mkdir -p ~/.julia/config
|
||||
ln -sf $(pwd)/dotfiles/startup_linux.jl ~/.julia/config/startup.jl
|
||||
curl -o ~/.julia/config/catppuccin.jl https://raw.githubusercontent.com/catppuccin/ohmyrepl/refs/heads/main/catppuccin.jl
|
||||
|
||||
mkdir -p ~/.config/lf
|
||||
ln -sf $(pwd)/dotfiles/lf/lfrc ~/.config/lf/lfrc
|
||||
|
||||
ln -sf $(pwd)/dotfiles/bat/config "$(bat --config-file)"
|
||||
|
|
|
@ -6,28 +6,24 @@ using Pkg
|
|||
# add LanguageServer.jl
|
||||
Pkg.add("LanguageServer")
|
||||
|
||||
# add PackageCompiler.jl
|
||||
Pkg.add("PackageCompiler")
|
||||
# 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 extra dependencies
|
||||
# these packages are manually collected
|
||||
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 = []
|
||||
pkg_extra = ["Logging", "Sockets", "DataStructures", "Tar", "ArgTools", "Dates", "Downloads"]
|
||||
foreach(Pkg.add, pkg_extra)
|
||||
@info "dependency added"
|
||||
|
||||
# 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
|
||||
end
|
||||
@info "finished writing precompile head file"
|
||||
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
# How to manage Julia Language Server
|
||||
This config use sysimage built with PackageCompiler to make language server starts faster.
|
||||
Scripts in this directory are for management of the sysimage.
|
||||
This config use sysimage built with PackageCompiler to make language server startup faster.
|
||||
Scripts in this directory is for management of sysimage.
|
||||
|
||||
# description
|
||||
all related process is done in project at `~/.julia/environments/nvim-lspconfig/`.
|
||||
|
||||
## install (or minor update of Julia)
|
||||
## startup
|
||||
```sh
|
||||
julia ./setup_julials.jl
|
||||
$ ./setup_julials.sh
|
||||
```
|
||||
Run Language Server with `--tracecompile` option from any editor.
|
||||
which executes `add_dependencies.jl` internally.
|
||||
|
||||
## update
|
||||
```sh
|
||||
julia ./update_julials.sh
|
||||
$ ./update_julials.sh
|
||||
```
|
||||
which updates project, compile sysimage, then do precompile.
|
||||
To use the sysimage, run Language Server with `-J ~/.julia/environments/nvim-lspconfig/` option.
|
||||
|
||||
# effect
|
||||
Start up got about x3 - x4 faster.
|
||||
It still takes some time to load packages though.
|
||||
|
||||
# TODO
|
||||
- [ ] Not sure all necessary packages are listed in add_dependencies.jl
|
||||
- [ ] Maybe it's better to set up different sysimages for each projects
|
||||
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
#!/usr/bin/julia
|
||||
project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig")
|
||||
if !ispath(project_path)
|
||||
try
|
||||
mkdir(project_path)
|
||||
@info "Created $(project_path)"
|
||||
touch(joinpath(project_path, "tracecompile.jl"))
|
||||
catch e
|
||||
@error e
|
||||
@error dump(e)
|
||||
throw(e)
|
||||
end
|
||||
end
|
||||
|
||||
using Pkg
|
||||
Pkg.activate(project_path)
|
||||
include("$(@__DIR__)/add_dependencies.jl")
|
||||
cmd = `julia --project=$(project_path) $(@__DIR__)/add_dependencies.jl`
|
||||
@info cmd
|
||||
run(cmd)
|
||||
|
||||
|
|
2
bin/neovim/setup_julials.sh
Executable file
2
bin/neovim/setup_julials.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/bash -x
|
||||
julia --project=~/.julia/environments/nvim-lspconfig ./add_dependencies.jl
|
|
@ -1,19 +1,14 @@
|
|||
#!/usr/bin/julia
|
||||
project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig")
|
||||
using Pkg
|
||||
using PackageCompiler;
|
||||
cd(project_path) do
|
||||
@info "now at " pwd()
|
||||
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..."
|
||||
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
|
||||
cd(project_path)
|
||||
@info "now at " pwd()
|
||||
run(`julia --project=. -e 'using Pkg; Pkg.update()'`)
|
||||
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"
|
||||
run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`)
|
||||
|
||||
|
|
7
bin/neovim/update_julials.sh
Executable file
7
bin/neovim/update_julials.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/bash -x
|
||||
cd ~/.julia/environments/nvim-lspconfig/ || return 1
|
||||
julia --project=. -e 'using Pkg; Pkg.update()'
|
||||
cat precompile_exec_head.jl tracecompile.jl > precompile_exec.jl
|
||||
julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path="sys-ls.so", precompile_execution_file=["precompile_exec.jl"])'
|
||||
julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
# use Catppuccin for bat
|
||||
# https://github.com/catppuccin/bat
|
||||
# Installation instruction on the readme
|
||||
--theme="Catppuccin Mocha"
|
|
@ -18,31 +18,11 @@ if status is-interactive
|
|||
# abbr (from 3.6, --universal is removed)
|
||||
abbr -a -- l less
|
||||
abbr -a -- ll 'eza -la --icons --git'
|
||||
abbr -a -- qpv 'qpdfview --unique'
|
||||
|
||||
zoxide init fish | source
|
||||
|
||||
# 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
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
cmap <tab> cmd-menu-complete
|
||||
cmap <backtab> cmd-menu-complete-back
|
||||
|
||||
## https://github.com/gokcehan/lf/wiki/Integrations#eza
|
||||
#cmd on-select &{{
|
||||
# lf -remote "send $id set statfmt \"$(eza -ld --color=always "$f" | sed 's/\\/\\\\/g;s/"/\\"/g')\""
|
||||
#}}
|
||||
#
|
||||
#cmd git_branch ${{
|
||||
# git branch | fzf | xargs git checkout
|
||||
# pwd_shell="$(pwd | sed 's/\\/\\\\/g;s/"/\\"/g')"
|
||||
# lf -remote "send $id updir; cd \"$pwd_shell\""
|
||||
#}}
|
||||
#map gb :git_branch
|
||||
#map gp $clear; git pull --rebase || true; echo "press ENTER"; read ENTER
|
||||
#map gs $clear; git status; echo "press ENTER"; read ENTER
|
||||
#map gl $clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
|
||||
#
|
||||
#cmd on-cd &{{
|
||||
# fmt="$(STARSHIP_SHELL= starship prompt | sed 's/\\/\\\\/g;s/"/\\"/g')"
|
||||
# lf -remote "send $id set promptfmt \"$fmt\""
|
||||
#}}
|
||||
|
1
dotfiles/neovim/.gitignore
vendored
1
dotfiles/neovim/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
lua/local_settings.lua
|
|
@ -1,7 +1,7 @@
|
|||
;; extends
|
||||
|
||||
(prefixed_string_literal
|
||||
prefix: (identifier) @_prefix
|
||||
(content) @injection.content
|
||||
(#eq? @_prefix "sql")
|
||||
(#set! injection.language "sql"))
|
||||
((prefixed_string_literal
|
||||
prefix: (identifier) @_prefix) @injection.content
|
||||
(#eq? @_prefix "md")
|
||||
(#set! injection.language "markdown")
|
||||
(#offset! @injection.content 0 2 0 -1))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-----------------------------------------------------------
|
||||
-- Installing plugin manager 'lazy.nvim'
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
|
@ -28,6 +28,16 @@ require('lazy').setup({
|
|||
}
|
||||
end
|
||||
},
|
||||
{
|
||||
dir = "./lua/pluto_nvim.lua",
|
||||
config = function()
|
||||
-- temp global for dev
|
||||
pluto_nvim = require("pluto_nvim")
|
||||
require("pluto_nvim").setup {}
|
||||
end,
|
||||
lazy = true,
|
||||
ft = { 'julia' },
|
||||
},
|
||||
{
|
||||
'folke/which-key.nvim',
|
||||
config = function()
|
||||
|
@ -56,21 +66,7 @@ require('lazy').setup({
|
|||
},
|
||||
{ -- lualine(statusline)
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons', lazy = true }
|
||||
},
|
||||
{
|
||||
'shellRaining/hlchunk.nvim',
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require('hlchunk').setup {
|
||||
chunk = {
|
||||
enable = true,
|
||||
},
|
||||
line_num = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
end
|
||||
dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true }
|
||||
},
|
||||
{
|
||||
'lervag/vimtex',
|
||||
|
@ -114,9 +110,6 @@ require('lazy').setup({
|
|||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context"
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -125,6 +118,14 @@ require('lazy').setup({
|
|||
},
|
||||
{
|
||||
"andymass/vim-matchup",
|
||||
config = function()
|
||||
vim.g.matchup_matchparen_offscreen = { method = "popup" }
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
matchup = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
|
@ -140,40 +141,7 @@ require('lazy').setup({
|
|||
},
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
opts = {},
|
||||
cmd = "Trouble",
|
||||
keys = {
|
||||
{
|
||||
"<space>xx",
|
||||
"<cmd>Trouble diagnostics toggle<cr>",
|
||||
desc = "Diagnostics (Trouble)",
|
||||
},
|
||||
{
|
||||
"<space>xX",
|
||||
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||
desc = "Buffer Diagnostics (Trouble)",
|
||||
},
|
||||
{
|
||||
"<space>cs",
|
||||
"<cmd>Trouble symbols toggle focus=false<cr>",
|
||||
desc = "Symbols (Trouble)",
|
||||
},
|
||||
{
|
||||
"<space>cl",
|
||||
"<cmd>Trouble lsp toggle focus=false win.position=bottom<cr>",
|
||||
desc = "LSP Definitions / references / ... (Trouble)",
|
||||
},
|
||||
{
|
||||
"<space>xL",
|
||||
"<cmd>Trouble loclist toggle<cr>",
|
||||
desc = "Location List (Trouble)",
|
||||
},
|
||||
{
|
||||
"<space>xQ",
|
||||
"<cmd>Trouble qflist toggle<cr>",
|
||||
desc = "Quickfix List (Trouble)",
|
||||
},
|
||||
},
|
||||
-- config = function
|
||||
},
|
||||
{
|
||||
'Julian/lean.nvim',
|
||||
|
@ -188,7 +156,29 @@ require('lazy').setup({
|
|||
-- see Julian/lean.nvim readme
|
||||
opts = {
|
||||
lsp = {
|
||||
on_attach = require("lsp_config").on_attach,
|
||||
on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
--vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below function
|
||||
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', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'g1', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'grf', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end,
|
||||
},
|
||||
mappings = true,
|
||||
},
|
||||
|
@ -204,105 +194,22 @@ require('lazy').setup({
|
|||
},
|
||||
-- event = 'VeryLazy', -- doesn't work with existing comp and treesitter
|
||||
config = function()
|
||||
-- Setup treesitter
|
||||
require('nvim-treesitter.configs').setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { 'org' },
|
||||
},
|
||||
ensure_installed = { 'org' },
|
||||
})
|
||||
|
||||
-- Setup orgmode
|
||||
require('orgmode').setup({
|
||||
org_agenda_files = require("local_settings").org_agenda_files,
|
||||
org_agenda_files = '~/orgfiles/**/*',
|
||||
org_default_notes_file = '~/orgfiles/refile.org',
|
||||
org_todo_keywords = {
|
||||
"TODO(t)",
|
||||
"PLAN(p)",
|
||||
"NEXT(n)",
|
||||
"|",
|
||||
"DONE(d)",
|
||||
"CANCELED(c)",
|
||||
},
|
||||
org_todo_keyword_faces = {
|
||||
-- TODO = ":foreground red",
|
||||
PLAN = ":foreground #F0BB61",
|
||||
NEXT = ":background #663333 :foreground #E0A0A0",
|
||||
CANCELED = ":foreground #99AA99",
|
||||
},
|
||||
org_archive_location = '~/orgfiles/archives/%s_archive::',
|
||||
org_adapt_indentation = false,
|
||||
org_id_link_to_org_use_id = true,
|
||||
org_capture_templates = {
|
||||
t = {
|
||||
description = "Task",
|
||||
template = '* TODO %?\n%u'
|
||||
},
|
||||
l = {
|
||||
description = "Log",
|
||||
template = '* %?\n%U'
|
||||
},
|
||||
j = {
|
||||
description = "Journal",
|
||||
template = '* %?\n%U',
|
||||
target = '~/orgfiles/journal.org',
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'chomosuke/typst-preview.nvim',
|
||||
ft = 'typst',
|
||||
version = 'v1.*',
|
||||
build = function()
|
||||
require 'typst-preview'.update()
|
||||
end,
|
||||
config = function()
|
||||
require 'typst-preview'.setup {
|
||||
-- Setting this true will enable logging debug information to
|
||||
-- `vim.fn.stdpath 'data' .. '/typst-preview/log.txt'`
|
||||
debug = true,
|
||||
|
||||
-- Custom format string to open the output link provided with %s
|
||||
-- Example: open_cmd = 'firefox %s -P typst-preview --class typst-preview'
|
||||
open_cmd = nil,
|
||||
|
||||
-- Setting this to 'always' will invert black and white in the preview
|
||||
-- Setting this to 'auto' will invert depending if the browser has enable
|
||||
-- dark mode
|
||||
-- Setting this to '{"rest": "<option>","image": "<option>"}' will apply
|
||||
-- your choice of color inversion to images and everything else
|
||||
-- separately.
|
||||
invert_colors = 'never',
|
||||
|
||||
-- Whether the preview will follow the cursor in the source file
|
||||
follow_cursor = true,
|
||||
|
||||
-- Provide the path to binaries for dependencies.
|
||||
-- Setting this will skip the download of the binary by the plugin.
|
||||
-- Warning: Be aware that your version might be older than the one
|
||||
-- required.
|
||||
dependencies_bin = {
|
||||
['tinymist'] = 'tinymist',
|
||||
['websocat'] = nil,
|
||||
},
|
||||
|
||||
-- A list of extra arguments (or nil) to be passed to previewer.
|
||||
-- For example, extra_args = { "--input=ver=draft", "--ignore-system-fonts" }
|
||||
extra_args = nil,
|
||||
|
||||
-- This function will be called to determine the root of the typst project
|
||||
get_root = function(path_of_main_file)
|
||||
-- Use root of git repository as a --root for typst
|
||||
local rootpath = vim.fs.root(path_of_main_file, '.git')
|
||||
if rootpath then
|
||||
return rootpath
|
||||
else
|
||||
return vim.fn.fnamemodify(path_of_main_file, ':p:h')
|
||||
end
|
||||
end,
|
||||
|
||||
-- This function will be called to determine the main file of the typst
|
||||
-- project.
|
||||
get_main_file = function(path_of_buffer)
|
||||
return path_of_buffer
|
||||
end,
|
||||
}
|
||||
end
|
||||
},
|
||||
})
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
@ -354,8 +261,7 @@ vim.keymap.set('n', 'L', '<cmd>tabn<cr>', { desc = 'tab next' })
|
|||
require('catppuccin').setup({
|
||||
transparent_background = true,
|
||||
})
|
||||
vim.cmd.colorscheme "catppuccin-mocha"
|
||||
-- vim.cmd.colorscheme "catppuccin-latte"
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
|
||||
-----------------------------------------------------------
|
||||
vim.g.mapleader = ' '
|
||||
|
@ -425,7 +331,7 @@ require('gitsigns').setup {
|
|||
---@param mode string|string[]
|
||||
---@param l string
|
||||
---@param r any
|
||||
---@param opts vim.keymap.set.Opts?
|
||||
---@param opts table?
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
|
@ -456,12 +362,7 @@ local builtin = require('telescope.builtin')
|
|||
vim.keymap.set('n', '<leader>ff', function() builtin.find_files { sort_lastused = true } end, { desc = "find files" })
|
||||
vim.keymap.set('n', '<leader>fw', builtin.lsp_workspace_symbols, { desc = "lsp workspace symbols" })
|
||||
vim.keymap.set('n', '<leader>fd', builtin.lsp_document_symbols, { desc = "lsp document symbols" })
|
||||
vim.keymap.set('n', '<leader>flr', builtin.lsp_references, { desc = "lsp references for word" })
|
||||
vim.keymap.set('n', '<leader>fli', builtin.lsp_incoming_calls, { desc = "lsp incoming calls" })
|
||||
vim.keymap.set('n', '<leader>flo', builtin.lsp_outgoing_calls, { desc = "lsp outgoing calls" })
|
||||
vim.keymap.set('n', '<leader>fll', builtin.lsp_implementations, { desc = "lsp implementations" })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = "buffers" })
|
||||
vim.keymap.set('n', '<leader>fz', builtin.current_buffer_fuzzy_find, { desc = "current buffer fuzzy find" })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = "grep" })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = "help tags" })
|
||||
vim.keymap.set('n', '<leader>fc', builtin.git_commits, { desc = "git commit" })
|
||||
|
@ -583,11 +484,35 @@ local lspconfig = require 'lspconfig'
|
|||
-- See `:help vim.diagnostic.* for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = require("lsp_config").on_attach
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
--vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below function
|
||||
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', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'g1', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'grf', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
-- cmp_nvim_lsp supports additional LSP completion capabilities
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
@ -628,17 +553,13 @@ if julials_so_file then -- if sysimage doesn't exist, julials_so_file == nil
|
|||
end
|
||||
-- main
|
||||
lspconfig.julials.setup {
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end,
|
||||
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",
|
||||
"-t4",
|
||||
"-e",
|
||||
[[
|
||||
# Load LanguageServer.jl: attempt to load from ~/.julia/environments/nvim-lspconfig
|
||||
|
@ -674,17 +595,7 @@ lspconfig.julials.setup {
|
|||
run(server)
|
||||
]] }
|
||||
}
|
||||
-- JETLS
|
||||
require 'lspconfig.server_configurations.jetls'
|
||||
lspconfig.jetls.setup {
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
-- SATySFi
|
||||
require 'lspconfig.server_configurations.satysfi_ls'
|
||||
lspconfig.satysfi_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
|
@ -696,45 +607,36 @@ 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 = vim.fn.has('win32') == 1 and win_pwsh_es_path or arch_pwsh_es_path,
|
||||
bundle_path = '~/scoop/apps/powershell-editorservice/current',
|
||||
capabilities = capabilities,
|
||||
}
|
||||
-- ccls
|
||||
-- -- csharp
|
||||
-- lspconfig.omnisharp.setup {
|
||||
-- cmd = {'omnisharp'},
|
||||
-- }
|
||||
|
||||
|
||||
lspconfig.tinymist.setup {
|
||||
lspconfig.typst_lsp.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
single_file_support = true,
|
||||
-- offset_encoding = "utf-8",
|
||||
settings = {
|
||||
formatterMode = "typstyle",
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.rust_analyzer.setup {
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
cargo = {
|
||||
features = "all",
|
||||
},
|
||||
check = {
|
||||
command = "clippy",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
local lss = { "pyright", "texlab", --[[ "ccls", ]] "clangd", "ts_ls", --[["tailwindcss"]] "hls", "cmake",
|
||||
"csharp_ls", "html", "r_language_server", "cssls", "jsonls", "sqls", "vhdl_ls", "ruff", "lemminx", "nixd", "nil_ls",
|
||||
"verible", "svls" }
|
||||
local lss = { "pyright", "texlab", "ccls", "clangd", "tsserver", --[["tailwindcss"]] "hls", "cmake",
|
||||
"csharp_ls", "html", "r_language_server", "ruff_lsp", "cssls", "jsonls", "sqls" }
|
||||
for _, ls in pairs(lss) do
|
||||
lspconfig[ls].setup {
|
||||
on_attach = on_attach,
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
---Add `desc` to bufopts table.
|
||||
---@param bufopts vim.keymap.set.Opts
|
||||
---@param desc string
|
||||
---@return vim.keymap.set.Opts
|
||||
local function with_desc(bufopts, desc)
|
||||
return vim.tbl_extend("error", bufopts, { desc = desc })
|
||||
end
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
--vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below function
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, with_desc(bufopts, "goto declaration"))
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, with_desc(bufopts, "goto definition"))
|
||||
vim.keymap.set('n', 'gT', vim.lsp.buf.type_definition, with_desc(bufopts, "goto type definition"))
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, with_desc(bufopts, "lsp hover"))
|
||||
vim.keymap.set('n', 'g1', vim.lsp.buf.implementation, with_desc(bufopts, "lsp implementations"))
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, with_desc(bufopts, "lsp signature help"))
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, with_desc(bufopts, "lsp add_workspace_folder"))
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder,
|
||||
with_desc(bufopts, "lsp remove_workspace_folder"))
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, with_desc(bufopts, "lsp list_workspace_folders"))
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, with_desc(bufopts, "lsp type definition"))
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, with_desc(bufopts, "lsp rename"))
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, with_desc(bufopts, "lsp code_action"))
|
||||
vim.keymap.set('n', 'grf', vim.lsp.buf.references, with_desc(bufopts, "lsp references"))
|
||||
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, with_desc(bufopts, "lsp format"))
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,36 +0,0 @@
|
|||
local configs = require 'lspconfig.configs'
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
local root_files = { 'Project.toml', 'JuliaProject.toml' }
|
||||
|
||||
configs.jetls = {
|
||||
default_config = {
|
||||
cmd = {
|
||||
'julia',
|
||||
'--project=' .. vim.env.HOME .. '/work/julia/JETLS.jl',
|
||||
'--startup-file=no',
|
||||
'--history-file=no',
|
||||
'-e',
|
||||
[[
|
||||
using JETLS
|
||||
runserver(stdin, stdout)
|
||||
]]
|
||||
},
|
||||
filetypes = { 'julia' },
|
||||
root_dir = function(fname)
|
||||
return util.root_pattern(unpack(root_files))(fname)
|
||||
or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true, })[1])
|
||||
end,
|
||||
single_file_support = true,
|
||||
},
|
||||
commands = {
|
||||
-- JuliaActivateEnv = {
|
||||
-- activate_env
|
||||
-- }
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
JETLS: https://github.com/aviatesk/JETLS.jl
|
||||
]],
|
||||
},
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
-- https://zenn.dev/monaqa/articles/2021-12-10-satysfi-language-server
|
||||
local configs = require 'lspconfig.configs'
|
||||
local util = require 'lspconfig.util'
|
||||
|
||||
configs.satysfi_ls = {
|
||||
return {
|
||||
default_config = {
|
||||
cmd = { 'satysfi-language-server' },
|
||||
filetypes = { 'satysfi' },
|
||||
root_dir = vim.fs.root(0, ".git"),
|
||||
root_dir = util.root_pattern('.git'),
|
||||
single_file_support = true,
|
||||
},
|
||||
docs = {
|
||||
|
@ -18,3 +18,4 @@ configs.satysfi_ls = {
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-- https://qiita.com/uhooi/items/99aeff822d4870a8e269
|
||||
local lsp_names = function ()
|
||||
local clients = {}
|
||||
for _, client in ipairs(vim.lsp.get_clients({ bufnr = 0})) do
|
||||
for _, client in ipairs(vim.lsp.get_active_clients({ bufnr = 0})) do
|
||||
table.insert(clients, client.name)
|
||||
end
|
||||
return ' ' .. table.concat(clients, ', ')
|
||||
|
|
230
dotfiles/neovim/lua/pluto_nvim.lua
Normal file
230
dotfiles/neovim/lua/pluto_nvim.lua
Normal file
|
@ -0,0 +1,230 @@
|
|||
local job = require('plenary.job')
|
||||
local M = {}
|
||||
|
||||
local NOTEBOOK_HEADER = "### A Pluto.jl notebook ###"
|
||||
local BLOCK_START = "# ╔═╡ "
|
||||
local CELLORDER_START = "# ╔═╡ Cell order:"
|
||||
local CELLORDER_VISIBLE_BODY = "# ╠═"
|
||||
local CELLORDER_HIDDEN_BODY = "# ╟─"
|
||||
|
||||
local function node_is_pluto_prefix(node)
|
||||
if node:type() ~= "line_comment" then
|
||||
return false
|
||||
end
|
||||
local row, col, _ = node:start()
|
||||
local comment_text = vim.api.nvim_buf_get_lines(0, row, row + 1, true)
|
||||
-- print("TEXT: ", comment_text[1])
|
||||
return nil ~= string.match(comment_text[1], BLOCK_START) and nil == string.match(comment_text[1], CELLORDER_START)
|
||||
end
|
||||
|
||||
---Get iterator of TSnodes of cell prefix comments
|
||||
---@return function
|
||||
function M.get_cell_prefix_nodes()
|
||||
local curnode = vim.treesitter.get_node()
|
||||
local top_nodes = curnode:root():iter_children()
|
||||
return function()
|
||||
while true do
|
||||
local node = top_nodes()
|
||||
if node == nil then
|
||||
return nil
|
||||
end
|
||||
if node_is_pluto_prefix(node) then
|
||||
return node
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function node_is_cell_order(node)
|
||||
if node:type() ~= "line_comment" then
|
||||
return false
|
||||
end
|
||||
local row, col, _ = node:start()
|
||||
local comment_text = vim.api.nvim_buf_get_lines(0, row, row + 1, true)
|
||||
-- print("TEXT: ", comment_text[1])
|
||||
return nil ~= string.match(comment_text[1], CELLORDER_START) or
|
||||
nil ~= string.match(comment_text[1], CELLORDER_VISIBLE_BODY) or
|
||||
nil ~= string.match(comment_text[1], CELLORDER_HIDDEN_BODY)
|
||||
end
|
||||
|
||||
function M.get_cell_order_nodes()
|
||||
local curnode = vim.treesitter.get_node()
|
||||
local top_nodes = curnode:root():iter_children()
|
||||
return function()
|
||||
while true do
|
||||
local node = top_nodes()
|
||||
if node == nil then
|
||||
return nil
|
||||
end
|
||||
if node_is_cell_order(node) then
|
||||
return node
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Get prefix TSNode of current cell
|
||||
---@return TSNode?
|
||||
local function get_current_cell_prefix_node()
|
||||
local curnode = vim.treesitter.get_node()
|
||||
if curnode == nil then
|
||||
print("Not in a cell")
|
||||
return nil
|
||||
end
|
||||
while curnode:parent():type() ~= "source_file" do
|
||||
print("curnode", curnode:range())
|
||||
curnode = curnode:parent()
|
||||
end
|
||||
local prefix_node
|
||||
if node_is_pluto_prefix(curnode) then
|
||||
prefix_node = curnode
|
||||
elseif curnode:prev_sibling() ~= nil and node_is_pluto_prefix(curnode:prev_sibling()) then
|
||||
prefix_node = curnode:prev_sibling()
|
||||
else
|
||||
print("Not a valid cell")
|
||||
print("current node", curnode:type(), curnode:range())
|
||||
return nil
|
||||
end
|
||||
return prefix_node
|
||||
end
|
||||
|
||||
local function get_uuid(node)
|
||||
local row, col, _ = node:start()
|
||||
local comment_text = vim.api.nvim_buf_get_lines(0, row, row + 1, true)
|
||||
-- print("text", comment_text[1])
|
||||
local _, _, uuid = string.find(comment_text[1], "(%x+-%x+-%x+-%x+-%x+)")
|
||||
return uuid
|
||||
end
|
||||
|
||||
---Get uuid of the current cell.
|
||||
---@return string?
|
||||
function M.get_current_cell_uuid()
|
||||
local prefix_node = get_current_cell_prefix_node()
|
||||
if prefix_node == nil then return nil end
|
||||
return get_uuid(prefix_node)
|
||||
end
|
||||
|
||||
local function get_cellbody_node(uuid)
|
||||
for node in M.get_cell_prefix_nodes() do
|
||||
if uuid == get_uuid(node) then
|
||||
return node
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---Generate uuid1 using Julia.
|
||||
---@return string
|
||||
local function uuid1()
|
||||
local generated
|
||||
job:new({
|
||||
command = "julia",
|
||||
args = { "-e", "using UUIDs; print(uuid1())" },
|
||||
on_exit = function(j, return_val)
|
||||
if return_val ~= 0 then
|
||||
print("error processing UUID", return_val, vim.inspect(j:result()))
|
||||
end
|
||||
generated = j:result()[1]
|
||||
end,
|
||||
}):sync()
|
||||
return generated
|
||||
end
|
||||
|
||||
---Get row number of the cell order entry which corresponds to the current cell
|
||||
---@param curuuid string
|
||||
---@return integer?
|
||||
local function get_cell_order_node(curuuid)
|
||||
local ordernode_row
|
||||
for ordernode in M.get_cell_order_nodes() do
|
||||
local srow, scol, erow, ecol = ordernode:range()
|
||||
local str = vim.api.nvim_buf_get_text(0, srow, scol, erow, ecol, {})
|
||||
local _, _, ordernode_uuid = string.find(str[1], "(%x+-%x+-%x+-%x+-%x+)")
|
||||
if ordernode_uuid == curuuid then
|
||||
-- print("Matched: ", curuuid, srow, erow)
|
||||
ordernode_row = srow
|
||||
end
|
||||
end
|
||||
return ordernode_row
|
||||
end
|
||||
|
||||
function M.insert_cell_below()
|
||||
local curuuid = M.get_current_cell_uuid()
|
||||
if curuuid == nil then
|
||||
return nil
|
||||
end
|
||||
local newuuid = uuid1()
|
||||
local ordernode_row = get_cell_order_node(curuuid)
|
||||
vim.api.nvim_buf_set_lines(0, ordernode_row + 1, ordernode_row + 1, true, {
|
||||
CELLORDER_VISIBLE_BODY .. newuuid
|
||||
})
|
||||
local prefix_node = get_current_cell_prefix_node()
|
||||
if prefix_node == nil then
|
||||
return nil
|
||||
end
|
||||
local _, _, end_row, _ = prefix_node:next_sibling():range()
|
||||
vim.api.nvim_buf_set_lines(0, end_row + 1, end_row + 1, true, {
|
||||
"",
|
||||
BLOCK_START .. newuuid,
|
||||
"",
|
||||
})
|
||||
vim.api.nvim_win_set_cursor(0, { end_row + 4, 0 })
|
||||
end
|
||||
|
||||
function M.goto_cellorder_entry()
|
||||
local curuuid = M.get_current_cell_uuid()
|
||||
if not curuuid then return nil end
|
||||
local ordernode_row = get_cell_order_node(curuuid)
|
||||
vim.cmd("norm! m`")
|
||||
vim.api.nvim_win_set_cursor(0, { ordernode_row + 1, 0 })
|
||||
end
|
||||
|
||||
function M.goto_cell_body()
|
||||
local line_str = vim.api.nvim_get_current_line()
|
||||
local _, _, uuid = string.find(line_str, "(%x+-%x+-%x+-%x+-%x+)")
|
||||
if uuid == nil then
|
||||
print("This line doesn't have valid id")
|
||||
return nil
|
||||
end
|
||||
local body_node = get_cellbody_node(uuid)
|
||||
local start_row, _, _, _ = body_node:range()
|
||||
vim.cmd("norm! m`")
|
||||
vim.api.nvim_win_set_cursor(0, { start_row + 2, 0 })
|
||||
end
|
||||
|
||||
function M.toggle_visibility()
|
||||
local curuuid = M.get_current_cell_uuid()
|
||||
if not curuuid then return nil end
|
||||
local ordernode_row = get_cell_order_node(curuuid)
|
||||
local ordernode_text = vim.api.nvim_buf_get_lines(0, ordernode_row, ordernode_row + 1, true)[1]
|
||||
if string.find(ordernode_text, CELLORDER_VISIBLE_BODY) then
|
||||
vim.api.nvim_buf_set_text(0, ordernode_row, 0, ordernode_row, 4, { CELLORDER_HIDDEN_BODY })
|
||||
elseif string.find(ordernode_text, CELLORDER_HIDDEN_BODY) then
|
||||
vim.api.nvim_buf_set_text(0, ordernode_row, 0, ordernode_row, 4, { CELLORDER_VISIBLE_BODY })
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(opts)
|
||||
vim.api.nvim_create_user_command('PlutoGoToCellOrder', M.goto_cellorder_entry, {
|
||||
nargs = 0,
|
||||
desc = "Go to the cell order entry which corresponds to the current cell",
|
||||
})
|
||||
vim.api.nvim_create_user_command('PlutoGoToCellBody', M.goto_cell_body, {
|
||||
nargs = 0,
|
||||
desc = "Go to the cell body which corresponds to the current order entry",
|
||||
})
|
||||
vim.api.nvim_create_user_command('PlutoToggleVisibility', M.toggle_visibility, {
|
||||
nargs = 0,
|
||||
desc = "Toggle visiblity of the current cell",
|
||||
})
|
||||
-- require('nvim-treesitter.configs').setup {
|
||||
-- textobjects = {
|
||||
-- select = {
|
||||
-- enable = true,
|
||||
-- keymaps = {
|
||||
-- ["ac"] = "@cell.outer",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
end
|
||||
|
||||
return M
|
|
@ -139,7 +139,7 @@ function Enable-SshAgent {
|
|||
.OUTPUTS
|
||||
no outputs
|
||||
#>
|
||||
sudo run pwsh -c "Set-Service -Name ssh-agent -StartupType Manual && Start-Service ssh-agent"
|
||||
sudo Set-Service -Name ssh-agent -StartupType Manual && Start-Service ssh-agent
|
||||
}
|
||||
# auto start ssh-agent and do ssh-add
|
||||
function Invoke-SshAdd {
|
||||
|
@ -164,8 +164,6 @@ $env:LESS = "-i -M -R -S -W -z-4 -x4"
|
|||
$env:JL_SYSIMG_PATH = "$HOME/dotfiles/julia-sysimages"
|
||||
$env:JL_SYSIMG_PLT = "$HOME/dotfiles/julia-sysimages/sys-plotsmakie.so"
|
||||
$env:JL_SYSIMG_ETC = "$HOME/dotfiles/julia-sysimages/sys-etc.so"
|
||||
# yazi file
|
||||
$env:YAZI_FILE_ONE = "C:\Program Files\Git\usr\bin\file.exe"
|
||||
|
||||
|
||||
# ==============================================================
|
||||
|
@ -233,3 +231,7 @@ Import-Module WSLTabCompletion
|
|||
|
||||
Get-ChildItem ~\.config\powershell\completions\ | % { . $_ }
|
||||
|
||||
# Automatically appended by pdm scoop package
|
||||
Get-ChildItem "$PROFILE\..\Completions\" | ForEach-Object {
|
||||
. $_.FullName
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
try
|
||||
using OhMyREPL
|
||||
enable_autocomplete_brackets(false)
|
||||
include("catppuccin.jl")
|
||||
OhMyREPL.colorscheme!("CatppuccinMocha")
|
||||
catch e
|
||||
@warn "Failed to load OhMyREPL"
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
source ~/.local.tmux.conf
|
||||
# -----------------------------------------------
|
||||
set -g history-limit 50000
|
||||
set -g history-limit 500000
|
||||
|
||||
set-option -g default-command fish
|
||||
|
||||
|
|
|
@ -45,17 +45,14 @@ return {
|
|||
-- },
|
||||
|
||||
color_scheme = "iceberg-dark",
|
||||
-- color_scheme = "catppuccin-macchiato",
|
||||
-- color_scheme = "catppuccin-latte",
|
||||
-- color_scheme = "Everforest Dark (Gogh)",
|
||||
use_fancy_tab_bar = false,
|
||||
tab_bar_at_bottom = true,
|
||||
window_background_opacity = 0.90,
|
||||
window_background_opacity = 0.85,
|
||||
-- font = wezterm.font 'FirgeNerd Console'
|
||||
font = wezterm.font_with_fallback {
|
||||
{
|
||||
family = 'Juisee HWNF',
|
||||
weight = 'Regular',
|
||||
family = 'JuiseeHW Nerd Font',
|
||||
weight = 'Bold',
|
||||
harfbuzz_features = {
|
||||
'calt=0', -- disables ligature
|
||||
'zero=1',
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
"""
|
||||
Modify qpdfview config.
|
||||
"""
|
||||
|
||||
import configparser
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# =======================================================================================
|
||||
|
||||
QPDFVIEW_CONFIGDIR = os.path.expanduser("~/.config/qpdfview/")
|
||||
if not os.path.exists(QPDFVIEW_CONFIGDIR):
|
||||
print("qpdfview config directory not found.")
|
||||
print("Install qpdfview first and rerun this script.")
|
||||
print("Exiting...")
|
||||
exit(1)
|
||||
|
||||
# =======================================================================================
|
||||
|
||||
QPDFVIEW_CONFIG_CONFIG = QPDFVIEW_CONFIGDIR + "qpdfview.conf"
|
||||
print(f"{QPDFVIEW_CONFIG_CONFIG=}")
|
||||
|
||||
if os.path.exists(QPDFVIEW_CONFIG_CONFIG):
|
||||
shutil.copyfile(QPDFVIEW_CONFIG_CONFIG, QPDFVIEW_CONFIG_CONFIG + ".orig")
|
||||
|
||||
config = configparser.RawConfigParser()
|
||||
config.optionxform = lambda optionstr: optionstr
|
||||
config.read(QPDFVIEW_CONFIG_CONFIG)
|
||||
|
||||
config["documentView"]["autoRefresh"] = "true"
|
||||
config["documentView"]["highlightAll"] = "true"
|
||||
config["documentView"]["highlightCurrentThumbnail"] = "true"
|
||||
config["documentView"]["highlightDuration"] = "5000"
|
||||
config["documentView"]["limitThumbnailsToResults"] = "true"
|
||||
config["documentView"]["prefetch"] = "true"
|
||||
config["documentView"]["prefetchDistance"] = "5"
|
||||
config["documentView"]["relativeJumps"] = "true"
|
||||
|
||||
config["mainWindow"]["recentlyClosedCount"] = "20"
|
||||
config["mainWindow"]["recentlyUsedCount"] = "40"
|
||||
config["mainWindow"]["restorePerFileSettings"] = "true"
|
||||
config["mainWindow"]["restoreTabs"] = "true"
|
||||
config["mainWindow"]["searchableMenus"] = "true"
|
||||
config["mainWindow"]["tabVisibility"] = "0"
|
||||
config["mainWindow"]["trackRecentlyUsed"] = "true"
|
||||
config["mainWindow"]["viewToolBar"] = "scaleFactor, zoomIn, zoomOut, fitToPageWidthMode"
|
||||
|
||||
config["pageItem"]["cacheSize"] = "131072K"
|
||||
|
||||
with open(QPDFVIEW_CONFIG_CONFIG, "w") as file:
|
||||
config.write(file, space_around_delimiters=False)
|
||||
|
||||
# =======================================================================================
|
||||
|
||||
QPDFVIEW_CONFIG_SHORTCUTS = QPDFVIEW_CONFIGDIR + "shortcuts.conf"
|
||||
|
||||
if os.path.exists(QPDFVIEW_CONFIG_SHORTCUTS):
|
||||
shutil.copyfile(QPDFVIEW_CONFIG_SHORTCUTS, QPDFVIEW_CONFIG_SHORTCUTS + ".orig")
|
||||
|
||||
shortcut_config = configparser.RawConfigParser()
|
||||
shortcut_config.optionxform = lambda optionstr: optionstr
|
||||
shortcut_config.read(QPDFVIEW_CONFIG_SHORTCUTS)
|
||||
|
||||
shortcut_config["General"]["continuousMode"] = "Ctrl+7, C"
|
||||
shortcut_config["General"]["findNext"] = "Ctrl+G, Return"
|
||||
shortcut_config["General"]["findPrevious"] = "Ctrl+Shift+G, Shift+Return"
|
||||
shortcut_config["General"]["jumpToPage"] = "Ctrl+J, G"
|
||||
shortcut_config["General"]["nextPage"] = "Space, N"
|
||||
shortcut_config["General"]["previousPage"] = "Backspace, P"
|
||||
|
||||
with open(QPDFVIEW_CONFIG_SHORTCUTS, "w") as file:
|
||||
shortcut_config.write(file, space_around_delimiters=False)
|
|
@ -16,9 +16,6 @@ modmap:
|
|||
Win_L:
|
||||
held: Win_L
|
||||
alone: Key_Chat
|
||||
- name: left shift
|
||||
remap:
|
||||
Capslock: shift_l
|
||||
keymap:
|
||||
- name: ZenkakuHankaku to Esc
|
||||
remap:
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
keymap:
|
||||
- name: Wheel Tilt
|
||||
remap:
|
||||
# Side forward
|
||||
# Btn_Side: Left
|
||||
# Side back
|
||||
# Btn_Extra: Right
|
||||
XRIGHTSCROLL:
|
||||
remap:
|
||||
XHIRES_RIGHTSCROLL: Ctrl-Tab
|
||||
XLEFTSCROLL:
|
||||
remap:
|
||||
XHIRES_LEFTSCROLL: Ctrl-Shift-Tab
|
||||
device:
|
||||
only: 'Logi M750 Mouse'
|
|
@ -1 +1 @@
|
|||
Subproject commit 98581abe7cb2baecd63e95c337da08778fec60ae
|
||||
Subproject commit 21f32a2032614d2e923be436ca4a4f0f07a8cdc5
|
|
@ -1,14 +0,0 @@
|
|||
# Experimental Nix flake for general cli environment
|
||||
- Basically for servers, not for my laptops.
|
||||
|
||||
# How to Install
|
||||
```sh
|
||||
$ nix flake build
|
||||
$ nix profile install .#my-packages
|
||||
```
|
||||
|
||||
# How to upgrade
|
||||
```sh
|
||||
$ nix flake upgrade
|
||||
$ nix profile upgrade my-packages
|
||||
```
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
description = "A very basic flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
|
||||
packages.x86_64-linux.my-packages = nixpkgs.legacyPackages.x86_64-linux.buildEnv {
|
||||
name = "my-packages-list";
|
||||
paths = [
|
||||
nixpkgs.legacyPackages.x86_64-linux.fish
|
||||
nixpkgs.legacyPackages.x86_64-linux.git
|
||||
nixpkgs.legacyPackages.x86_64-linux.curl
|
||||
nixpkgs.legacyPackages.x86_64-linux.neovim
|
||||
nixpkgs.legacyPackages.x86_64-linux.ripgrep
|
||||
nixpkgs.legacyPackages.x86_64-linux.fzf
|
||||
|
||||
nixpkgs.legacyPackages.x86_64-linux.clang-tools
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue