From d5f8d807b9d0fae807ab6bb4f38065f14b73571f Mon Sep 17 00:00:00 2001 From: js0ny Date: Wed, 20 Nov 2024 14:27:00 +0000 Subject: [PATCH] Sync from Windows --- .config/NuGet/NuGet.Config | 14 +- .config/conda/condarc.yaml | 14 +- .config/git/.gitconfig | 31 +- .config/ideavim/ideavimrc.vimrc | 302 +-- .../ipython/profile_default/ipython_config.py | 2 +- .../ipython/profile_default/starup/keymap.py | 138 +- .../profile_default/starup/magic_ps.py | 20 +- .config/lesskey | 26 +- .config/markdownlint/.markdownlint.json | 10 +- .config/npm/.npmrc | 8 +- .config/npm/npmrc | 12 +- .config/nvim/.neoconf.json | 30 +- .config/nvim/.options/obsidian.all.lua | 42 +- .config/nvim/README.md | 14 +- .config/nvim/init.lua | 4 +- .config/nvim/lua/config/autocmds.lua | 6 +- .config/nvim/lua/config/keymaps.lua | 292 +-- .config/nvim/lua/config/lazy.lua | 106 +- .config/nvim/lua/config/options.lua | 6 +- .config/nvim/lua/plugins/catppuccin.lua | 108 +- .config/nvim/lua/plugins/colorscheme.lua | 26 +- .config/nvim/lua/plugins/example.lua | 394 ++-- .config/nvim/lua/plugins/neo-tree.lua | 254 +- .config/nvim/lua/plugins/wakatime.lua | 4 +- .config/nvim/stylua.toml | 4 +- .config/pip/pip.conf | 8 +- .config/starship/starship.toml | 404 ++-- .config/starship/starship_nu.toml | 210 ++ .config/starship/starship_pwsh.toml | 416 ++-- .config/starship/starship_zsh.toml | 416 ++-- .config/tmux/tmux.conf | 78 +- .config/vim/vimrc | 5 +- .config/zellij/config.kdl | 48 +- .editorconfig | 20 + .gitignore | 33 +- .obsidian.vimrc | 118 +- LICENSE | 688 +++++- browser/surfingkeys.js | 718 +++--- desktop.ini | 12 +- mac/.zshrc | 88 +- mac/Microsoft.PowerShell_profile.ps1 | 46 +- mac/karabiner/caps_to_esc_lcmd.json | 50 +- mac/karabiner/fn-tab_to_cmd-tab.json | 46 +- mac/neovide.toml | 42 +- mac/set_mirror.sh | 66 +- mac/shortcuts/finder_open.applescript | 8 +- mirror/set_mirror.ps1 | 12 +- mirror/set_mirror.sh | 42 +- mirror/tuna_ubuntu.list | 28 +- powershell/Aliases.ps1 | 72 +- powershell/Completions.ps1 | 9 + powershell/Config.ps1 | 12 +- powershell/Keymap.ps1 | 48 +- powershell/Modules.ps1 | 16 +- powershell/Navigation.ps1 | 28 +- powershell/Prompt.ps1 | 182 +- powershell/Scripts.ps1 | 32 +- powershell/readme.md | 46 +- readme.md | 8 +- setup/requirements.txt | 19 + setup/set_symblink_unix.sh | 42 +- setup/win_setup.ps1 | 31 +- vscode/hsnips/c.hsnips | 28 +- vscode/hsnips/latex.hsnips | 2074 ++++++++--------- vscode/hsnips/markdown.hsnips | 2018 ++++++++-------- vscode/hsnips/readme.md | 14 +- vscode/hsnips/typst.hsnips | 264 +-- vscode/vscode.vimrc | 44 +- win/.wslconfig | 22 +- win/Microsoft.PowerShell_profile.ps1 | 14 + win/WindowsTerminal.json | 60 +- win/neovide.toml | 30 +- win/readme.md | 98 +- wsl/.bashrc | 18 + wsl/.zshrc | 144 +- zsh/.zshenv | 40 +- zsh/alias.zsh | 88 +- zsh/config.zsh | 152 +- zsh/keymap.zsh | 38 +- zsh/navi.zsh | 16 +- 80 files changed, 6079 insertions(+), 5097 deletions(-) create mode 100644 .config/starship/starship_nu.toml create mode 100644 .editorconfig create mode 100644 powershell/Completions.ps1 create mode 100644 setup/requirements.txt create mode 100644 wsl/.bashrc diff --git a/.config/NuGet/NuGet.Config b/.config/NuGet/NuGet.Config index 5fbb352..4a9acec 100644 --- a/.config/NuGet/NuGet.Config +++ b/.config/NuGet/NuGet.Config @@ -1,10 +1,6 @@ - - - - - - - - - + + + + + \ No newline at end of file diff --git a/.config/conda/condarc.yaml b/.config/conda/condarc.yaml index 5788ada..c589efc 100644 --- a/.config/conda/condarc.yaml +++ b/.config/conda/condarc.yaml @@ -1,7 +1,7 @@ -# $XDG_CONFIG_HOME/conda/condarc.yaml -# ================================================================== -# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME\conda\.condarc -Target $DOTFILES\.config\conda\condarc.yaml -# ln -s $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc -# ================================================================== -# https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html -auto_activate_base: false +# $XDG_CONFIG_HOME/conda/condarc.yaml +# ================================================================== +# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME\conda\.condarc -Target $DOTFILES\.config\conda\condarc.yaml +# ln -s $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc +# ================================================================== +# https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html +auto_activate_base: false diff --git a/.config/git/.gitconfig b/.config/git/.gitconfig index 50b50fa..494d67c 100644 --- a/.config/git/.gitconfig +++ b/.config/git/.gitconfig @@ -1,13 +1,20 @@ -# $XDG_CONFIG_HOME/git/config -# ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config -# New-Item -ItemType SymbolicLink -Path "$Env:XDG_CONFIG_HOME\git\config" -Target "$DOTFILES\.config\git\.gitconfig" -[user] - name = js0ny - email = json.y@outlook.com -[core] - editor = vim -[filter "lfs"] - clean = git-lfs clean -- %f - smudge = git-lfs smudge -- %f - process = git-lfs filter-process +# $XDG_CONFIG_HOME/git/config +# %USERPROFILE%\.gitconfig # No XDG support on Windows +# ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config +# New-Item -ItemType SymbolicLink -Path "$Env:XDG_CONFIG_HOME\git\config" -Target "$DOTFILES\.config\git\.gitconfig" +[user] + name = js0ny + email = json.y@outlook.com +[core] + editor = nvim + pager = delta +[interactive] + diffFilter = delta --color-only +[delta] + navigate = true + dark = true +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process required = true \ No newline at end of file diff --git a/.config/ideavim/ideavimrc.vimrc b/.config/ideavim/ideavimrc.vimrc index 8b7b1ae..1d8116a 100644 --- a/.config/ideavim/ideavimrc.vimrc +++ b/.config/ideavim/ideavimrc.vimrc @@ -1,152 +1,152 @@ -"$XDG_CONFIG_HOME/ideavim/ideavimrc -" New-Item -ItemType SymbolicLink -Path ~\.ideavimrc -Target $DOTFILES\.config\ideavim\ideavimrc.vimrc -" ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc -""" Basic Configs """ -let mapleader = " " " set to - -""" Colemak """ -" Word wrap -noremap n gj -noremap e gk -noremap i l - -" Similar position to i -noremap l i -noremap L I -" ne[k]st -noremap k n -noremap K N -" [j]ump -noremap j e -noremap J E - -" Y to yank to end of line -noremap Y y$ - -""" Options """ -" search for actions: :actionlist - -"" Vim Compat "" -set clipboard=unnamedplus,unnamed,ideaput " integrate with system clipboard -set gdefault " substitute all occurrences in line per default -set history=4096 " keep x lines of command line history -set hlsearch -set ignorecase -set incsearch -set keymodel=startsel,stopsel -set matchpairs+=<:> -set showcmd -set smartcase " no ignore case when pattern is uppercase -set wrapscan " searches wrap around the end of the file - -"" IDE Settings "" -set scrolloff=5 -set sidescrolloff=10 - -"" IDE Features "" -set relativenumber " Hybrid Line Number shown - -"" IdeaVim Only "" -set ideajoin -set ideastatusicon=enabled - -""" Plugins """ - -Plug 'justinmk/vim-sneak' -Plug 'preservim/nerdtree' -Plug 'tpope/vim-surround' -Plug 'tpope/vim-commentary' -Plug 'terryma/vim-multiple-cursors' -Plug 'machakann/vim-highlightedyank' -Plug 'easymotion/vim-easymotion' - -""" Keybindings """ - -"" edit ideavim config v + "" -nnoremap vv :e ~/.ideavimrc -nnoremap vr :source ~/.ideavimrc - -"" NERDTree "" -nnoremap e :NERDTreeToggle - -"" EasyMotion "" -nmap s (easymotion-f) -nmap S (easymotion-F) - -"" Sneak "" -nmap f (sneak-s) -nmap F (sneak-S) - -"" Miscs "" -nnoremap : :action GotoAction - -"" AI Related a + "" -nnoremap ac :action copilot.chat.show -nnoremap ad :action copilot.disableCopilot -nnoremap ae :action copilot.enableCopilot -nnoremap ai :action copilot.openCopilot - -"" Codes Action c + "" -nnoremap cf :action ReformatCode -nnoremap cs :action GotoSymbol -nnoremap c/ :action CommentByLineComment - -"" Project Action p + "" -nnoremap pr :action Run -nnoremap pd :action Debug -nnoremap pb :action Build - -"" Files Action f + "" -nnoremap fe :NERDTreeToggle -nnoremap ft :action ActivateTerminalToolWindow - -"" Tab Actions + "" -nnoremap :action Switcher - -"" Collapse and Expand z + "" -nnoremap zi :action ExpandCollapseToggleAction -nnoremap zc :action CollapseRegion -nnoremap zC :action CollapseRegionRecursively -nnoremap zM :action CollapseAll -nnoremap zo :action ExpandRegion -nnoremap zO :action ExpandRegionRecursively -nnoremap zR :action ExpandAll - -"" don't lose selection when indenting "" -vnoremap < >gv -vnoremap = =gv - - -nnoremap a :action FindInPath -nnoremap gd :action GotoDeclaration -nnoremap gtd :action GotoTypeDeclaration -nnoremap gtD :action QuickTypeDefinition -nnoremap gr :action ShowUsages -nnoremap gi :action GotoImplementation -nnoremap gpi :action QuickImplementations -nnoremap gs :action GotoSuperMethod -nnoremap ga :action -nnoremap gq :action ShowIntentionActions -nnoremap ge :action GotoNextError - -nnoremap :action ParameterInfo -inoremap :action ParameterInfo - -"" Refractor r + "" - -nnoremap ri :action Inline -nnoremap rr :action RenameElement -nnoremap rev :action IntroduceVariable -vnoremap rev :action IntroduceVariable -nnoremap rem :action ExtractMethod -vnoremap rem :action ExtractMethod -nnoremap rm :action Move -nnoremap ro :action OptimizeImports -nnoremap rG :action Generate - -""" Handling Ctrls """ - -sethandler n-v:vim i:ide -sethandler a:ide +"$XDG_CONFIG_HOME/ideavim/ideavimrc +" New-Item -ItemType SymbolicLink -Path ~\.ideavimrc -Target $DOTFILES\.config\ideavim\ideavimrc.vimrc +" ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc +""" Basic Configs """ +let mapleader = " " " set to + +""" Colemak """ +" Word wrap +noremap n gj +noremap e gk +noremap i l + +" Similar position to i +noremap l i +noremap L I +" ne[k]st +noremap k n +noremap K N +" [j]ump +noremap j e +noremap J E + +" Y to yank to end of line +noremap Y y$ + +""" Options """ +" search for actions: :actionlist + +"" Vim Compat "" +set clipboard=unnamedplus,unnamed,ideaput " integrate with system clipboard +set gdefault " substitute all occurrences in line per default +set history=4096 " keep x lines of command line history +set hlsearch +set ignorecase +set incsearch +set keymodel=startsel,stopsel +set matchpairs+=<:> +set showcmd +set smartcase " no ignore case when pattern is uppercase +set wrapscan " searches wrap around the end of the file + +"" IDE Settings "" +set scrolloff=5 +set sidescrolloff=10 + +"" IDE Features "" +set relativenumber " Hybrid Line Number shown + +"" IdeaVim Only "" +set ideajoin +set ideastatusicon=enabled + +""" Plugins """ + +Plug 'justinmk/vim-sneak' +Plug 'preservim/nerdtree' +Plug 'tpope/vim-surround' +Plug 'tpope/vim-commentary' +Plug 'terryma/vim-multiple-cursors' +Plug 'machakann/vim-highlightedyank' +Plug 'easymotion/vim-easymotion' + +""" Keybindings """ + +"" edit ideavim config v + "" +nnoremap vv :e ~/.ideavimrc +nnoremap vr :source ~/.ideavimrc + +"" NERDTree "" +nnoremap e :NERDTreeToggle + +"" EasyMotion "" +nmap s (easymotion-f) +nmap S (easymotion-F) + +"" Sneak "" +nmap f (sneak-s) +nmap F (sneak-S) + +"" Miscs "" +nnoremap : :action GotoAction + +"" AI Related a + "" +nnoremap ac :action copilot.chat.show +nnoremap ad :action copilot.disableCopilot +nnoremap ae :action copilot.enableCopilot +nnoremap ai :action copilot.openCopilot + +"" Codes Action c + "" +nnoremap cf :action ReformatCode +nnoremap cs :action GotoSymbol +nnoremap c/ :action CommentByLineComment + +"" Project Action p + "" +nnoremap pr :action Run +nnoremap pd :action Debug +nnoremap pb :action Build + +"" Files Action f + "" +nnoremap fe :NERDTreeToggle +nnoremap ft :action ActivateTerminalToolWindow + +"" Tab Actions + "" +nnoremap :action Switcher + +"" Collapse and Expand z + "" +nnoremap zi :action ExpandCollapseToggleAction +nnoremap zc :action CollapseRegion +nnoremap zC :action CollapseRegionRecursively +nnoremap zM :action CollapseAll +nnoremap zo :action ExpandRegion +nnoremap zO :action ExpandRegionRecursively +nnoremap zR :action ExpandAll + +"" don't lose selection when indenting "" +vnoremap < >gv +vnoremap = =gv + + +nnoremap a :action FindInPath +nnoremap gd :action GotoDeclaration +nnoremap gtd :action GotoTypeDeclaration +nnoremap gtD :action QuickTypeDefinition +nnoremap gr :action ShowUsages +nnoremap gi :action GotoImplementation +nnoremap gpi :action QuickImplementations +nnoremap gs :action GotoSuperMethod +nnoremap ga :action +nnoremap gq :action ShowIntentionActions +nnoremap ge :action GotoNextError + +nnoremap :action ParameterInfo +inoremap :action ParameterInfo + +"" Refractor r + "" + +nnoremap ri :action Inline +nnoremap rr :action RenameElement +nnoremap rev :action IntroduceVariable +vnoremap rev :action IntroduceVariable +nnoremap rem :action ExtractMethod +vnoremap rem :action ExtractMethod +nnoremap rm :action Move +nnoremap ro :action OptimizeImports +nnoremap rG :action Generate + +""" Handling Ctrls """ + +sethandler n-v:vim i:ide +sethandler a:ide sethandler > a:ide \ No newline at end of file diff --git a/.config/ipython/profile_default/ipython_config.py b/.config/ipython/profile_default/ipython_config.py index 889258b..3c7c713 100644 --- a/.config/ipython/profile_default/ipython_config.py +++ b/.config/ipython/profile_default/ipython_config.py @@ -40,4 +40,4 @@ def custom_return(shell): return handle -c.TerminalInteractiveShell.handle_return = custom_return \ No newline at end of file +c.TerminalInteractiveShell.handle_return = custom_return diff --git a/.config/ipython/profile_default/starup/keymap.py b/.config/ipython/profile_default/starup/keymap.py index 2dae6da..828d26d 100644 --- a/.config/ipython/profile_default/starup/keymap.py +++ b/.config/ipython/profile_default/starup/keymap.py @@ -1,69 +1,69 @@ -from prompt_toolkit.key_binding import KeyBindings -from prompt_toolkit.key_binding.vi_state import InputMode -from prompt_toolkit.filters import Condition -from IPython import get_ipython - -ip = get_ipython() -key_bindings = KeyBindings() - -@Condition -def in_navigation_mode(): - return ip.pt_app.app.vi_state.input_mode == InputMode.NAVIGATION - -# colemak keymap hnei -@key_bindings.add("n", filter=in_navigation_mode) -def _(event): - "Move cursor down by visual line" - event.current_buffer.auto_down(count=event.arg) - -@key_bindings.add("e", filter=in_navigation_mode) -def _(event): - "Move cursor up by visual line" - event.current_buffer.auto_up(count=event.arg) - -@key_bindings.add("i", filter=in_navigation_mode) -def _(event): - "Move cursor right" - event.current_buffer.cursor_right(count=event.arg) - -# Insert with 'l' and 'L' -@key_bindings.add("l", filter=in_navigation_mode) -def _(event): - "Enter insert mode (similar position to 'i' in Colemak)" - event.app.vi_state.input_mode = InputMode.INSERT - -@key_bindings.add("L", filter=in_navigation_mode) -def _(event): - "Enter insert mode at the beginning of the line" - event.current_buffer.cursor_position += event.current_buffer.document.get_start_of_line_position() - -# Ne[k]st -@key_bindings.add("k", filter=in_navigation_mode) -def _(event): - "Find next match" - event.current_buffer.forward_search() - -@key_bindings.add("K", filter=in_navigation_mode) -def _(event): - "Find previous match" - event.current_buffer.reverse_search() - -# [J]ump -@key_bindings.add("j", filter=in_navigation_mode) -def _(event): - "Move to end of next word" - event.current_buffer.cursor_right_word() - -@key_bindings.add("J", filter=in_navigation_mode) -def _(event): - "Move to end of next word with capital E" - event.current_buffer.cursor_right_word(end=True) - -# Yank to end of line with 'Y' -@key_bindings.add("Y", filter=in_navigation_mode) -def _(event): - "Yank to the end of the line" - text_to_yank = event.current_buffer.document.text_after_cursor - event.app.clipboard.set_text(text_to_yank) - -ip.pt_app.key_bindings = key_bindings +from prompt_toolkit.key_binding import KeyBindings +from prompt_toolkit.key_binding.vi_state import InputMode +from prompt_toolkit.filters import Condition +from IPython import get_ipython + +ip = get_ipython() +key_bindings = KeyBindings() + +@Condition +def in_navigation_mode(): + return ip.pt_app.app.vi_state.input_mode == InputMode.NAVIGATION + +# colemak keymap hnei +@key_bindings.add("n", filter=in_navigation_mode) +def _(event): + "Move cursor down by visual line" + event.current_buffer.auto_down(count=event.arg) + +@key_bindings.add("e", filter=in_navigation_mode) +def _(event): + "Move cursor up by visual line" + event.current_buffer.auto_up(count=event.arg) + +@key_bindings.add("i", filter=in_navigation_mode) +def _(event): + "Move cursor right" + event.current_buffer.cursor_right(count=event.arg) + +# Insert with 'l' and 'L' +@key_bindings.add("l", filter=in_navigation_mode) +def _(event): + "Enter insert mode (similar position to 'i' in Colemak)" + event.app.vi_state.input_mode = InputMode.INSERT + +@key_bindings.add("L", filter=in_navigation_mode) +def _(event): + "Enter insert mode at the beginning of the line" + event.current_buffer.cursor_position += event.current_buffer.document.get_start_of_line_position() + +# Ne[k]st +@key_bindings.add("k", filter=in_navigation_mode) +def _(event): + "Find next match" + event.current_buffer.forward_search() + +@key_bindings.add("K", filter=in_navigation_mode) +def _(event): + "Find previous match" + event.current_buffer.reverse_search() + +# [J]ump +@key_bindings.add("j", filter=in_navigation_mode) +def _(event): + "Move to end of next word" + event.current_buffer.cursor_right_word() + +@key_bindings.add("J", filter=in_navigation_mode) +def _(event): + "Move to end of next word with capital E" + event.current_buffer.cursor_right_word(end=True) + +# Yank to end of line with 'Y' +@key_bindings.add("Y", filter=in_navigation_mode) +def _(event): + "Yank to the end of the line" + text_to_yank = event.current_buffer.document.text_after_cursor + event.app.clipboard.set_text(text_to_yank) + +ip.pt_app.key_bindings = key_bindings diff --git a/.config/ipython/profile_default/starup/magic_ps.py b/.config/ipython/profile_default/starup/magic_ps.py index d4c5e8a..8800f71 100644 --- a/.config/ipython/profile_default/starup/magic_ps.py +++ b/.config/ipython/profile_default/starup/magic_ps.py @@ -1,10 +1,10 @@ -from IPython.core.magic import register_line_magic - -@register_line_magic -def ps(cmd): - output = get_ipython().getoutput(f"powershell -Command {cmd}") - # If no variable is assigned to the output, print it - if get_ipython().last_execution_result is None: - print("\n".join(output)) - else: - return "\n".join(output) +from IPython.core.magic import register_line_magic + +@register_line_magic +def ps(cmd): + output = get_ipython().getoutput(f"powershell -Command {cmd}") + # If no variable is assigned to the output, print it + if get_ipython().last_execution_result is None: + print("\n".join(output)) + else: + return "\n".join(output) diff --git a/.config/lesskey b/.config/lesskey index c497024..eee8fa7 100644 --- a/.config/lesskey +++ b/.config/lesskey @@ -1,13 +1,13 @@ -# $XDG_CONFIG_HOME/lesskey -- less options -# ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey -# work for less -V > 582, for mac, use brew install less to override the system less - -# Format: key action - -# Arrow Remap (hnei -> hjkl) -n forw-line -e back-line - -# search with k : ne[k]st -k repeat-search -K reverse-search +# $XDG_CONFIG_HOME/lesskey -- less options +# ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey +# work for less -V > 582, for mac, use brew install less to override the system less + +# Format: key action + +# Arrow Remap (hnei -> hjkl) +n forw-line +e back-line + +# search with k : ne[k]st +k repeat-search +K reverse-search diff --git a/.config/markdownlint/.markdownlint.json b/.config/markdownlint/.markdownlint.json index f325493..1f69f42 100644 --- a/.config/markdownlint/.markdownlint.json +++ b/.config/markdownlint/.markdownlint.json @@ -1,6 +1,6 @@ -{ - "line-length": false, - "no-inline-html": false, - "no-alt-text": false, - "ul-style": { "style": "dash" } +{ + "line-length": false, + "no-inline-html": false, + "no-alt-text": false, + "ul-style": { "style": "dash" } } \ No newline at end of file diff --git a/.config/npm/.npmrc b/.config/npm/.npmrc index b95c6b1..ad82c4c 100644 --- a/.config/npm/.npmrc +++ b/.config/npm/.npmrc @@ -1,4 +1,4 @@ -# ~/.npmrc -# New-Item -ItemType SymbolicLink -Path ~\.npmrc -Target ~\.dotfiles\.npmrc -# ln -s $DOTFILES/.npmrc ~/.npmrc -# registry=https://registry.npmmirror.com +# ~/.npmrc +# New-Item -ItemType SymbolicLink -Path ~\.npmrc -Target ~\.dotfiles\.npmrc +# ln -s $DOTFILES/.npmrc ~/.npmrc +# registry=https://registry.npmmirror.com diff --git a/.config/npm/npmrc b/.config/npm/npmrc index 222bca4..5f0ed17 100644 --- a/.config/npm/npmrc +++ b/.config/npm/npmrc @@ -1,6 +1,6 @@ -# export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc -# =========================================================== -# $XDG_CONFIG_HOME/npm/npmrc -# ln -s $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG -# New-Item -ItemType SymbolicLink -Path $env:NPM_CONFIG_USERCONFIG -Value $env:DOTFILES/.config/npm/npmrc -# registry=https://registry.npmmirror.com +# export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc +# =========================================================== +# $XDG_CONFIG_HOME/npm/npmrc +# ln -s $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG +# New-Item -ItemType SymbolicLink -Path $env:NPM_CONFIG_USERCONFIG -Value $env:DOTFILES/.config/npm/npmrc +# registry=https://registry.npmmirror.com diff --git a/.config/nvim/.neoconf.json b/.config/nvim/.neoconf.json index 7c48087..6e89f00 100644 --- a/.config/nvim/.neoconf.json +++ b/.config/nvim/.neoconf.json @@ -1,15 +1,15 @@ -{ - "neodev": { - "library": { - "enabled": true, - "plugins": true - } - }, - "neoconf": { - "plugins": { - "lua_ls": { - "enabled": true - } - } - } -} +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/.config/nvim/.options/obsidian.all.lua b/.config/nvim/.options/obsidian.all.lua index f0cbf04..0529135 100644 --- a/.config/nvim/.options/obsidian.all.lua +++ b/.config/nvim/.options/obsidian.all.lua @@ -1,22 +1,22 @@ -return { - "epwalsh/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit - lazy = true, - ft = "markdown", - dependencies = { - -- Required. - "nvim-lua/plenary.nvim", - - -- see below for full list of optional dependencies 👇 - }, - opts = { - workspaces = { - { - name = "All", - path = "~/Obsidian", - }, - }, - - -- see below for full list of options 👇 - }, +return { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + lazy = true, + ft = "markdown", + dependencies = { + -- Required. + "nvim-lua/plenary.nvim", + + -- see below for full list of optional dependencies 👇 + }, + opts = { + workspaces = { + { + name = "All", + path = "~/Obsidian", + }, + }, + + -- see below for full list of options 👇 + }, } \ No newline at end of file diff --git a/.config/nvim/README.md b/.config/nvim/README.md index 9de6f77..e4c3da5 100644 --- a/.config/nvim/README.md +++ b/.config/nvim/README.md @@ -1,8 +1,8 @@ -# Colemak *LazyVim* - -- Replace the default `hjkl` movement keys with `hnei` -- `j->e`, `k->n`, `h->h`, `l->i` - -```sh -ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim +# Colemak *LazyVim* + +- Replace the default `hjkl` movement keys with `hnei` +- `j->e`, `k->n`, `h->h`, `l->i` + +```sh +ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim ``` \ No newline at end of file diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 2514f9e..98952e4 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,2 +1,2 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 27e9e06..d9ea6db 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -1,3 +1,3 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua --- Add any additional autocmds here +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Add any additional autocmds here diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 450022b..0105618 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -1,146 +1,146 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua --- Add any additional keymaps here - -vim.g.mapleader = " " - --- ================= GENERAL KEYBINDS ================= --- SAVE/QUIT {{{ -vim.keymap.set("n", "Q", "q", { desc = "Q to quit" }) -vim.keymap.set("n", "", "w", { desc = "S to write file" }) ---}}} - --- NVIM CONFIG SHORTCUTS {{{ --- stylua: ignore -vim.keymap.set("n", "rc", "e $HOME/.config/nvim/lua/config/options.lua", { desc = "Open nvim options.lua" }) -vim.keymap.set("n", "rp", "e $HOME/.config/nvim/lua/plugins/.", { desc = "lazy plugins dir" }) ---}}} - --- UNDO -vim.keymap.set({ "n", "v" }, "l", "u", { desc = "Undo" }) - --- INSERT -vim.keymap.set({ "n", "v" }, "l", "i", { desc = "Insert" }) -vim.keymap.set({ "n", "v" }, "L", "I", { desc = "Insert at line start" }) - --- YANK TO SYSTEM CLIPBOARD -vim.keymap.set("v", "Y", '"+y', { desc = "Copy to (System) Clipboard" }) - --- SEARCH {{{ -vim.keymap.set("n", "", "nohlsearch", { desc = "clear search highlight" }) ---}}} - --- SPACE TO TAB{{{ -vim.keymap.set("n", "tt", "%s/ /\t/g", { desc = "space to tab" }) -vim.keymap.set("v", "tt", "s/ /\t/g", { desc = "space to tab" }) ---}}} - --- MISC {{{ -vim.keymap.set("n", "o", "za", { desc = "folding" }) -vim.keymap.set("i", "", "A {}iko", { desc = "insert a pair of {} and goto next line" }) ---}}} - --- ================= CURSOR MOVEMENT ===================== {{{ --- NEW CURSOR MOVEMENT (ARROW KEY RESIZE WINDOWS) --- ^ --- e --- < h i > --- n --- v --- -vim.keymap.set({ "n", "v", "", "s", "x" }, "e", "k", { desc = "move cursor ⇧" }) -vim.keymap.set({ "n", "v", "", "s", "x" }, "n", "j", { desc = "move cursor ⇩" }) -vim.keymap.set({ "n", "v", "", "s", "x" }, "h", "h", { desc = "move cursor ⇦" }) -vim.keymap.set({ "n", "v", "", "s", "x" }, "i", "l", { desc = "move cursor ⇨" }) - -vim.keymap.set({ "n", "v" }, "E", "5k", { desc = "Move 5up K -> U" }) -vim.keymap.set({ "n", "v" }, "N", "5j", { desc = "Move 5down J -> E" }) - -vim.keymap.set({ "n", "v" }, "H", "0", { desc = "Move start of line" }) -vim.keymap.set({ "n", "v" }, "I", "$", { desc = "Move end of line" }) - -vim.keymap.set("n", "gu", "gk", { desc = "move up gk -> gu" }) -vim.keymap.set("n", "ge", "gj", { desc = "move down gj -> ge" }) - -vim.keymap.set("n", "\v", "v$h", { desc = "???" }) - --- FASTER IN-LINE NAVIGATION - --- SET h (SAME AS n, CURSOR LEFT) TO 'END OF WORD' -vim.keymap.set("n", "j", "e", { desc = "Move cursor to end of word" }) --- CTRL + U OR E WILL MOVE UP/DOWN THE VIEW PORT WITHOUT MOVING THE CURSOR - -vim.keymap.set({ "n", "v" }, "", "5", { desc = "Move viewport ⇧" }) -vim.keymap.set({ "n", "v" }, "", "5", { desc = "Move viewport ⇩" }) - --- INSERT MODE CURSOR MOVEMENT -vim.keymap.set("i", "", "A") - --- COMMAND MODE CURSOR MOVEMENT -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") -vim.keymap.set("c", "", "") ---}}} - --- ================= SPLIT MANAGMENT ===================== {{{ -vim.keymap.set("n", "E", "set nosplitbelowsplitset splitbelow", { desc = "Split ⇧" }) -vim.keymap.set("n", "N", "set splitbelowsplit", { desc = "Split ⇩" }) -vim.keymap.set("n", "H", "set nosplitrightvsplitset splitright", { desc = "Split ⇦" }) -vim.keymap.set("n", "I", "set splitrightvsplit", { desc = "Split ⇨" }) - -vim.keymap.set({ "n", "t" }, "e", "k", { desc = "Move cursor to split ⇧" }) -vim.keymap.set({ "n", "t" }, "n", "j", { desc = "Move cursor to split ⇩" }) -vim.keymap.set({ "n", "t" }, "h", "h", { desc = "Move cursor to split ⇦" }) -vim.keymap.set({ "n", "t" }, "i", "l", { desc = "Move cursor to split ⇨" }) - -vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇧" }) -vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇩" }) -vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇦" }) -vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇨" }) - -vim.keymap.set("n", "", "res -5", { desc = "Resize split 0,-5" }) -vim.keymap.set("n", "", "res +5", { desc = "Resize split 0,+5" }) -vim.keymap.set("n", "", "vertical resize +5", { desc = "Resize split +5,0" }) -vim.keymap.set("n", "", "vertical resize -5", { desc = "Resize split -5,0" }) - -vim.keymap.set("n", "H", "tK", { desc = "Make splits [H]orizontal" }) -vim.keymap.set("n", "V", "tH", { desc = "Make splits [V]ertical" }) - -vim.keymap.set("n", "ri", "bK", { desc = "Rotate splits 90" }) -vim.keymap.set("n", "rh", "bH", { desc = "Rotate splits -90" }) - -vim.keymap.set("n", "q", "jq", { desc = "Close Split ⇩ (Below)" }) ---}}} - --- TAB MANAGEMENT {{{ -vim.keymap.set("n", "", "tabe", { desc = "New [Tab]" }) - -vim.keymap.set("n", "h", "-tabnext", { desc = "Select Tab ⇦" }) -vim.keymap.set("n", "i", "+tabnext", { desc = "Select Tab ⇨" }) - -vim.keymap.set("n", "H", "-tabmove", { desc = "Tab move ⇦" }) -vim.keymap.set("n", "I", "+tabmove", { desc = "Tab move ⇨" }) - --- NOTE: Doesn't seem to work: --- vim.keymap.set("n", "c", "tab split", { desc = "New Tab from [C]urrent" }) --- vim.keymap.set('n', 'dw', '/\(\<\w\+\>\)\_s*\1', {desc='adjacent duplicate words'}) - ---vim.keymap.del("n", "j") ---vim.keymap.del("n", "k") ---vim.keymap.del("n", "l") --- }}} - --- =================== TERM BEHAVIORS ==================== -vim.keymap.set("t", "", "", { desc = "escape terminal, allowing excmds" }) -vim.keymap.set("t", "", "", { desc = "close terminal" }) - ---vim: set fdm=marker fdl=0 - --- buffers -vim.keymap.set("n", "", "bprevious", { desc = "Prev Buffer" }) -vim.keymap.set("n", "", "bnext", { desc = "Next Buffer" }) +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here + +vim.g.mapleader = " " + +-- ================= GENERAL KEYBINDS ================= +-- SAVE/QUIT {{{ +vim.keymap.set("n", "Q", "q", { desc = "Q to quit" }) +vim.keymap.set("n", "", "w", { desc = "S to write file" }) +--}}} + +-- NVIM CONFIG SHORTCUTS {{{ +-- stylua: ignore +vim.keymap.set("n", "rc", "e $HOME/.config/nvim/lua/config/options.lua", { desc = "Open nvim options.lua" }) +vim.keymap.set("n", "rp", "e $HOME/.config/nvim/lua/plugins/.", { desc = "lazy plugins dir" }) +--}}} + +-- UNDO +vim.keymap.set({ "n", "v" }, "l", "u", { desc = "Undo" }) + +-- INSERT +vim.keymap.set({ "n", "v" }, "l", "i", { desc = "Insert" }) +vim.keymap.set({ "n", "v" }, "L", "I", { desc = "Insert at line start" }) + +-- YANK TO SYSTEM CLIPBOARD +vim.keymap.set("v", "Y", '"+y', { desc = "Copy to (System) Clipboard" }) + +-- SEARCH {{{ +vim.keymap.set("n", "", "nohlsearch", { desc = "clear search highlight" }) +--}}} + +-- SPACE TO TAB{{{ +vim.keymap.set("n", "tt", "%s/ /\t/g", { desc = "space to tab" }) +vim.keymap.set("v", "tt", "s/ /\t/g", { desc = "space to tab" }) +--}}} + +-- MISC {{{ +vim.keymap.set("n", "o", "za", { desc = "folding" }) +vim.keymap.set("i", "", "A {}iko", { desc = "insert a pair of {} and goto next line" }) +--}}} + +-- ================= CURSOR MOVEMENT ===================== {{{ +-- NEW CURSOR MOVEMENT (ARROW KEY RESIZE WINDOWS) +-- ^ +-- e +-- < h i > +-- n +-- v +-- +vim.keymap.set({ "n", "v", "", "s", "x" }, "e", "k", { desc = "move cursor ⇧" }) +vim.keymap.set({ "n", "v", "", "s", "x" }, "n", "j", { desc = "move cursor ⇩" }) +vim.keymap.set({ "n", "v", "", "s", "x" }, "h", "h", { desc = "move cursor ⇦" }) +vim.keymap.set({ "n", "v", "", "s", "x" }, "i", "l", { desc = "move cursor ⇨" }) + +vim.keymap.set({ "n", "v" }, "E", "5k", { desc = "Move 5up K -> U" }) +vim.keymap.set({ "n", "v" }, "N", "5j", { desc = "Move 5down J -> E" }) + +vim.keymap.set({ "n", "v" }, "H", "0", { desc = "Move start of line" }) +vim.keymap.set({ "n", "v" }, "I", "$", { desc = "Move end of line" }) + +vim.keymap.set("n", "gu", "gk", { desc = "move up gk -> gu" }) +vim.keymap.set("n", "ge", "gj", { desc = "move down gj -> ge" }) + +vim.keymap.set("n", "\v", "v$h", { desc = "???" }) + +-- FASTER IN-LINE NAVIGATION + +-- SET h (SAME AS n, CURSOR LEFT) TO 'END OF WORD' +vim.keymap.set("n", "j", "e", { desc = "Move cursor to end of word" }) +-- CTRL + U OR E WILL MOVE UP/DOWN THE VIEW PORT WITHOUT MOVING THE CURSOR + +vim.keymap.set({ "n", "v" }, "", "5", { desc = "Move viewport ⇧" }) +vim.keymap.set({ "n", "v" }, "", "5", { desc = "Move viewport ⇩" }) + +-- INSERT MODE CURSOR MOVEMENT +vim.keymap.set("i", "", "A") + +-- COMMAND MODE CURSOR MOVEMENT +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +vim.keymap.set("c", "", "") +--}}} + +-- ================= SPLIT MANAGMENT ===================== {{{ +vim.keymap.set("n", "E", "set nosplitbelowsplitset splitbelow", { desc = "Split ⇧" }) +vim.keymap.set("n", "N", "set splitbelowsplit", { desc = "Split ⇩" }) +vim.keymap.set("n", "H", "set nosplitrightvsplitset splitright", { desc = "Split ⇦" }) +vim.keymap.set("n", "I", "set splitrightvsplit", { desc = "Split ⇨" }) + +vim.keymap.set({ "n", "t" }, "e", "k", { desc = "Move cursor to split ⇧" }) +vim.keymap.set({ "n", "t" }, "n", "j", { desc = "Move cursor to split ⇩" }) +vim.keymap.set({ "n", "t" }, "h", "h", { desc = "Move cursor to split ⇦" }) +vim.keymap.set({ "n", "t" }, "i", "l", { desc = "Move cursor to split ⇨" }) + +vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇧" }) +vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇩" }) +vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇦" }) +vim.keymap.set({ "n", "t" }, "", "", { desc = "Move cursor to split ⇨" }) + +vim.keymap.set("n", "", "res -5", { desc = "Resize split 0,-5" }) +vim.keymap.set("n", "", "res +5", { desc = "Resize split 0,+5" }) +vim.keymap.set("n", "", "vertical resize +5", { desc = "Resize split +5,0" }) +vim.keymap.set("n", "", "vertical resize -5", { desc = "Resize split -5,0" }) + +vim.keymap.set("n", "H", "tK", { desc = "Make splits [H]orizontal" }) +vim.keymap.set("n", "V", "tH", { desc = "Make splits [V]ertical" }) + +vim.keymap.set("n", "ri", "bK", { desc = "Rotate splits 90" }) +vim.keymap.set("n", "rh", "bH", { desc = "Rotate splits -90" }) + +vim.keymap.set("n", "q", "jq", { desc = "Close Split ⇩ (Below)" }) +--}}} + +-- TAB MANAGEMENT {{{ +vim.keymap.set("n", "", "tabe", { desc = "New [Tab]" }) + +vim.keymap.set("n", "h", "-tabnext", { desc = "Select Tab ⇦" }) +vim.keymap.set("n", "i", "+tabnext", { desc = "Select Tab ⇨" }) + +vim.keymap.set("n", "H", "-tabmove", { desc = "Tab move ⇦" }) +vim.keymap.set("n", "I", "+tabmove", { desc = "Tab move ⇨" }) + +-- NOTE: Doesn't seem to work: +-- vim.keymap.set("n", "c", "tab split", { desc = "New Tab from [C]urrent" }) +-- vim.keymap.set('n', 'dw', '/\(\<\w\+\>\)\_s*\1', {desc='adjacent duplicate words'}) + +--vim.keymap.del("n", "j") +--vim.keymap.del("n", "k") +--vim.keymap.del("n", "l") +-- }}} + +-- =================== TERM BEHAVIORS ==================== +vim.keymap.set("t", "", "", { desc = "escape terminal, allowing excmds" }) +vim.keymap.set("t", "", "", { desc = "close terminal" }) + +--vim: set fdm=marker fdl=0 + +-- buffers +vim.keymap.set("n", "", "bprevious", { desc = "Prev Buffer" }) +vim.keymap.set("n", "", "bnext", { desc = "Next Buffer" }) diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua index d73bfa1..532a434 100644 --- a/.config/nvim/lua/config/lazy.lua +++ b/.config/nvim/lua/config/lazy.lua @@ -1,53 +1,53 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ - spec = { - -- add LazyVim and import its plugins - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- import/override with your plugins - { import = "plugins" }, - }, - defaults = { - -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. - -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. - lazy = false, - -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, - -- have outdated releases, which may break your Neovim install. - version = false, -- always use the latest git commit - -- version = "*", -- try installing the latest stable version for plugins that support semver - }, - install = { colorscheme = { "tokyonight", "habamax" } }, - checker = { - enabled = true, -- check for plugin updates periodically - notify = false, -- notify on update - }, -- automatically check for plugin updates - performance = { - rtp = { - -- disable some rtp plugins - disabled_plugins = { - "gzip", - -- "matchit", - -- "matchparen", - -- "netrwPlugin", - "tarPlugin", - "tohtml", - "tutor", - "zipPlugin", - }, - }, - }, -}) +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { + enabled = true, -- check for plugin updates periodically + notify = false, -- notify on update + }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index 3ea1454..415944a 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -1,3 +1,3 @@ --- Options are automatically loaded before lazy.nvim startup --- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua --- Add any additional options here +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here diff --git a/.config/nvim/lua/plugins/catppuccin.lua b/.config/nvim/lua/plugins/catppuccin.lua index c6e52c7..01f8b27 100644 --- a/.config/nvim/lua/plugins/catppuccin.lua +++ b/.config/nvim/lua/plugins/catppuccin.lua @@ -1,54 +1,54 @@ -return { - "catppuccin/nvim", - lazy = true, - name = "catppuccin", - opts = { - integrations = { - aerial = true, - alpha = true, - cmp = true, - dashboard = true, - flash = true, - grug_far = true, - gitsigns = true, - headlines = true, - illuminate = true, - indent_blankline = { enabled = true }, - leap = true, - lsp_trouble = true, - mason = true, - markdown = true, - mini = true, - native_lsp = { - enabled = true, - underlines = { - errors = { "undercurl" }, - hints = { "undercurl" }, - warnings = { "undercurl" }, - information = { "undercurl" }, - }, - }, - navic = { enabled = true, custom_bg = "lualine" }, - neotest = true, - neotree = true, - noice = true, - notify = true, - semantic_tokens = true, - telescope = true, - treesitter = true, - treesitter_context = true, - which_key = true, - }, - }, - specs = { - { - "akinsho/bufferline.nvim", - optional = true, - opts = function(_, opts) - if (vim.g.colors_name or ""):find("catppuccin") then - opts.highlights = require("catppuccin.groups.integrations.bufferline").get() - end - end, - }, - }, -} +return { + "catppuccin/nvim", + lazy = true, + name = "catppuccin", + opts = { + integrations = { + aerial = true, + alpha = true, + cmp = true, + dashboard = true, + flash = true, + grug_far = true, + gitsigns = true, + headlines = true, + illuminate = true, + indent_blankline = { enabled = true }, + leap = true, + lsp_trouble = true, + mason = true, + markdown = true, + mini = true, + native_lsp = { + enabled = true, + underlines = { + errors = { "undercurl" }, + hints = { "undercurl" }, + warnings = { "undercurl" }, + information = { "undercurl" }, + }, + }, + navic = { enabled = true, custom_bg = "lualine" }, + neotest = true, + neotree = true, + noice = true, + notify = true, + semantic_tokens = true, + telescope = true, + treesitter = true, + treesitter_context = true, + which_key = true, + }, + }, + specs = { + { + "akinsho/bufferline.nvim", + optional = true, + opts = function(_, opts) + if (vim.g.colors_name or ""):find("catppuccin") then + opts.highlights = require("catppuccin.groups.integrations.bufferline").get() + end + end, + }, + }, +} diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua index ab99258..233e7e8 100644 --- a/.config/nvim/lua/plugins/colorscheme.lua +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -1,13 +1,13 @@ -return { - -- add gruvbox - { "ellisonleao/gruvbox.nvim" }, - { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, - - -- Configure LazyVim to load gruvbox - { - "LazyVim/LazyVim", - opts = { - colorscheme = "catppuccin", - }, - }, -} +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "catppuccin", + }, + }, +} diff --git a/.config/nvim/lua/plugins/example.lua b/.config/nvim/lua/plugins/example.lua index 17f53d6..1fd75d4 100644 --- a/.config/nvim/lua/plugins/example.lua +++ b/.config/nvim/lua/plugins/example.lua @@ -1,197 +1,197 @@ --- since this is just an example spec, don't actually load anything here and return an empty spec --- stylua: ignore -if true then return {} end - --- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim --- --- In your plugin files, you can: --- * add extra plugins --- * disable/enabled LazyVim plugins --- * override the configuration of LazyVim plugins -return { - -- add gruvbox - { "ellisonleao/gruvbox.nvim" }, - - -- Configure LazyVim to load gruvbox - { - "LazyVim/LazyVim", - opts = { - colorscheme = "gruvbox", - }, - }, - - -- change trouble config - { - "folke/trouble.nvim", - -- opts will be merged with the parent spec - opts = { use_diagnostic_signs = true }, - }, - - -- disable trouble - { "folke/trouble.nvim", enabled = false }, - - -- override nvim-cmp and add cmp-emoji - { - "hrsh7th/nvim-cmp", - dependencies = { "hrsh7th/cmp-emoji" }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, { name = "emoji" }) - end, - }, - - -- change some telescope options and a keymap to browse plugin files - { - "nvim-telescope/telescope.nvim", - keys = { - -- add a keymap to browse plugin files - -- stylua: ignore - { - "fp", - function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, - desc = "Find Plugin File", - }, - }, - -- change some options - opts = { - defaults = { - layout_strategy = "horizontal", - layout_config = { prompt_position = "top" }, - sorting_strategy = "ascending", - winblend = 0, - }, - }, - }, - - -- add pyright to lspconfig - { - "neovim/nvim-lspconfig", - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - -- pyright will be automatically installed with mason and loaded with lspconfig - pyright = {}, - }, - }, - }, - - -- add tsserver and setup with typescript.nvim instead of lspconfig - { - "neovim/nvim-lspconfig", - dependencies = { - "jose-elias-alvarez/typescript.nvim", - init = function() - require("lazyvim.util").lsp.on_attach(function(_, buffer) - -- stylua: ignore - vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) - vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) - end) - end, - }, - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - -- tsserver will be automatically installed with mason and loaded with lspconfig - tsserver = {}, - }, - -- you can do any additional lsp server setup here - -- return true if you don't want this server to be setup with lspconfig - ---@type table - setup = { - -- example to setup with typescript.nvim - tsserver = function(_, opts) - require("typescript").setup({ server = opts }) - return true - end, - -- Specify * to use this function as a fallback for any server - -- ["*"] = function(server, opts) end, - }, - }, - }, - - -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, - -- treesitter, mason and typescript.nvim. So instead of the above, you can use: - { import = "lazyvim.plugins.extras.lang.typescript" }, - - -- add more treesitter parsers - { - "nvim-treesitter/nvim-treesitter", - opts = { - ensure_installed = { - "bash", - "html", - "javascript", - "json", - "lua", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "tsx", - "typescript", - "vim", - "yaml", - }, - }, - }, - - -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above - -- would overwrite `ensure_installed` with the new value. - -- If you'd rather extend the default config, use the code below instead: - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - -- add tsx and treesitter - vim.list_extend(opts.ensure_installed, { - "tsx", - "typescript", - }) - end, - }, - - -- the opts function can also be used to change the default opts: - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function(_, opts) - table.insert(opts.sections.lualine_x, { - function() - return "😄" - end, - }) - end, - }, - - -- or you can return new options to override all the defaults - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function() - return { - --[[add your custom lualine config here]] - } - end, - }, - - -- use mini.starter instead of alpha - { import = "lazyvim.plugins.extras.ui.mini-starter" }, - - -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc - { import = "lazyvim.plugins.extras.lang.json" }, - - -- add any tools you want to have installed below - { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - "stylua", - "shellcheck", - "shfmt", - "flake8", - }, - }, - }, -} +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").lsp.on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, { + function() + return "😄" + end, + }) + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/neo-tree.lua b/.config/nvim/lua/plugins/neo-tree.lua index 615367b..f2f0fb5 100644 --- a/.config/nvim/lua/plugins/neo-tree.lua +++ b/.config/nvim/lua/plugins/neo-tree.lua @@ -1,127 +1,127 @@ -return { - "nvim-neo-tree/neo-tree.nvim", - cmd = "Neotree", - keys = { - { - "fe", - function() - require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() }) - end, - desc = "Explorer NeoTree (Root Dir)", - }, - { - "fE", - function() - require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) - end, - desc = "Explorer NeoTree (cwd)", - }, - { "e", "fe", desc = "Explorer NeoTree (Root Dir)", remap = true }, - { "E", "fE", desc = "Explorer NeoTree (cwd)", remap = true }, - { - "ge", - function() - require("neo-tree.command").execute({ source = "git_status", toggle = true }) - end, - desc = "Git Explorer", - }, - { - "be", - function() - require("neo-tree.command").execute({ source = "buffers", toggle = true }) - end, - desc = "Buffer Explorer", - }, - }, - deactivate = function() - vim.cmd([[Neotree close]]) - end, - init = function() - -- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it, - -- because `cwd` is not set up properly. - vim.api.nvim_create_autocmd("BufEnter", { - group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }), - desc = "Start Neo-tree with directory", - once = true, - callback = function() - if package.loaded["neo-tree"] then - return - else - local stats = vim.uv.fs_stat(vim.fn.argv(0)) - if stats and stats.type == "directory" then - require("neo-tree") - end - end - end, - }) - end, - opts = { - sources = { "filesystem", "buffers", "git_status" }, - open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, - filesystem = { - bind_to_cwd = false, - follow_current_file = { enabled = true }, - use_libuv_file_watcher = true, - }, - window = { - mappings = { - -- MARKED - ["i"] = "open", - -- MARKED - ["e"] = "noop", - ["h"] = "close_node", - [""] = "none", - ["Y"] = { - function(state) - local node = state.tree:get_node() - local path = node:get_id() - vim.fn.setreg("+", path, "c") - end, - desc = "Copy Path to Clipboard", - }, - ["O"] = { - function(state) - require("lazy.util").open(state.tree:get_node().path, { system = true }) - end, - desc = "Open with System Application", - }, - ["P"] = { "toggle_preview", config = { use_float = false } }, - }, - }, - default_component_configs = { - indent = { - with_expanders = true, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - git_status = { - symbols = { - unstaged = "󰄱", - staged = "󰱒", - }, - }, - }, - }, - config = function(_, opts) - local function on_move(data) - LazyVim.lsp.on_rename(data.source, data.destination) - end - - local events = require("neo-tree.events") - opts.event_handlers = opts.event_handlers or {} - vim.list_extend(opts.event_handlers, { - { event = events.FILE_MOVED, handler = on_move }, - { event = events.FILE_RENAMED, handler = on_move }, - }) - require("neo-tree").setup(opts) - vim.api.nvim_create_autocmd("TermClose", { - pattern = "*lazygit", - callback = function() - if package.loaded["neo-tree.sources.git_status"] then - require("neo-tree.sources.git_status").refresh() - end - end, - }) - end, -} +return { + "nvim-neo-tree/neo-tree.nvim", + cmd = "Neotree", + keys = { + { + "fe", + function() + require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() }) + end, + desc = "Explorer NeoTree (Root Dir)", + }, + { + "fE", + function() + require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() }) + end, + desc = "Explorer NeoTree (cwd)", + }, + { "e", "fe", desc = "Explorer NeoTree (Root Dir)", remap = true }, + { "E", "fE", desc = "Explorer NeoTree (cwd)", remap = true }, + { + "ge", + function() + require("neo-tree.command").execute({ source = "git_status", toggle = true }) + end, + desc = "Git Explorer", + }, + { + "be", + function() + require("neo-tree.command").execute({ source = "buffers", toggle = true }) + end, + desc = "Buffer Explorer", + }, + }, + deactivate = function() + vim.cmd([[Neotree close]]) + end, + init = function() + -- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it, + -- because `cwd` is not set up properly. + vim.api.nvim_create_autocmd("BufEnter", { + group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }), + desc = "Start Neo-tree with directory", + once = true, + callback = function() + if package.loaded["neo-tree"] then + return + else + local stats = vim.uv.fs_stat(vim.fn.argv(0)) + if stats and stats.type == "directory" then + require("neo-tree") + end + end + end, + }) + end, + opts = { + sources = { "filesystem", "buffers", "git_status" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" }, + filesystem = { + bind_to_cwd = false, + follow_current_file = { enabled = true }, + use_libuv_file_watcher = true, + }, + window = { + mappings = { + -- MARKED + ["i"] = "open", + -- MARKED + ["e"] = "noop", + ["h"] = "close_node", + [""] = "none", + ["Y"] = { + function(state) + local node = state.tree:get_node() + local path = node:get_id() + vim.fn.setreg("+", path, "c") + end, + desc = "Copy Path to Clipboard", + }, + ["O"] = { + function(state) + require("lazy.util").open(state.tree:get_node().path, { system = true }) + end, + desc = "Open with System Application", + }, + ["P"] = { "toggle_preview", config = { use_float = false } }, + }, + }, + default_component_configs = { + indent = { + with_expanders = true, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + git_status = { + symbols = { + unstaged = "󰄱", + staged = "󰱒", + }, + }, + }, + }, + config = function(_, opts) + local function on_move(data) + LazyVim.lsp.on_rename(data.source, data.destination) + end + + local events = require("neo-tree.events") + opts.event_handlers = opts.event_handlers or {} + vim.list_extend(opts.event_handlers, { + { event = events.FILE_MOVED, handler = on_move }, + { event = events.FILE_RENAMED, handler = on_move }, + }) + require("neo-tree").setup(opts) + vim.api.nvim_create_autocmd("TermClose", { + pattern = "*lazygit", + callback = function() + if package.loaded["neo-tree.sources.git_status"] then + require("neo-tree.sources.git_status").refresh() + end + end, + }) + end, +} diff --git a/.config/nvim/lua/plugins/wakatime.lua b/.config/nvim/lua/plugins/wakatime.lua index e37e7b5..5161b78 100644 --- a/.config/nvim/lua/plugins/wakatime.lua +++ b/.config/nvim/lua/plugins/wakatime.lua @@ -1,3 +1,3 @@ -return { - { 'wakatime/vim-wakatime', lazy = false }, +return { + { 'wakatime/vim-wakatime', lazy = false }, } \ No newline at end of file diff --git a/.config/nvim/stylua.toml b/.config/nvim/stylua.toml index 5d6c50d..964e1aa 100644 --- a/.config/nvim/stylua.toml +++ b/.config/nvim/stylua.toml @@ -1,3 +1,3 @@ -indent_type = "Spaces" -indent_width = 2 +indent_type = "Spaces" +indent_width = 2 column_width = 120 \ No newline at end of file diff --git a/.config/pip/pip.conf b/.config/pip/pip.conf index 359fd84..75044dc 100644 --- a/.config/pip/pip.conf +++ b/.config/pip/pip.conf @@ -1,5 +1,5 @@ -# $XDG_CONFIG_HOME/pip/pip.conf -# ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf -# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/pip/pip.conp -Value $DOTFILES\.config\pip\pip.conf -[global] +# $XDG_CONFIG_HOME/pip/pip.conf +# ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf +# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/pip/pip.conp -Value $DOTFILES\.config\pip\pip.conf +[global] # index-url = https://pypi.tuna.tsinghua.edu.cn/simple \ No newline at end of file diff --git a/.config/starship/starship.toml b/.config/starship/starship.toml index 3a7e341..b88e5f7 100644 --- a/.config/starship/starship.toml +++ b/.config/starship/starship.toml @@ -1,202 +1,202 @@ -# starship.toml -# ~/.config/starship.toml -format = '''$os$time $username @ $hostname $directory $all$character''' - -add_newline = true - -[time] -disabled = false -format = '[\[$time\]](purple)' -time_format = '%H:%M' - -[username] -format = '[$user](bold)' -show_always = true - -[hostname] -ssh_only = false -ssh_symbol = '󰞉 ' - -[directory] -truncation_length = 2 -truncate_to_repo = true -read_only = " 󰌾" -style ="bold cyan" -truncation_symbol = ".../" - -[directory.substitutions] -"~/Documents" = "󰈙 " -"~/Downloads" = " " -"~/Music" = " " -"~/Pictures" = " " -"Source" = " " -"src" = " " - -[aws] -symbol = " " - -[buf] -symbol = " " - -[c] -symbol = " " - -[conda] -symbol = " " - -[crystal] -symbol = " " - -[dart] -symbol = " " - - -[docker_context] -symbol = " " - -[elixir] -symbol = " " - -[elm] -symbol = " " - -[fennel] -symbol = " " - -[fossil_branch] -symbol = " " - -[git_branch] -symbol = " " - -[git_commit] -tag_symbol = '  ' - -[golang] -symbol = " " - -[guix_shell] -symbol = " " - -[haskell] -symbol = " " - -[haxe] -symbol = " " - -[hg_branch] -symbol = " " - -[java] -symbol = " " - -[julia] -symbol = " " - -[kotlin] -symbol = " " - -[lua] -symbol = " " - -[memory_usage] -symbol = "󰍛 " - -[meson] -symbol = "󰔷 " - -[nim] -symbol = "󰆥 " - -[nix_shell] -symbol = " " - -[nodejs] -symbol = " " - -[ocaml] -symbol = " " - -[os] -disabled = false - -[os.symbols] -Alpaquita = " " -Alpine = " " -AlmaLinux = " " -Amazon = " " -Android = " " -Arch = " " -Artix = " " -CentOS = " " -Debian = " " -DragonFly = " " -Emscripten = " " -EndeavourOS = " " -Fedora = " " -FreeBSD = " " -Garuda = "󰛓 " -Gentoo = " " -HardenedBSD = "󰞌 " -Illumos = "󰈸 " -Kali = " " -Linux = " " -Mabox = " " -Macos = " " -Manjaro = " " -Mariner = " " -MidnightBSD = " " -Mint = " " -NetBSD = " " -NixOS = " " -OpenBSD = "󰈺 " -openSUSE = " " -OracleLinux = "󰌷 " -Pop = " " -Raspbian = " " -Redhat = " " -RedHatEnterprise = " " -RockyLinux = " " -Redox = "󰀘 " -Solus = "󰠳 " -SUSE = " " -Ubuntu = " " -Unknown = " " -Void = " " -Windows = "󰍲 " - -[package] -symbol = "󰏗 " - -[perl] -symbol = " " - -[php] -symbol = " " - -[pijul_channel] -symbol = " " - -[python] -symbol = " " - -[rlang] -symbol = "󰟔 " - -[ruby] -symbol = " " - -[rust] -symbol = "󱘗 " - -[scala] -symbol = " " - -[swift] -symbol = " " - -[zig] -symbol = " " - -[gradle] -symbol = " " +# starship.toml +# ~/.config/starship.toml +format = '''$os$time $username @ $hostname $directory $all$character''' + +add_newline = true + +[time] +disabled = false +format = '[\[$time\]](purple)' +time_format = '%H:%M' + +[username] +format = '[$user](bold)' +show_always = true + +[hostname] +ssh_only = false +ssh_symbol = '󰞉 ' + +[directory] +truncation_length = 2 +truncate_to_repo = true +read_only = " 󰌾" +style ="bold cyan" +truncation_symbol = ".../" + +[directory.substitutions] +"~/Documents" = "󰈙 " +"~/Downloads" = " " +"~/Music" = " " +"~/Pictures" = " " +"Source" = " " +"src" = " " + +[aws] +symbol = " " + +[buf] +symbol = " " + +[c] +symbol = " " + +[conda] +symbol = " " + +[crystal] +symbol = " " + +[dart] +symbol = " " + + +[docker_context] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[fennel] +symbol = " " + +[fossil_branch] +symbol = " " + +[git_branch] +symbol = " " + +[git_commit] +tag_symbol = '  ' + +[golang] +symbol = " " + +[guix_shell] +symbol = " " + +[haskell] +symbol = " " + +[haxe] +symbol = " " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[kotlin] +symbol = " " + +[lua] +symbol = " " + +[memory_usage] +symbol = "󰍛 " + +[meson] +symbol = "󰔷 " + +[nim] +symbol = "󰆥 " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[ocaml] +symbol = " " + +[os] +disabled = false + +[os.symbols] +Alpaquita = " " +Alpine = " " +AlmaLinux = " " +Amazon = " " +Android = " " +Arch = " " +Artix = " " +CentOS = " " +Debian = " " +DragonFly = " " +Emscripten = " " +EndeavourOS = " " +Fedora = " " +FreeBSD = " " +Garuda = "󰛓 " +Gentoo = " " +HardenedBSD = "󰞌 " +Illumos = "󰈸 " +Kali = " " +Linux = " " +Mabox = " " +Macos = " " +Manjaro = " " +Mariner = " " +MidnightBSD = " " +Mint = " " +NetBSD = " " +NixOS = " " +OpenBSD = "󰈺 " +openSUSE = " " +OracleLinux = "󰌷 " +Pop = " " +Raspbian = " " +Redhat = " " +RedHatEnterprise = " " +RockyLinux = " " +Redox = "󰀘 " +Solus = "󰠳 " +SUSE = " " +Ubuntu = " " +Unknown = " " +Void = " " +Windows = "󰍲 " + +[package] +symbol = "󰏗 " + +[perl] +symbol = " " + +[php] +symbol = " " + +[pijul_channel] +symbol = " " + +[python] +symbol = " " + +[rlang] +symbol = "󰟔 " + +[ruby] +symbol = " " + +[rust] +symbol = "󱘗 " + +[scala] +symbol = " " + +[swift] +symbol = " " + +[zig] +symbol = " " + +[gradle] +symbol = " " diff --git a/.config/starship/starship_nu.toml b/.config/starship/starship_nu.toml new file mode 100644 index 0000000..5bf9e16 --- /dev/null +++ b/.config/starship/starship_nu.toml @@ -0,0 +1,210 @@ +# starship.toml +# ~/.config/starship.toml +format = '''$os$time $username @ $hostname $directory $all$character''' +continuation_prompt = "[ cr >](bold cyan) " + +add_newline = true + +[time] +disabled = false +format = '[\[$time\]](purple)' +time_format = '%H:%M' + +[username] +format = '[$user](bold)' +show_always = true + +[hostname] +ssh_only = false +ssh_symbol = '󰞉 ' + +# Currently vimcmd_symbol is not supported in Nu, define in `config.nu` instead +[character] +success_symbol = "" +error_symbol = "" +vimcmd_symbol = "" + + +[directory] +truncation_length = 2 +truncate_to_repo = true +read_only = " 󰌾" +style ="bold cyan" +truncation_symbol = ".../" + +[directory.substitutions] +"~/Documents" = "󰈙 " +"~/Downloads" = " " +"~/Music" = " " +"~/Pictures" = " " +"Source" = " " +"src" = " " + +[aws] +symbol = " " + +[buf] +symbol = " " + +[c] +symbol = " " + +[conda] +symbol = " " + +[crystal] +symbol = " " + +[dart] +symbol = " " + + +[docker_context] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[fennel] +symbol = " " + +[fossil_branch] +symbol = " " + +[git_branch] +symbol = " " + +[git_commit] +tag_symbol = '  ' + +[golang] +symbol = " " + +[guix_shell] +symbol = " " + +[haskell] +symbol = " " + +[haxe] +symbol = " " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[kotlin] +symbol = " " + +[lua] +symbol = " " + +[memory_usage] +symbol = "󰍛 " + +[meson] +symbol = "󰔷 " + +[nim] +symbol = "󰆥 " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[ocaml] +symbol = " " + +[os] +disabled = false + +[os.symbols] +Alpaquita = " " +Alpine = " " +AlmaLinux = " " +Amazon = " " +Android = " " +Arch = " " +Artix = " " +CentOS = " " +Debian = " " +DragonFly = " " +Emscripten = " " +EndeavourOS = " " +Fedora = " " +FreeBSD = " " +Garuda = "󰛓 " +Gentoo = " " +HardenedBSD = "󰞌 " +Illumos = "󰈸 " +Kali = " " +Linux = " " +Mabox = " " +Macos = " " +Manjaro = " " +Mariner = " " +MidnightBSD = " " +Mint = " " +NetBSD = " " +NixOS = " " +OpenBSD = "󰈺 " +openSUSE = " " +OracleLinux = "󰌷 " +Pop = " " +Raspbian = " " +Redhat = " " +RedHatEnterprise = " " +RockyLinux = " " +Redox = "󰀘 " +Solus = "󰠳 " +SUSE = " " +Ubuntu = " " +Unknown = " " +Void = " " +Windows = "󰍲 " + +[package] +symbol = "󰏗 " + +[perl] +symbol = " " + +[php] +symbol = " " + +[pijul_channel] +symbol = " " + +[python] +symbol = " " + +[rlang] +symbol = "󰟔 " + +[ruby] +symbol = " " + +[rust] +symbol = "󱘗 " + +[scala] +symbol = " " + +[swift] +symbol = " " + +[zig] +symbol = " " + +[gradle] +symbol = " " diff --git a/.config/starship/starship_pwsh.toml b/.config/starship/starship_pwsh.toml index e20e2e9..aec0050 100644 --- a/.config/starship/starship_pwsh.toml +++ b/.config/starship/starship_pwsh.toml @@ -1,208 +1,208 @@ -# starship.toml -# ~/.config/starship.toml -format = '''$os$time $username @ $hostname $directory $all$character''' -continuation_prompt = "[CR > ](bold cyan) " - -add_newline = true - -[time] -disabled = false -format = '[\[$time\]](purple)' -time_format = '%H:%M' - -[username] -format = '[$user](bold)' -show_always = true - -[hostname] -ssh_only = false -ssh_symbol = '󰞉 ' - -[character] -success_symbol = "[PS > ](bold green)" -error_symbol = "[PS > ](bold red)" -vimcmd_symbol = "[Vi < ](bold green)" - -[directory] -truncation_length = 2 -truncate_to_repo = true -read_only = " 󰌾" -style ="bold cyan" -truncation_symbol = ".../" - -[directory.substitutions] -"~/Documents" = "󰈙 " -"~/Downloads" = " " -"~/Music" = " " -"~/Pictures" = " " -"Source" = " " -"src" = " " - -[aws] -symbol = " " - -[buf] -symbol = " " - -[c] -symbol = " " - -[conda] -symbol = " " - -[crystal] -symbol = " " - -[dart] -symbol = " " - - -[docker_context] -symbol = " " - -[elixir] -symbol = " " - -[elm] -symbol = " " - -[fennel] -symbol = " " - -[fossil_branch] -symbol = " " - -[git_branch] -symbol = " " - -[git_commit] -tag_symbol = '  ' - -[golang] -symbol = " " - -[guix_shell] -symbol = " " - -[haskell] -symbol = " " - -[haxe] -symbol = " " - -[hg_branch] -symbol = " " - -[java] -symbol = " " - -[julia] -symbol = " " - -[kotlin] -symbol = " " - -[lua] -symbol = " " - -[memory_usage] -symbol = "󰍛 " - -[meson] -symbol = "󰔷 " - -[nim] -symbol = "󰆥 " - -[nix_shell] -symbol = " " - -[nodejs] -symbol = " " - -[ocaml] -symbol = " " - -[os] -disabled = false - -[os.symbols] -Alpaquita = " " -Alpine = " " -AlmaLinux = " " -Amazon = " " -Android = " " -Arch = " " -Artix = " " -CentOS = " " -Debian = " " -DragonFly = " " -Emscripten = " " -EndeavourOS = " " -Fedora = " " -FreeBSD = " " -Garuda = "󰛓 " -Gentoo = " " -HardenedBSD = "󰞌 " -Illumos = "󰈸 " -Kali = " " -Linux = " " -Mabox = " " -Macos = " " -Manjaro = " " -Mariner = " " -MidnightBSD = " " -Mint = " " -NetBSD = " " -NixOS = " " -OpenBSD = "󰈺 " -openSUSE = " " -OracleLinux = "󰌷 " -Pop = " " -Raspbian = " " -Redhat = " " -RedHatEnterprise = " " -RockyLinux = " " -Redox = "󰀘 " -Solus = "󰠳 " -SUSE = " " -Ubuntu = " " -Unknown = " " -Void = " " -Windows = "󰍲 " - -[package] -symbol = "󰏗 " - -[perl] -symbol = " " - -[php] -symbol = " " - -[pijul_channel] -symbol = " " - -[python] -symbol = " " - -[rlang] -symbol = "󰟔 " - -[ruby] -symbol = " " - -[rust] -symbol = "󱘗 " - -[scala] -symbol = " " - -[swift] -symbol = " " - -[zig] -symbol = " " - -[gradle] -symbol = " " +# starship.toml +# ~/.config/starship.toml +format = '''$os$time $username @ $hostname $directory $all$character''' +continuation_prompt = "[CR > ](bold cyan) " + +add_newline = true + +[time] +disabled = false +format = '[\[$time\]](purple)' +time_format = '%H:%M' + +[username] +format = '[$user](bold)' +show_always = true + +[hostname] +ssh_only = false +ssh_symbol = '󰞉 ' + +[character] +success_symbol = "[PS > ](bold green)" +error_symbol = "[PS > ](bold red)" +vimcmd_symbol = "[Vi < ](bold green)" + +[directory] +truncation_length = 2 +truncate_to_repo = true +read_only = " 󰌾" +style ="bold cyan" +truncation_symbol = ".../" + +[directory.substitutions] +"~/Documents" = "󰈙 " +"~/Downloads" = " " +"~/Music" = " " +"~/Pictures" = " " +"Source" = " " +"src" = " " + +[aws] +symbol = " " + +[buf] +symbol = " " + +[c] +symbol = " " + +[conda] +symbol = " " + +[crystal] +symbol = " " + +[dart] +symbol = " " + + +[docker_context] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[fennel] +symbol = " " + +[fossil_branch] +symbol = " " + +[git_branch] +symbol = " " + +[git_commit] +tag_symbol = '  ' + +[golang] +symbol = " " + +[guix_shell] +symbol = " " + +[haskell] +symbol = " " + +[haxe] +symbol = " " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[kotlin] +symbol = " " + +[lua] +symbol = " " + +[memory_usage] +symbol = "󰍛 " + +[meson] +symbol = "󰔷 " + +[nim] +symbol = "󰆥 " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[ocaml] +symbol = " " + +[os] +disabled = false + +[os.symbols] +Alpaquita = " " +Alpine = " " +AlmaLinux = " " +Amazon = " " +Android = " " +Arch = " " +Artix = " " +CentOS = " " +Debian = " " +DragonFly = " " +Emscripten = " " +EndeavourOS = " " +Fedora = " " +FreeBSD = " " +Garuda = "󰛓 " +Gentoo = " " +HardenedBSD = "󰞌 " +Illumos = "󰈸 " +Kali = " " +Linux = " " +Mabox = " " +Macos = " " +Manjaro = " " +Mariner = " " +MidnightBSD = " " +Mint = " " +NetBSD = " " +NixOS = " " +OpenBSD = "󰈺 " +openSUSE = " " +OracleLinux = "󰌷 " +Pop = " " +Raspbian = " " +Redhat = " " +RedHatEnterprise = " " +RockyLinux = " " +Redox = "󰀘 " +Solus = "󰠳 " +SUSE = " " +Ubuntu = " " +Unknown = " " +Void = " " +Windows = "󰍲 " + +[package] +symbol = "󰏗 " + +[perl] +symbol = " " + +[php] +symbol = " " + +[pijul_channel] +symbol = " " + +[python] +symbol = " " + +[rlang] +symbol = "󰟔 " + +[ruby] +symbol = " " + +[rust] +symbol = "󱘗 " + +[scala] +symbol = " " + +[swift] +symbol = " " + +[zig] +symbol = " " + +[gradle] +symbol = " " diff --git a/.config/starship/starship_zsh.toml b/.config/starship/starship_zsh.toml index 2594f58..6308e99 100644 --- a/.config/starship/starship_zsh.toml +++ b/.config/starship/starship_zsh.toml @@ -1,208 +1,208 @@ -# starship.toml -# ~/.config/starship.toml -format = '''$os$time $username @ $hostname $directory $all$character''' -continuation_prompt = "[r % ](bold cyan) " - -add_newline = true - -[time] -disabled = false -format = '[\[$time\]](purple)' -time_format = '%H:%M' - -[username] -format = '[$user](bold)' -show_always = true - -[hostname] -ssh_only = false -ssh_symbol = '󰞉 ' - -[character] -success_symbol = "[z % ](bold green)" -error_symbol = "[z % ](bold red)" -vimcmd_symbol = "[v ! ](bold green)" - -[directory] -truncation_length = 2 -truncate_to_repo = true -read_only = " 󰌾" -style ="bold cyan" -truncation_symbol = ".../" - -[directory.substitutions] -"~/Documents" = "󰈙 " -"~/Downloads" = " " -"~/Music" = " " -"~/Pictures" = " " -"Source" = " " -"src" = " " - -[aws] -symbol = " " - -[buf] -symbol = " " - -[c] -symbol = " " - -[conda] -symbol = " " - -[crystal] -symbol = " " - -[dart] -symbol = " " - - -[docker_context] -symbol = " " - -[elixir] -symbol = " " - -[elm] -symbol = " " - -[fennel] -symbol = " " - -[fossil_branch] -symbol = " " - -[git_branch] -symbol = " " - -[git_commit] -tag_symbol = '  ' - -[golang] -symbol = " " - -[guix_shell] -symbol = " " - -[haskell] -symbol = " " - -[haxe] -symbol = " " - -[hg_branch] -symbol = " " - -[java] -symbol = " " - -[julia] -symbol = " " - -[kotlin] -symbol = " " - -[lua] -symbol = " " - -[memory_usage] -symbol = "󰍛 " - -[meson] -symbol = "󰔷 " - -[nim] -symbol = "󰆥 " - -[nix_shell] -symbol = " " - -[nodejs] -symbol = " " - -[ocaml] -symbol = " " - -[os] -disabled = false - -[os.symbols] -Alpaquita = " " -Alpine = " " -AlmaLinux = " " -Amazon = " " -Android = " " -Arch = " " -Artix = " " -CentOS = " " -Debian = " " -DragonFly = " " -Emscripten = " " -EndeavourOS = " " -Fedora = " " -FreeBSD = " " -Garuda = "󰛓 " -Gentoo = " " -HardenedBSD = "󰞌 " -Illumos = "󰈸 " -Kali = " " -Linux = " " -Mabox = " " -Macos = " " -Manjaro = " " -Mariner = " " -MidnightBSD = " " -Mint = " " -NetBSD = " " -NixOS = " " -OpenBSD = "󰈺 " -openSUSE = " " -OracleLinux = "󰌷 " -Pop = " " -Raspbian = " " -Redhat = " " -RedHatEnterprise = " " -RockyLinux = " " -Redox = "󰀘 " -Solus = "󰠳 " -SUSE = " " -Ubuntu = " " -Unknown = " " -Void = " " -Windows = "󰍲 " - -[package] -symbol = "󰏗 " - -[perl] -symbol = " " - -[php] -symbol = " " - -[pijul_channel] -symbol = " " - -[python] -symbol = " " - -[rlang] -symbol = "󰟔 " - -[ruby] -symbol = " " - -[rust] -symbol = "󱘗 " - -[scala] -symbol = " " - -[swift] -symbol = " " - -[zig] -symbol = " " - -[gradle] -symbol = " " +# starship.toml +# ~/.config/starship.toml +format = '''$os$time $username @ $hostname $directory $all$character''' +continuation_prompt = "[r % ](bold cyan) " + +add_newline = true + +[time] +disabled = false +format = '[\[$time\]](purple)' +time_format = '%H:%M' + +[username] +format = '[$user](bold)' +show_always = true + +[hostname] +ssh_only = false +ssh_symbol = '󰞉 ' + +[character] +success_symbol = "[z % ](bold green)" +error_symbol = "[z % ](bold red)" +vimcmd_symbol = "[v ! ](bold green)" + +[directory] +truncation_length = 2 +truncate_to_repo = true +read_only = " 󰌾" +style ="bold cyan" +truncation_symbol = ".../" + +[directory.substitutions] +"~/Documents" = "󰈙 " +"~/Downloads" = " " +"~/Music" = " " +"~/Pictures" = " " +"Source" = " " +"src" = " " + +[aws] +symbol = " " + +[buf] +symbol = " " + +[c] +symbol = " " + +[conda] +symbol = " " + +[crystal] +symbol = " " + +[dart] +symbol = " " + + +[docker_context] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[fennel] +symbol = " " + +[fossil_branch] +symbol = " " + +[git_branch] +symbol = " " + +[git_commit] +tag_symbol = '  ' + +[golang] +symbol = " " + +[guix_shell] +symbol = " " + +[haskell] +symbol = " " + +[haxe] +symbol = " " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[kotlin] +symbol = " " + +[lua] +symbol = " " + +[memory_usage] +symbol = "󰍛 " + +[meson] +symbol = "󰔷 " + +[nim] +symbol = "󰆥 " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[ocaml] +symbol = " " + +[os] +disabled = false + +[os.symbols] +Alpaquita = " " +Alpine = " " +AlmaLinux = " " +Amazon = " " +Android = " " +Arch = " " +Artix = " " +CentOS = " " +Debian = " " +DragonFly = " " +Emscripten = " " +EndeavourOS = " " +Fedora = " " +FreeBSD = " " +Garuda = "󰛓 " +Gentoo = " " +HardenedBSD = "󰞌 " +Illumos = "󰈸 " +Kali = " " +Linux = " " +Mabox = " " +Macos = " " +Manjaro = " " +Mariner = " " +MidnightBSD = " " +Mint = " " +NetBSD = " " +NixOS = " " +OpenBSD = "󰈺 " +openSUSE = " " +OracleLinux = "󰌷 " +Pop = " " +Raspbian = " " +Redhat = " " +RedHatEnterprise = " " +RockyLinux = " " +Redox = "󰀘 " +Solus = "󰠳 " +SUSE = " " +Ubuntu = " " +Unknown = " " +Void = " " +Windows = "󰍲 " + +[package] +symbol = "󰏗 " + +[perl] +symbol = " " + +[php] +symbol = " " + +[pijul_channel] +symbol = " " + +[python] +symbol = " " + +[rlang] +symbol = "󰟔 " + +[ruby] +symbol = " " + +[rust] +symbol = "󱘗 " + +[scala] +symbol = " " + +[swift] +symbol = " " + +[zig] +symbol = " " + +[gradle] +symbol = " " diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 8b23714..fa3ba79 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,39 +1,39 @@ -# $XDG_CONFIG_HOME/tmux/tmux.conf -# ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf -# Prefix -# ----------------- -set-option -g prefix C-x -unbind C-b -bind C-x send-prefix - -# Index -# ----------------- -set -g base-index 1 -set -g pane-base-index 1 - -# History -# ----------------- -set -g history-limit 4096 - -# Reload Config -# ----------------- -bind r source-file ~/.tmux.conf \; display "Reloaded Config" - -# Vi Mode -# ----------------- -set -g status-keys vi -set-window-option -g mode-keys vi - -# Windows Management -# ----------------- -bind | split-window -h -unbind '"' -bind - split-window -v -unbind % -bind h select-pane -L -bind n select-pane -D -bind e select-pane -U -bind i select-pane -R - - - +# $XDG_CONFIG_HOME/tmux/tmux.conf +# ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf +# Prefix +# ----------------- +set-option -g prefix C-x +unbind C-b +bind C-x send-prefix + +# Index +# ----------------- +set -g base-index 1 +set -g pane-base-index 1 + +# History +# ----------------- +set -g history-limit 4096 + +# Reload Config +# ----------------- +bind r source-file ~/.tmux.conf \; display "Reloaded Config" + +# Vi Mode +# ----------------- +set -g status-keys vi +set-window-option -g mode-keys vi + +# Windows Management +# ----------------- +bind | split-window -h +unbind '"' +bind - split-window -v +unbind % +bind h select-pane -L +bind n select-pane -D +bind e select-pane -U +bind i select-pane -R + + + diff --git a/.config/vim/vimrc b/.config/vim/vimrc index c29f0de..5622443 100644 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -8,6 +8,9 @@ noremap n j noremap e k noremap i l +noremap N J +noremap E K +noremap I L " Similar position to i noremap l i @@ -15,7 +18,7 @@ noremap L I " ne[k]st noremap k n noremap K N -" [j]ump +" [j]ump noremap j e noremap J E diff --git a/.config/zellij/config.kdl b/.config/zellij/config.kdl index b55fa30..f08db80 100644 --- a/.config/zellij/config.kdl +++ b/.config/zellij/config.kdl @@ -1,24 +1,24 @@ -// ~/.config/zellij/config.kdl -// ln -sf $DOTFILES/.config/zellij/config.kdl ~.config/zellij/config.kdl -// https://zellij.dev/documentation/configuration -keybinds { - // keybinds are divided into modes - normal { - // bind instructions can include one or more keys (both keys will be bound separately) - // bind keys can include one or more actions (all actions will be performed with no sequential guarantees) - bind "Ctrl g" { SwitchToMode "locked"; } - bind "Ctrl p" { SwitchToMode "pane"; } - bind "Alt n" { NewPane; } - bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } - } - pane { - bind "h" "Left" { MoveFocus "Left"; } - bind "i" "Right" { MoveFocus "Right"; } - bind "n" "Down" { MoveFocus "Down"; } - bind "e" "Up" { MoveFocus "Up"; } - bind "p" { SwitchFocus; } - } - locked { - bind "Ctrl g" { SwitchToMode "normal"; } - } -} +// ~/.config/zellij/config.kdl +// ln -sf $DOTFILES/.config/zellij/config.kdl ~.config/zellij/config.kdl +// https://zellij.dev/documentation/configuration +keybinds { + // keybinds are divided into modes + normal { + // bind instructions can include one or more keys (both keys will be bound separately) + // bind keys can include one or more actions (all actions will be performed with no sequential guarantees) + bind "Ctrl g" { SwitchToMode "locked"; } + bind "Ctrl p" { SwitchToMode "pane"; } + bind "Alt n" { NewPane; } + bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } + } + pane { + bind "h" "Left" { MoveFocus "Left"; } + bind "i" "Right" { MoveFocus "Right"; } + bind "n" "Down" { MoveFocus "Down"; } + bind "e" "Up" { MoveFocus "Up"; } + bind "p" { SwitchFocus; } + } + locked { + bind "Ctrl g" { SwitchToMode "normal"; } + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2528ba8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# $DOTFILES/.editorconfig + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false +indent_style = space +indent_size = 2 + +[*.{json,toml,js,lua,yaml,yml}] +indent_size = 2 +indent_style = space diff --git a/.gitignore b/.gitignore index 537db61..2aeec1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,28 @@ +# Private Files *private* .private.env.* + +# Test files +test/ +test.* + +# Archives +*.gz +*.tar +*.zip +*.tgz + +# Utils +xdg-ninja/ + +# IPython config cache .config/ipython/profile_default/db .config/ipython/profile_default/log .config/ipython/profile_default/pid .config/ipython/profile_default/security .config/ipython/profile_default/history.sqlite + +# nvim config cache .config/nvim/tt.* .config/nvim/.tests .config/nvim/doc/tags @@ -16,12 +34,11 @@ .config/nvim/lazy-lock.json .config/nvim/lazyvim.json .config/nvim/lua/plugins/obsidian.lua -test/ -test.* -*.gz -*.tar -*.zip -*.tgz -# WindowsTerminal.json + +# Undone +# Windows PowerToys PowerToys/ -xdg-ninja/ \ No newline at end of file +# Just Script +Justfile +# Nushell +.config/nushell/ diff --git a/.obsidian.vimrc b/.obsidian.vimrc index 585a791..01679ea 100644 --- a/.obsidian.vimrc +++ b/.obsidian.vimrc @@ -1,59 +1,59 @@ -" Put this in OBSIDIAN_VAULT/.obsidian.vimrc -set clipboard=unnamed " Sync with System Clipboard - -" Word wrap -noremap n gj -noremap e gk -noremap i l - -" Similar position to i -noremap l i -noremap L I -" ne[k]st -noremap k n -noremap K N -" [j]ump -noremap j e -noremap J E - -" Y to yank to end of line -noremap Y y$ - -""" Visual mode surrounding -exmap addbold obcommand editor:toogle-bold -exmap additalic obcommand editor:toogle-italic -exmap addhighlight obcommand editor:toogle-highlight -exmap addcode obcommand editor:toogle-code -exmap adddel obcommand editor:toogle-strikethrough -vnoremap ~ :adddel " Add delete to selection -vnoremap ` c`"` " editor:toogle-code is buggy -vnoremap * :addbold " Add bold to selection -vnoremap _ :additalic " Add italic to selection -vnoremap = :addhighlight " Add highlight to selection - -exmap prevtab obcommand workspace:previous-tab -exmap nexttab obcommand workspace:next-tab -nnoremap H :prevtab -nnoremap I :nexttab - -exmap reload :source .obsidian.vimrc - -unmap -exmap vsplit obcommand workspace:split-vertical -exmap hsplit obcommand workspace:split-horizontal -map | :vsplit -map - :hsplit -" map bd - -exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt -map ai :chat - -exmap omnisearch obcommand omnisearch:show-modal -map :omnisearch - -exmap command-palette obcommand command-palette:open -map : :command-palette - -""" g-commands -exmap tsource obcommand editor:toggle-source -nnoremap gs :tsource +" Put this in OBSIDIAN_VAULT/.obsidian.vimrc +set clipboard=unnamed " Sync with System Clipboard + +" Word wrap +noremap n gj +noremap e gk +noremap i l + +" Similar position to i +noremap l i +noremap L I +" ne[k]st +noremap k n +noremap K N +" [j]ump +noremap j e +noremap J E + +" Y to yank to end of line +noremap Y y$ + +""" Visual mode surrounding +exmap addbold obcommand editor:toogle-bold +exmap additalic obcommand editor:toogle-italic +exmap addhighlight obcommand editor:toogle-highlight +exmap addcode obcommand editor:toogle-code +exmap adddel obcommand editor:toogle-strikethrough +vnoremap ~ :adddel " Add delete to selection +vnoremap ` c`"` " editor:toogle-code is buggy +vnoremap * :addbold " Add bold to selection +vnoremap _ :additalic " Add italic to selection +vnoremap = :addhighlight " Add highlight to selection + +exmap prevtab obcommand workspace:previous-tab +exmap nexttab obcommand workspace:next-tab +nnoremap H :prevtab +nnoremap I :nexttab + +exmap reload :source .obsidian.vimrc + +unmap +exmap vsplit obcommand workspace:split-vertical +exmap hsplit obcommand workspace:split-horizontal +map | :vsplit +map - :hsplit +" map bd + +exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt +map ai :chat + +exmap omnisearch obcommand omnisearch:show-modal +map :omnisearch + +exmap command-palette obcommand command-palette:open +map : :command-palette + +""" g-commands +exmap tsource obcommand editor:toggle-source +nnoremap gs :tsource diff --git a/LICENSE b/LICENSE index c6acddc..1978a49 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,675 @@ -MIT License +Copyright (c) 2024-2024 js0ny + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 -Copyright (c) 2024 js0ny + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: + Preamble -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. + The GNU General Public License is a free, copyleft license for +software and other kinds of works. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/browser/surfingkeys.js b/browser/surfingkeys.js index 012882e..e3ec806 100644 --- a/browser/surfingkeys.js +++ b/browser/surfingkeys.js @@ -1,360 +1,360 @@ -// Paste this into surfingkeys advanced settings -// or use: -// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/browser/surfingkeys.js - -/** Examples - -// an example to create a new mapping `ctrl-y` -api.mapkey('', 'Show me the money', function() { - Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).'); -}); - -// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works. -api.map('gt', 'T'); - - -// an example to remove mapkey `Ctrl-i` -api.unmap(''); - -*/ -// Settings -settings.language = "zh-CN" ; -settings.showModeStatus = false; -// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main -const forward = { - add: function (key) { // 转发即将被 unmap 的键 - return api.map(`for${key}`, key) - }, - cancel: function (key) { // 删除转发生成的键 - api.unmap(`for${key}`) - api.unmap(key) - }, - use: function (key) { - return `for${key}` - } -} - -const colemak = { - forward: function (key) { // 转发即将被 unmap 的键 - api.map(key, `col${key}`) - api.unmap(`col${key}`) - - }, - use: function (key) { - return `col${key}` - }, - map: function (a, b) { - api.map(colemak.use(a), forward.use(b)) - } -} - -const forwardFactory = { - push: function (mapLists) { // forward original keys - for (let key in mapLists) { - forward.add(mapLists[key]) - } - }, - map: function (mapLists) { - for (let key in mapLists) { - colemak.map(key, mapLists[key]) - } - }, - pull: function (mapLists) { - for (let key in mapLists) { - forward.cancel(mapLists[key]) - } - for (let key in mapLists) { - colemak.forward(key) - } - } -} - -const mapLists = { - /// scroll page - // Arrow - 'n': 'j', - 'e': 'k', - 'i': 'l', - // l <-> i - 'l': 'i', - 'L': 'I', - // k <-> n - 'k': 'n', - 'K': 'N', - // j <-> e - 'j': 'e', - 'J': 'E', - // 缩放 - 'zu': 'zi', - 'zo': 'ze', - 'zz': 'zr', -} - -forwardFactory.push(mapLists) -api.unmap('t') -forwardFactory.map(mapLists) -// 鼠标点击 -api.unmap('gi') -api.unmap('[[') -api.unmap(']]') -api.unmap(';m') -api.unmap(';fs') -api.unmap('O') -api.unmap('C') -forwardFactory.pull(mapLists) - - -// Search Alias -api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) { - var res = JSON.parse(response.text); - return res.map(function(r){ - return r.phrase; - }); -}); -api.addSearchAlias('p', 'Perplexity', 'https://www.perplexity.ai/?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) { - var res = JSON.parse(response.text); - return res.map(function(r){ - return r.phrase; - }); -}); -api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https://duckduckgo.com/ac/?q=', function(response) { - var res = JSON.parse(response.text); - return res.map(function(r){ - return r.phrase; - }); -}); - - -// Theme, reference to https://github.com/Foldex/surfingkeys-config -api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;'); -api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text"); -api.Visual.style('marks', 'background-color: #A3BE8C99;'); -api.Visual.style('cursor', 'background-color: #88C0D0;'); -settings.theme = ` -fg: #E5E9F0; -bg: #3B4252; -bg-dark: #2E3440; -border: #4C566A; -main-fg: #88C0D0; -accent-fg: #A3BE8C; -info-fg: #5E81AC; -select: #4C566A; -/* ---------- Generic ---------- */ -.sk_theme { -background: var(--bg); -color: var(--fg); - background-color: var(--bg); - border-color: var(--border); - font-family: var(--font); - font-size: var(--font-size); - font-weight: var(--font-weight); -} - -input { - font-family: var(--font); - font-weight: var(--font-weight); -} - -.sk_theme tbody { - color: var(--fg); -} - -.sk_theme input { - color: var(--fg); -} - -/* Hints */ -#sk_hints .begin { - color: var(--accent-fg) !important; -} - -#sk_tabs .sk_tab { - background: var(--bg-dark); - border: 1px solid var(--border); -} - -#sk_tabs .sk_tab_title { - color: var(--fg); -} - -#sk_tabs .sk_tab_url { - color: var(--main-fg); -} - -#sk_tabs .sk_tab_hint { - background: var(--bg); - border: 1px solid var(--border); - color: var(--accent-fg); -} - -.sk_theme #sk_frame { - background: var(--bg); - opacity: 0.2; - color: var(--accent-fg); -} - -/* ---------- Omnibar ---------- */ -/* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */ -/* .sk_theme#sk_omnibar { - width: 100%; - left: 0; -} */ - -.sk_theme .title { - color: var(--accent-fg); -} - -.sk_theme .url { - color: var(--main-fg); -} - -.sk_theme .annotation { - color: var(--accent-fg); -} - -.sk_theme .omnibar_highlight { - color: var(--accent-fg); -} - -.sk_theme .omnibar_timestamp { - color: var(--info-fg); -} - -.sk_theme .omnibar_visitcount { - color: var(--accent-fg); -} - -.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) { - background: var(--bg-dark); -} - -.sk_theme #sk_omnibarSearchResult ul li.focused { - background: var(--border); -} - -.sk_theme #sk_omnibarSearchArea { - border-top-color: var(--border); - border-bottom-color: var(--border); -} - -.sk_theme #sk_omnibarSearchArea input, -.sk_theme #sk_omnibarSearchArea span { - font-size: var(--font-size); -} - -.sk_theme .separator { - color: var(--accent-fg); -} - -/* ---------- Popup Notification Banner ---------- */ -#sk_banner { - font-family: var(--font); - font-size: var(--font-size); - font-weight: var(--font-weight); - background: var(--bg); - border-color: var(--border); - color: var(--fg); - opacity: 0.9; -} - -/* ---------- Popup Keys ---------- */ -#sk_keystroke { - background-color: var(--bg); -} - -.sk_theme kbd .candidates { - color: var(--info-fg); -} - -.sk_theme span.annotation { - color: var(--accent-fg); -} - -/* ---------- Popup Translation Bubble ---------- */ -#sk_bubble { - background-color: var(--bg) !important; - color: var(--fg) !important; - border-color: var(--border) !important; -} - -#sk_bubble * { - color: var(--fg) !important; -} - -#sk_bubble div.sk_arrow div:nth-of-type(1) { - border-top-color: var(--border) !important; - border-bottom-color: var(--border) !important; -} - -#sk_bubble div.sk_arrow div:nth-of-type(2) { - border-top-color: var(--bg) !important; - border-bottom-color: var(--bg) !important; -} - -/* ---------- Search ---------- */ -#sk_status, -#sk_find { - font-size: var(--font-size); - border-color: var(--border); -} - -.sk_theme kbd { - background: var(--bg-dark); - border-color: var(--border); - box-shadow: none; - color: var(--fg); -} - -.sk_theme .feature_name span { - color: var(--main-fg); -} - -/* ---------- ACE Editor ---------- */ -#sk_editor { - background: var(--bg-dark) !important; - height: 50% !important; - /* Remove this to restore the default editor size */ -} - -.ace_dialog-bottom { - border-top: 1px solid var(--bg) !important; -} - -.ace-chrome .ace_print-margin, -.ace_gutter, -.ace_gutter-cell, -.ace_dialog { - background: var(--bg) !important; -} - -.ace-chrome { - color: var(--fg) !important; -} - -.ace_gutter, -.ace_dialog { - color: var(--fg) !important; -} - -.ace_cursor { - color: var(--fg) !important; -} - -.normal-mode .ace_cursor { - background-color: var(--fg) !important; - border: var(--fg) !important; - opacity: 0.7 !important; -} - -.ace_marker-layer .ace_selection { - background: var(--select) !important; -} - -.ace_editor, -.ace_dialog span, -.ace_dialog input { - font-family: var(--font); - font-size: var(--font-size); - font-weight: var(--font-weight); -}`; +// Paste this into surfingkeys advanced settings +// or use: +// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/browser/surfingkeys.js + +/** Examples + +// an example to create a new mapping `ctrl-y` +api.mapkey('', 'Show me the money', function() { + Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).'); +}); + +// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works. +api.map('gt', 'T'); + + +// an example to remove mapkey `Ctrl-i` +api.unmap(''); + +*/ +// Settings +settings.language = "zh-CN" ; +settings.showModeStatus = false; +// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main +const forward = { + add: function (key) { // 转发即将被 unmap 的键 + return api.map(`for${key}`, key) + }, + cancel: function (key) { // 删除转发生成的键 + api.unmap(`for${key}`) + api.unmap(key) + }, + use: function (key) { + return `for${key}` + } +} + +const colemak = { + forward: function (key) { // 转发即将被 unmap 的键 + api.map(key, `col${key}`) + api.unmap(`col${key}`) + + }, + use: function (key) { + return `col${key}` + }, + map: function (a, b) { + api.map(colemak.use(a), forward.use(b)) + } +} + +const forwardFactory = { + push: function (mapLists) { // forward original keys + for (let key in mapLists) { + forward.add(mapLists[key]) + } + }, + map: function (mapLists) { + for (let key in mapLists) { + colemak.map(key, mapLists[key]) + } + }, + pull: function (mapLists) { + for (let key in mapLists) { + forward.cancel(mapLists[key]) + } + for (let key in mapLists) { + colemak.forward(key) + } + } +} + +const mapLists = { + /// scroll page + // Arrow + 'n': 'j', + 'e': 'k', + 'i': 'l', + // l <-> i + 'l': 'i', + 'L': 'I', + // k <-> n + 'k': 'n', + 'K': 'N', + // j <-> e + 'j': 'e', + 'J': 'E', + // 缩放 + 'zu': 'zi', + 'zo': 'ze', + 'zz': 'zr', +} + +forwardFactory.push(mapLists) +api.unmap('t') +forwardFactory.map(mapLists) +// 鼠标点击 +api.unmap('gi') +api.unmap('[[') +api.unmap(']]') +api.unmap(';m') +api.unmap(';fs') +api.unmap('O') +api.unmap('C') +forwardFactory.pull(mapLists) + + +// Search Alias +api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) { + var res = JSON.parse(response.text); + return res.map(function(r){ + return r.phrase; + }); +}); +api.addSearchAlias('p', 'Perplexity', 'https://www.perplexity.ai/?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) { + var res = JSON.parse(response.text); + return res.map(function(r){ + return r.phrase; + }); +}); +api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https://duckduckgo.com/ac/?q=', function(response) { + var res = JSON.parse(response.text); + return res.map(function(r){ + return r.phrase; + }); +}); + + +// Theme, reference to https://github.com/Foldex/surfingkeys-config +api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;'); +api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text"); +api.Visual.style('marks', 'background-color: #A3BE8C99;'); +api.Visual.style('cursor', 'background-color: #88C0D0;'); +settings.theme = ` +fg: #E5E9F0; +bg: #3B4252; +bg-dark: #2E3440; +border: #4C566A; +main-fg: #88C0D0; +accent-fg: #A3BE8C; +info-fg: #5E81AC; +select: #4C566A; +/* ---------- Generic ---------- */ +.sk_theme { +background: var(--bg); +color: var(--fg); + background-color: var(--bg); + border-color: var(--border); + font-family: var(--font); + font-size: var(--font-size); + font-weight: var(--font-weight); +} + +input { + font-family: var(--font); + font-weight: var(--font-weight); +} + +.sk_theme tbody { + color: var(--fg); +} + +.sk_theme input { + color: var(--fg); +} + +/* Hints */ +#sk_hints .begin { + color: var(--accent-fg) !important; +} + +#sk_tabs .sk_tab { + background: var(--bg-dark); + border: 1px solid var(--border); +} + +#sk_tabs .sk_tab_title { + color: var(--fg); +} + +#sk_tabs .sk_tab_url { + color: var(--main-fg); +} + +#sk_tabs .sk_tab_hint { + background: var(--bg); + border: 1px solid var(--border); + color: var(--accent-fg); +} + +.sk_theme #sk_frame { + background: var(--bg); + opacity: 0.2; + color: var(--accent-fg); +} + +/* ---------- Omnibar ---------- */ +/* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */ +/* .sk_theme#sk_omnibar { + width: 100%; + left: 0; +} */ + +.sk_theme .title { + color: var(--accent-fg); +} + +.sk_theme .url { + color: var(--main-fg); +} + +.sk_theme .annotation { + color: var(--accent-fg); +} + +.sk_theme .omnibar_highlight { + color: var(--accent-fg); +} + +.sk_theme .omnibar_timestamp { + color: var(--info-fg); +} + +.sk_theme .omnibar_visitcount { + color: var(--accent-fg); +} + +.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) { + background: var(--bg-dark); +} + +.sk_theme #sk_omnibarSearchResult ul li.focused { + background: var(--border); +} + +.sk_theme #sk_omnibarSearchArea { + border-top-color: var(--border); + border-bottom-color: var(--border); +} + +.sk_theme #sk_omnibarSearchArea input, +.sk_theme #sk_omnibarSearchArea span { + font-size: var(--font-size); +} + +.sk_theme .separator { + color: var(--accent-fg); +} + +/* ---------- Popup Notification Banner ---------- */ +#sk_banner { + font-family: var(--font); + font-size: var(--font-size); + font-weight: var(--font-weight); + background: var(--bg); + border-color: var(--border); + color: var(--fg); + opacity: 0.9; +} + +/* ---------- Popup Keys ---------- */ +#sk_keystroke { + background-color: var(--bg); +} + +.sk_theme kbd .candidates { + color: var(--info-fg); +} + +.sk_theme span.annotation { + color: var(--accent-fg); +} + +/* ---------- Popup Translation Bubble ---------- */ +#sk_bubble { + background-color: var(--bg) !important; + color: var(--fg) !important; + border-color: var(--border) !important; +} + +#sk_bubble * { + color: var(--fg) !important; +} + +#sk_bubble div.sk_arrow div:nth-of-type(1) { + border-top-color: var(--border) !important; + border-bottom-color: var(--border) !important; +} + +#sk_bubble div.sk_arrow div:nth-of-type(2) { + border-top-color: var(--bg) !important; + border-bottom-color: var(--bg) !important; +} + +/* ---------- Search ---------- */ +#sk_status, +#sk_find { + font-size: var(--font-size); + border-color: var(--border); +} + +.sk_theme kbd { + background: var(--bg-dark); + border-color: var(--border); + box-shadow: none; + color: var(--fg); +} + +.sk_theme .feature_name span { + color: var(--main-fg); +} + +/* ---------- ACE Editor ---------- */ +#sk_editor { + background: var(--bg-dark) !important; + height: 50% !important; + /* Remove this to restore the default editor size */ +} + +.ace_dialog-bottom { + border-top: 1px solid var(--bg) !important; +} + +.ace-chrome .ace_print-margin, +.ace_gutter, +.ace_gutter-cell, +.ace_dialog { + background: var(--bg) !important; +} + +.ace-chrome { + color: var(--fg) !important; +} + +.ace_gutter, +.ace_dialog { + color: var(--fg) !important; +} + +.ace_cursor { + color: var(--fg) !important; +} + +.normal-mode .ace_cursor { + background-color: var(--fg) !important; + border: var(--fg) !important; + opacity: 0.7 !important; +} + +.ace_marker-layer .ace_selection { + background: var(--select) !important; +} + +.ace_editor, +.ace_dialog span, +.ace_dialog input { + font-family: var(--font); + font-size: var(--font-size); + font-weight: var(--font-weight); +}`; // click `Save` button to make above settings to take effect. \ No newline at end of file diff --git a/desktop.ini b/desktop.ini index 2db53c7..1a49096 100644 --- a/desktop.ini +++ b/desktop.ini @@ -1,6 +1,6 @@ -[.ShellClassInfo] -IconResource=D:\Assets\Folder11-Ico\ico\bash.ico,0 -[ViewState] -Mode= -Vid= -FolderType=Documents +[.ShellClassInfo] +IconResource=D:\Assets\Folder11-Ico\ico\bash.ico,0 +[ViewState] +Mode= +Vid= +FolderType=Documents diff --git a/mac/.zshrc b/mac/.zshrc index afefec8..8e06b87 100644 --- a/mac/.zshrc +++ b/mac/.zshrc @@ -1,44 +1,44 @@ -# $XDG_CONFIG_HOME/zsh/.zshrc -# ln -s $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc -### Variables ### - -export DOTFILES="$HOME/.dotfiles" -export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH -for file in $DOTFILES/zsh/*.zsh; do - source $file -done -export ARCHFLAGS="-arch arm64" - -### Navigation ### -# Absolute navigation -alias doku="cd ~/doku && ls" -alias dotfiles="cd $DOTFILES && ls" -alias docs="cd ~/Documents" -alias dt="cd ~/Desktop" -alias down="cd ~/Downloads" -alias one="cd ~/OneDrive" -alias gdrive="cd ~/Google\ Drive" - -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! -__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then - . "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" - else - export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH" - fi -fi -unset __conda_setup -# <<< conda initialize <<< - -# >>> juliaup initialize >>> - -# !! Contents within this block are managed by juliaup !! - -path=('$HOME/.juliaup/bin' $path) -export PATH - -# <<< juliaup initialize <<< +# $XDG_CONFIG_HOME/zsh/.zshrc +# ln -s $DOTFILES/mac/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc +### Variables ### + +export DOTFILES="$HOME/.dotfiles" +export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH +for file in $DOTFILES/zsh/*.zsh; do + source $file +done +export ARCHFLAGS="-arch arm64" + +### Navigation ### +# Absolute navigation +alias doku="cd ~/doku && ls" +alias dotfiles="cd $DOTFILES && ls" +alias docs="cd ~/Documents" +alias dt="cd ~/Desktop" +alias down="cd ~/Downloads" +alias one="cd ~/OneDrive" +alias gdrive="cd ~/Google\ Drive" + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then + . "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" + else + export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< + +# >>> juliaup initialize >>> + +# !! Contents within this block are managed by juliaup !! + +path=('$HOME/.juliaup/bin' $path) +export PATH + +# <<< juliaup initialize <<< diff --git a/mac/Microsoft.PowerShell_profile.ps1 b/mac/Microsoft.PowerShell_profile.ps1 index a54d167..e51f72c 100644 --- a/mac/Microsoft.PowerShell_profile.ps1 +++ b/mac/Microsoft.PowerShell_profile.ps1 @@ -1,24 +1,24 @@ -# $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1 -# ln -sf $DOTFILES/mac/Microsoft.PowerShell_profile.ps1 $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1 -### Variables ### - -$DOTFILES = "$HOME\.dotfiles" - -### Load Configs ### - -Get-ChildItem -Path $DOTFILES\powershell -Filter *.ps1 | ForEach-Object {. $_} -Get-ChildItem -Path $DOTFILES\powershell_private -Filter *.ps1 | ForEach-Object {. $_} - -## Aliases ### - -# PowerShell Equivalents # - -# Set-Alias "curl" "Invoke-WebRequest" -# Set-Alias "man" "Get-Help" -Set-Alias "kill" "Stop-Process" -Set-Alias "open" "Invoke-Item" # Use ii instead of open - -# Dev # - -${function:zshcfg} = { nvim ~/.zshrc } +# $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1 +# ln -sf $DOTFILES/mac/Microsoft.PowerShell_profile.ps1 $XDG_CONFIG_HOME/powershell/Microsoft.PowerShell_profile.ps1 +### Variables ### + +$DOTFILES = "$HOME\.dotfiles" + +### Load Configs ### + +Get-ChildItem -Path $DOTFILES\powershell -Filter *.ps1 | ForEach-Object {. $_} +Get-ChildItem -Path $DOTFILES\powershell_private -Filter *.ps1 | ForEach-Object {. $_} + +## Aliases ### + +# PowerShell Equivalents # + +# Set-Alias "curl" "Invoke-WebRequest" +# Set-Alias "man" "Get-Help" +Set-Alias "kill" "Stop-Process" +Set-Alias "open" "Invoke-Item" # Use ii instead of open + +# Dev # + +${function:zshcfg} = { nvim ~/.zshrc } ${function:bashcfg} = { nvim ~/.bashrc } \ No newline at end of file diff --git a/mac/karabiner/caps_to_esc_lcmd.json b/mac/karabiner/caps_to_esc_lcmd.json index 9723e0b..00607a9 100644 --- a/mac/karabiner/caps_to_esc_lcmd.json +++ b/mac/karabiner/caps_to_esc_lcmd.json @@ -1,26 +1,26 @@ -{ - "description": "CapsLock to ESC (alone) or LCommand (withKeys)", - "manipulators": [ - { - "from": { - "key_code": "caps_lock", - "modifiers": { - "optional": [ - "any" - ] - } - }, - "to": [ - { - "key_code": "left_command" - } - ], - "to_if_alone": [ - { - "key_code": "escape" - } - ], - "type": "basic" - } - ] +{ + "description": "CapsLock to ESC (alone) or LCommand (withKeys)", + "manipulators": [ + { + "from": { + "key_code": "caps_lock", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_command" + } + ], + "to_if_alone": [ + { + "key_code": "escape" + } + ], + "type": "basic" + } + ] } \ No newline at end of file diff --git a/mac/karabiner/fn-tab_to_cmd-tab.json b/mac/karabiner/fn-tab_to_cmd-tab.json index fadf814..bc8089f 100644 --- a/mac/karabiner/fn-tab_to_cmd-tab.json +++ b/mac/karabiner/fn-tab_to_cmd-tab.json @@ -1,24 +1,24 @@ -{ - "description": "Map fn+tab to cmd+tab", - "manipulators": [ - { - "from": { - "key_code": "tab", - "modifiers": { - "mandatory": [ - "fn" - ] - } - }, - "to": [ - { - "key_code": "tab", - "modifiers": [ - "left_command" - ] - } - ], - "type": "basic" - } - ] +{ + "description": "Map fn+tab to cmd+tab", + "manipulators": [ + { + "from": { + "key_code": "tab", + "modifiers": { + "mandatory": [ + "fn" + ] + } + }, + "to": [ + { + "key_code": "tab", + "modifiers": [ + "left_command" + ] + } + ], + "type": "basic" + } + ] } \ No newline at end of file diff --git a/mac/neovide.toml b/mac/neovide.toml index 5677d38..1ec074b 100644 --- a/mac/neovide.toml +++ b/mac/neovide.toml @@ -1,21 +1,21 @@ -# $XDG_CONFIG_HOME/neovide/config.toml -# ln -sf $DOTFILES/mac/neovide.toml $XDG_CONFIG_HOME/neovide/config.toml -# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/neovide/config.toml -Value $DOTFILES\mac\neovide.toml (Mac) -# https://neovide.dev/config-file.html?highlight=toml#config-file -fork = false -frame = "full" -idle = true -maximized = false -neovim-bin = "/opt/homebrew/bin/nvim" -no-multigrid = false -srgb = false -tabs = true -theme = "auto" -title-hidden = true -vsync = true -wsl = false - -[font] -normal = ["CaskaydiaCove Nerd Font"] # Will use the bundled Fira Code Nerd Font by default -size = 14.0 - +# $XDG_CONFIG_HOME/neovide/config.toml +# ln -sf $DOTFILES/mac/neovide.toml $XDG_CONFIG_HOME/neovide/config.toml +# New-Item -ItemType SymbolicLink -Path $Env:XDG_CONFIG_HOME/neovide/config.toml -Value $DOTFILES\mac\neovide.toml (Mac) +# https://neovide.dev/config-file.html?highlight=toml#config-file +fork = false +frame = "full" +idle = true +maximized = false +neovim-bin = "/opt/homebrew/bin/nvim" +no-multigrid = false +srgb = false +tabs = true +theme = "auto" +title-hidden = true +vsync = true +wsl = false + +[font] +normal = ["CaskaydiaCove Nerd Font"] # Will use the bundled Fira Code Nerd Font by default +size = 14.0 + diff --git a/mac/set_mirror.sh b/mac/set_mirror.sh index 1c7b27b..b5454d3 100644 --- a/mac/set_mirror.sh +++ b/mac/set_mirror.sh @@ -1,33 +1,33 @@ -# pip -alias pip=pip3 -alias python=python3 -python -m pip install --upgrade pip -pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -# npm -npm config set registry https://registry.npmmirror.com - - - -# Homebrew -# 手动设置 -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" - -# 注:自 brew 4.0 起,大部分 Homebrew 用户无需设置 homebrew/core 和 homebrew/cask 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 -# 如果需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 和 homebrew/cask 镜像。 -# 请按需执行如下两行命令: -brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git -brew tap --custom-remote --force-auto-update homebrew/cask https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git - -# 除 homebrew/core 和 homebrew/cask 仓库外的 tap 仓库仍然需要设置镜像 -brew tap --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git -brew tap --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git -brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git -brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git -brew update - -# 或使用下面的几行命令自动设置 -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" -for tap in core cask{,-fonts,-versions} command-not-found services; do - brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git" -done -brew update +# pip +alias pip=pip3 +alias python=python3 +python -m pip install --upgrade pip +pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple +# npm +npm config set registry https://registry.npmmirror.com + + + +# Homebrew +# 手动设置 +export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" + +# 注:自 brew 4.0 起,大部分 Homebrew 用户无需设置 homebrew/core 和 homebrew/cask 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 +# 如果需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 和 homebrew/cask 镜像。 +# 请按需执行如下两行命令: +brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git +brew tap --custom-remote --force-auto-update homebrew/cask https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git + +# 除 homebrew/core 和 homebrew/cask 仓库外的 tap 仓库仍然需要设置镜像 +brew tap --custom-remote --force-auto-update homebrew/cask-fonts https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git +brew tap --custom-remote --force-auto-update homebrew/cask-versions https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-versions.git +brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git +brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git +brew update + +# 或使用下面的几行命令自动设置 +export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" +for tap in core cask{,-fonts,-versions} command-not-found services; do + brew tap --custom-remote --force-auto-update "homebrew/${tap}" "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-${tap}.git" +done +brew update diff --git a/mac/shortcuts/finder_open.applescript b/mac/shortcuts/finder_open.applescript index 7ab435c..da3f806 100644 --- a/mac/shortcuts/finder_open.applescript +++ b/mac/shortcuts/finder_open.applescript @@ -1,4 +1,4 @@ -tell application "Finder" - activate - make new Finder window -end tell +tell application "Finder" + activate + make new Finder window +end tell diff --git a/mirror/set_mirror.ps1 b/mirror/set_mirror.ps1 index c7d6573..48a3fdf 100644 --- a/mirror/set_mirror.ps1 +++ b/mirror/set_mirror.ps1 @@ -1,7 +1,7 @@ -# pip -Set-Alias pip pip3 -Set-Alias python python3 -python -m pip install --upgrade pip -pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -# npm +# pip +Set-Alias pip pip3 +Set-Alias python python3 +python -m pip install --upgrade pip +pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple +# npm npm config set registry https://registry.npmmirror.com \ No newline at end of file diff --git a/mirror/set_mirror.sh b/mirror/set_mirror.sh index 7ba2502..6f5df72 100644 --- a/mirror/set_mirror.sh +++ b/mirror/set_mirror.sh @@ -1,22 +1,22 @@ -# pip -alias pip=pip3 -alias python=python3 -python -m pip install --upgrade pip -pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple -# npm -npm config set registry https://registry.npmmirror.com - - - -# Linuxbrew -export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" - -# 注:自 brew 4.0 起,使用默认 prefix (即 "/home/linuxbrew/.linuxbrew") 的大部分 Homebrew 用户无需设置 homebrew/core 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 -# 如果不是默认 prefix 或者需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 镜像。 -# 请按需执行如下命令: -brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git - -# 除 homebrew/core 仓库外的 tap 仓库仍然需要设置镜像 -brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git -brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git +# pip +alias pip=pip3 +alias python=python3 +python -m pip install --upgrade pip +pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple +# npm +npm config set registry https://registry.npmmirror.com + + + +# Linuxbrew +export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git" + +# 注:自 brew 4.0 起,使用默认 prefix (即 "/home/linuxbrew/.linuxbrew") 的大部分 Homebrew 用户无需设置 homebrew/core 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。 +# 如果不是默认 prefix 或者需要使用 Homebrew 的开发命令 (如 `brew cat `),则仍然需要设置 homebrew/core 镜像。 +# 请按需执行如下命令: +brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git + +# 除 homebrew/core 仓库外的 tap 仓库仍然需要设置镜像 +brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git +brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git brew update \ No newline at end of file diff --git a/mirror/tuna_ubuntu.list b/mirror/tuna_ubuntu.list index 505cc44..ca0d87a 100644 --- a/mirror/tuna_ubuntu.list +++ b/mirror/tuna_ubuntu.list @@ -1,15 +1,15 @@ -# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 -deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse -# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse -deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse -# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse -deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse -# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse - -# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换 -deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse -# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse - -# 预发布软件源,不建议启用 -# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse +# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 +deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse +deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse +deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse + +# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换 +deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse +# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse + +# 预发布软件源,不建议启用 +# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse \ No newline at end of file diff --git a/powershell/Aliases.ps1 b/powershell/Aliases.ps1 index 147a4f6..29fff31 100644 --- a/powershell/Aliases.ps1 +++ b/powershell/Aliases.ps1 @@ -1,37 +1,37 @@ -### VARIABLES ### -$EDITOR = "code" -# Shell Equivalents # -Set-Alias "touch" "New-Item" -${function:ll} = { Get-ChildItem -Force } - -# Shell Configurations # -${function:shcfg} = { code $PROFILE } -Set-Alias "pwshcfg" "shcfg" -${function:reload} = { . $PROFILE } -${function:pulldots} = { Set-Location -Path $DOTFILES && git pull } - -# Editors # -Set-Alias "v" "nvim" -Set-Alias "c" "code" -Set-Alias "gvi" "neovide" - -# File Creation # -function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname } -function tc { param ( [string] $filename) New-Item $filename && code $filename } -function tv { param ( [string] $filename) New-Item $filename && nvim $filename } -function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem } - -### Dev ### - -# .NET # -${function:csi} = { dotnet repl --default-kernel csharp} -${function:fsi} = { dotnet repl --default-kernel fsharp} - -# Python & Conda # -Set-Alias "py" "python" -Set-Alias "ipy" "ipython" -${function:pyact} = { conda activate $args[0] } -${function:pydact} = { conda deactivate } -${function:pylsenvs} = { conda env list } -${function:pymkenv} = { conda create --name $args[0] } +### VARIABLES ### +$EDITOR = "code" +# Shell Equivalents # +Set-Alias "touch" "New-Item" +${function:ll} = { Get-ChildItem -Force } + +# Shell Configurations # +${function:shcfg} = { code $PROFILE } +Set-Alias "pwshcfg" "shcfg" +${function:reload} = { . $PROFILE } +${function:pulldots} = { Set-Location -Path $DOTFILES && git pull } + +# Editors # +Set-Alias "v" "nvim" +Set-Alias "c" "code" +Set-Alias "gvi" "neovide" + +# File Creation # +function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname } +function tc { param ( [string] $filename) New-Item $filename && code $filename } +function tv { param ( [string] $filename) New-Item $filename && nvim $filename } +function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem } + +### Dev ### + +# .NET # +${function:csi} = { dotnet repl --default-kernel csharp} +${function:fsi} = { dotnet repl --default-kernel fsharp} + +# Python & Conda # +Set-Alias "py" "python" +Set-Alias "ipy" "ipython" +${function:pyact} = { conda activate $args[0] } +${function:pydact} = { conda deactivate } +${function:pylsenvs} = { conda env list } +${function:pymkenv} = { conda create --name $args[0] } ${function:pyrmenv} = { conda remove --name $args[0] --all } \ No newline at end of file diff --git a/powershell/Completions.ps1 b/powershell/Completions.ps1 new file mode 100644 index 0000000..2050048 --- /dev/null +++ b/powershell/Completions.ps1 @@ -0,0 +1,9 @@ +function Invoke-Completion { + param ([string]$command) + switch ($command) { + 'docker' { docker completion powershell | Out-String | Invoke-Expression } + 'git' { Import-Module Posh-Git } + 'hugo' { hugo completion powershell | Out-String | Invoke-Expression } + 'pip' { pip completion --powershell | Out-String | Invoke-Expression } + } +} diff --git a/powershell/Config.ps1 b/powershell/Config.ps1 index cf8f566..b095745 100644 --- a/powershell/Config.ps1 +++ b/powershell/Config.ps1 @@ -1,7 +1,7 @@ -# Use XDG Base Directory Specification and its similar structure for Windows - -# wget -${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args} - -# yarn v1 +# Use XDG Base Directory Specification and its similar structure for Windows + +# wget +${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args} + +# yarn v1 ${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args} \ No newline at end of file diff --git a/powershell/Keymap.ps1 b/powershell/Keymap.ps1 index 995d46e..f765339 100644 --- a/powershell/Keymap.ps1 +++ b/powershell/Keymap.ps1 @@ -1,25 +1,25 @@ -# aka PSReadLine -# PSReadLineOptions -Set-PSReadLineOption -EditMode Vi # Vi Keybindings -Set-PSReadLineOption -PredictionViewStyle ListView -Set-PSReadLineOption -PredictionSource HistoryAndPlugin -# Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " # Use Starship instead -# PSReadLineKeyHandlers -## Colemak hnei -Set-PSReadLineKeyHandler -Chord "n" -Function NextHistory -ViMode Command -Set-PSReadLineKeyHandler -Chord "e" -Function PreviousHistory -ViMode Command -Set-PSReadLineKeyHandler -Chord "i" -Function ViForwardChar -ViMode Command -## Similar position to [i] in QWERTY -Set-PSReadLineKeyHandler -Chord "l" -Function ViInsertMode -ViMode Command -Set-PSReadlineKeyHandler -Chord "L" -Function ViInsertAtBegining -ViMode Command -## Ne{[k]s}t -Set-PSReadLineKeyHandler -Chord "k" -Function RepeatSearch -ViMode Command -Set-PSReadLineKeyHandler -Chord "K" -Function RepeatSearchBackward -ViMode Command -## [j]ump -Set-PSReadLineKeyHandler -Chord "j" -Function NextWordEnd -ViMode Command -Set-PSReadLineKeyHandler -Chord "J" -Function ViEndOfGlob -ViMode Command -## Use N to Join -Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command -Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape -Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine +# aka PSReadLine +# PSReadLineOptions +Set-PSReadLineOption -EditMode Vi # Vi Keybindings +Set-PSReadLineOption -PredictionViewStyle ListView +Set-PSReadLineOption -PredictionSource HistoryAndPlugin +# Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " # Use Starship instead +# PSReadLineKeyHandlers +## Colemak hnei +Set-PSReadLineKeyHandler -Chord "n" -Function NextHistory -ViMode Command +Set-PSReadLineKeyHandler -Chord "e" -Function PreviousHistory -ViMode Command +Set-PSReadLineKeyHandler -Chord "i" -Function ViForwardChar -ViMode Command +## Similar position to [i] in QWERTY +Set-PSReadLineKeyHandler -Chord "l" -Function ViInsertMode -ViMode Command +Set-PSReadlineKeyHandler -Chord "L" -Function ViInsertAtBegining -ViMode Command +## Ne{[k]s}t +Set-PSReadLineKeyHandler -Chord "k" -Function RepeatSearch -ViMode Command +Set-PSReadLineKeyHandler -Chord "K" -Function RepeatSearchBackward -ViMode Command +## [j]ump +Set-PSReadLineKeyHandler -Chord "j" -Function NextWordEnd -ViMode Command +Set-PSReadLineKeyHandler -Chord "J" -Function ViEndOfGlob -ViMode Command +## Use N to Join +Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command +Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape +Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine \ No newline at end of file diff --git a/powershell/Modules.ps1 b/powershell/Modules.ps1 index 6e0fe0c..a0825a6 100644 --- a/powershell/Modules.ps1 +++ b/powershell/Modules.ps1 @@ -1,9 +1,9 @@ -Import-Module -Name Terminal-Icons -Import-Module -Name CompletionPredictor -if ($IsWindows) { - # Chocolatey - $ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" - if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" } - # WinGet - Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58 +Import-Module -Name Terminal-Icons +Import-Module -Name CompletionPredictor +if ($IsWindows) { + # Chocolatey + $ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" + if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" } + # WinGet + Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58 } \ No newline at end of file diff --git a/powershell/Navigation.ps1 b/powershell/Navigation.ps1 index 149cc31..c4f120a 100644 --- a/powershell/Navigation.ps1 +++ b/powershell/Navigation.ps1 @@ -1,15 +1,15 @@ -# ${function:~} = { Set-Location -Path ~ } cd is better -${function:...} = { Set-Location -Path ..\.. } -${function:....} = { Set-Location -Path ..\..\.. } -${function:.....} = { Set-Location -Path ..\..\..\.. } -${function:......} = { Set-Location -Path ..\..\..\..\.. } - -# Absolute navigation -${function:docs} = { Set-Location -Path ~/Documents } -${function:down} = { Set-Location -Path ~/Downloads } -${function:dt} = { Set-Location -Path ~/Desktop } -${function:mytmp} = { Set-Location -Path ~/Temp } -${function:one} = { Set-Location -Path ~/OneDrive } -${function:doku} = { Set-Location -Path ~/doku && Get-ChildItem } - +# ${function:~} = { Set-Location -Path ~ } cd is better +${function:...} = { Set-Location -Path ..\.. } +${function:....} = { Set-Location -Path ..\..\.. } +${function:.....} = { Set-Location -Path ..\..\..\.. } +${function:......} = { Set-Location -Path ..\..\..\..\.. } + +# Absolute navigation +${function:docs} = { Set-Location -Path ~/Documents } +${function:down} = { Set-Location -Path ~/Downloads } +${function:dt} = { Set-Location -Path ~/Desktop } +${function:mytmp} = { Set-Location -Path ~/Temp } +${function:one} = { Set-Location -Path ~/OneDrive } +${function:doku} = { Set-Location -Path ~/doku && Get-ChildItem } + Invoke-Expression (& { (zoxide init powershell | Out-String) }) \ No newline at end of file diff --git a/powershell/Prompt.ps1 b/powershell/Prompt.ps1 index 2933558..40806a3 100644 --- a/powershell/Prompt.ps1 +++ b/powershell/Prompt.ps1 @@ -1,92 +1,92 @@ -# Use starship to set prompt -$ENV:STARSHIP_CONFIG = "$DOTFILES/.config/starship/starship_pwsh.toml" - -Invoke-Expression (&starship init powershell) - -# Below is the backup of original prompt function -# $promptTime = $true -# # $promptWeather = $false - -# function prompt { -# $prompt = "`e[35m" -# # Time -# if ($promptTime) { -# $promptTime = Get-Date -Format HH:mm -# $prompt += "`[$promptTime]" -# } -# # UserInfo -# $prompt += " $Env:Username @ $Env:Userdomain" -# # Directory -# $promptCurrentDirectory = $(PWD).Path -# $promptCurrentDirectory = $promptCurrentDirectory.Replace("$HOME", "~") -# $prompt += "`e[0m in `e[33m$promptCurrentDirectory " -# # Git -# if ($(git rev-parse --is-inside-work-tree 2> $null) -eq "true") { -# $prompt += "`e[32m`u{e702} $(git branch --show-current)" -# } -# # Conda -# if ( $Env:CONDA_PROMPT_MODIFIER ) { -# $promptConda = $Env:CONDA_PROMPT_MODIFIER.Replace("`(","").Replace(")","") -# $pythonVersion = $(python --version).Split(" ")[1] -# $prompt += " `e[33m`u{e73c} $promptConda $pythonVersion" -# } -# # Programming Language (by Get-ChildItem) -# ## Python -# if (Test-Path -Path "$PWD\pyproject.toml") { -# $pythonVersion = $(python --version).Split(" ")[1] -# $prompt += " `e[33m`u{e73c} $pythonVersion" -# } -# ## Node.js -# if (Test-Path -Path "$PWD\package.json") { -# $nodeVersion = $(node --version) -# $prompt += " `e[32m`u{e3a0} $nodeVersion" -# # Locked -# if (Test-Path -Path "$PWD\yarn.lock" || Test-Path -Path "$PWD\package-lock.json") { -# $prompt += "`u{f023}" -# } -# } -# ## .NET -# ### C Sharp -# if (Test-Path -Path "$PWD\*.csproj") { -# $dotnetVersion = $(dotnet --version) -# $prompt += " `e[34m`u{e648} $dotnetVersion" -# } -# ### F Sharp -# if (Test-Path -Path "$PWD\*.fsproj") { -# $dotnetVersion = $(dotnet --version) -# $prompt += " `e[35m`u{e65a} $dotnetVersion" -# } -# ## Rust -# if (Test-Path -Path "$PWD\Cargo.toml") { -# $rustVersion = $(cargo --version).Split(" ")[1] -# $prompt += " `e[31m`u{e7a8} $rustVersion" -# } -# ## Java -# if (Test-Path -Path "$PWD\pom.xml" || Test-Path -Path "$PWD\build.gradle") { -# $javaVersion = $(java --version).Split(" ")[1] -# $prompt += " `e[31m`u{e738} $javaVersion" -# } -# ## Makefile -# if (Test-Path -Path "$PWD\Makefile") { -# $prompt += " `e[32m`u{e673}" -# } -# if (Test-Path -Path "$PWD\CMakeLists.txt") { -# $prompt += " `e[32m `u{e61d}" -# } -# # Docker -# if (Test-Path -Path "$PWD\Dockerfile" || Test-Path -Path "$PWD\docker-compose.yml") { -# $prompt += " `e[33m`u{f21f}" -# } -# # Weather -# # if ( $global:promptWeather ) { -# # $prompt += $(Write-WeatherCurrent -City "Edinburgh" -Country "UK" -Unit "metric" -Inline -Apikey $Env:WEATHER_API_KEY) -# # } -# # Error on last command -# ## TODO: Seems does not work -# if ($?) { -# $prompt += "`n`e[32m PS > `e[0m" -# } else { -# $prompt += "`n`e[31m PS > `e[0m" -# } -# return $prompt +# Use starship to set prompt +$ENV:STARSHIP_CONFIG = "$DOTFILES/.config/starship/starship_pwsh.toml" + +Invoke-Expression (&starship init powershell) + +# Below is the backup of original prompt function +# $promptTime = $true +# # $promptWeather = $false + +# function prompt { +# $prompt = "`e[35m" +# # Time +# if ($promptTime) { +# $promptTime = Get-Date -Format HH:mm +# $prompt += "`[$promptTime]" +# } +# # UserInfo +# $prompt += " $Env:Username @ $Env:Userdomain" +# # Directory +# $promptCurrentDirectory = $(PWD).Path +# $promptCurrentDirectory = $promptCurrentDirectory.Replace("$HOME", "~") +# $prompt += "`e[0m in `e[33m$promptCurrentDirectory " +# # Git +# if ($(git rev-parse --is-inside-work-tree 2> $null) -eq "true") { +# $prompt += "`e[32m`u{e702} $(git branch --show-current)" +# } +# # Conda +# if ( $Env:CONDA_PROMPT_MODIFIER ) { +# $promptConda = $Env:CONDA_PROMPT_MODIFIER.Replace("`(","").Replace(")","") +# $pythonVersion = $(python --version).Split(" ")[1] +# $prompt += " `e[33m`u{e73c} $promptConda $pythonVersion" +# } +# # Programming Language (by Get-ChildItem) +# ## Python +# if (Test-Path -Path "$PWD\pyproject.toml") { +# $pythonVersion = $(python --version).Split(" ")[1] +# $prompt += " `e[33m`u{e73c} $pythonVersion" +# } +# ## Node.js +# if (Test-Path -Path "$PWD\package.json") { +# $nodeVersion = $(node --version) +# $prompt += " `e[32m`u{e3a0} $nodeVersion" +# # Locked +# if (Test-Path -Path "$PWD\yarn.lock" || Test-Path -Path "$PWD\package-lock.json") { +# $prompt += "`u{f023}" +# } +# } +# ## .NET +# ### C Sharp +# if (Test-Path -Path "$PWD\*.csproj") { +# $dotnetVersion = $(dotnet --version) +# $prompt += " `e[34m`u{e648} $dotnetVersion" +# } +# ### F Sharp +# if (Test-Path -Path "$PWD\*.fsproj") { +# $dotnetVersion = $(dotnet --version) +# $prompt += " `e[35m`u{e65a} $dotnetVersion" +# } +# ## Rust +# if (Test-Path -Path "$PWD\Cargo.toml") { +# $rustVersion = $(cargo --version).Split(" ")[1] +# $prompt += " `e[31m`u{e7a8} $rustVersion" +# } +# ## Java +# if (Test-Path -Path "$PWD\pom.xml" || Test-Path -Path "$PWD\build.gradle") { +# $javaVersion = $(java --version).Split(" ")[1] +# $prompt += " `e[31m`u{e738} $javaVersion" +# } +# ## Makefile +# if (Test-Path -Path "$PWD\Makefile") { +# $prompt += " `e[32m`u{e673}" +# } +# if (Test-Path -Path "$PWD\CMakeLists.txt") { +# $prompt += " `e[32m `u{e61d}" +# } +# # Docker +# if (Test-Path -Path "$PWD\Dockerfile" || Test-Path -Path "$PWD\docker-compose.yml") { +# $prompt += " `e[33m`u{f21f}" +# } +# # Weather +# # if ( $global:promptWeather ) { +# # $prompt += $(Write-WeatherCurrent -City "Edinburgh" -Country "UK" -Unit "metric" -Inline -Apikey $Env:WEATHER_API_KEY) +# # } +# # Error on last command +# ## TODO: Seems does not work +# if ($?) { +# $prompt += "`n`e[32m PS > `e[0m" +# } else { +# $prompt += "`n`e[31m PS > `e[0m" +# } +# return $prompt # } \ No newline at end of file diff --git a/powershell/Scripts.ps1 b/powershell/Scripts.ps1 index 49f47f0..2878059 100644 --- a/powershell/Scripts.ps1 +++ b/powershell/Scripts.ps1 @@ -1,17 +1,17 @@ -function CsvToMarkdown { - param( [string]$csv) - $counter = 0 - $column = $csv.Split("`n")[0].Split(",").Length - $aHeader = " --- |" - $header = "|" + $aHeader * $column - $csv.replace(",", " | ").Split("`n") | ForEach-Object { - if ($counter -eq 0) { - Write-Output "| $_ |" - $counter++ - Write-Output $header - } - else { - Write-Output "| $_ |" - } - } +function CsvToMarkdown { + param( [string]$csv) + $counter = 0 + $column = $csv.Split("`n")[0].Split(",").Length + $aHeader = " --- |" + $header = "|" + $aHeader * $column + $csv.replace(",", " | ").Split("`n") | ForEach-Object { + if ($counter -eq 0) { + Write-Output "| $_ |" + $counter++ + Write-Output $header + } + else { + Write-Output "| $_ |" + } + } } \ No newline at end of file diff --git a/powershell/readme.md b/powershell/readme.md index ec682bd..2b31694 100644 --- a/powershell/readme.md +++ b/powershell/readme.md @@ -1,23 +1,23 @@ -# PowerShell Profile - -This is the cross-platform PowerShell profile for PowerShell Core - -```text -. -├── Aliases.ps1 -├── Keymap.ps1 # keymaps, optimize for Vi-Mode and Colemak -├── Modules.ps1 -├── Navigation.ps1 -├── Prompt.ps1 -├── readme.md -└── Scripts.ps1 - -1 directory, 7 files -``` - -| Keymap | Action | Mode | -| --- | --- | --- | -| `^a` | To Beginning of Line | All | -| `^e` | To End of Line | All | -| `^[` | To Normal Mode | Insert | - +# PowerShell Profile + +This is the cross-platform PowerShell profile for PowerShell Core + +```text +. +├── Aliases.ps1 +├── Keymap.ps1 # keymaps, optimize for Vi-Mode and Colemak +├── Modules.ps1 +├── Navigation.ps1 +├── Prompt.ps1 +├── readme.md +└── Scripts.ps1 + +1 directory, 7 files +``` + +| Keymap | Action | Mode | +| --- | --- | --- | +| `^a` | To Beginning of Line | All | +| `^e` | To End of Line | All | +| `^[` | To Normal Mode | Insert | + diff --git a/readme.md b/readme.md index 5cf4169..2475aca 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# .dotfiles - -Moving to *Colemak* - +# .dotfiles + +Moving to *Colemak* + diff --git a/setup/requirements.txt b/setup/requirements.txt new file mode 100644 index 0000000..2a0f048 --- /dev/null +++ b/setup/requirements.txt @@ -0,0 +1,19 @@ +# This file lists all the must-have libraries for installing a new computer +# For scripting use +# pip install -r requirements.txt +colorama +# Basic Mathemetics +numpy +matplotlib +# Data Analysis +pandas +# Image Processing +pillow +# Web Scraping +requests +beautifulsoup4 +# Testing +pytest +mypy +# Healthy Neovim +pynvim diff --git a/setup/set_symblink_unix.sh b/setup/set_symblink_unix.sh index c038b3e..b68006a 100644 --- a/setup/set_symblink_unix.sh +++ b/setup/set_symblink_unix.sh @@ -1,22 +1,22 @@ -#! /bin/sh -mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm -mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory -mkdir -p $WAKATIME_HOME -mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view -# $DOTFILES/.config -ln -sf $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc -ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config -ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc -ln -sf $DOTFILES/.config/markdownlint/.markdownlint.json $XDG_CONFIG_HOME/markdownlint/markdownlint.json -ln -sf $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG -ln -sf $DOTFILES/.config/NuGet/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config -ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim -ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf -ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf -ln -sf $DOTFILES/.config/vim/vimrc $XDG_CONFIG_HOME/vim/vimrc -ln -sf $DOTFILES/.config/zellij/config.kdl ~/.config/zellij/config.kdl -ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey -# $DOTFILES/vscode -ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode.vimrc -# $DOTFILES root +#! /bin/sh +mkdir -p $XDG_CONFIG_HOME/conda $XDG_CONFIG_HOME/git $XDG_CONFIG_HOME/ideavim $XDG_CONFIG_HOME/markdownlint $XDG_CONFIG_HOME/pip $XDG_CONFIG_HOME/neovide $XDG_CONFIG_HOME/powershell $XDG_CONFIG_HOME/vscode $XDG_CONFIG_HOME/NuGet $XDG_CONFIG_HOME/vim $XDG_CONFIG_HOME/tmux $XDG_CONFIG_HOME/npm +mkdir -p ~/.config/zellij # Not support XDG_CONFIG_HOME but same directory +mkdir -p $WAKATIME_HOME +mkdir -p $XDG_STATE_HOME/vim/undo $XDG_STATE_HOME/vim/backup $XDG_STATE_HOME/vim/swap $XDG_STATE_HOME/vim/view +# $DOTFILES/.config +ln -sf $DOTFILES/.config/conda/condarc.yaml $XDG_CONFIG_HOME/conda/.condarc +ln -sf $DOTFILES/.config/git/.gitconfig $XDG_CONFIG_HOME/git/config +ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc +ln -sf $DOTFILES/.config/markdownlint/.markdownlint.json $XDG_CONFIG_HOME/markdownlint/markdownlint.json +ln -sf $DOTFILES/.config/npm/npmrc $NPM_CONFIG_USERCONFIG +ln -sf $DOTFILES/.config/NuGet/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config +ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim +ln -sf $DOTFILES/.config/pip/pip.conf $XDG_CONFIG_HOME/pip/pip.conf +ln -sf $DOTFILES/.config/tmux/tmux.conf $XDG_CONFIG_HOME/tmux/tmux.conf +ln -sf $DOTFILES/.config/vim/vimrc $XDG_CONFIG_HOME/vim/vimrc +ln -sf $DOTFILES/.config/zellij/config.kdl ~/.config/zellij/config.kdl +ln -sf $DOTFILES/.config/lesskey $XDG_CONFIG_HOME/lesskey +# $DOTFILES/vscode +ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode.vimrc +# $DOTFILES root ln -sf $DOTFILES/.haskeline ~/.haskeline \ No newline at end of file diff --git a/setup/win_setup.ps1 b/setup/win_setup.ps1 index 8ae2e8d..e7f1177 100644 --- a/setup/win_setup.ps1 +++ b/setup/win_setup.ps1 @@ -16,7 +16,9 @@ Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression # Set Environment Variables # Use %PATH_EXT% to prevent PATH from being too long [System.Environment]::SetEnvironmentVariable("Path_EXT_0", "D:\bin", "User") -[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_0", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_1", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") +[System.Environment]::SetEnvironmentVariable("Path_EXT_2", "C:\Users\citoy\AppData\Local\Cargo\bin", "User") [System.Environment]::SetEnvironmentVariable("Path_EXT_2", "", "User") $currentPath = [System.Environment]::GetEnvironmentVariable("Path", "User") if ($currentPath -notlike "*%PATH_EXT%*") { @@ -59,7 +61,7 @@ New-Item -ItemType Directory -Path "$Env:AppData\aws" -Force # ~\.dotnet -> %LocalAppData%\dotNET :: .NET Core [System.Environment]::SetEnvironmentVariable("DOTNET_CLI_HOME", "$Env:LocalAppData\dotNET", "User") # ~\.emacs.d -> %AppData%\.emacs.d :: Emacs (This is default) -# [System.Environment]::SetEnvironmentVariable("EMACS_HOME", "$Env:AppData\emacs.d", "User") +# [System.Environment]::SetEnvironmentVariable("EMACS_HOME", "$Env:AppData\emacs.d", "User") # ~\go -> %LocalAppData%\GO :: golang [System.Environment]::SetEnvironmentVariable("GOPATH", "$Env:LocalAppData\GO", "User") # ~\.ipython -> %AppData%\ipython :: IPython @@ -125,14 +127,14 @@ New-Item -ItemType SymbolicLink -Path "$Env:XDG_CONFIG_HOME\Vim\_vimrc" -Target New-Item -ItemType SymbolicLink -Path "~\.wslconfig" -Target "$DOTFILES\win\.wslconfig" -Force New-Item -ItemType SymbolicLink -Path "$Env:AppData\neovide\config.toml" -Target "$DOTFILES\win\neovide.toml" -Force # New-Item -ItemType SymbolicLink -Path "~\.vscode.vimrc" -Target "$DOTFILES\vscode\vscode.vimrc" Use Absolute Path -# Hide dotfiles -Get-ChildItem -Force -Filter .* -Path $HOME | ForEach-Object { $_.Attributes += "Hidden" } +# Hide dotfiles +Get-ChildItem -Force -Filter .* -Path $HOME | ForEach-Object { $_.Attributes += "Hidden" } @( Join-Path $HOME '.config' Join-Path $HOME '.dotfiles' -) | ForEach-Object { +) | ForEach-Object { $_.Attributes -band -bnot [System.IO.FileAttributes]::Hidden -} +} Set-Location $HOME\Documents # Match WindowsPowerShell and PowerShell Get-ChildItem -Force -Filter *owerShell | ForEach-Object { $_.Attributes += "Hidden" } @@ -167,9 +169,12 @@ scoop install main/ripgrep scoop install main/wget scoop install main/wget2 scoop install main/cmake -scoop install main/bat -scoop install main/zoxide -scoop install main/dos2unix +scoop install main/bat # modern cat +scoop install main/zoxide # Directory Jump +scoop install main/dos2unix # Convert line endings +scoop install main/hyperfine # Benchmark +scoop install main/bottom # System Monitor +scoop install main/delta # diff # File Management scoop install extras/everything @@ -207,7 +212,7 @@ scoop install keyguard/keyguard # PKM scoop install extras/obsidian -winget install -e --id 9P7HPMXP73K4 # Siyuan +winget install -e --id 9P7HPMXP73K4 # Siyuan scoop install extras/typora scoop install extras/zotero scoop install extras/anki @@ -215,7 +220,7 @@ scoop install extras/anki # Browser # Use Microsoft Edge directly -# winget install -e --id TheBrowserCompany.Arc +# winget install -e --id TheBrowserCompany.Arc # winget install -e --id Mozilla.Firefox.Nightly # Not working # Programming Languages @@ -223,7 +228,7 @@ winget install -e --id Python.Python.3.13 winget install -e --id Anaconda.Miniconda3 winget install -e --id OpenJS.NodeJS winget install -e --id Rustlang.Rustup -winget install -e --id Microsoft.DotNet.SDK.8 +winget install -e --id Microsoft.DotNet.SDK.9 # Dev scoop install extras/docker @@ -260,4 +265,4 @@ scoop install LXGWWenKaiMono # 霞鹜文楷Mono # WSL scoop install archwsl -wsl --set-version Arch 1 \ No newline at end of file +wsl --set-version Arch 1 diff --git a/vscode/hsnips/c.hsnips b/vscode/hsnips/c.hsnips index 92652ae..68b2008 100644 --- a/vscode/hsnips/c.hsnips +++ b/vscode/hsnips/c.hsnips @@ -1,15 +1,15 @@ -snippet hio "include stdio.h" iA -#include -endsnippet - -snippet hlib "include stdlib.h" iA -#include -endsnippet - -snippet hmath "include math.h" iA -#include -endsnippet - -snippet hstr "include string.h" iA -#include +snippet hio "include stdio.h" iA +#include +endsnippet + +snippet hlib "include stdlib.h" iA +#include +endsnippet + +snippet hmath "include math.h" iA +#include +endsnippet + +snippet hstr "include string.h" iA +#include endsnippet \ No newline at end of file diff --git a/vscode/hsnips/latex.hsnips b/vscode/hsnips/latex.hsnips index d610c84..7c82b39 100644 --- a/vscode/hsnips/latex.hsnips +++ b/vscode/hsnips/latex.hsnips @@ -1,1038 +1,1038 @@ -global -// JavaScript code -function gen_matrix(nrow, ncol) { - let results = ""; - let order = 1; - for (var i=0; i < nrow; i++){ - results += ' '; - for(var j = 0; j < ncol - 1; j++){ - results += "$" + (order).toString() + " & "; - order ++; - } - results += "$" + (order).toString() + " \\\\" + "\\"; - order ++; - } - return results; -} - -function gen_matrix_transposed(nrow, ncol) { - let results = ""; - for (var i = 0; i < nrow; i++){ - results += ' '; - var j = 0; - for(; j < ncol - 1;j++){ - results += "$" + (i + j * ncol + 1).toString() + " & "; - } - results += "$" + (i + j * ncol + 1).toString() + " \\\\" + "\\"; - } - return results; -} - -function tes_matrix(nrow, ncol,t) { - let results = ""; - let order = 1; - for (var i=0; i 1 ){ - results += "${" +(order ).toString() + ":" + t[order-2] + "}\t & "; - } - else{ - results += "$" +(order ).toString() + " & "; - } - order ++; - } - results += "$"+(order).toString() +" \\\\" + "\\ "; - order ++; - } - return results; -} - -// 输出一个表格 -function createTable(rows, cols) { - let ret = ""; - let order = 1; - for (let i = 0; i < parseInt(rows) + 2; i++) { - for (let j = 0; j < parseInt(cols); j++) { - if (i === 1) { - ret += "|---"; - } else { - ret += "| $" + (order).toString() + " "; - order++; - } - } - ret += "|\n" - } - return ret; -} - -endglobal - -snippet example "Example" i -\documentclass{article} -\usepackage{amsmath} -\usepackage{amssymb} - -\begin{document} -\title{${1:title}} -\author{Peikun Yang} -\date{\today} -\maketitle -$0 -\end{document} -endsnippet - -# == Fraction Match == - - -snippet // "Fraction" iAm -\\frac{${1:${VISUAL}}}{$2}$0 -endsnippet - -snippet `((\d+)|(\d*)(\\)?([A-Za-z!]+)((\^|_)(\{\d+\}|\d))*)/` "Fraction no ()" iAm -\frac{``rv = m[1]``}{$1}$0 -endsnippet - -priority 200 -snippet `(?<=\s)(\\mu|\\alpha|\\sigma|\\rho|\\beta|\\gamma|\\delta|\\zeta|\\eta|\\varepsilon|\\theta|\\iota|\\kappa|\\vartheta|\\lambda|\\nu|\\pi|\\rho|\\tau|\\upsilon|\\phi|\\chi|\\psi|\\omega|\\Gamma|\\Delta|\\Theta|\\Lambda|\\Xi|\\Pi|\\Sigma|\\Upsilon|\\Phi|\\Psi|\\Omega|[A-Za-z]{1,2})?(_[A-Za-z0-9]|_\{[^}]+\})?(\^[A-Za-z0-9]|\^\{[^}]+\})?(_[A-Za-z0-9]|_\{[^}]+\})?(\([^)]+\))(_[A-Za-z0-9]|_\{[^}]+\})?(\^[A-Za-z0-9]|\^\{[^}]+\})?(_[A-Za-z0-9]|_\{[^}]+\})?\/` "Fraction with ()" iAm -``rv = "\\frac{" + m.slice(1, m.length).join('') + "}{$1}$2"`` -endsnippet - -# == Hat Operation == - -# ==== Auto Capture Hat Operation ==== -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hbar|BAR)` "Bar" iAm -\overline{``rv = m[1] + m[2] + m[3]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(htd|TD)` "tilde" iAm -\tilde{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)bar` "bar" iAm -\bar{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hat|HAT)` "hat" iAm -\hat{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hvec)` "Vector postfix" iAm -\vec{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(rta)` "Vector postfix" iAm -\overrightarrow{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(dot)` "dot" iAm -\dot{``rv = m[1]``} -endsnippet - -priority 1000 -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hdd)` "ddot" iAm -\ddot{``rv = m[1]``} -endsnippet - -# ===== Static Hat Operation ==== - -snippet hbar "bar" iAm -\overline{$1}$0 -endsnippet - -snippet hat "hat" iAm -\hat{$1}$0 -endsnippet - -snippet sq "\sqrt{}" iAm -\sqrt{${1}}$0 -endsnippet - -priority 10000 -snippet psq "\sqrt[]{}" iAm -\sqrt[${2}]{${1}} -endsnippet - -# == Superscript Operation == - -snippet invs "inverse" iAm -^{-1} -endsnippet - -snippet dig "digree" iAm -^{\circ} -endsnippet - -priority 10000 -snippet TR "inverse" iAm -^{\mathsf{T}} -endsnippet - -snippet CL "complement" iAm -^{c} -endsnippet - -snippet R+ "R0+" iAm -R_0^+ -endsnippet - -snippet pow "power" iAm -^{${1:n}} -endsnippet - -snippet tp "to the ... power" iAm -^{${1:2}}$0 -endsnippet - -snippet sr "square" iAm -^{2}$0 -endsnippet - -snippet cb "cube" iAm -^{3}$0 -endsnippet - -# == Subscript Operation == - -snippet td "subscript" iAm -_{${1}}$0 -endsnippet - -snippet sb "subscript" iAm -_{${0}} -endsnippet - -snippet `(})(\d)\2` "auto subscript" iAm -`` rv = m[1] + "_" + m[2]`` -endsnippet - -snippet `([A-Za-z])(\d)` "auto subscript" iAm -`` rv = m[1] + "_" + m[2]`` -endsnippet - -priority 100 -snippet `([A-Za-z])_(\d{2})` "auto subscript" iAm -`` rv = m[1] + "_{" + m[2] + "}$0" `` -endsnippet - -priority 100 -snippet `([A-Za-z])S(\d)` "auto subscript" iAm -`` rv = m[1] + "_{" + m[2] + "$1}$2"`` -endsnippet - -snippet `\b(? "${1:_}" + d + "${2:, }").join('');``\cdots${3:${2:, }${1:_}n} -endsnippet - -snippet `(\d\d+),` "0, 1, 2" iAm -``rv = m[1].split('').map((d) => "${1:_}" + d).join("${2:, }");`` -endsnippet - -snippet <> "hokje" iA -\diamond -endsnippet - -# +... -> , \cdots -# - ... -> , \cdots -# add a space if there already is one. -priority 101 -snippet `(?<=[-+])\s*\.\.\.` "smart cdots" imA - \cdots -endsnippet - -# It seems that \ldots is only used when , ..., -# ,... -> , \ldots -# , ... -> , \ldots -priority 101 -snippet `(?<=,)(\s*)\.\.\.` "smart ldots" imA - \ldots -endsnippet - -snippet ** "dot multiply" iAm -\cdot -endsnippet - -snippet +- "pm" iAm -\pm -endsnippet - -snippet -+ "mp" iAm -\mp -endsnippet - -snippet odot "odot" iAm -\odot -endsnippet - -priority 101 -snippet xx "cross" iAm -\times -endsnippet - -snippet eps "epsilon" iAm -\epsilon -endsnippet - -priority 100 -snippet veps "varepsilon" iAm -\varepsilon -endsnippet - -priority 100 -snippet ell "ell" iAm -\ell -endsnippet - -priority 100 -snippet log "log" iAm -\log -endsnippet - -snippet bin "binom" iAm -\binom{$1}{$2} -endsnippet - -snippet oth "otherwise" iAm -\text{otherwise} -endsnippet - -snippet star "star" iAm -^{*} -endsnippet - -snippet `(? "to" iAm -\to -endsnippet - -snippet !> "mapsto" iAm -\mapsto -endsnippet - -snippet => "implies" iAm -\implies -endsnippet - -snippet =< "implied by" iAm -\impliedby -endsnippet - -priority 200 -snippet iff "if and only if" iAm -\iff -endsnippet - -snippet EE "exist" iAm -\exists -endsnippet - -snippet AA "forall" iAm -\forall -endsnippet - -snippet bec "because" iAm -\because -endsnippet - -snippet thr "therefore" iAm -\therefore -endsnippet - - -# ==== Possibility Symbol ==== - -snippet Pr "Pr" iAm -\operatorname{Pr} -endsnippet - -snippet Var "Var" iAm -\operatorname{Var} -endsnippet - -snippet Cov "Cov" iAm -\operatorname{Cov} -endsnippet - -snippet Exp "Expected" iAm -\mathbb{E} -endsnippet - - -# ==== Compare Symbol ==== - -snippet -- "setminus" iAm -\setminus -endsnippet - -snippet >= "greater than" iAm -\ge $0 -endsnippet - -snippet dis "displaystyle" iAm -\displaystyle -endsnippet - -snippet <= "less than" iAm -\le $0 -endsnippet - -snippet != "no equals" iAm -\neq -endsnippet - -snippet == " constan equals" iAm -\equiv -endsnippet - -snippet sim "sim" iAm -\sim -endsnippet - -snippet `\\sim eq` "simeq" iAm -\simeq -endsnippet - -snippet ~~ " Amppro equals" iAm -\approx -endsnippet - -snippet ~= " Amppro equals2" iAm -\cong -endsnippet - -snippet >> ">>" iAm -\gg -endsnippet - - -snippet << "<<" iAm -\ll -endsnippet - - -# == Auto Environment == - -# ==== Auto Math Mode ==== - -snippet mk "inline Math" wA -\(${1}\)$0 -endsnippet - -snippet dm "display Math" w -\[ -${1} -\] -endsnippet - -snippet dmi "display Math" wA -\[$1\]$0 -endsnippet - -snippet eqt "equation" wA -\begin{equation} - ${1} -\end{equation} -endsnippet - -snippet eqs "equation*" wA -\begin{equation*} - ${1} -\end{equation*} -endsnippet - -# ==== Common Environment ==== - -# snippet case "cases" iAm -# \begin{cases} $1, & $2 \\\\ $3, & $4 \end{cases} -# endsnippet - -snippet ali "aligned" iAm -\begin{aligned} -$1 \\\\ -\end{aligned} -endsnippet - -# == Auto Adaptive Close == - -snippet ceil "ceil" iAm -\left\lceil $1 \right\rceil $0 -endsnippet - -snippet floor "floor" iAm -\left\lfloor $1 \right\rfloor$0 -endsnippet - -priority 100 -snippet @) "left( right)" Aim -\left( ${1} \right) $0 -endsnippet - -priority 100 -snippet @| "left| right|" Aim -\left| ${1} \right| $0 -endsnippet - -priority 100 -snippet @\ "left. right|" Aim -\left. ${1} \right|_{${2}}$0 -endsnippet - -priority 100 -snippet @} "left\{ right\}" Aim -\left\\{ ${1} \right\\} $0 -endsnippet - -priority 100 -snippet set "\{ \}" Aim -\\{ ${1} \\}$0 -endsnippet - -priority 100 -snippet @] "left[ right]" Aim -\left[ ${1} \right] $0 -endsnippet - -priority 100 -snippet @> "leftangle rightangle" iAm -\left<${1} \right>$0 -endsnippet - -priority 200 - -# == Snippet == - -# ==== General Snippet ==== - -# ====== Lite Snippet ====== - -snippet tag "tag" iAm -\tag{$1} -endsnippet - -snippet xyb "Auto (x, y)" iAm -(x, y) -endsnippet - -snippet xyzb "Auto (x, y ,z)" iAm -(x, y, z) -endsnippet - -priority 100 -snippet `\b([a-zA-Z])n(\d)` "x[n+1]" iAm -``rv = m[1]``_{${1:n}+``rv = m[2]``}$0 -endsnippet - -# Unkown -snippet rij "mrij" iAm -(${1:x}_${2:n})_{${3:$2} \\in ${4:N}}$0 -endsnippet - -priority 200 -snippet abs "absolute value" iAm -\left\vert ${1} \right\vert $0 -endsnippet - -snippet beg "begin{} / end{}" bA -\\begin{$1} - $0 -\\end{$1} -endsnippet - -# ======== N Series ======== - -priority 100 -snippet comma "comma" iAm -${1:\\alpha}_1,${1:\\alpha}_2,\\cdots,${1:\\alpha}_${2:n} -endsnippet - -priority 100 -snippet plus "plus" iAm -${1:k}_1${2:\\alpha}_1+${1:k}_2${2:\\alpha}_2+\\cdots+${1:k}_${3:n}${2:\\alpha}_${3:n} -endsnippet - -snippet `\b([ijk])=n` "i=1,2,\cdots,n" iAm -``rv = m[1]``=1,2,\cdots,n -endsnippet - -# ======== Common Operator Snippet ======== - -snippet taylor "taylor" iAm -\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0 -endsnippet - -snippet `(?= 2) || (b != 1 && !isO && isL)) ? "\\limits" : ""; -let r = (b == 3) ? "E" : (b == 1 && (isL || isO)) ? "C" : "R"; -final += ((b >= 2) || isO || (b == 1 && isL)) ? "_{${1:" + r + "}}" : "_{${1:-\\infty}}^{${2:\\infty}}"; -let x = (b == 2) ? "A" : (b == 3) ? "V" : (b == 1 && isL) ? "s" : "x"; -final += " ${3} \\mathrm{d}${4:" + x + "}$0"; -rv = final; -`` -endsnippet - -# Custom: Can add more defined operator -priority 100 -snippet `(? 0} \\\\ -\end{aligned} -endsnippet - -priority 300 -snippet Argmax "Optimization problem" iAm -\begin{aligned} -\argmax_{${1:\beta}} -&\quad ${2:f(x)} \\\\ -\text{s.t.} -&\quad ${3:g(x) > 0} \\\\ -\end{aligned} -endsnippet - -snippet deff "Definition of function" iAm -$1\colon ${2:\\mathbb{R\}} \to ${3:\\mathbb{R\}}, ${4:x} \mapsto $0 -endsnippet - - -snippet iid "independent and identical distribution" iAm -\overset{\text{i.i.d.}}{\sim} -endsnippet - -snippet defe "define equal" iAm -\overset{\underset{\mathrm{def}}{}}{=} -endsnippet - -snippet deft "define triangleq" iAm -\triangleq -endsnippet - - -# == Matrix == - -# ==== Static Matrix ==== - -snippet pmat "pmat" wm -\begin{pmatrix} - ${1: } -\end{pmatrix} $0 -endsnippet - -snippet bmat "pmat" wm -\begin{bmatrix} - $1 -\end{bmatrix} $0 -endsnippet - -snippet vecC "column vector" iAm -\begin{bmatrix} ${1:x}_1 \\\\ ${1:x}_2 \\\\ \vdots \\\\ ${1:x}_${2:n} \end{bmatrix} -endsnippet - -snippet vecR "row vector" iAm -\begin{bmatrix} ${1:x}_1, ${1:x}_2, \cdots, ${1:x}_${2:n} \end{bmatrix}$0 -endsnippet - -priority 300 -snippet omis "omission" iAm -\\begin{bmatrix}${1:1}&${2:1}&\\cdots&${4:1}\\\\${5:1}&${6:1}&\\cdots&${8:1}\\\\\\vdots&\\vdots&\\ddots&\\vdots\\\\${13:1}&${14:1}&\\cdots&${16:1}\\end{bmatrix} -endsnippet - -priority 300 -snippet submat "omission" iAm -\\begin{bmatrix} - ${1:a}_{11} & ${1:a}_{12} & \\cdots & ${1:a}_{1n} \\\\ - ${1:a}_{21} & ${1:a}_{22} & \\cdots & ${1:a}_{2n} \\\\ - \\vdots & \\vdots & \\ddots & \\vdots \\\\ - ${1:a}_{n1} & ${1:a}_{n2} & \\cdots & ${1:a}_{nn} -\\end{bmatrix} -endsnippet - -priority 300 -snippet subplusmat "omission" iAm -\\begin{bmatrix} - ${1:a}_{11}+${2:b}_{11} & ${1:a}_{12}+${2:b}_{12} & \\cdots & ${1:a}_{1n}+${2:b}_{1n} \\\\ - ${1:a}_{21}+${2:b}_{21} & ${1:a}_{22}+${2:b}_{22} & \\cdots & ${1:a}_{2n}+${2:b}_{2n} \\\\ - \\vdots & \\vdots & \\ddots & \\vdots \\\\ - ${1:a}_{n1}+${2:b}_{n1} & ${1:a}_{n2}+${2:b}_{n2} & \\cdots & ${1:a}_{nn}+${2:b}_{nn} -\\end{bmatrix} -endsnippet - -snippet jacobi "jacobi" iAm -\\begin{bmatrix}\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_${3:n}}\\\\\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_${3:n}}\\\\\\vdots&\\vdots&\\ddots&\\vdots\\\\\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_${3:n}}\\end{bmatrix} -endsnippet - -# ==== Dynamic Matrix ==== - -priority 300 -snippet `(b|p|v)mata([1-9])` "bmatrix" iiAm -\\begin{``rv = m[1]``matrix}`` - let len = m[2]; - let results = ""; - for (var i=0; i 1 ){ + results += "${" +(order ).toString() + ":" + t[order-2] + "}\t & "; + } + else{ + results += "$" +(order ).toString() + " & "; + } + order ++; + } + results += "$"+(order).toString() +" \\\\" + "\\ "; + order ++; + } + return results; +} + +// 输出一个表格 +function createTable(rows, cols) { + let ret = ""; + let order = 1; + for (let i = 0; i < parseInt(rows) + 2; i++) { + for (let j = 0; j < parseInt(cols); j++) { + if (i === 1) { + ret += "|---"; + } else { + ret += "| $" + (order).toString() + " "; + order++; + } + } + ret += "|\n" + } + return ret; +} + +endglobal + +snippet example "Example" i +\documentclass{article} +\usepackage{amsmath} +\usepackage{amssymb} + +\begin{document} +\title{${1:title}} +\author{Peikun Yang} +\date{\today} +\maketitle +$0 +\end{document} +endsnippet + +# == Fraction Match == + + +snippet // "Fraction" iAm +\\frac{${1:${VISUAL}}}{$2}$0 +endsnippet + +snippet `((\d+)|(\d*)(\\)?([A-Za-z!]+)((\^|_)(\{\d+\}|\d))*)/` "Fraction no ()" iAm +\frac{``rv = m[1]``}{$1}$0 +endsnippet + +priority 200 +snippet `(?<=\s)(\\mu|\\alpha|\\sigma|\\rho|\\beta|\\gamma|\\delta|\\zeta|\\eta|\\varepsilon|\\theta|\\iota|\\kappa|\\vartheta|\\lambda|\\nu|\\pi|\\rho|\\tau|\\upsilon|\\phi|\\chi|\\psi|\\omega|\\Gamma|\\Delta|\\Theta|\\Lambda|\\Xi|\\Pi|\\Sigma|\\Upsilon|\\Phi|\\Psi|\\Omega|[A-Za-z]{1,2})?(_[A-Za-z0-9]|_\{[^}]+\})?(\^[A-Za-z0-9]|\^\{[^}]+\})?(_[A-Za-z0-9]|_\{[^}]+\})?(\([^)]+\))(_[A-Za-z0-9]|_\{[^}]+\})?(\^[A-Za-z0-9]|\^\{[^}]+\})?(_[A-Za-z0-9]|_\{[^}]+\})?\/` "Fraction with ()" iAm +``rv = "\\frac{" + m.slice(1, m.length).join('') + "}{$1}$2"`` +endsnippet + +# == Hat Operation == + +# ==== Auto Capture Hat Operation ==== +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hbar|BAR)` "Bar" iAm +\overline{``rv = m[1] + m[2] + m[3]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(htd|TD)` "tilde" iAm +\tilde{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)bar` "bar" iAm +\bar{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hat|HAT)` "hat" iAm +\hat{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hvec)` "Vector postfix" iAm +\vec{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(rta)` "Vector postfix" iAm +\overrightarrow{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(dot)` "dot" iAm +\dot{``rv = m[1]``} +endsnippet + +priority 1000 +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hdd)` "ddot" iAm +\ddot{``rv = m[1]``} +endsnippet + +# ===== Static Hat Operation ==== + +snippet hbar "bar" iAm +\overline{$1}$0 +endsnippet + +snippet hat "hat" iAm +\hat{$1}$0 +endsnippet + +snippet sq "\sqrt{}" iAm +\sqrt{${1}}$0 +endsnippet + +priority 10000 +snippet psq "\sqrt[]{}" iAm +\sqrt[${2}]{${1}} +endsnippet + +# == Superscript Operation == + +snippet invs "inverse" iAm +^{-1} +endsnippet + +snippet dig "digree" iAm +^{\circ} +endsnippet + +priority 10000 +snippet TR "inverse" iAm +^{\mathsf{T}} +endsnippet + +snippet CL "complement" iAm +^{c} +endsnippet + +snippet R+ "R0+" iAm +R_0^+ +endsnippet + +snippet pow "power" iAm +^{${1:n}} +endsnippet + +snippet tp "to the ... power" iAm +^{${1:2}}$0 +endsnippet + +snippet sr "square" iAm +^{2}$0 +endsnippet + +snippet cb "cube" iAm +^{3}$0 +endsnippet + +# == Subscript Operation == + +snippet td "subscript" iAm +_{${1}}$0 +endsnippet + +snippet sb "subscript" iAm +_{${0}} +endsnippet + +snippet `(})(\d)\2` "auto subscript" iAm +`` rv = m[1] + "_" + m[2]`` +endsnippet + +snippet `([A-Za-z])(\d)` "auto subscript" iAm +`` rv = m[1] + "_" + m[2]`` +endsnippet + +priority 100 +snippet `([A-Za-z])_(\d{2})` "auto subscript" iAm +`` rv = m[1] + "_{" + m[2] + "}$0" `` +endsnippet + +priority 100 +snippet `([A-Za-z])S(\d)` "auto subscript" iAm +`` rv = m[1] + "_{" + m[2] + "$1}$2"`` +endsnippet + +snippet `\b(? "${1:_}" + d + "${2:, }").join('');``\cdots${3:${2:, }${1:_}n} +endsnippet + +snippet `(\d\d+),` "0, 1, 2" iAm +``rv = m[1].split('').map((d) => "${1:_}" + d).join("${2:, }");`` +endsnippet + +snippet <> "hokje" iA +\diamond +endsnippet + +# +... -> , \cdots +# - ... -> , \cdots +# add a space if there already is one. +priority 101 +snippet `(?<=[-+])\s*\.\.\.` "smart cdots" imA + \cdots +endsnippet + +# It seems that \ldots is only used when , ..., +# ,... -> , \ldots +# , ... -> , \ldots +priority 101 +snippet `(?<=,)(\s*)\.\.\.` "smart ldots" imA + \ldots +endsnippet + +snippet ** "dot multiply" iAm +\cdot +endsnippet + +snippet +- "pm" iAm +\pm +endsnippet + +snippet -+ "mp" iAm +\mp +endsnippet + +snippet odot "odot" iAm +\odot +endsnippet + +priority 101 +snippet xx "cross" iAm +\times +endsnippet + +snippet eps "epsilon" iAm +\epsilon +endsnippet + +priority 100 +snippet veps "varepsilon" iAm +\varepsilon +endsnippet + +priority 100 +snippet ell "ell" iAm +\ell +endsnippet + +priority 100 +snippet log "log" iAm +\log +endsnippet + +snippet bin "binom" iAm +\binom{$1}{$2} +endsnippet + +snippet oth "otherwise" iAm +\text{otherwise} +endsnippet + +snippet star "star" iAm +^{*} +endsnippet + +snippet `(? "to" iAm +\to +endsnippet + +snippet !> "mapsto" iAm +\mapsto +endsnippet + +snippet => "implies" iAm +\implies +endsnippet + +snippet =< "implied by" iAm +\impliedby +endsnippet + +priority 200 +snippet iff "if and only if" iAm +\iff +endsnippet + +snippet EE "exist" iAm +\exists +endsnippet + +snippet AA "forall" iAm +\forall +endsnippet + +snippet bec "because" iAm +\because +endsnippet + +snippet thr "therefore" iAm +\therefore +endsnippet + + +# ==== Possibility Symbol ==== + +snippet Pr "Pr" iAm +\operatorname{Pr} +endsnippet + +snippet Var "Var" iAm +\operatorname{Var} +endsnippet + +snippet Cov "Cov" iAm +\operatorname{Cov} +endsnippet + +snippet Exp "Expected" iAm +\mathbb{E} +endsnippet + + +# ==== Compare Symbol ==== + +snippet -- "setminus" iAm +\setminus +endsnippet + +snippet >= "greater than" iAm +\ge $0 +endsnippet + +snippet dis "displaystyle" iAm +\displaystyle +endsnippet + +snippet <= "less than" iAm +\le $0 +endsnippet + +snippet != "no equals" iAm +\neq +endsnippet + +snippet == " constan equals" iAm +\equiv +endsnippet + +snippet sim "sim" iAm +\sim +endsnippet + +snippet `\\sim eq` "simeq" iAm +\simeq +endsnippet + +snippet ~~ " Amppro equals" iAm +\approx +endsnippet + +snippet ~= " Amppro equals2" iAm +\cong +endsnippet + +snippet >> ">>" iAm +\gg +endsnippet + + +snippet << "<<" iAm +\ll +endsnippet + + +# == Auto Environment == + +# ==== Auto Math Mode ==== + +snippet mk "inline Math" wA +\(${1}\)$0 +endsnippet + +snippet dm "display Math" w +\[ +${1} +\] +endsnippet + +snippet dmi "display Math" wA +\[$1\]$0 +endsnippet + +snippet eqt "equation" wA +\begin{equation} + ${1} +\end{equation} +endsnippet + +snippet eqs "equation*" wA +\begin{equation*} + ${1} +\end{equation*} +endsnippet + +# ==== Common Environment ==== + +# snippet case "cases" iAm +# \begin{cases} $1, & $2 \\\\ $3, & $4 \end{cases} +# endsnippet + +snippet ali "aligned" iAm +\begin{aligned} +$1 \\\\ +\end{aligned} +endsnippet + +# == Auto Adaptive Close == + +snippet ceil "ceil" iAm +\left\lceil $1 \right\rceil $0 +endsnippet + +snippet floor "floor" iAm +\left\lfloor $1 \right\rfloor$0 +endsnippet + +priority 100 +snippet @) "left( right)" Aim +\left( ${1} \right) $0 +endsnippet + +priority 100 +snippet @| "left| right|" Aim +\left| ${1} \right| $0 +endsnippet + +priority 100 +snippet @\ "left. right|" Aim +\left. ${1} \right|_{${2}}$0 +endsnippet + +priority 100 +snippet @} "left\{ right\}" Aim +\left\\{ ${1} \right\\} $0 +endsnippet + +priority 100 +snippet set "\{ \}" Aim +\\{ ${1} \\}$0 +endsnippet + +priority 100 +snippet @] "left[ right]" Aim +\left[ ${1} \right] $0 +endsnippet + +priority 100 +snippet @> "leftangle rightangle" iAm +\left<${1} \right>$0 +endsnippet + +priority 200 + +# == Snippet == + +# ==== General Snippet ==== + +# ====== Lite Snippet ====== + +snippet tag "tag" iAm +\tag{$1} +endsnippet + +snippet xyb "Auto (x, y)" iAm +(x, y) +endsnippet + +snippet xyzb "Auto (x, y ,z)" iAm +(x, y, z) +endsnippet + +priority 100 +snippet `\b([a-zA-Z])n(\d)` "x[n+1]" iAm +``rv = m[1]``_{${1:n}+``rv = m[2]``}$0 +endsnippet + +# Unkown +snippet rij "mrij" iAm +(${1:x}_${2:n})_{${3:$2} \\in ${4:N}}$0 +endsnippet + +priority 200 +snippet abs "absolute value" iAm +\left\vert ${1} \right\vert $0 +endsnippet + +snippet beg "begin{} / end{}" bA +\\begin{$1} + $0 +\\end{$1} +endsnippet + +# ======== N Series ======== + +priority 100 +snippet comma "comma" iAm +${1:\\alpha}_1,${1:\\alpha}_2,\\cdots,${1:\\alpha}_${2:n} +endsnippet + +priority 100 +snippet plus "plus" iAm +${1:k}_1${2:\\alpha}_1+${1:k}_2${2:\\alpha}_2+\\cdots+${1:k}_${3:n}${2:\\alpha}_${3:n} +endsnippet + +snippet `\b([ijk])=n` "i=1,2,\cdots,n" iAm +``rv = m[1]``=1,2,\cdots,n +endsnippet + +# ======== Common Operator Snippet ======== + +snippet taylor "taylor" iAm +\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0 +endsnippet + +snippet `(?= 2) || (b != 1 && !isO && isL)) ? "\\limits" : ""; +let r = (b == 3) ? "E" : (b == 1 && (isL || isO)) ? "C" : "R"; +final += ((b >= 2) || isO || (b == 1 && isL)) ? "_{${1:" + r + "}}" : "_{${1:-\\infty}}^{${2:\\infty}}"; +let x = (b == 2) ? "A" : (b == 3) ? "V" : (b == 1 && isL) ? "s" : "x"; +final += " ${3} \\mathrm{d}${4:" + x + "}$0"; +rv = final; +`` +endsnippet + +# Custom: Can add more defined operator +priority 100 +snippet `(? 0} \\\\ +\end{aligned} +endsnippet + +priority 300 +snippet Argmax "Optimization problem" iAm +\begin{aligned} +\argmax_{${1:\beta}} +&\quad ${2:f(x)} \\\\ +\text{s.t.} +&\quad ${3:g(x) > 0} \\\\ +\end{aligned} +endsnippet + +snippet deff "Definition of function" iAm +$1\colon ${2:\\mathbb{R\}} \to ${3:\\mathbb{R\}}, ${4:x} \mapsto $0 +endsnippet + + +snippet iid "independent and identical distribution" iAm +\overset{\text{i.i.d.}}{\sim} +endsnippet + +snippet defe "define equal" iAm +\overset{\underset{\mathrm{def}}{}}{=} +endsnippet + +snippet deft "define triangleq" iAm +\triangleq +endsnippet + + +# == Matrix == + +# ==== Static Matrix ==== + +snippet pmat "pmat" wm +\begin{pmatrix} + ${1: } +\end{pmatrix} $0 +endsnippet + +snippet bmat "pmat" wm +\begin{bmatrix} + $1 +\end{bmatrix} $0 +endsnippet + +snippet vecC "column vector" iAm +\begin{bmatrix} ${1:x}_1 \\\\ ${1:x}_2 \\\\ \vdots \\\\ ${1:x}_${2:n} \end{bmatrix} +endsnippet + +snippet vecR "row vector" iAm +\begin{bmatrix} ${1:x}_1, ${1:x}_2, \cdots, ${1:x}_${2:n} \end{bmatrix}$0 +endsnippet + +priority 300 +snippet omis "omission" iAm +\\begin{bmatrix}${1:1}&${2:1}&\\cdots&${4:1}\\\\${5:1}&${6:1}&\\cdots&${8:1}\\\\\\vdots&\\vdots&\\ddots&\\vdots\\\\${13:1}&${14:1}&\\cdots&${16:1}\\end{bmatrix} +endsnippet + +priority 300 +snippet submat "omission" iAm +\\begin{bmatrix} + ${1:a}_{11} & ${1:a}_{12} & \\cdots & ${1:a}_{1n} \\\\ + ${1:a}_{21} & ${1:a}_{22} & \\cdots & ${1:a}_{2n} \\\\ + \\vdots & \\vdots & \\ddots & \\vdots \\\\ + ${1:a}_{n1} & ${1:a}_{n2} & \\cdots & ${1:a}_{nn} +\\end{bmatrix} +endsnippet + +priority 300 +snippet subplusmat "omission" iAm +\\begin{bmatrix} + ${1:a}_{11}+${2:b}_{11} & ${1:a}_{12}+${2:b}_{12} & \\cdots & ${1:a}_{1n}+${2:b}_{1n} \\\\ + ${1:a}_{21}+${2:b}_{21} & ${1:a}_{22}+${2:b}_{22} & \\cdots & ${1:a}_{2n}+${2:b}_{2n} \\\\ + \\vdots & \\vdots & \\ddots & \\vdots \\\\ + ${1:a}_{n1}+${2:b}_{n1} & ${1:a}_{n2}+${2:b}_{n2} & \\cdots & ${1:a}_{nn}+${2:b}_{nn} +\\end{bmatrix} +endsnippet + +snippet jacobi "jacobi" iAm +\\begin{bmatrix}\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_${3:n}}\\\\\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_${3:n}}\\\\\\vdots&\\vdots&\\ddots&\\vdots\\\\\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_${3:n}}\\end{bmatrix} +endsnippet + +# ==== Dynamic Matrix ==== + +priority 300 +snippet `(b|p|v)mata([1-9])` "bmatrix" iiAm +\\begin{``rv = m[1]``matrix}`` + let len = m[2]; + let results = ""; + for (var i=0; i 1 ){ - results += "${" +(order ).toString() + ":" + t[order-2] + "}\t & "; - } - else{ - results += "$" +(order ).toString() + " & "; - } - order ++; - } - results += "$"+(order).toString() +" \\\\" + "\\ "; - order ++; - } - return results; -} - -// 输出一个表格 -function createTable(rows, cols) { - let ret = ""; - let order = 1; - for (let i = 0; i < parseInt(rows) + 2; i++) { - for (let j = 0; j < parseInt(cols); j++) { - if (i === 1) { - ret += "|---"; - } else { - ret += "| $" + (order).toString() + " "; - order++; - } - } - ret += "|\n" - } - return ret; -} - -endglobal - - -# == Fraction Match == - -snippet // "Fraction" iAm -\\frac{${1:${VISUAL}}}{$2}$0 -endsnippet - -snippet `((\d+)|(\d*)(\\)?([A-Za-z!]+)((\^|_)(\{\d+\}|\d))*)/` "Fraction no ()" iAm -\frac{``rv = m[1]``}{$1}$0 -endsnippet - -priority 200 -snippet `(?<=\s)(\\mu|\\alpha|\\sigma|\\rho|\\beta|\\gamma|\\delta|\\zeta|\\eta|\\varepsilon|\\theta|\\iota|\\kappa|\\vartheta|\\lambda|\\nu|\\pi|\\rho|\\tau|\\upsilon|\\phi|\\chi|\\psi|\\omega|\\Gamma|\\Delta|\\Theta|\\Lambda|\\Xi|\\Pi|\\Sigma|\\Upsilon|\\Phi|\\Psi|\\Omega|[A-Za-z]{1,2})?(_[A-Za-z0-9]|_\{[^}]+\})?(\^[A-Za-z0-9]|\^\{[^}]+\})?(_[A-Za-z0-9]|_\{[^}]+\})?(\([^)]+\))(_[A-Za-z0-9]|_\{[^}]+\})?(\^[A-Za-z0-9]|\^\{[^}]+\})?(_[A-Za-z0-9]|_\{[^}]+\})?\/` "Fraction with ()" iAm -``rv = "\\frac{" + m.slice(1, m.length).join('') + "}{$1}$2"`` -endsnippet - -# == Hat Operation == - -# ==== Auto Capture Hat Operation ==== -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hbar|BAR)` "Bar" iAm -\overline{``rv = m[1] + m[2] + m[3]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(htd|TD)` "tilde" iAm -\tilde{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)bar` "bar" iAm -\bar{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hat|HAT)` "hat" iAm -\hat{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hvec)` "Vector postfix" iAm -\vec{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(rta)` "Vector postfix" iAm -\overrightarrow{``rv = m[1]``} -endsnippet - -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(dot)` "dot" iAm -\dot{``rv = m[1]``} -endsnippet - -priority 1000 -snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hdd)` "ddot" iAm -\ddot{``rv = m[1]``} -endsnippet - -# ===== Static Hat Operation ==== - -snippet hbar "bar" iAm -\overline{$1}$0 -endsnippet - -snippet hat "hat" iAm -\hat{$1}$0 -endsnippet - -snippet hsq "\sqrt{}" iAm -\sqrt{${1}}$0 -endsnippet - -# == Superscript Operation == - -snippet invs "inverse" iAm -^{-1} -endsnippet - -snippet dig "digree" iAm -^{\circ} -endsnippet - -priority 10000 -snippet TR "inverse" iAm -^{\mathsf{T}} -endsnippet - -snippet CL "complement" iAm -\complement -endsnippet - -snippet R+ "R0+" iAm -R_0^+ -endsnippet - -snippet pow "power" iAm -^{${1:2}}$0 -endsnippet - -snippet tp "to the ... power" iAm -^{${1:2}}$0 -endsnippet - -snippet sr "square" iAm -^{2}$0 -endsnippet - -# == Subscript Operation == - -snippet td "subscript" iAm -_{${1}}$0 -endsnippet - -snippet sb "subscript" iAm -_{${1:2}}$0 -endsnippet - -snippet `(})(\d)\2` "auto subscript" iAm -`` rv = m[1] + "_" + m[2]`` -endsnippet - -snippet `([A-Za-z])(\d)` "auto subscript" iAm -`` rv = m[1] + "_" + m[2]`` -endsnippet - -priority 100 -snippet `([A-Za-z])_(\d{2})` "auto subscript" iAm -`` rv = m[1] + "_{" + m[2] + "}$0" `` -endsnippet - -priority 100 -snippet `([A-Za-z])S(\d)` "auto subscript" iAm -`` rv = m[1] + "_{" + m[2] + "$1}$2"`` -endsnippet - -snippet `\b(? "${1:_}" + d + "${2:, }").join('');``\cdots${3:${2:, }${1:_}n} -endsnippet - -snippet `(\d\d+),` "0, 1, 2" iAm -``rv = m[1].split('').map((d) => "${1:_}" + d).join("${2:, }");`` -endsnippet - -snippet <> "hokje" imA -\diamond -endsnippet - -# +... -> , \cdots -# - ... -> , \cdots -# add a space if there already is one. -priority 101 -snippet `(?<=[-+])\s*\.\.\.` "smart cdots" imA - \cdots -endsnippet - -# It seems that \ldots is only used when , ..., -# ,... -> , \ldots -# , ... -> , \ldots -priority 101 -snippet `(?<=,)(\s*)\.\.\.` "smart ldots" imA - \ldots -endsnippet - -snippet ** "dot multiply" iAm -\cdot -endsnippet - -snippet +- "pm" iAm -\pm -endsnippet - -snippet -+ "mp" iAm -\mp -endsnippet - -snippet odot "odot" iAm -\odot -endsnippet - -priority 101 -snippet xx "cross" iAm -\times -endsnippet - -snippet eps "epsilon" iAm -\epsilon -endsnippet - -priority 100 -snippet veps "varepsilon" iAm -\varepsilon -endsnippet - -priority 100 -snippet ell "ell" iAm -\ell -endsnippet - -priority 100 -snippet log "log" iAm -\log -endsnippet - -snippet bin "binom" iAm -\binom{$1}{$2} -endsnippet - -snippet oth "otherwise" iAm -\text{otherwise} -endsnippet - -snippet star "star" iAm -\star -endsnippet - -priority 100 -snippet pstar "star" iAm -^{*}$1 -endsnippet - -priority 100 -snippet `(? "to" iAm -\to -endsnippet - -snippet !> "mapsto" iAm -\mapsto -endsnippet - -snippet => "implies" iAm -\implies -endsnippet - -snippet =< "implied by" iAm -\impliedby -endsnippet - -priority 200 -snippet iff "if and only if" iAm -\iff -endsnippet - -snippet EE "exist" iAm -\exists -endsnippet - -snippet AA "forall" iAm -\forall -endsnippet - -snippet bec "because" iAm -\because -endsnippet - -snippet thr "therefore" iAm -\therefore -endsnippet - - -# ==== Possibility Symbol ==== - -snippet Pr "Pr" iAm -\operatorname{Pr} -endsnippet - -snippet Var "Var" iAm -\operatorname{Var} -endsnippet - -snippet Cov "Cov" iAm -\operatorname{Cov} -endsnippet - -snippet Exp "Expected" iAm -\mathbb{E} -endsnippet - - -# ==== Compare Symbol ==== - -snippet -- "setminus" iAm -\setminus -endsnippet - -snippet >= "greater than" iAm -\ge $0 -endsnippet - -snippet dis "displaystyle" iAm -\displaystyle -endsnippet - -snippet <= "less than" iAm -\le $0 -endsnippet - -snippet != "no equals" iAm -\neq -endsnippet - -snippet == " constan equals" iAm -\equiv -endsnippet - -snippet sim "sim" iAm -\sim -endsnippet - -snippet `\\sim eq` "simeq" iAm -\simeq -endsnippet - -snippet ~~ " Amppro equals" iAm -\approx -endsnippet - -snippet ~= " Amppro equals2" iAm -\cong -endsnippet - -snippet >> ">>" iAm -\gg -endsnippet - - -snippet << "<<" iAm -\ll -endsnippet - - -# == Auto Environment == - -# ==== Auto Math Mode ==== - -snippet mk "inline Math" wA -$${1}$$0 -endsnippet - -snippet dm "display Math" wA -$$ -${1} -$$$0 -endsnippet - -snippet eqt "equation" wA -\begin{equation} - ${1} -\end{equation} -endsnippet - -snippet eqs "equation*" wA -\begin{equation*} - ${1} -\end{equation*} -endsnippet - -# ==== Common Environment ==== - -snippet case "cases" iAm -\begin{cases} $1, & $2 \\\\ $3, & $4 \end{cases} -endsnippet - -snippet ali "aligned" iAm -\begin{aligned} -$1 \\\\ -\end{aligned} -endsnippet - -# == Auto Adaptive Close == - -snippet ceil "ceil" iAm -\left\lceil $1 \right\rceil $0 -endsnippet - -snippet floor "floor" iAm -\left\lfloor $1 \right\rfloor$0 -endsnippet - -priority 100 -snippet @) "left( right)" Aim -\left( ${1} \right) $0 -endsnippet - -priority 100 -snippet @| "left| right|" Aim -\left| ${1} \right| $0 -endsnippet - -priority 100 -snippet @\ "left. right|" Aim -\left. ${1} \right|_{${2}}$0 -endsnippet - -priority 100 -snippet @} "left\{ right\}" Aim -\left\\{ ${1} \right\\} $0 -endsnippet - -priority 100 -snippet set "\{ \}" Aim -\\{ ${1} \\}$0 -endsnippet - -priority 100 -snippet @] "left[ right]" Aim -\left[ ${1} \right] $0 -endsnippet - -priority 100 -snippet @> "leftangle rightangle" iAm -\left<${1} \right>$0 -endsnippet - -priority 200 -snippet norm iAm -\left\| ${1} \right\|$2 -endsnippet - -# == Snippet == - -# ==== General Snippet ==== - -# ====== Lite Snippet ====== - -snippet tag "tag" iAm -\tag{$1} -endsnippet - -snippet xyb "Auto (x, y)" iAm -(x, y) -endsnippet - -snippet xyzb "Auto (x, y ,z)" iAm -(x, y, z) -endsnippet - -priority 100 -snippet `\b([a-zA-Z])n(\d)` "x[n+1]" iAm -``rv = m[1]``_{${1:n}+``rv = m[2]``}$0 -endsnippet - -# Unkown -snippet rij "mrij" iAm -(${1:x}_${2:n})_{${3:$2} \\in ${4:N}}$0 -endsnippet - -priority 200 -snippet abs "absolute value" iAm -\left\vert ${1} \right\vert $0 -endsnippet - -snippet beg "begin{} / end{}" bA -\\begin{$1} - $0 -\\end{$1} -endsnippet - -# ======== N Series ======== - -priority 100 -snippet comma "comma" iAm -${1:\\alpha}_1,${1:\\alpha}_2,\\cdots,${1:\\alpha}_${2:n} -endsnippet - -priority 100 -snippet plus "plus" iAm -${1:k}_1${2:\\alpha}_1+${1:k}_2${2:\\alpha}_2+\\cdots+${1:k}_${3:n}${2:\\alpha}_${3:n} -endsnippet - -snippet `\b([ijk])=n` "i=1,2,\cdots,n" iAm -``rv = m[1]``=1,2,\cdots,n -endsnippet - -# ======== Common Operator Snippet ======== - -snippet taylor "taylor" iAm -\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0 -endsnippet - -snippet `(?= 2) || (b != 1 && !isO && isL)) ? "\\limits" : ""; -let r = (b == 3) ? "E" : (b == 1 && (isL || isO)) ? "C" : "R"; -final += ((b >= 2) || isO || (b == 1 && isL)) ? "_{${1:" + r + "}}" : "_{${1:-\\infty}}^{${2:\\infty}}"; -let x = (b == 2) ? "A" : (b == 3) ? "V" : (b == 1 && isL) ? "s" : "x"; -final += " ${3} \\mathrm{d}${4:" + x + "}$0"; -rv = final; -`` -endsnippet - -# Custom: Can add more defined operator -priority 100 -snippet `(? 0} \\\\ -\end{aligned} -endsnippet - -priority 300 -snippet Argmax "Optimization problem" iAm -\begin{aligned} -\argmax_{${1:\beta}} -&\quad ${2:f(x)} \\\\ -\text{s.t.} -&\quad ${3:g(x) > 0} \\\\ -\end{aligned} -endsnippet - -snippet deff "Definition of function" iAm -$1\colon ${2:\\mathbb{R\}} \to ${3:\\mathbb{R\}}, ${4:x} \mapsto $0 -endsnippet - - -snippet iid "independent and identical distribution" iAm -\overset{\text{i.i.d.}}{\sim} -endsnippet - -snippet defe "define equal" iAm -\overset{\underset{\mathrm{def}}{}}{=} -endsnippet - -snippet deft "define triangleq" iAm -\triangleq -endsnippet - - -# == Matrix == - -# ==== Static Matrix ==== - -snippet pmat "pmat" wm -\begin{pmatrix} - ${1: } -\end{pmatrix} $0 -endsnippet - -snippet bmat "pmat" wm -\begin{bmatrix} - $1 -\end{bmatrix} $0 -endsnippet - -snippet vecC "column vector" iAm -\begin{bmatrix} ${1:x}_1 \\\\ ${1:x}_2 \\\\ \vdots \\\\ ${1:x}_${2:n} \end{bmatrix} -endsnippet - -snippet vecR "row vector" iAm -\begin{bmatrix} ${1:x}_1, ${1:x}_2, \cdots, ${1:x}_${2:n} \end{bmatrix}$0 -endsnippet - -priority 300 -snippet omis "omission" iAm -\\begin{bmatrix}${1:1}&${2:1}&\\cdots&${4:1}\\\\${5:1}&${6:1}&\\cdots&${8:1}\\\\\\vdots&\\vdots&\\ddots&\\vdots\\\\${13:1}&${14:1}&\\cdots&${16:1}\\end{bmatrix} -endsnippet - -priority 300 -snippet submat "omission" iAm -\\begin{bmatrix} - ${1:a}_{11} & ${1:a}_{12} & \\cdots & ${1:a}_{1n} \\\\ - ${1:a}_{21} & ${1:a}_{22} & \\cdots & ${1:a}_{2n} \\\\ - \\vdots & \\vdots & \\ddots & \\vdots \\\\ - ${1:a}_{n1} & ${1:a}_{n2} & \\cdots & ${1:a}_{nn} -\\end{bmatrix} -endsnippet - -priority 300 -snippet subplusmat "omission" iAm -\\begin{bmatrix} - ${1:a}_{11}+${2:b}_{11} & ${1:a}_{12}+${2:b}_{12} & \\cdots & ${1:a}_{1n}+${2:b}_{1n} \\\\ - ${1:a}_{21}+${2:b}_{21} & ${1:a}_{22}+${2:b}_{22} & \\cdots & ${1:a}_{2n}+${2:b}_{2n} \\\\ - \\vdots & \\vdots & \\ddots & \\vdots \\\\ - ${1:a}_{n1}+${2:b}_{n1} & ${1:a}_{n2}+${2:b}_{n2} & \\cdots & ${1:a}_{nn}+${2:b}_{nn} -\\end{bmatrix} -endsnippet - -snippet jacobi "jacobi" iAm -\\begin{bmatrix}\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_${3:n}}\\\\\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_${3:n}}\\\\\\vdots&\\vdots&\\ddots&\\vdots\\\\\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_${3:n}}\\end{bmatrix} -endsnippet - -# ==== Dynamic Matrix ==== - -priority 300 -snippet `(b|p|v)mata([1-9])` "bmatrix" iiAm -\\begin{``rv = m[1]``matrix}`` - let len = m[2]; - let results = ""; - for (var i=0; i 1 ){ + results += "${" +(order ).toString() + ":" + t[order-2] + "}\t & "; + } + else{ + results += "$" +(order ).toString() + " & "; + } + order ++; + } + results += "$"+(order).toString() +" \\\\" + "\\ "; + order ++; + } + return results; +} + +// 输出一个表格 +function createTable(rows, cols) { + let ret = ""; + let order = 1; + for (let i = 0; i < parseInt(rows) + 2; i++) { + for (let j = 0; j < parseInt(cols); j++) { + if (i === 1) { + ret += "|---"; + } else { + ret += "| $" + (order).toString() + " "; + order++; + } + } + ret += "|\n" + } + return ret; +} + +endglobal + + +# == Fraction Match == + +snippet // "Fraction" iAm +\\frac{${1:${VISUAL}}}{$2}$0 +endsnippet + +snippet `((\d+)|(\d*)(\\)?([A-Za-z!]+)((\^|_)(\{\d+\}|\d))*)/` "Fraction no ()" iAm +\frac{``rv = m[1]``}{$1}$0 +endsnippet + +priority 200 +snippet `(?<=\s)(\\mu|\\alpha|\\sigma|\\rho|\\beta|\\gamma|\\delta|\\zeta|\\eta|\\varepsilon|\\theta|\\iota|\\kappa|\\vartheta|\\lambda|\\nu|\\pi|\\rho|\\tau|\\upsilon|\\phi|\\chi|\\psi|\\omega|\\Gamma|\\Delta|\\Theta|\\Lambda|\\Xi|\\Pi|\\Sigma|\\Upsilon|\\Phi|\\Psi|\\Omega|[A-Za-z]{1,2})?(_[A-Za-z0-9]|_\{[^}]+\})?(\^[A-Za-z0-9]|\^\{[^}]+\})?(_[A-Za-z0-9]|_\{[^}]+\})?(\([^)]+\))(_[A-Za-z0-9]|_\{[^}]+\})?(\^[A-Za-z0-9]|\^\{[^}]+\})?(_[A-Za-z0-9]|_\{[^}]+\})?\/` "Fraction with ()" iAm +``rv = "\\frac{" + m.slice(1, m.length).join('') + "}{$1}$2"`` +endsnippet + +# == Hat Operation == + +# ==== Auto Capture Hat Operation ==== +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hbar|BAR)` "Bar" iAm +\overline{``rv = m[1] + m[2] + m[3]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(htd|TD)` "tilde" iAm +\tilde{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)bar` "bar" iAm +\bar{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hat|HAT)` "hat" iAm +\hat{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hvec)` "Vector postfix" iAm +\vec{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(rta)` "Vector postfix" iAm +\overrightarrow{``rv = m[1]``} +endsnippet + +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(dot)` "dot" iAm +\dot{``rv = m[1]``} +endsnippet + +priority 1000 +snippet `(\\?[a-zA-Z]\w*({?\w*})?)(hdd)` "ddot" iAm +\ddot{``rv = m[1]``} +endsnippet + +# ===== Static Hat Operation ==== + +snippet hbar "bar" iAm +\overline{$1}$0 +endsnippet + +snippet hat "hat" iAm +\hat{$1}$0 +endsnippet + +snippet hsq "\sqrt{}" iAm +\sqrt{${1}}$0 +endsnippet + +# == Superscript Operation == + +snippet invs "inverse" iAm +^{-1} +endsnippet + +snippet dig "digree" iAm +^{\circ} +endsnippet + +priority 10000 +snippet TR "inverse" iAm +^{\mathsf{T}} +endsnippet + +snippet CL "complement" iAm +\complement +endsnippet + +snippet R+ "R0+" iAm +R_0^+ +endsnippet + +snippet pow "power" iAm +^{${1:2}}$0 +endsnippet + +snippet tp "to the ... power" iAm +^{${1:2}}$0 +endsnippet + +snippet sr "square" iAm +^{2}$0 +endsnippet + +# == Subscript Operation == + +snippet td "subscript" iAm +_{${1}}$0 +endsnippet + +snippet sb "subscript" iAm +_{${1:2}}$0 +endsnippet + +snippet `(})(\d)\2` "auto subscript" iAm +`` rv = m[1] + "_" + m[2]`` +endsnippet + +snippet `([A-Za-z])(\d)` "auto subscript" iAm +`` rv = m[1] + "_" + m[2]`` +endsnippet + +priority 100 +snippet `([A-Za-z])_(\d{2})` "auto subscript" iAm +`` rv = m[1] + "_{" + m[2] + "}$0" `` +endsnippet + +priority 100 +snippet `([A-Za-z])S(\d)` "auto subscript" iAm +`` rv = m[1] + "_{" + m[2] + "$1}$2"`` +endsnippet + +snippet `\b(? "${1:_}" + d + "${2:, }").join('');``\cdots${3:${2:, }${1:_}n} +endsnippet + +snippet `(\d\d+),` "0, 1, 2" iAm +``rv = m[1].split('').map((d) => "${1:_}" + d).join("${2:, }");`` +endsnippet + +snippet <> "hokje" imA +\diamond +endsnippet + +# +... -> , \cdots +# - ... -> , \cdots +# add a space if there already is one. +priority 101 +snippet `(?<=[-+])\s*\.\.\.` "smart cdots" imA + \cdots +endsnippet + +# It seems that \ldots is only used when , ..., +# ,... -> , \ldots +# , ... -> , \ldots +priority 101 +snippet `(?<=,)(\s*)\.\.\.` "smart ldots" imA + \ldots +endsnippet + +snippet ** "dot multiply" iAm +\cdot +endsnippet + +snippet +- "pm" iAm +\pm +endsnippet + +snippet -+ "mp" iAm +\mp +endsnippet + +snippet odot "odot" iAm +\odot +endsnippet + +priority 101 +snippet xx "cross" iAm +\times +endsnippet + +snippet eps "epsilon" iAm +\epsilon +endsnippet + +priority 100 +snippet veps "varepsilon" iAm +\varepsilon +endsnippet + +priority 100 +snippet ell "ell" iAm +\ell +endsnippet + +priority 100 +snippet log "log" iAm +\log +endsnippet + +snippet bin "binom" iAm +\binom{$1}{$2} +endsnippet + +snippet oth "otherwise" iAm +\text{otherwise} +endsnippet + +snippet star "star" iAm +\star +endsnippet + +priority 100 +snippet pstar "star" iAm +^{*}$1 +endsnippet + +priority 100 +snippet `(? "to" iAm +\to +endsnippet + +snippet !> "mapsto" iAm +\mapsto +endsnippet + +snippet => "implies" iAm +\implies +endsnippet + +snippet =< "implied by" iAm +\impliedby +endsnippet + +priority 200 +snippet iff "if and only if" iAm +\iff +endsnippet + +snippet EE "exist" iAm +\exists +endsnippet + +snippet AA "forall" iAm +\forall +endsnippet + +snippet bec "because" iAm +\because +endsnippet + +snippet thr "therefore" iAm +\therefore +endsnippet + + +# ==== Possibility Symbol ==== + +snippet Pr "Pr" iAm +\operatorname{Pr} +endsnippet + +snippet Var "Var" iAm +\operatorname{Var} +endsnippet + +snippet Cov "Cov" iAm +\operatorname{Cov} +endsnippet + +snippet Exp "Expected" iAm +\mathbb{E} +endsnippet + + +# ==== Compare Symbol ==== + +snippet -- "setminus" iAm +\setminus +endsnippet + +snippet >= "greater than" iAm +\ge $0 +endsnippet + +snippet dis "displaystyle" iAm +\displaystyle +endsnippet + +snippet <= "less than" iAm +\le $0 +endsnippet + +snippet != "no equals" iAm +\neq +endsnippet + +snippet == " constan equals" iAm +\equiv +endsnippet + +snippet sim "sim" iAm +\sim +endsnippet + +snippet `\\sim eq` "simeq" iAm +\simeq +endsnippet + +snippet ~~ " Amppro equals" iAm +\approx +endsnippet + +snippet ~= " Amppro equals2" iAm +\cong +endsnippet + +snippet >> ">>" iAm +\gg +endsnippet + + +snippet << "<<" iAm +\ll +endsnippet + + +# == Auto Environment == + +# ==== Auto Math Mode ==== + +snippet mk "inline Math" wA +$${1}$$0 +endsnippet + +snippet dm "display Math" wA +$$ +${1} +$$$0 +endsnippet + +snippet eqt "equation" wA +\begin{equation} + ${1} +\end{equation} +endsnippet + +snippet eqs "equation*" wA +\begin{equation*} + ${1} +\end{equation*} +endsnippet + +# ==== Common Environment ==== + +snippet case "cases" iAm +\begin{cases} $1, & $2 \\\\ $3, & $4 \end{cases} +endsnippet + +snippet ali "aligned" iAm +\begin{aligned} +$1 \\\\ +\end{aligned} +endsnippet + +# == Auto Adaptive Close == + +snippet ceil "ceil" iAm +\left\lceil $1 \right\rceil $0 +endsnippet + +snippet floor "floor" iAm +\left\lfloor $1 \right\rfloor$0 +endsnippet + +priority 100 +snippet @) "left( right)" Aim +\left( ${1} \right) $0 +endsnippet + +priority 100 +snippet @| "left| right|" Aim +\left| ${1} \right| $0 +endsnippet + +priority 100 +snippet @\ "left. right|" Aim +\left. ${1} \right|_{${2}}$0 +endsnippet + +priority 100 +snippet @} "left\{ right\}" Aim +\left\\{ ${1} \right\\} $0 +endsnippet + +priority 100 +snippet set "\{ \}" Aim +\\{ ${1} \\}$0 +endsnippet + +priority 100 +snippet @] "left[ right]" Aim +\left[ ${1} \right] $0 +endsnippet + +priority 100 +snippet @> "leftangle rightangle" iAm +\left<${1} \right>$0 +endsnippet + +priority 200 +snippet norm iAm +\left\| ${1} \right\|$2 +endsnippet + +# == Snippet == + +# ==== General Snippet ==== + +# ====== Lite Snippet ====== + +snippet tag "tag" iAm +\tag{$1} +endsnippet + +snippet xyb "Auto (x, y)" iAm +(x, y) +endsnippet + +snippet xyzb "Auto (x, y ,z)" iAm +(x, y, z) +endsnippet + +priority 100 +snippet `\b([a-zA-Z])n(\d)` "x[n+1]" iAm +``rv = m[1]``_{${1:n}+``rv = m[2]``}$0 +endsnippet + +# Unkown +snippet rij "mrij" iAm +(${1:x}_${2:n})_{${3:$2} \\in ${4:N}}$0 +endsnippet + +priority 200 +snippet abs "absolute value" iAm +\left\vert ${1} \right\vert $0 +endsnippet + +snippet beg "begin{} / end{}" bA +\\begin{$1} + $0 +\\end{$1} +endsnippet + +# ======== N Series ======== + +priority 100 +snippet comma "comma" iAm +${1:\\alpha}_1,${1:\\alpha}_2,\\cdots,${1:\\alpha}_${2:n} +endsnippet + +priority 100 +snippet plus "plus" iAm +${1:k}_1${2:\\alpha}_1+${1:k}_2${2:\\alpha}_2+\\cdots+${1:k}_${3:n}${2:\\alpha}_${3:n} +endsnippet + +snippet `\b([ijk])=n` "i=1,2,\cdots,n" iAm +``rv = m[1]``=1,2,\cdots,n +endsnippet + +# ======== Common Operator Snippet ======== + +snippet taylor "taylor" iAm +\sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0 +endsnippet + +snippet `(?= 2) || (b != 1 && !isO && isL)) ? "\\limits" : ""; +let r = (b == 3) ? "E" : (b == 1 && (isL || isO)) ? "C" : "R"; +final += ((b >= 2) || isO || (b == 1 && isL)) ? "_{${1:" + r + "}}" : "_{${1:-\\infty}}^{${2:\\infty}}"; +let x = (b == 2) ? "A" : (b == 3) ? "V" : (b == 1 && isL) ? "s" : "x"; +final += " ${3} \\mathrm{d}${4:" + x + "}$0"; +rv = final; +`` +endsnippet + +# Custom: Can add more defined operator +priority 100 +snippet `(? 0} \\\\ +\end{aligned} +endsnippet + +priority 300 +snippet Argmax "Optimization problem" iAm +\begin{aligned} +\argmax_{${1:\beta}} +&\quad ${2:f(x)} \\\\ +\text{s.t.} +&\quad ${3:g(x) > 0} \\\\ +\end{aligned} +endsnippet + +snippet deff "Definition of function" iAm +$1\colon ${2:\\mathbb{R\}} \to ${3:\\mathbb{R\}}, ${4:x} \mapsto $0 +endsnippet + + +snippet iid "independent and identical distribution" iAm +\overset{\text{i.i.d.}}{\sim} +endsnippet + +snippet defe "define equal" iAm +\overset{\underset{\mathrm{def}}{}}{=} +endsnippet + +snippet deft "define triangleq" iAm +\triangleq +endsnippet + + +# == Matrix == + +# ==== Static Matrix ==== + +snippet pmat "pmat" wm +\begin{pmatrix} + ${1: } +\end{pmatrix} $0 +endsnippet + +snippet bmat "pmat" wm +\begin{bmatrix} + $1 +\end{bmatrix} $0 +endsnippet + +snippet vecC "column vector" iAm +\begin{bmatrix} ${1:x}_1 \\\\ ${1:x}_2 \\\\ \vdots \\\\ ${1:x}_${2:n} \end{bmatrix} +endsnippet + +snippet vecR "row vector" iAm +\begin{bmatrix} ${1:x}_1, ${1:x}_2, \cdots, ${1:x}_${2:n} \end{bmatrix}$0 +endsnippet + +priority 300 +snippet omis "omission" iAm +\\begin{bmatrix}${1:1}&${2:1}&\\cdots&${4:1}\\\\${5:1}&${6:1}&\\cdots&${8:1}\\\\\\vdots&\\vdots&\\ddots&\\vdots\\\\${13:1}&${14:1}&\\cdots&${16:1}\\end{bmatrix} +endsnippet + +priority 300 +snippet submat "omission" iAm +\\begin{bmatrix} + ${1:a}_{11} & ${1:a}_{12} & \\cdots & ${1:a}_{1n} \\\\ + ${1:a}_{21} & ${1:a}_{22} & \\cdots & ${1:a}_{2n} \\\\ + \\vdots & \\vdots & \\ddots & \\vdots \\\\ + ${1:a}_{n1} & ${1:a}_{n2} & \\cdots & ${1:a}_{nn} +\\end{bmatrix} +endsnippet + +priority 300 +snippet subplusmat "omission" iAm +\\begin{bmatrix} + ${1:a}_{11}+${2:b}_{11} & ${1:a}_{12}+${2:b}_{12} & \\cdots & ${1:a}_{1n}+${2:b}_{1n} \\\\ + ${1:a}_{21}+${2:b}_{21} & ${1:a}_{22}+${2:b}_{22} & \\cdots & ${1:a}_{2n}+${2:b}_{2n} \\\\ + \\vdots & \\vdots & \\ddots & \\vdots \\\\ + ${1:a}_{n1}+${2:b}_{n1} & ${1:a}_{n2}+${2:b}_{n2} & \\cdots & ${1:a}_{nn}+${2:b}_{nn} +\\end{bmatrix} +endsnippet + +snippet jacobi "jacobi" iAm +\\begin{bmatrix}\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_1}{\\partial ${2:x}_${3:n}}\\\\\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_2}{\\partial ${2:x}_${3:n}}\\\\\\vdots&\\vdots&\\ddots&\\vdots\\\\\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_1}&\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_2}&\\cdots&\\frac{\\partial ${1:f}_${3:m}}{\\partial ${2:x}_${3:n}}\\end{bmatrix} +endsnippet + +# ==== Dynamic Matrix ==== + +priority 300 +snippet `(b|p|v)mata([1-9])` "bmatrix" iiAm +\\begin{``rv = m[1]``matrix}`` + let len = m[2]; + let results = ""; + for (var i=0; i ${2:oo}) -endsnippet - -snippet derive "derive" iAm -derive(${1:f}, ${2:x}) -endsnippet - -snippet part "partial" iAm -(diff ${1:f})/(diff ${3:x}) -endsnippet - -snippet sb "subscript" iAm -_(${1:2}) -endsnippet - -snippet sr "square" iAm -^2 -endsnippet - -snippet pow "to the ... power" iAm -^(${1:3}) -endsnippet - -snippet veps "epsilon.alt" iAm -epsilon.alt -endsnippet - -snippet ;; "\;" iAm -\; -endsnippet - -snippet ,, "\," iAm -\, -endsnippet - -snippet `([A-Za-z\)])(\d)` "auto subscript" iAm -`` rv = m[1] + "_" + m[2]`` -endsnippet - -snippet `([A-Za-z\)])_(\d{2})` "auto subscript" iAm -`` rv = m[1] + "_(" + m[2] + ")" `` -endsnippet - -snippet `(? ${2:oo}) +endsnippet + +snippet derive "derive" iAm +derive(${1:f}, ${2:x}) +endsnippet + +snippet part "partial" iAm +(diff ${1:f})/(diff ${3:x}) +endsnippet + +snippet sb "subscript" iAm +_(${1:2}) +endsnippet + +snippet sr "square" iAm +^2 +endsnippet + +snippet pow "to the ... power" iAm +^(${1:3}) +endsnippet + +snippet veps "epsilon.alt" iAm +epsilon.alt +endsnippet + +snippet ;; "\;" iAm +\; +endsnippet + +snippet ,, "\," iAm +\, +endsnippet + +snippet `([A-Za-z\)])(\d)` "auto subscript" iAm +`` rv = m[1] + "_" + m[2]`` +endsnippet + +snippet `([A-Za-z\)])_(\d{2})` "auto subscript" iAm +`` rv = m[1] + "_(" + m[2] + ")" `` +endsnippet + +snippet `(?> ~/.bashrc +set -o vi + +bind '"\en": "\C-j"' +bind '"\ee": "\C-k"' +bind '"\ei": "\C-l"' + +bind '"\el": "\ei"' +bind '"\eL": "\eI"' + +bind '"\ek": "\en"' +bind '"\eK": "\eN"' + +bind '"\ej": "\ee"' +bind '"\eJ": "\eE"' + +bind '"\eY": "\ey$"' \ No newline at end of file diff --git a/wsl/.zshrc b/wsl/.zshrc index 04bbafe..4425f16 100644 --- a/wsl/.zshrc +++ b/wsl/.zshrc @@ -1,73 +1,73 @@ -# $XDG_CONFIG_HOME/zsh/.zshrc -# ln -s $DOTFILES/wsl/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc -### Variables ### - -export DOTFILES="$HOME/.dotfiles" -for file in $DOTFILES/zsh/*.zsh; do - source $file -done -export ARCHFLAGS="-arch x86_64" - -# Absolute navigation -alias src="cd ~/Source && ls" -alias dotfiles="cd $DOTFILES && ls" - - -### WSL Options ### - -# WSL open -open() { - local target=$1 - - if command -v explorer.exe > /dev/null; then - explorer.exe "$target" - else - command open "$target" - fi -} - -# WSL Neovide -gvi() { - local target=$1 - - if command -v neovide.exe > /dev/null; then - neovide.exe "$target" - else - if command -v neovide > /dev/null; then - neovide "$target" - else - echo "neovide is not installed" - fi - fi -} - -### Misc ### - -export PATH=/opt/bin:$PATH - -# Conda # - -# >>> conda initialize >>> -# !! Contents within this block are managed by 'conda init' !! -__conda_setup="$('/home/js0ny/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" -if [ $? -eq 0 ]; then - eval "$__conda_setup" -else - if [ -f "/home/js0ny/miniconda3/etc/profile.d/conda.sh" ]; then - . "/home/js0ny/miniconda3/etc/profile.d/conda.sh" - else - export PATH="/home/js0ny/miniconda3/bin:$PATH" - fi -fi -unset __conda_setup -# <<< conda initialize <<< - - -if [ -f /usr/share/doc/pkgfile/command-not-found.sh ]; then - source /usr/share/doc/pkgfile/command-not-found.sh -fi - - -# vcpkg - +# $XDG_CONFIG_HOME/zsh/.zshrc +# ln -s $DOTFILES/wsl/.zshrc $XDG_CONFIG_HOME/zsh/.zshrc +### Variables ### + +export DOTFILES="$HOME/.dotfiles" +for file in $DOTFILES/zsh/*.zsh; do + source $file +done +export ARCHFLAGS="-arch x86_64" + +# Absolute navigation +alias src="cd ~/Source && ls" +alias dotfiles="cd $DOTFILES && ls" + + +### WSL Options ### + +# WSL open +open() { + local target=$1 + + if command -v explorer.exe > /dev/null; then + explorer.exe "$target" + else + command open "$target" + fi +} + +# WSL Neovide +gvi() { + local target=$1 + + if command -v neovide.exe > /dev/null; then + neovide.exe "$target" + else + if command -v neovide > /dev/null; then + neovide "$target" + else + echo "neovide is not installed" + fi + fi +} + +### Misc ### + +export PATH=/opt/bin:$PATH + +# Conda # + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('/home/js0ny/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/home/js0ny/miniconda3/etc/profile.d/conda.sh" ]; then + . "/home/js0ny/miniconda3/etc/profile.d/conda.sh" + else + export PATH="/home/js0ny/miniconda3/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< + + +if [ -f /usr/share/doc/pkgfile/command-not-found.sh ]; then + source /usr/share/doc/pkgfile/command-not-found.sh +fi + + +# vcpkg + export VCPKG_ROOT=~/vcpkg \ No newline at end of file diff --git a/zsh/.zshenv b/zsh/.zshenv index 9c83239..d8106ef 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,20 +1,20 @@ -# ~/.zshenv -# ln -s $DOTFILES/zsh/.zshenv $ZDOTDIR/.zshenv -# This file is sourced by all zsh sessions upon startup. - -# Use XDG Base Directory Specification -export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" -export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" -export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" -export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" -export XDG_RUNTIME_DIR="/run/user/$(id -u)" -# Disable shell sessions on macOS when using default terminal -SHELL_SESSIONS_DISABLE=1 - -# Zsh -export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" - -# Also put in /etc/zsh/zshenv -# or /etc/zshenv in macOS -# sudo cp $DOTFILES/zsh/.zshenv /etc/zsh/zshenv -# sudo cp $DOTFILES/zsh/.zshenv /etc/zshenv +# ~/.zshenv +# ln -s $DOTFILES/zsh/.zshenv $ZDOTDIR/.zshenv +# This file is sourced by all zsh sessions upon startup. + +# Use XDG Base Directory Specification +export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" +export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" +export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}" +export XDG_RUNTIME_DIR="/run/user/$(id -u)" +# Disable shell sessions on macOS when using default terminal +SHELL_SESSIONS_DISABLE=1 + +# Zsh +export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" + +# Also put in /etc/zsh/zshenv +# or /etc/zshenv in macOS +# sudo cp $DOTFILES/zsh/.zshenv /etc/zsh/zshenv +# sudo cp $DOTFILES/zsh/.zshenv /etc/zshenv diff --git a/zsh/alias.zsh b/zsh/alias.zsh index a37837c..5c59223 100644 --- a/zsh/alias.zsh +++ b/zsh/alias.zsh @@ -1,45 +1,45 @@ -# PowerShell Equivalent # -alias ni=touch -alias cls=clear - -# Dev # -alias g++='g++ -std=c++2b' # Set the default C++ standard to C++20 -alias gcc='gcc -std=c99' # Set the default C standard to C99 -alias cl='clang -std=c99' -alias clpp='clang++ -std=c++2b' -alias python=python3 # Set the default Python version to Python 3 -alias py=python # Alias for Python -alias bashcfg="nvim ~/.bashrc" -alias zshcfg="nvim ~/.zshrc" -alias shcfg=zshcfg -alias reload="source ~/.zshrc" -alias nvimrc="nvim $XDG_CONFIG_HOME/nvim/" -alias ohmyzsh="code ~/.oh-my-zsh" -alias pulldots="cd $DOTFILES && git pull" - -# Conda # -alias pyact="conda activate" -alias pydact="conda deactivate" -alias pylsenv="conda env list" -alias pymkenv="conda create --name" - -# Editors # -alias v=nvim -alias c=code - -# Misc # -alias cf=cfiles - -# Functions # -mcd() { - mkdir -p -- "$0" && cd -P -- "$1" -} -cdls(){ - cd $1 && ls -} -tc(){ - touch $1 && code $1 -} -tv(){ - touch $1 && nvim $1 +# PowerShell Equivalent # +alias ni=touch +alias cls=clear + +# Dev # +alias g++='g++ -std=c++2b' # Set the default C++ standard to C++20 +alias gcc='gcc -std=c99' # Set the default C standard to C99 +alias cl='clang -std=c99' +alias clpp='clang++ -std=c++2b' +alias python=python3 # Set the default Python version to Python 3 +alias py=python # Alias for Python +alias bashcfg="nvim ~/.bashrc" +alias zshcfg="nvim ~/.zshrc" +alias shcfg=zshcfg +alias reload="source ~/.zshrc" +alias nvimrc="nvim $XDG_CONFIG_HOME/nvim/" +alias ohmyzsh="code ~/.oh-my-zsh" +alias pulldots="cd $DOTFILES && git pull" + +# Conda # +alias pyact="conda activate" +alias pydact="conda deactivate" +alias pylsenv="conda env list" +alias pymkenv="conda create --name" + +# Editors # +alias v=nvim +alias c=code + +# Misc # +alias cf=cfiles + +# Functions # +mkcd() { + mkdir -p -- "$0" && cd -P -- "$1" +} +cdls(){ + cd $1 && ls +} +tc(){ + touch $1 && code $1 +} +tv(){ + touch $1 && nvim $1 } \ No newline at end of file diff --git a/zsh/config.zsh b/zsh/config.zsh index 15da6a7..accdf15 100644 --- a/zsh/config.zsh +++ b/zsh/config.zsh @@ -1,77 +1,77 @@ -### ZSH Config ### -export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH -export ZSH="$ZDOTDIR/ohmyzsh" -ZSH_THEME="avit" -# DISABLE_MAGIC_FUNCTIONS="true" -# DISABLE_LS_COLORS="true" -# DISABLE_AUTO_TITLE="true" -# ENABLE_CORRECTION="true" -# Uncomment the following line to display red dots whilst waiting for completion. -# You can also set it to another string to have that shown instead of the default red dots. -# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" -# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) -# COMPLETION_WAITING_DOTS="true" -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" -HIST_STAMPS="yyyy-mm-dd" -plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions) -source $ZSH/oh-my-zsh.sh -source .private.env.sh - -# export MANPATH="/usr/local/man:$MANPATH" -# export LANG= "en_US.UTF-8" - -# Use XDG Base Directory Specification - -# ~/.azure/ -> $XDG_DATA_HOME/azure/ -export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure -# ~/.cgdb/ -> $XDG_CONFIG_HOME/cgdb/ -export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb -# ~/.nv -> $XDG_CACHE_HOME/nv (CUDA) -# macOS does not have Cuda; Check if CUDA is installed -if [ "$(uname)" != "Darwin" ] && [ -d "/usr/local/cuda" ]; then - export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv -fi -# ~/.docker -> $XDG_CONFIG_HOME/docker -export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker -# ~/.dotnet -> $XDG_DATA_HOME/dotnet -export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet -# ~/.gnupg -> $XDG_CONFIG_HOME/gnupg -export GNUPGHOME="$XDG_DATA_HOME"/gnupg -# ~/go -> $XDG_DATA_HOME/go -export GOPATH="$XDG_DATA_HOME"/go -# ~/.juliaup/ -> $XDG_DATA_HOME/julia/ -export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH" -# Check if node is installed -if command -v node > /dev/null; then - # ~/.node_repl_history -> $XDG_STATE_HOME/node/repl_history - export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history - # ~/.ts_node_repl_history -> $XDG_STATE_HOME/node/ts_node_repl_history - export TS_NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/ts_node_repl_history - # ~/.npmrc -> $XDG_CONFIG_HOME/npm/npmrc - export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc - # ~/.npm -> $XDG_CACHE_HOME/npm - export NPM_CONFIG_INIT_MODULE="$XDG_CONFIG_HOME"/npm/config/npm-init.js - export NPM_CONFIG_CACHE="$XDG_CACHE_HOME"/npm - export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm -fi -# ~/.python_history -> $XDG_DATA_HOME/python/history -# Works only with Python 3.13.0a3 and later -export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history -# ~/.tldrc/ -> $XDG_CACHE_HOME/tldr -export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr -# ~/.w3m -> $XDG_DATA_HOME/w3m -export W3M_DIR="$XDG_DATA_HOME"/w3m -# ~/.wakatime.cfg -> $XDG_CONFIG_HOME/wakatime.cfg -# ~/.wakatime/ -> $XDG_CONFIG_HOME/wakatime/ -export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime" -# ~/.wget-hsts -> $XDG_DATA_HOME/wget-hsts -alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' -# ~/.z -> $XDG_DATA_HOME/z -export _Z_DATA="$XDG_DATA_HOME/z" -# ~/.zcompdump* -> $XDG_CACHE_HOME/zsh/zcompdump* -compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION" -# ~/.zsh_history -> $XDG_STATE_HOME/zsh/history +### ZSH Config ### +export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH +export ZSH="$ZDOTDIR/ohmyzsh" +ZSH_THEME="avit" +# DISABLE_MAGIC_FUNCTIONS="true" +# DISABLE_LS_COLORS="true" +# DISABLE_AUTO_TITLE="true" +# ENABLE_CORRECTION="true" +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +# COMPLETION_WAITING_DOTS="true" +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" +HIST_STAMPS="yyyy-mm-dd" +plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions) +source $ZSH/oh-my-zsh.sh +source .private.env.sh + +# export MANPATH="/usr/local/man:$MANPATH" +# export LANG= "en_US.UTF-8" + +# Use XDG Base Directory Specification + +# ~/.azure/ -> $XDG_DATA_HOME/azure/ +export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure +# ~/.cgdb/ -> $XDG_CONFIG_HOME/cgdb/ +export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb +# ~/.nv -> $XDG_CACHE_HOME/nv (CUDA) +# macOS does not have Cuda; Check if CUDA is installed +if [ "$(uname)" != "Darwin" ] && [ -d "/usr/local/cuda" ]; then + export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv +fi +# ~/.docker -> $XDG_CONFIG_HOME/docker +export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker +# ~/.dotnet -> $XDG_DATA_HOME/dotnet +export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet +# ~/.gnupg -> $XDG_CONFIG_HOME/gnupg +export GNUPGHOME="$XDG_DATA_HOME"/gnupg +# ~/go -> $XDG_DATA_HOME/go +export GOPATH="$XDG_DATA_HOME"/go +# ~/.juliaup/ -> $XDG_DATA_HOME/julia/ +export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH" +# Check if node is installed +if command -v node > /dev/null; then + # ~/.node_repl_history -> $XDG_STATE_HOME/node/repl_history + export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history + # ~/.ts_node_repl_history -> $XDG_STATE_HOME/node/ts_node_repl_history + export TS_NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/ts_node_repl_history + # ~/.npmrc -> $XDG_CONFIG_HOME/npm/npmrc + export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc + # ~/.npm -> $XDG_CACHE_HOME/npm + export NPM_CONFIG_INIT_MODULE="$XDG_CONFIG_HOME"/npm/config/npm-init.js + export NPM_CONFIG_CACHE="$XDG_CACHE_HOME"/npm + export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm +fi +# ~/.python_history -> $XDG_DATA_HOME/python/history +# Works only with Python 3.13.0a3 and later +export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history +# ~/.tldrc/ -> $XDG_CACHE_HOME/tldr +export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr +# ~/.w3m -> $XDG_DATA_HOME/w3m +export W3M_DIR="$XDG_DATA_HOME"/w3m +# ~/.wakatime.cfg -> $XDG_CONFIG_HOME/wakatime.cfg +# ~/.wakatime/ -> $XDG_CONFIG_HOME/wakatime/ +export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime" +# ~/.wget-hsts -> $XDG_DATA_HOME/wget-hsts +alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' +# ~/.z -> $XDG_DATA_HOME/z +export _Z_DATA="$XDG_DATA_HOME/z" +# ~/.zcompdump* -> $XDG_CACHE_HOME/zsh/zcompdump* +compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION" +# ~/.zsh_history -> $XDG_STATE_HOME/zsh/history export HISTFILE="$XDG_STATE_HOME"/zsh/history \ No newline at end of file diff --git a/zsh/keymap.zsh b/zsh/keymap.zsh index 32cceb0..0639b89 100644 --- a/zsh/keymap.zsh +++ b/zsh/keymap.zsh @@ -1,20 +1,20 @@ -# $DOTFILES/keymap.zsh -bindkey -v # Vi Keybindings - -# Colemak hnei -# bindkey -M vicmd 'h' vi-backward-char # No change -bindkey -M vicmd 'n' down-line-or-history -bindkey -M vicmd 'e' up-line-or-history -bindkey -M vicmd 'i' vi-forward-char - -# Similar position to [i] in QWERTY -bindkey -M vicmd 'l' vi-insert -bindkey -M vicmd 'L' vi-insert-bol -# Ne{[k]s}t -bindkey -M vicmd 'k' vi-repeat-search -bindkey -M vicmd 'K' vi-rev-repeat-search -# [J]ump -bindkey -M vicmd 'j' vi-forward-word-end -bindkey -M vicmd 'J' vi-forward-blank-word-end -# Use N to Join +# $DOTFILES/keymap.zsh +bindkey -v # Vi Keybindings + +# Colemak hnei +# bindkey -M vicmd 'h' vi-backward-char # No change +bindkey -M vicmd 'n' down-line-or-history +bindkey -M vicmd 'e' up-line-or-history +bindkey -M vicmd 'i' vi-forward-char + +# Similar position to [i] in QWERTY +bindkey -M vicmd 'l' vi-insert +bindkey -M vicmd 'L' vi-insert-bol +# Ne{[k]s}t +bindkey -M vicmd 'k' vi-repeat-search +bindkey -M vicmd 'K' vi-rev-repeat-search +# [J]ump +bindkey -M vicmd 'j' vi-forward-word-end +bindkey -M vicmd 'J' vi-forward-blank-word-end +# Use N to Join bindkey -M vicmd 'N' vi-join \ No newline at end of file diff --git a/zsh/navi.zsh b/zsh/navi.zsh index 27e008f..1b24b16 100644 --- a/zsh/navi.zsh +++ b/zsh/navi.zsh @@ -1,9 +1,9 @@ - -# Relative navigation -alias ..="cd .." -alias ...="cd ../.." -alias ....="cd ../../.." -alias .....="cd ../../../.." -alias ......="cd ../../../../.." - + +# Relative navigation +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." +alias ......="cd ../../../../.." + eval "$(zoxide init zsh)" \ No newline at end of file