diff --git a/README.md b/README.md index cfe1850..2bf618a 100644 --- a/README.md +++ b/README.md @@ -7,16 +7,18 @@ my dotfiles - AHK macro - wezterm - etc -- Ubuntu 20.04 on WSL - - fish -- Arch/Manjaro +- Arch - fish - tmux - neovim - keyboard config(xremap) - wezterm +- Ubuntu 22.04 on WSL + - fish +- Termux ## extra +- qpdfview - okular # Installing @@ -29,11 +31,20 @@ my dotfiles 6. run `bin/install.ps1` ### note -* manual install lean +* manually install lean ## Linux -1. install fish -2. run install.sh +1. run install.sh + +# Neovim + +## Julia +### Initial setup +- `./bin/neovim/setup_julials.jl` to set up environment with LanguageServer.jl + +- `./bin/neovim/update_julials.jl` to generate sysimage for faster startup time + +Edit `init.lua` to change arguments for julials. # TODO - Iron.nvim doesn't work for julia on Windows diff --git a/bin/install.ps1 b/bin/install.ps1 index bcc5fce..1726980 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -54,16 +54,22 @@ 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 +New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lspconfig\server_configurations\jetls.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lspconfig\server_configurations\jetls.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) +New-Item -ItemType SymbolicLink -Path $env:LOCALAPPDATA\nvim\after\ftplugin\org.lua -Target (Resolve-Path .\dotfiles\neovim\after\ftplugin\org.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 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 @@ -76,4 +82,7 @@ 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 diff --git a/bin/install.sh b/bin/install.sh index 09fca0c..964fe27 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -10,37 +10,49 @@ set -eu # exit 1 # fi # TODO: check git in path -cd $(git rev-parse --show-toplevel) +cd "$(git rev-parse --show-toplevel)" # ========================================================= # links # ========================================================= mkdir -p ~/.config/fish -ln -sf $(pwd)/dotfiles/fish/config.fish ~/.config/fish/config.fish -ln -sf $(pwd)/dotfiles/starship/starship.toml ~/.config/starship.toml -ln -sf $(pwd)/dotfiles/tmux.conf ~/.tmux.conf +ln -sf "$(pwd)/dotfiles/fish/config.fish" ~/.config/fish/config.fish +ln -sf "$(pwd)/dotfiles/starship/starship.toml" ~/.config/starship.toml +ln -sf "$(pwd)/dotfiles/tmux.conf" ~/.tmux.conf +# ln -s $(pwd)/dotfiles/neovim ~/.config/nvim mkdir -p ~/.config/nvim -ln -sf $(pwd)/dotfiles/neovim/init.lua ~/.config/nvim/init.lua +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 +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 +ln -sf "$(pwd)/dotfiles/neovim/lua/lspconfig/server_configurations/satysfi_ls.lua" ~/.config/nvim/lua/lspconfig/server_configurations/satysfi_ls.lua +ln -sf "$(pwd)/dotfiles/neovim/lua/lspconfig/server_configurations/jetls.lua" ~/.config/nvim/lua/lspconfig/server_configurations/jetls.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/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 +ln -sf "$(pwd)/dotfiles/neovim/after/ftplugin/org.lua" ~/.config/nvim/after/ftplugin/org.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 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 +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 +ln -sf "$(pwd)/dotfiles/neovim/luasnippets/all.lua" ~/.config/nvim/luasnippets/all.lua mkdir -p ~/.config/nvim/luasnippets/satysfi -ln -sf $(pwd)/dotfiles/neovim/luasnippets/satysfi/math.lua ~/.config/nvim/luasnippets/satysfi/math.lua +ln -sf "$(pwd)/dotfiles/neovim/luasnippets/satysfi/math.lua" ~/.config/nvim/luasnippets/satysfi/math.lua mkdir -p ~/.julia/config -ln -sf $(pwd)/dotfiles/startup_linux.jl ~/.julia/config/startup.jl +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)" diff --git a/bin/neovim/add_dependencies.jl b/bin/neovim/add_dependencies.jl index 82a99d6..b3e39fa 100644 --- a/bin/neovim/add_dependencies.jl +++ b/bin/neovim/add_dependencies.jl @@ -6,24 +6,26 @@ 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"] -foreach(Pkg.add, pkg_extra) -@info "dependency added" +pkg_extra = ["Logging", "Sockets", "DataStructures", "Tar", "ArgTools", "Dates", "Downloads", "TOML", "JSONRPC", "SymbolServer", "CSTParser", "StaticLint", "JSON"] +Pkg.add(pkg_extra) +@info "added dependencies" + +# Extra package to be executed in precompiled code +pkg_precompiled = ["Pkg"] # 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, ", ")) + println(io, "import FileWatching") end @info "finished writing precompile head file" diff --git a/bin/neovim/readme.md b/bin/neovim/readme.md index b94f686..ba69a49 100644 --- a/bin/neovim/readme.md +++ b/bin/neovim/readme.md @@ -1,27 +1,24 @@ # How to manage Julia Language Server -This config use sysimage built with PackageCompiler to make language server startup faster. -Scripts in this directory is for management of sysimage. +This config use sysimage built with PackageCompiler to make language server starts faster. +Scripts in this directory are for management of the sysimage. # description all related process is done in project at `~/.julia/environments/nvim-lspconfig/`. -## startup +## install (or minor update of Julia) ```sh -$ ./setup_julials.sh +julia ./setup_julials.jl ``` -which executes `add_dependencies.jl` internally. +Run Language Server with `--tracecompile` option from any editor. ## update ```sh -$ ./update_julials.sh +julia ./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 - diff --git a/bin/neovim/setup_julials.jl b/bin/neovim/setup_julials.jl index 5c28658..dbd44f3 100644 --- a/bin/neovim/setup_julials.jl +++ b/bin/neovim/setup_julials.jl @@ -1,16 +1,12 @@ #!/usr/bin/julia project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig") if !ispath(project_path) - try - mkdir(project_path) - @info "Created $(project_path)" - catch e - @error e - @error dump(e) - throw(e) - end + mkdir(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/setup_julials.sh b/bin/neovim/setup_julials.sh deleted file mode 100755 index f1aa150..0000000 --- a/bin/neovim/setup_julials.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/bash -x -julia --project=~/.julia/environments/nvim-lspconfig ./add_dependencies.jl diff --git a/bin/neovim/update_julials.jl b/bin/neovim/update_julials.jl index 935848c..77c157e 100644 --- a/bin/neovim/update_julials.jl +++ b/bin/neovim/update_julials.jl @@ -1,14 +1,19 @@ #!/usr/bin/julia project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig") -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()'`) +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 diff --git a/bin/neovim/update_julials.sh b/bin/neovim/update_julials.sh deleted file mode 100755 index 8dd5a78..0000000 --- a/bin/neovim/update_julials.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/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()' - diff --git a/dotfiles/bat/config b/dotfiles/bat/config new file mode 100644 index 0000000..a717d92 --- /dev/null +++ b/dotfiles/bat/config @@ -0,0 +1,4 @@ +# use Catppuccin for bat +# https://github.com/catppuccin/bat +# Installation instruction on the readme +--theme="Catppuccin Mocha" diff --git a/dotfiles/fish/config.fish b/dotfiles/fish/config.fish index ebdacbf..f549acb 100644 --- a/dotfiles/fish/config.fish +++ b/dotfiles/fish/config.fish @@ -18,11 +18,31 @@ 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 diff --git a/dotfiles/lf/lfrc b/dotfiles/lf/lfrc new file mode 100644 index 0000000..15b8558 --- /dev/null +++ b/dotfiles/lf/lfrc @@ -0,0 +1,23 @@ +cmap cmd-menu-complete +cmap 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\"" +#}} + diff --git a/dotfiles/neovim/.gitignore b/dotfiles/neovim/.gitignore new file mode 100644 index 0000000..8089223 --- /dev/null +++ b/dotfiles/neovim/.gitignore @@ -0,0 +1 @@ +lua/local_settings.lua diff --git a/dotfiles/neovim/after/ftplugin/org.lua b/dotfiles/neovim/after/ftplugin/org.lua new file mode 100644 index 0000000..530b84c --- /dev/null +++ b/dotfiles/neovim/after/ftplugin/org.lua @@ -0,0 +1,2 @@ +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 diff --git a/dotfiles/neovim/after/queries/julia/injections.scm b/dotfiles/neovim/after/queries/julia/injections.scm index 60d3f24..efc8930 100644 --- a/dotfiles/neovim/after/queries/julia/injections.scm +++ b/dotfiles/neovim/after/queries/julia/injections.scm @@ -1,7 +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)) +(prefixed_string_literal + prefix: (identifier) @_prefix + (content) @injection.content + (#eq? @_prefix "sql") + (#set! injection.language "sql")) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index d478482..6c5dd9c 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -1,7 +1,7 @@ ----------------------------------------------------------- -- Installing plugin manager 'lazy.nvim' local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then +if not (vim.uv or vim.loop).fs_stat(lazypath) then vim.fn.system({ "git", "clone", @@ -28,16 +28,6 @@ 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() @@ -66,7 +56,21 @@ require('lazy').setup({ }, { -- lualine(statusline) 'nvim-lualine/lualine.nvim', - dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true } + 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 }, { 'lervag/vimtex', @@ -110,6 +114,9 @@ require('lazy').setup({ build = ":TSUpdate", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", + { + "nvim-treesitter/nvim-treesitter-context" + } }, }, { @@ -118,14 +125,6 @@ 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', @@ -141,7 +140,40 @@ require('lazy').setup({ }, { 'folke/trouble.nvim', - -- config = function + opts = {}, + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=bottom", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, }, { 'Julian/lean.nvim', @@ -156,29 +188,7 @@ require('lazy').setup({ -- see Julian/lean.nvim readme opts = { lsp = { - on_attach = function(client, bufnr) - -- Enable completion triggered by - --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', '', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - 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) - end, + on_attach = require("lsp_config").on_attach, }, mappings = true, }, @@ -194,22 +204,105 @@ 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 = '~/orgfiles/**/*', + org_agenda_files = require("local_settings").org_agenda_files, 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": "