This commit is contained in:
js0ny 2025-01-13 12:18:21 +00:00
commit 9eb09bade7
45 changed files with 1212 additions and 770 deletions

2
.gitignore vendored
View file

@ -36,3 +36,5 @@ platforms/win/komorebi/applications.json
gitconfig gitconfig
*.exe *.exe
spacemacs/

View file

@ -8,3 +8,7 @@ pull:
push: push:
git push github master git push github master
git push codeberg master git push codeberg master
init:
git remote add github git@github.com:js0ny/dotfiles.git
git remote add codeberg git@codeberg.org:js0ny/dotfiles.git

View file

@ -3,7 +3,7 @@
# Date: 2024-12-01 # Date: 2024-12-01
# Author: js0ny # Author: js0ny
# Set symbolic links for Unix-like systems # Set symbolic links for Unix-like systems
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 $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython 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 $XDG_CONFIG_HOME/readline $XDG_CONFIG_HOME/ipython $XDG_CONFIG_HOME/lazygit
# Not support XDG_CONFIG_HOME but same directory # Not support XDG_CONFIG_HOME but same directory
mkdir -p ~/.config/zellij ~/.config/yazi ~/.config/glow mkdir -p ~/.config/zellij ~/.config/yazi ~/.config/glow
# mkdir -p $WAKATIME_HOME # mkdir -p $WAKATIME_HOME
@ -15,6 +15,7 @@ cp $DOTFILES/common/gitconfig.example $XDG_CONFIG_HOME/git/config
ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml ln -sf $DOTFILES/common/glow.yaml ~/.config/glow/config.yml
ln -sf $DOTFILES/common/haskeline ~/.haskeline ln -sf $DOTFILES/common/haskeline ~/.haskeline
ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc ln -sf $DOTFILES/common/ideavimrc $XDG_CONFIG_HOME/ideavim/ideavimrc
ln -sf $DOTFILES/common/lazygit.yaml $XDG_CONFIG_HOME/lazygit/config.yml
ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey ln -sf $DOTFILES/common/lesskey $XDG_CONFIG_HOME/lesskey
# ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG # ln -sf $DOTFILES/common/npmrc $NPM_CONFIG_USERCONFIG
ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config ln -sf $DOTFILES/common/NuGet.Config $XDG_CONFIG_HOME/NuGet/NuGet.Config
@ -37,5 +38,5 @@ if [ $(uname) = "Darwin" ]; then
ln -sf $DOTFILES/platforms/mac/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc ln -sf $DOTFILES/platforms/mac/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc
ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc
else else
ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc ln -sf $DOTFILES/common/inputrc ~/.inputrc
fi fi

View file

@ -67,6 +67,11 @@ Plug 'easymotion/vim-easymotion'
""" Keybindings """ """ Keybindings """
"" don't lose selection when indenting ""
vnoremap < <gv
vnoremap > >gv
vnoremap = =gv
"" edit ideavim config <leader>v + "" "" edit ideavim config <leader>v + ""
nnoremap <leader>vv :e ~/.ideavimrc<CR> nnoremap <leader>vv :e ~/.ideavimrc<CR>
nnoremap <leader>vr :source ~/.ideavimrc<CR> nnoremap <leader>vr :source ~/.ideavimrc<CR>
@ -82,49 +87,7 @@ nmap S <Plug>(easymotion-F)
nmap f <Plug>(sneak-s) nmap f <Plug>(sneak-s)
nmap F <Plug>(sneak-S) nmap F <Plug>(sneak-S)
"" Miscs "" "" Language Server Protocol ""
nnoremap <leader>: :action GotoAction<CR>
nnoremap <leader><leader> :action GotoFile<CR>
"" AI Related <leader>a + ""
nnoremap <leader>ac :action copilot.chat.show<CR>
nnoremap <leader>ad :action copilot.disableCopilot<CR>
nnoremap <leader>ae :action copilot.enableCopilot<CR>
nnoremap <leader>ai :action copilot.openCopilot<CR>
"" Codes Action <leader>c + ""
nnoremap <leader>cf :action ReformatCode<CR>
nnoremap <leader>cs :action GotoSymbol<CR>
nnoremap <leader>c/ :action CommentByLineComment<CR>
"" Project Action <leader>p + ""
nnoremap <leader>pr :action Run<CR>
nnoremap <leader>pd :action Debug<CR>
nnoremap <leader>pb :action Build<CR>
"" Files Action <leader>f + ""
nnoremap <leader>fe :NERDTreeToggle<CR>
nnoremap <leader>ft :action ActivateTerminalToolWindow<CR>
"" Tab Actions <leader><tab> + ""
nnoremap <leader><tab><tab> :action Switcher<CR>
"" Collapse and Expand z + ""
nnoremap zi :action ExpandCollapseToggleAction<CR>
nnoremap zc :action CollapseRegion<CR>
nnoremap zC :action CollapseRegionRecursively<CR>
nnoremap zM :action CollapseAll<CR>
nnoremap zo :action ExpandRegion<CR>
nnoremap zO :action ExpandRegionRecursively<CR>
nnoremap zR :action ExpandAll<CR>
"" don't lose selection when indenting ""
vnoremap < <gv
vnoremap > >gv
vnoremap = =gv
nnoremap <leader>a :action FindInPath<CR>
nnoremap gd :action GotoDeclaration<CR> nnoremap gd :action GotoDeclaration<CR>
nnoremap gtd :action GotoTypeDeclaration<CR> nnoremap gtd :action GotoTypeDeclaration<CR>
nnoremap gtD :action QuickTypeDefinition<CR> nnoremap gtD :action QuickTypeDefinition<CR>
@ -136,13 +99,82 @@ nnoremap ga :action
nnoremap gq :action ShowIntentionActions<CR> nnoremap gq :action ShowIntentionActions<CR>
nnoremap ge :action GotoNextError<CR> nnoremap ge :action GotoNextError<CR>
nnoremap <C-p> :action ParameterInfo<CR> "" Collapse and Expand z + ""
inoremap <C-p> <C-o>:action ParameterInfo<CR> nnoremap zi :action ExpandCollapseToggleAction<CR>
nnoremap zc :action CollapseRegion<CR>
nnoremap zC :action CollapseRegionRecursively<CR>
nnoremap zM :action CollapseAll<CR>
nnoremap zo :action ExpandRegion<CR>
nnoremap zO :action ExpandRegionRecursively<CR>
nnoremap zR :action ExpandAll<CR>
"" Refractor <leader>r + "" "" Miscs ""
nnoremap <leader>: :action GotoAction<CR>
nnoremap <leader><leader> :action GotoFile<CR>
nnoremap <leader>h :action PrevSplitter<CR>
nnoremap <leader>i :action NextSplitter<CR>
"" AI Related <leader>a + ""
nnoremap <leader>ac :action copilot.chat.show<CR>
nnoremap <leader>ad :action copilot.disableCopilot<CR>
nnoremap <leader>ae :action copilot.enableCopilot<CR>
nnoremap <leader>aa :action copilot.openCopilot<CR>
" <leader>b : +buffer
nnoremap <leader>bb :action Switcher<CR>
noremap <leader>bd :bdelete<CR>
noremap <leader>bh :bprevious<CR>
noremap <leader>bi :bnext<CR>
noremap <leader>bp :bprevious<CR>
noremap <leader>bn :bnext<CR>
" <leader>c : +code/compile
nnoremap <leader>cr :action Run<CR>
nnoremap <leader>cf :action ReformatCode<CR>
nnoremap <leader>cs :action GotoSymbol<CR>
nnoremap <leader>cS :action GotoSymbol<CR>
nnoremap <leader>cR :action RenameElement<CR>
""" Works for Rider only
nnoremap <leader>ce :action ReSharperGotoNextErrorInSolution<CR>
nnoremap <leader>cE :action ReSharperGotoPrevErrorInSolution<CR>
" <leader>d : +debug
" <leader>f : +file
nnoremap <leader>ff :action GotoFile<CR>
nnoremap <leader>fF :action TextSearchAction<CR>
nnoremap <leader>fc :action ShowSettings<CR>
nnoremap <leader>fC :action ShowSettings<CR>
nnoremap <leader>fe :NERDTreeToggle<CR>
nnoremap <leader>fo :OpenInAssociatedApplication<CR>
nnoremap <leader>ft :action ActivateTerminalToolWindow<CR>
nnoremap <leader>fx :action WelcomeScreen.Plugins<CR>
" <leader>g : +git
nnoremap <leader>gp :action Git.Pull<CR>
nnoremap <leader>gP :action Vcs.Push<CR>
nnoremap <leader>gb :action Git.Branches<CR>
nnoremap <leader>gR :action Git.Rebase<CR>
nnoremap <leader>gM :action Git.Merge<CR>
nnoremap <leader>gc :action CheckinProject<CR>
nnoremap <leader>gC :action Git.Clone<CR>
nnoremap <leader>gg :action ActivateVersionControlToolWindow<CR>
nnoremap <leader>gS :action Git.Stash<CR>
" <leader>h : +help
" <leader>p : +project
nnoremap <leader>pr :action Run<CR>
nnoremap <leader>pd :action Debug<CR>
nnoremap <leader>pb :action Build<CR>
" <leader>q : +quit
nnoremap <leader>qq :action Exit<CR>
nnoremap <leader>Q :action Exit<CR>
" <leader>r : +refactor
nnoremap <leader>ri :action Inline<CR> nnoremap <leader>ri :action Inline<CR>
nnoremap <leader>rr :action RenameElement<CR> nnoremap <leader>rr :action RenamElement<CR>
nnoremap <leader>rev :action IntroduceVariable<CR> nnoremap <leader>rev :action IntroduceVariable<CR>
vnoremap <leader>rev :action IntroduceVariable<CR> vnoremap <leader>rev :action IntroduceVariable<CR>
nnoremap <leader>rem :action ExtractMethod<CR> nnoremap <leader>rem :action ExtractMethod<CR>
@ -151,6 +183,32 @@ nnoremap <leader>rm :action Move<CR>
nnoremap <leader>ro :action OptimizeImports<CR> nnoremap <leader>ro :action OptimizeImports<CR>
nnoremap <leader>rG :action Generate<CR> nnoremap <leader>rG :action Generate<CR>
" <leader>t : +test
nnoremap <leader>tt :action RiderUnitTestRunSolutionAction<CR>
nnoremap <leader>tT :action Rider.UnitTesting.MainMenu<CR>
" <leader>u : +ui
nnoremap <leader>ui :action ChangeLaf<CR>
nnoremap <leader>uw :action EditorToggleUseSoftWraps<CR>
" <leader>w : +write/window
nnoremap <leader>ww :write<CR>
nnoremap <leader>wa :wall<CR>
nnoremap <leader>wq :wq<CR>
nnoremap <leader>W :write<CR>
nnoremap <leader>wh :action PrevSplitter<CR>
nnoremap <leader>wi :action NextSplitter<CR>
nnoremap <leader>wH :action SplitHorizontally<CR>
nnoremap <leader>wI :action SplitHorizontally<CR>
nnoremap <leader>wN :action SplitVertically<CR>
nnoremap <leader>wE :action SplitVertically<CR>
nnoremap <leader>w- :action SplitHorizontally<CR>
nnoremap <leader>w| :action SplitVertically<CR>
nnoremap <leader>w\ :action SplitVertically<CR>
nnoremap <C-p> :action ParameterInfo<CR>
inoremap <C-p> <C-o>:action ParameterInfo<CR>
""" Handling Ctrls """ """ Handling Ctrls """
sethandler <C-C> i:ide sethandler <C-C> i:ide

View file

@ -9,72 +9,54 @@
# ln -sf ~/.dotfiles/common/lazygit.yaml ~/.config/lazygit/config.yml # ln -sf ~/.dotfiles/common/lazygit.yaml ~/.config/lazygit/config.yml
yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json
# Config relating to the Lazygit UI # Config relating to the Lazygit UI
gui: gui:
# The number of lines you scroll by when scrolling the main window # The number of lines you scroll by when scrolling the main window
scrollHeight: 2 scrollHeight: 2
# If true, allow scrolling past the bottom of the content in the main window # If true, allow scrolling past the bottom of the content in the main window
scrollPastBottom: true scrollPastBottom: true
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#scroll-off-margin # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#scroll-off-margin
scrollOffMargin: 2 scrollOffMargin: 2
# One of: 'margin' (default) | 'jump' # One of: 'margin' (default) | 'jump'
scrollOffBehavior: margin scrollOffBehavior: margin
# If true, capture mouse events. # If true, capture mouse events.
# When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS. # When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.
mouseEvents: true mouseEvents: true
# If true, do not show a warning when discarding changes in the staging view. # If true, do not show a warning when discarding changes in the staging view.
skipDiscardChangeWarning: false skipDiscardChangeWarning: false
# If true, do not show warning when applying/popping the stash # If true, do not show warning when applying/popping the stash
skipStashWarning: false skipStashWarning: false
# If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files. # If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files.
skipNoStagedFilesWarning: false skipNoStagedFilesWarning: false
# If true, do not show a warning when rewording a commit via an external editor # If true, do not show a warning when rewording a commit via an external editor
skipRewordInEditorWarning: false skipRewordInEditorWarning: false
# Fraction of the total screen width to use for the left side section. You may want to pick a small number (e.g. 0.2) if you're using a narrow screen, so that you can see more of the main section. # Fraction of the total screen width to use for the left side section. You may want to pick a small number (e.g. 0.2) if you're using a narrow screen, so that you can see more of the main section.
# Number from 0 to 1.0. # Number from 0 to 1.0.
sidePanelWidth: 0.3333 sidePanelWidth: 0.3333
# If true, increase the height of the focused side window; creating an accordion effect. # If true, increase the height of the focused side window; creating an accordion effect.
expandFocusedSidePanel: false expandFocusedSidePanel: false
# The weight of the expanded side panel, relative to the other panels. 2 means # The weight of the expanded side panel, relative to the other panels. 2 means
# twice as tall as the other panels. Only relevant if `expandFocusedSidePanel` is true. # twice as tall as the other panels. Only relevant if `expandFocusedSidePanel` is true.
expandedSidePanelWeight: 2 expandedSidePanelWeight: 2
# Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split. # Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split.
# Options are: # Options are:
# - 'horizontal': split the window horizontally # - 'horizontal': split the window horizontally
# - 'vertical': split the window vertically # - 'vertical': split the window vertically
# - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically # - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically
mainPanelSplitMode: flexible mainPanelSplitMode: flexible
# How the window is split when in half screen mode (i.e. after hitting '+' once). # How the window is split when in half screen mode (i.e. after hitting '+' once).
# Possible values: # Possible values:
# - 'left': split the window horizontally (side panel on the left, main view on the right) # - 'left': split the window horizontally (side panel on the left, main view on the right)
# - 'top': split the window vertically (side panel on top, main view below) # - 'top': split the window vertically (side panel on top, main view below)
enlargedSideViewLocation: left enlargedSideViewLocation: left
# One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru' # One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru'
language: auto language: auto
# Format used when displaying time e.g. commit time. # Format used when displaying time e.g. commit time.
# Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format # Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format
timeFormat: 02 Jan 06 timeFormat: 02 Jan 06
# Format used when displaying time if the time is less than 24 hours ago. # Format used when displaying time if the time is less than 24 hours ago.
# Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format # Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format
shortTimeFormat: 3:04PM shortTimeFormat: 3:04PM
# Config relating to colors and styles. # Config relating to colors and styles.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#color-attributes # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#color-attributes
theme: theme:
@ -82,134 +64,99 @@ gui:
activeBorderColor: activeBorderColor:
- green - green
- bold - bold
# Border color of non-focused windows # Border color of non-focused windows
inactiveBorderColor: inactiveBorderColor:
- default - default
# Border color of focused window when searching in that window # Border color of focused window when searching in that window
searchingActiveBorderColor: searchingActiveBorderColor:
- cyan - cyan
- bold - bold
# Color of keybindings help text in the bottom line # Color of keybindings help text in the bottom line
optionsTextColor: optionsTextColor:
- blue - blue
# Background color of selected line. # Background color of selected line.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line
selectedLineBgColor: selectedLineBgColor:
- blue - blue
# Background color of selected line when view doesn't have focus. # Background color of selected line when view doesn't have focus.
inactiveViewSelectedLineBgColor: inactiveViewSelectedLineBgColor:
- bold - bold
# Foreground color of copied commit # Foreground color of copied commit
cherryPickedCommitFgColor: cherryPickedCommitFgColor:
- blue - blue
# Background color of copied commit # Background color of copied commit
cherryPickedCommitBgColor: cherryPickedCommitBgColor:
- cyan - cyan
# Foreground color of marked base commit (for rebase) # Foreground color of marked base commit (for rebase)
markedBaseCommitFgColor: markedBaseCommitFgColor:
- blue - blue
# Background color of marked base commit (for rebase) # Background color of marked base commit (for rebase)
markedBaseCommitBgColor: markedBaseCommitBgColor:
- yellow - yellow
# Color for file with unstaged changes # Color for file with unstaged changes
unstagedChangesColor: unstagedChangesColor:
- red - red
# Default text color # Default text color
defaultFgColor: defaultFgColor:
- default - default
# Config relating to the commit length indicator # Config relating to the commit length indicator
commitLength: commitLength:
# If true, show an indicator of commit message length # If true, show an indicator of commit message length
show: true show: true
# If true, show the '5 of 20' footer at the bottom of list views # If true, show the '5 of 20' footer at the bottom of list views
showListFooter: true showListFooter: true
# If true, display the files in the file views as a tree. If false, display the files as a flat list. # If true, display the files in the file views as a tree. If false, display the files as a flat list.
# This can be toggled from within Lazygit with the '~' key, but that will not change the default. # This can be toggled from within Lazygit with the '~' key, but that will not change the default.
showFileTree: true showFileTree: true
# If true, show the number of lines changed per file in the Files view # If true, show the number of lines changed per file in the Files view
showNumstatInFilesView: false showNumstatInFilesView: false
# If true, show a random tip in the command log when Lazygit starts # If true, show a random tip in the command log when Lazygit starts
showRandomTip: true showRandomTip: true
# If true, show the command log # If true, show the command log
showCommandLog: true showCommandLog: true
# If true, show the bottom line that contains keybinding info and useful buttons. If false, this line will be hidden except to display a loader for an in-progress action. # If true, show the bottom line that contains keybinding info and useful buttons. If false, this line will be hidden except to display a loader for an in-progress action.
showBottomLine: true showBottomLine: true
# If true, show jump-to-window keybindings in window titles. # If true, show jump-to-window keybindings in window titles.
showPanelJumps: true showPanelJumps: true
# Deprecated: use nerdFontsVersion instead # Deprecated: use nerdFontsVersion instead
showIcons: false showIcons: false
# Nerd fonts version to use. # Nerd fonts version to use.
# One of: '2' | '3' | empty string (default) # One of: '2' | '3' | empty string (default)
# If empty, do not show icons. # If empty, do not show icons.
nerdFontsVersion: "" nerdFontsVersion: ""
# If true (default), file icons are shown in the file views. Only relevant if NerdFontsVersion is not empty. # If true (default), file icons are shown in the file views. Only relevant if NerdFontsVersion is not empty.
showFileIcons: true showFileIcons: true
# Length of author name in (non-expanded) commits view. 2 means show initials only. # Length of author name in (non-expanded) commits view. 2 means show initials only.
commitAuthorShortLength: 2 commitAuthorShortLength: 2
# Length of author name in expanded commits view. 2 means show initials only. # Length of author name in expanded commits view. 2 means show initials only.
commitAuthorLongLength: 17 commitAuthorLongLength: 17
# Length of commit hash in commits view. 0 shows '*' if NF icons aren't on. # Length of commit hash in commits view. 0 shows '*' if NF icons aren't on.
commitHashLength: 8 commitHashLength: 8
# If true, show commit hashes alongside branch names in the branches view. # If true, show commit hashes alongside branch names in the branches view.
showBranchCommitHash: false showBranchCommitHash: false
# Whether to show the divergence from the base branch in the branches view. # Whether to show the divergence from the base branch in the branches view.
# One of: 'none' | 'onlyArrow' | 'arrowAndNumber' # One of: 'none' | 'onlyArrow' | 'arrowAndNumber'
showDivergenceFromBaseBranch: none showDivergenceFromBaseBranch: none
# Height of the command log view # Height of the command log view
commandLogSize: 8 commandLogSize: 8
# Whether to split the main window when viewing file changes. # Whether to split the main window when viewing file changes.
# One of: 'auto' | 'always' # One of: 'auto' | 'always'
# If 'auto', only split the main window when a file has both staged and unstaged changes # If 'auto', only split the main window when a file has both staged and unstaged changes
splitDiff: auto splitDiff: auto
# Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default). # Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).
# One of: 'normal' (default) | 'half' | 'full' # One of: 'normal' (default) | 'half' | 'full'
windowSize: normal screenMode: normal
# Window border style. # Window border style.
# One of 'rounded' (default) | 'single' | 'double' | 'hidden' # One of 'rounded' (default) | 'single' | 'double' | 'hidden'
border: rounded border: rounded
# If true, show a seriously epic explosion animation when nuking the working tree. # If true, show a seriously epic explosion animation when nuking the working tree.
animateExplosion: true animateExplosion: true
# Whether to stack UI components on top of each other. # Whether to stack UI components on top of each other.
# One of 'auto' (default) | 'always' | 'never' # One of 'auto' (default) | 'always' | 'never'
portraitMode: auto portraitMode: auto
# How things are filtered when typing '/'. # How things are filtered when typing '/'.
# One of 'substring' (default) | 'fuzzy' # One of 'substring' (default) | 'fuzzy'
filterMode: substring filterMode: substring
# Config relating to the spinner. # Config relating to the spinner.
spinner: spinner:
# The frames of the spinner animation. # The frames of the spinner animation.
@ -218,116 +165,86 @@ gui:
- / - /
- "-" - "-"
- \ - \
# The "speed" of the spinner in milliseconds. # The "speed" of the spinner in milliseconds.
rate: 50 rate: 50
# Status panel view. # Status panel view.
# One of 'dashboard' (default) | 'allBranchesLog' # One of 'dashboard' (default) | 'allBranchesLog'
statusPanelView: dashboard statusPanelView: dashboard
# If true, jump to the Files panel after popping a stash # If true, jump to the Files panel after popping a stash
switchToFilesAfterStashPop: true switchToFilesAfterStashPop: true
# If true, jump to the Files panel after applying a stash # If true, jump to the Files panel after applying a stash
switchToFilesAfterStashApply: true switchToFilesAfterStashApply: true
# If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead # If true, when using the panel jump keys (default 1 through 5) and target panel is already active, go to next tab instead
switchTabsWithPanelJumpKeys: false switchTabsWithPanelJumpKeys: false
# Config relating to git # Config relating to git
git: git:
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md # See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md
paging: paging:
# Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never' # Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never'
colorArg: always colorArg: always
# e.g. # e.g.
# diff-so-fancy # diff-so-fancy
# delta --dark --paging=never # delta --dark --paging=never
# ydiff -p cat -s --wrap --width={{columnWidth}} # ydiff -p cat -s --wrap --width={{columnWidth}}
pager: "" pager: "delta --dark --paging=never"
# If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). # If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager).
useConfig: false useConfig: false
# e.g. 'difft --color=always' # e.g. 'difft --color=always'
externalDiffCommand: "" externalDiffCommand: ""
# Config relating to committing # Config relating to committing
commit: commit:
# If true, pass '--signoff' flag when committing # If true, pass '--signoff' flag when committing
signOff: false signOff: false
# Automatic WYSIWYG wrapping of the commit message as you type # Automatic WYSIWYG wrapping of the commit message as you type
autoWrapCommitMessage: true autoWrapCommitMessage: true
# If autoWrapCommitMessage is true, the width to wrap to # If autoWrapCommitMessage is true, the width to wrap to
autoWrapWidth: 72 autoWrapWidth: 72
# Config relating to merging # Config relating to merging
merging: merging:
# If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang # If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang
# Only applicable to unix users. # Only applicable to unix users.
manualCommit: false manualCommit: false
# Extra args passed to `git merge`, e.g. --no-ff # Extra args passed to `git merge`, e.g. --no-ff
args: "" args: ""
# The commit message to use for a squash merge commit. Can contain "{{selectedRef}}" and "{{currentBranch}}" placeholders. # The commit message to use for a squash merge commit. Can contain "{{selectedRef}}" and "{{currentBranch}}" placeholders.
squashMergeMessage: Squash merge {{selectedRef}} into {{currentBranch}} squashMergeMessage: Squash merge {{selectedRef}} into {{currentBranch}}
# list of branches that are considered 'main' branches, used when displaying commits # list of branches that are considered 'main' branches, used when displaying commits
mainBranches: mainBranches:
- master - master
- main - main
# Prefix to use when skipping hooks. E.g. if set to 'WIP', then pre-commit hooks will be skipped when the commit message starts with 'WIP' # Prefix to use when skipping hooks. E.g. if set to 'WIP', then pre-commit hooks will be skipped when the commit message starts with 'WIP'
skipHookPrefix: WIP skipHookPrefix: WIP
# If true, periodically fetch from remote # If true, periodically fetch from remote
autoFetch: true autoFetch: true
# If true, periodically refresh files and submodules # If true, periodically refresh files and submodules
autoRefresh: true autoRefresh: true
# If true, pass the --all arg to git fetch # If true, pass the --all arg to git fetch
fetchAll: true fetchAll: true
# If true, lazygit will automatically stage files that used to have merge # If true, lazygit will automatically stage files that used to have merge
# conflicts but no longer do; and it will also ask you if you want to # conflicts but no longer do; and it will also ask you if you want to
# continue a merge or rebase if you've resolved all conflicts. If false, it # continue a merge or rebase if you've resolved all conflicts. If false, it
# won't do either of these things. # won't do either of these things.
autoStageResolvedConflicts: true autoStageResolvedConflicts: true
# Command used when displaying the current branch git log in the main window # Command used when displaying the current branch git log in the main window
branchLogCmd: git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} -- branchLogCmd: git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --
# Command used to display git log of all branches in the main window. # Command used to display git log of all branches in the main window.
# Deprecated: Use `allBranchesLogCmds` instead. # Deprecated: Use `allBranchesLogCmds` instead.
allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium
# If true, do not spawn a separate process when using GPG # If true, do not spawn a separate process when using GPG
overrideGpg: false overrideGpg: false
# If true, do not allow force pushes # If true, do not allow force pushes
disableForcePushing: false disableForcePushing: false
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
commitPrefix: commitPrefix:
# pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*" # pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*"
pattern: "" pattern: ""
# Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] " # Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
replace: "" replace: ""
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix
branchPrefix: "" branchPrefix: ""
# If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀 # If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀
# (This should really be under 'gui', not 'git') # (This should really be under 'gui', not 'git')
parseEmoji: false parseEmoji: false
# Config for showing the log in the commits view # Config for showing the log in the commits view
log: log:
# One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default' # One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default'
@ -336,110 +253,84 @@ git:
# #
# Deprecated: Configure this with `Log menu -> Commit sort order` (<c-l> in the commits window by default). # Deprecated: Configure this with `Log menu -> Commit sort order` (<c-l> in the commits window by default).
order: topo-order order: topo-order
# This determines whether the git graph is rendered in the commits panel # This determines whether the git graph is rendered in the commits panel
# One of 'always' | 'never' | 'when-maximised' # One of 'always' | 'never' | 'when-maximised'
# #
# Deprecated: Configure this with `Log menu -> Show git graph` (<c-l> in the commits window by default). # Deprecated: Configure this with `Log menu -> Show git graph` (<c-l> in the commits window by default).
showGraph: always showGraph: always
# displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`) # displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`)
showWholeGraph: false showWholeGraph: false
# When copying commit hashes to the clipboard, truncate them to this # When copying commit hashes to the clipboard, truncate them to this
# length. Set to 40 to disable truncation. # length. Set to 40 to disable truncation.
truncateCopiedCommitHashesTo: 12 truncateCopiedCommitHashesTo: 12
# Periodic update checks # Periodic update checks
update: update:
# One of: 'prompt' (default) | 'background' | 'never' # One of: 'prompt' (default) | 'background' | 'never'
method: prompt method: prompt
# Period in days between update checks # Period in days between update checks
days: 14 days: 14
# Background refreshes # Background refreshes
refresher: refresher:
# File/submodule refresh interval in seconds. # File/submodule refresh interval in seconds.
# Auto-refresh can be disabled via option 'git.autoRefresh'. # Auto-refresh can be disabled via option 'git.autoRefresh'.
refreshInterval: 10 refreshInterval: 10
# Re-fetch interval in seconds. # Re-fetch interval in seconds.
# Auto-fetch can be disabled via option 'git.autoFetch'. # Auto-fetch can be disabled via option 'git.autoFetch'.
fetchInterval: 60 fetchInterval: 60
# If true, show a confirmation popup before quitting Lazygit # If true, show a confirmation popup before quitting Lazygit
confirmOnQuit: false confirmOnQuit: false
# If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close # If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close
quitOnTopLevelReturn: false quitOnTopLevelReturn: false
# Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc # Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc
os: os:
# Command for editing a file. Should contain "{{filename}}". # Command for editing a file. Should contain "{{filename}}".
edit: "" edit: ""
# Command for editing a file at a given line number. Should contain # Command for editing a file at a given line number. Should contain
# "{{filename}}", and may optionally contain "{{line}}". # "{{filename}}", and may optionally contain "{{line}}".
editAtLine: "" editAtLine: ""
# Same as EditAtLine, except that the command needs to wait until the # Same as EditAtLine, except that the command needs to wait until the
# window is closed. # window is closed.
editAtLineAndWait: "" editAtLineAndWait: ""
# For opening a directory in an editor # For opening a directory in an editor
openDirInEditor: "" openDirInEditor: ""
# A built-in preset that sets all of the above settings. Supported presets # A built-in preset that sets all of the above settings. Supported presets
# are defined in the getPreset function in editor_presets.go. # are defined in the getPreset function in editor_presets.go.
editPreset: "" editPreset: ""
# Command for opening a file, as if the file is double-clicked. Should # Command for opening a file, as if the file is double-clicked. Should
# contain "{{filename}}", but doesn't support "{{line}}". # contain "{{filename}}", but doesn't support "{{line}}".
open: "" open: ""
# Command for opening a link. Should contain "{{link}}". # Command for opening a link. Should contain "{{link}}".
openLink: "" openLink: ""
# EditCommand is the command for editing a file. # EditCommand is the command for editing a file.
# Deprecated: use Edit instead. Note that semantics are different: # Deprecated: use Edit instead. Note that semantics are different:
# EditCommand is just the command itself, whereas Edit contains a # EditCommand is just the command itself, whereas Edit contains a
# "{{filename}}" variable. # "{{filename}}" variable.
editCommand: "" editCommand: ""
# EditCommandTemplate is the command template for editing a file # EditCommandTemplate is the command template for editing a file
# Deprecated: use EditAtLine instead. # Deprecated: use EditAtLine instead.
editCommandTemplate: "" editCommandTemplate: ""
# OpenCommand is the command for opening a file # OpenCommand is the command for opening a file
# Deprecated: use Open instead. # Deprecated: use Open instead.
openCommand: "" openCommand: ""
# OpenLinkCommand is the command for opening a link # OpenLinkCommand is the command for opening a link
# Deprecated: use OpenLink instead. # Deprecated: use OpenLink instead.
openLinkCommand: "" openLinkCommand: ""
# CopyToClipboardCmd is the command for copying to clipboard. # CopyToClipboardCmd is the command for copying to clipboard.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard
copyToClipboardCmd: "" copyToClipboardCmd: ""
# ReadFromClipboardCmd is the command for reading the clipboard. # ReadFromClipboardCmd is the command for reading the clipboard.
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard
readFromClipboardCmd: "" readFromClipboardCmd: ""
# If true, don't display introductory popups upon opening Lazygit. # If true, don't display introductory popups upon opening Lazygit.
disableStartupPopups: false disableStartupPopups: false
# What to do when opening Lazygit outside of a git repo. # What to do when opening Lazygit outside of a git repo.
# - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo # - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo
# - 'create': initialize a new repo # - 'create': initialize a new repo
# - 'skip': open most recent repo # - 'skip': open most recent repo
# - 'quit': exit Lazygit # - 'quit': exit Lazygit
notARepository: prompt notARepository: prompt
# If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit. # If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.
promptToReturnFromSubprocess: true promptToReturnFromSubprocess: true
# Keybindings # Keybindings
keybinding: keybinding:
universal: universal:
@ -494,10 +385,8 @@ keybinding:
scrollDownMain-alt2: <c-d> scrollDownMain-alt2: <c-d>
executeShellCommand: ":" executeShellCommand: ":"
createRebaseOptionsMenu: m createRebaseOptionsMenu: m
# 'Files' appended for legacy reasons # 'Files' appended for legacy reasons
pushFiles: P pushFiles: P
# 'Files' appended for legacy reasons # 'Files' appended for legacy reasons
pullFiles: p pullFiles: p
refresh: R refresh: R

View file

@ -10,5 +10,5 @@
# --enable-features=UseOzonePlatform # --enable-features=UseOzonePlatform
# --ozone-platform=wayland # --ozone-platform=wayland
--ozone-platform-hint=x11 --ozone-platform-hint=auto
# --enable-wayland-ime --enable-wayland-ime

View file

@ -11,5 +11,5 @@
# --enable-features=UseOzonePlatform # --enable-features=UseOzonePlatform
# --ozone-platform=wayland # --ozone-platform=wayland
# --enable-icd # --enable-icd
# --enable-wayland-ime --ozone-platform-hint=auto
--ozone-platform-hint=x11 --enable-wayland-ime

View file

@ -1,7 +1,6 @@
// Paste this into surfingkeys advanced settings // Paste this into surfingkeys advanced settings
// or use: // or use:
// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/tools/browser/surfingkeys.js // Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/tools/browser/surfingkeys.js
// TODO: Visual Mode
// #region Example // #region Example
/** Examples /** Examples
@ -23,247 +22,459 @@ api.unmap('<ctrl-i>');
// Settings // Settings
settings.language = "zh-CN"; settings.language = "zh-CN";
settings.showModeStatus = false; settings.showModeStatus = false;
// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main
// #region Helper // #region Helper
const {
aceVimMap,
addVimMapKey,
mapkey,
imap,
imapkey,
getClickableElements,
vmapkey,
map,
unmap,
cmap,
addSearchAlias,
removeSearchAlias,
tabOpenLink,
readText,
Clipboard,
Front,
Hints,
Visual,
RUNTIME,
} = api;
// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main
const forward = { const forward = {
add: function (key) { // 转发即将被 unmap 的键 add: function (key) {
return api.map(`for${key}`, key) // 转发即将被 unmap 的键
return api.map(`for${key}`, key);
}, },
cancel: function (key) { // 删除转发生成的键 cancel: function (key) {
api.unmap(`for${key}`) // 删除转发生成的键
api.unmap(key) api.unmap(`for${key}`);
api.unmap(key);
}, },
use: function (key) { use: function (key) {
return `for${key}` return `for${key}`;
} },
} };
const colemak = { const colemak = {
forward: function (key) { // 转发即将被 unmap 的键 forward: function (key) {
api.map(key, `col${key}`) // 转发即将被 unmap 的键
api.unmap(`col${key}`) api.map(key, `col${key}`);
api.unmap(`col${key}`);
}, },
use: function (key) { use: function (key) {
return `col${key}` return `col${key}`;
}, },
map: function (a, b) { map: function (a, b) {
api.map(colemak.use(a), forward.use(b)) api.map(colemak.use(a), forward.use(b));
}
}
const vforward = {
add: function (key) { // 转发即将被 unmap 的键
return api.vmap(`vfor${key}`, key)
}, },
cancel: function (key) { // 删除转发生成的键 };
api.vunmap(`vfor${key}`)
api.vunmap(key) const vForward = {
add: function (key) {
// 转发即将被 unmap 的键
return api.vmap(`vfor${key}`, key);
},
cancel: function (key) {
// 删除转发生成的键
api.vunmap(`vfor${key}`);
api.vunmap(key);
}, },
use: function (key) { use: function (key) {
return `vfor${key}` return `vfor${key}`;
} },
} };
const vcolemak = {
forward: function (key) { // 转发即将被 unmap 的键
api.vmap(key, `vcol${key}`)
api.vunmap(`vcol${key}`)
const vColemak = {
forward: function (key) {
// 转发即将被 unmap 的键
api.vmap(key, `vcol${key}`);
api.vunmap(`vcol${key}`);
}, },
use: function (key) { use: function (key) {
return `vcol${key}` return `vcol${key}`;
}, },
map: function (a, b) { map: function (a, b) {
api.vmap(vcolemak.use(a), vforward.use(b)) api.vmap(vColemak.use(a), vForward.use(b));
} },
} };
const forwardFactory = { const forwardFactory = {
push: function (mapLists) { // forward original keys push: function (mapLists) {
// forward original keys
for (let key in mapLists) { for (let key in mapLists) {
forward.add(mapLists[key]) forward.add(mapLists[key]);
} }
}, },
map: function (mapLists) { map: function (mapLists) {
for (let key in mapLists) { for (let key in mapLists) {
colemak.map(key, mapLists[key]) colemak.map(key, mapLists[key]);
} }
}, },
pull: function (mapLists) { pull: function (mapLists) {
for (let key in mapLists) { for (let key in mapLists) {
forward.cancel(mapLists[key]) forward.cancel(mapLists[key]);
} }
for (let key in mapLists) { for (let key in mapLists) {
colemak.forward(key) colemak.forward(key);
} }
} },
} };
const vforwardFactory = { const vForwardFactory = {
push: function (mapLists) { // forward original keys push: function (mapLists) {
// forward original keys
for (let key in mapLists) { for (let key in mapLists) {
vforward.add(mapLists[key]) vForward.add(mapLists[key]);
} }
}, },
map: function (mapLists) { map: function (mapLists) {
for (let key in mapLists) { for (let key in mapLists) {
vcolemak.map(key, mapLists[key]) vColemak.map(key, mapLists[key]);
} }
}, },
pull: function (mapLists) { pull: function (mapLists) {
for (let key in mapLists) { for (let key in mapLists) {
vforward.cancel(mapLists[key]) vForward.cancel(mapLists[key]);
} }
for (let key in mapLists) { for (let key in mapLists) {
vcolemak.forward(key) vColemak.forward(key);
} }
} },
} };
const parseSearchResponse = function (response) { const parseSearchResponse = function (response) {
const res = JSON.parse(response.text); const res = JSON.parse(response.text);
return res.map(r => r.phrase); return res.map((r) => r.phrase);
}; };
const _addSearchAlias = function (alias, name, searchUrl, searchPrefix = 's', acUrl = "https://duckduckgo.com/ac/?q=", parseResponse = parseSearchResponse) { const _addSearchAlias = function (
api.addSearchAlias(alias, name, searchUrl, searchPrefix, acUrl, parseResponse); alias,
} name,
searchUrl,
acUrl = "https://duckduckgo.com/ac/?q=",
searchPrefix = "s",
parseResponse = parseSearchResponse,
) {
api.addSearchAlias(
alias,
name,
searchUrl,
searchPrefix,
acUrl,
parseResponse,
);
};
// #endregion // #endregion
// #region Keymap // #region Keymap
const mapLists = { const mapLists = {
/// scroll page /// scroll page
// Arrow // Arrow
'n': 'j', n: "j",
'e': 'k', e: "k",
'i': 'l', i: "l",
// l <-> i // l <-> i
'l': 'i', l: "i",
'L': 'I', L: "I",
// k <-> n // k <-> n
'k': 'n', k: "n",
'K': 'N', K: "N",
// j <-> e // j <-> e
'j': 'e', j: "e",
// PrevTab < H - I > NextTab // PrevTab < H - I > NextTab
'H': 'E', H: "E",
'I': 'R', I: "R",
// E,N -> Up/Down HalfPage // E,N -> Up/Down HalfPage
'N': 'd', N: "d",
'E': 'e', E: "e",
// F -> Open Link in New Tab // F -> Open Link in New Tab
'F': 'af', F: "af",
// oH -> Tab History // oH -> Tab History
'oH': 'H', oH: "H",
// gh/gi -> Prev/Next History // gh/gi -> Prev/Next History
'gh': 'S', gh: "S",
'gi': 'D', gi: "D",
// t -> Open Link in New Tab // t -> Open Link in New Tab
't': 'gf', t: "gf",
// 缩放 // 缩放
'zu': 'zi', zu: "zi",
'zo': 'ze', zo: "ze",
'zz': 'zr', zz: "zr",
} };
const vmapLists = { const vMapLists = {
'n': 'j', n: "j",
'N': 'J', N: "J",
'e': 'k', e: "k",
'E': 'K', E: "K",
'i': 'l', i: "l",
'I': 'L', I: "L",
'j': 'e', j: "e",
'J': 'E', J: "E",
'k': 'n', k: "n",
'K': 'N', K: "N",
} };
forwardFactory.push(mapLists) forwardFactory.push(mapLists);
forwardFactory.map(mapLists) forwardFactory.map(mapLists);
vforwardFactory.push(vmapLists) vForwardFactory.push(vMapLists);
vforwardFactory.map(vmapLists) vForwardFactory.map(vMapLists);
// 鼠标点击 // 鼠标点击
api.unmap('gi') api.unmap("gi");
api.unmap('[[') api.unmap("[[");
api.unmap(']]') api.unmap("]]");
api.unmap(';m') api.unmap(";m");
api.unmap(';fs') api.unmap(";fs");
api.unmap('O') api.unmap("O");
api.unmap('C') api.unmap("C");
api.map('g/', 'gU') // Goto Root Domain api.map("g/", "gU"); // Goto Root Domain
forwardFactory.pull(mapLists) // p to site-specific
api.unmap("p");
api.unmap("<space>"); // Leader Key
forwardFactory.pull(mapLists);
vForwardFactory.pull(vMapLists);
// #endregion // #endregion
// #region Search Alias // #region Search Alias
api.unmap('os') // StackOverflow removeSearchAlias("s"); // StackOverflow
api.vunmap('ss') removeSearchAlias("d"); // DuckDuckGo
api.unmap('ob') // Baidu removeSearchAlias("g"); // Google
api.vunmap('sb') removeSearchAlias("b"); // Baidu
api.unmap('og') // Google removeSearchAlias("w"); // Bing
api.vunmap('sg') removeSearchAlias("y"); // YouTube
api.unmap('od') // DuckDuckGo
api.vunmap('sd')
/// Common /// Common
_addSearchAlias('dd', 'DuckDuckGo', 'https://duckduckgo.com/?q=') _addSearchAlias("dd", "DuckDuckGo", "https://duckduckgo.com/?q=");
_addSearchAlias('gg', 'Google', 'https://www.google.com/search?q=') _addSearchAlias("gg", "Google", "https://www.google.com/search?q=");
_addSearchAlias('bd', 'Baidu', 'https://www.baidu.com/s?wd=') _addSearchAlias("bd", "Baidu", "https://www.baidu.com/s?wd=");
_addSearchAlias('bi', 'Bing', 'https://www.bing.com/search?q=') _addSearchAlias("bi", "Bing", "https://www.bing.com/search?q=");
_addSearchAlias(
"wk",
"Wikipedia",
"https://en.wikipedia.org/w/index.php?title=Special:Search&search=",
);
_addSearchAlias("re", "Reddit", "https://www.reddit.com/search?q=");
_addSearchAlias("st", "Steam", "https://store.steampowered.com/search/?term=");
_addSearchAlias(
"ud",
"UrbanDictionary",
"https://www.urbandictionary.com/define.php?term=",
);
_addSearchAlias("tw", "X", "https://twitter.com/search?q=");
_addSearchAlias("de", "Thesaurus", "https://www.onelook.com/?w=");
_addSearchAlias(
"ww",
"WantWords",
"https://www.shenyandayi.com/wantWordsResult?lang=zh&query=",
);
/// AI Search /// AI Search
_addSearchAlias('fe', 'Felo', 'https://felo.ai/search?q=') _addSearchAlias("fe", "Felo", "https://felo.ai/search?q=");
_addSearchAlias('pp', 'Perplexity', 'https://www.perplexity.ai/?q=') _addSearchAlias("pp", "Perplexity", "https://www.perplexity.ai/?q=");
_addSearchAlias('cg', 'ChatGPT', 'https://chat.openai.com/?q=') _addSearchAlias("cg", "ChatGPT", "https://chat.openai.com/?q=");
_addSearchAlias("mc", "Metacritic", "https://www.metacritic.com/search/");
/// EECS Related /// EECS Related
_addSearchAlias('gh', 'GitHub', 'https://github.com/search?type=repositories&q=') _addSearchAlias(
_addSearchAlias('so', 'StackOverflow', 'https://stackoverflow.com/search?q=') "gh",
_addSearchAlias('aw', 'ArchWiki', 'https://wiki.archlinux.org/index.php?search=') "GitHub",
/// Software "https://github.com/search?type=repositories&q=",
_addSearchAlias('sc', 'Scoop', 'https://scoop.sh/#/apps?q=') );
_addSearchAlias('br', 'Brew', 'https://duckduckgo.com/?q=!brew ') _addSearchAlias("so", "StackOverflow", "https://stackoverflow.com/search?q=");
_addSearchAlias("se", "StackExchange", "https://stackexchange.com/search?q=");
_addSearchAlias(
"aw",
"ArchWiki",
"https://wiki.archlinux.org/index.php?search=",
);
_addSearchAlias("wa", "WolframAlpha", "https://www.wolframalpha.com/input/?i=");
_addSearchAlias("eb", "ebay", "https://www.ebay.co.uk/sch/i.html?kw=");
// Programming language packages
_addSearchAlias("py", "pypi", "https://pypi.org/search/?q=");
_addSearchAlias("ng", "NuGet", "https://www.nuget.org/packages?q=");
_addSearchAlias("np", "npm", "https://www.npmjs.com/search?q=");
// Package Manager Search
_addSearchAlias("wg", "winget", "https://winget.ragerworks.com/search/all/");
_addSearchAlias("sc", "Scoop", "https://scoop.sh/#/apps?q=");
_addSearchAlias("br", "HomeBrew", "https://duckduckgo.com/?q=!brew ");
_addSearchAlias("au", "AUR", "https://aur.archlinux.org/packages?K=");
_addSearchAlias("pa", "Pacman", "https://archlinux.org/packages/?q=");
_addSearchAlias("ap", "APT", "https://packages.ubuntu.com/search?keywords=");
_addSearchAlias(
"a2",
"AlternativeTo",
"https://alternativeto.net/browse/search/?q=",
);
_addSearchAlias(
"cr",
"Chrome Web Store",
"https://chrome.google.com/webstore/search/",
);
/// Video
_addSearchAlias(
"yt",
"YouTube",
"https://www.youtube.com/results?search_query=",
);
_addSearchAlias("bl", "Bilibili", "https://search.bilibili.com/all?keyword=");
// #endregion // #endregion
// #region Site-specific // #region Site-specific
// chatgpt.com // chatgpt.com
api.unmap('t', /chatgpt.com/); const chatgptNewChat = function () {
api.mapkey('tn', 'New Chat', function () { var btn = document.querySelector(
var btn = document.querySelector('div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)') "div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)",
);
btn.click(); btn.click();
}, { domain: /chatgpt.com/ }); };
api.mapkey('ts', 'Start/Stop Generating', function () { const chatgptStartStop = function () {
var btn = document.querySelector('button.h-8:nth-child(2)'); var btn = document.querySelector("button.h-8:nth-child(2)");
btn.click(); btn.click();
}, { domain: /chatgpt.com/ }); };
api.mapkey('ts', 'Start/Stop Generating', function () { api.unmap("t", /chatgpt.com/);
var btn = document.querySelector('button.h-8:nth-child(2)'); api.mapkey("tn", "New Chat", chatgptNewChat, { domain: /chatgpt.com/ });
btn.click(); api.mapkey("ts", "Start/Stop Generating", chatgptStartStop, {
}, { domain: /chatgpt.com/ }); domain: /chatgpt.com/,
api.mapkey('S', 'Start/Stop Generating', function () { });
var btn = document.querySelector('button.h-8:nth-child(2)'); api.mapkey("S", "Start/Stop Generating", chatgptStartStop, {
btn.click(); domain: /chatgpt.com/,
}, { domain: /chatgpt.com/ }); });
api.mapkey('an', 'New Chat', function () { api.mapkey("an", "New Chat", chatgptNewChat, { domain: /chatgpt.com/ });
var btn = document.querySelector('div.no-draggable:nth-child(3) > span:nth-child(1) > button:nth-child(1)') api.mapkey("as", "Start/Stop Generating", chatgptStartStop, {
btn.click(); domain: /chatgpt.com/,
}, { domain: /chatgpt.com/ }); });
api.mapkey('as', 'Start/Stop Generating', function () {
var btn = document.querySelector('button.h-8:nth-child(2)');
btn.click();
}, { domain: /chatgpt.com/ });
api.mapkey('as', 'Start/Stop Generating', function () {
var btn = document.querySelector('button.h-8:nth-child(2)');
btn.click();
}, { domain: /chatgpt.com/ });
//api.mapkey('tm', 'Toggle Model', function () { //api.mapkey('tm', 'Toggle Model', function () {
// var btn = document.querySelector('#radix -\: r2i\:'); // var btn = document.querySelector('#radix -\: r2i\:');
// btn.click(); // btn.click();
//}, { domain: /chatgpt.com/ }); //}, { domain: /chatgpt.com/ });
// perplexity.ai // perplexity.ai
api.unmap('<Ctrl-i>', /perplexity.ai/); api.unmap("<Ctrl-i>", /perplexity.ai/); // allows to use perplexity web keybindings
api.mapkey("aB", "Add Perplexity Bookmark", function () {
// button.border:nth-child(2)
var btn = document.querySelector("button.border:nth-child(2)");
btn.click();
});
// #endregion // #endregion
// #region ACE Editor
addVimMapKey(
// Navigation
{
keys: "k",
type: "motion",
motion: "findNext",
motionArgs: { forward: true, toJumplist: true },
},
{
keys: "K",
type: "motion",
motion: "findNext",
motionArgs: { forward: false, toJumplist: true },
},
// Word movement
{
keys: "j",
type: "motion",
motion: "moveByWords",
motionArgs: { forward: true, wordEnd: true, inclusive: true },
},
{
keys: "J",
type: "motion",
motion: "moveByWords",
motionArgs: {
forward: true,
wordEnd: true,
bigWord: true,
inclusive: true,
},
},
// Insert mode entries
{
keys: "l",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "inplace" },
context: "normal",
},
{
keys: "gl",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "lastEdit" },
context: "normal",
},
{
keys: "L",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "firstNonBlank" },
context: "normal",
},
{
keys: "gL",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "bol" },
context: "normal",
},
{
keys: "L",
type: "action",
action: "enterInsertMode",
isEdit: true,
actionArgs: { insertAt: "startOfSelectedArea" },
context: "visual",
},
{
keys: "n",
type: "motion",
motion: "moveByLines",
motionArgs: { forward: true, linewise: true },
},
{
keys: "e",
type: "motion",
motion: "moveByLines",
motionArgs: { forward: false, linewise: true },
},
{
keys: "i",
type: "motion",
motion: "moveByCharacters",
motionArgs: { forward: true },
},
{
keys: "H",
type: "keyToKey",
toKeys: "^",
},
{
keys: "I",
type: "keyToKey",
toKeys: "$",
},
{
keys: "Y",
type: "keyToKey",
toKeys: "y$",
},
);
// #endregion
// #region Hints
Hints.setNumeric();
// #endregion

View file

@ -142,7 +142,13 @@ end
# Coursier: Scala dependency manager # Coursier: Scala dependency manager
if command -v coursier > /dev/null if command -v coursier > /dev/null
set -gx PATH "$PATH:/home/js0ny/.local/share/coursier/bin" set -gx PATH "$PATH:$XDG_DATA_HOME/coursier/bin"
end end
# pnpm
set -gx PNPM_HOME "$XDG_DATA_HOME/pnpm"
if not string match -q -- $PNPM_HOME $PATH
set -gx PATH "$PNPM_HOME" $PATH
end
# pnpm end
test -d /opt/miniconda3 && source /opt/miniconda3/etc/fish/conf.d/conda.fish test -d /opt/miniconda3 && source /opt/miniconda3/etc/fish/conf.d/conda.fish

View file

@ -9,7 +9,13 @@
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown", -- 指定文件类型 pattern = "markdown", -- 指定文件类型
callback = function() callback = function()
vim.api.nvim_buf_set_keymap(0, "v", "`", "c`<C-r>\"`<Esc>", { noremap = true, silent = true, desc = "Wrap selection with backticks" }) vim.api.nvim_buf_set_keymap(
0,
"v",
"`",
'c`<C-r>"`<Esc>',
{ noremap = true, silent = true, desc = "Wrap selection with backticks" }
)
end, end,
}) })
@ -24,5 +30,4 @@ require("config.plugins")
-- 加载主题 -- 加载主题
require("config.colorscheme") require("config.colorscheme")
-- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree }) -- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })

View file

@ -1 +1 @@
vim.cmd.colorscheme("catppuccin") vim.cmd.colorscheme("kanagawa")

View file

@ -1,2 +1 @@
require("keymaps") require("keymaps")

View file

@ -54,4 +54,3 @@ opt.sidescrolloff = 10
opt.conceallevel = 2 opt.conceallevel = 2
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"

View file

@ -1,20 +1,23 @@
local mode_arrow = { "n", "v", "o", "s", "x" } local mode_arrow = { "n", "v", "o", "s", "x" }
local keymaps_basic = { -- Modification of Original Keymap - Colemak local keymaps_basic = { -- Modification of Original Keymap - Colemak
{ mode = mode_arrow, keys = "n", cmd = "j" }, { mode = mode_arrow, keys = "n", cmd = "j", desc = "Down" },
{ mode = mode_arrow, keys = "e", cmd = "k" }, { mode = mode_arrow, keys = "e", cmd = "k", desc = "Up" },
{ mode = mode_arrow, keys = "i", cmd = "l" }, { mode = mode_arrow, keys = "i", cmd = "l", desc = "Right" },
{ keys = "H", cmd = ":bprevious<CR>" }, { keys = "H", cmd = ":bprevious<CR>" },
{ keys = "N", cmd = "J" }, { keys = "N", cmd = "5j" },
{ keys = "E", cmd = "K" }, { keys = "E", cmd = "5k" },
{ keys = "I", cmd = ":bnext<CR>" }, { keys = "I", cmd = ":bnext<CR>" },
{ keys = "l", cmd = "i" }, -- Text object implementation
{ mode = { "n", "o", "x" }, keys = "l", cmd = "i", group = "inside" },
{ keys = "L", cmd = "I" }, { keys = "L", cmd = "I" },
{ keys = "k", cmd = "n" }, { keys = "k", cmd = "n" },
{ keys = "K", cmd = "N" }, { keys = "K", cmd = "N" },
{ keys = "j", cmd = "e" }, { keys = "j", cmd = "e" },
{ keys = "J", cmd = "E" }, { keys = "J", cmd = "E" },
{ keys = "Y", cmd = "y$"}, { keys = "Y", cmd = "y$" },
-- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L60
{ keys = "<Esc>", cmd = "<Cmd>nohlsearch<Bar>diffupdate<CR>" },
} }
return keymaps_basic return keymaps_basic

View file

@ -1,4 +1,5 @@
local M = {} local M = {}
local keymaps_user_command = require("keymaps.user-command")
local global_default_opts = { noremap = true, silent = true } local global_default_opts = { noremap = true, silent = true }
local global_default_mode = { "n" } local global_default_mode = { "n" }
-- local mode_arrow = { "n", "v", "o", "s", "x" } -- local mode_arrow = { "n", "v", "o", "s", "x" }
@ -11,8 +12,6 @@ local function set_keymaps(maps, default_opts, default_mode)
end end
end end
local keymaps_basic = require("keymaps.basic") local keymaps_basic = require("keymaps.basic")
local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global
local keymaps_leader = require("keymaps.leaders") local keymaps_leader = require("keymaps.leaders")
@ -37,7 +36,7 @@ end
local function set_markdown_keymaps(bufnr) local function set_markdown_keymaps(bufnr)
local opts = { noremap = true, silent = true, buffer = bufnr } local opts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set("v", "`", "c`<C-r>\"`<Esc>", opts) vim.keymap.set("v", "`", 'c`<C-r>"`<Esc>', opts)
end end
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {

View file

@ -1,6 +1,5 @@
local M = {} local M = {}
-- Markdown -- Markdown
local function set_markdown_keymaps(bufnr) local function set_markdown_keymaps(bufnr)
@ -11,11 +10,10 @@ local function set_markdown_keymaps(bufnr)
end end
end end
M.markdown = { M.markdown = {
{ mode = "v", keys = "`", cmd = "c`<Esc>pi`<Esc>" , desc = "Wrap selection in ` for inline code" }, { mode = "v", keys = "`", cmd = "c`<Esc>pi`<Esc>", desc = "Wrap selection in ` for inline code" },
{ mode = "v", keys = "*", cmd = "c**<Esc>pi**<Esc>" , desc = "Wrap selection in ** for bold" }, { mode = "v", keys = "*", cmd = "c**<Esc>pi**<Esc>", desc = "Wrap selection in ** for bold" },
{ mode = "v", keys = "_", cmd = "c*<Esc>pi*<Esc>" , desc = "Wrap selection in * for italic" }, { mode = "v", keys = "_", cmd = "c*<Esc>pi*<Esc>", desc = "Wrap selection in * for italic" },
} }
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {

View file

@ -1,11 +1,47 @@
local M = {} local M = {}
local formatFx = function()
require("conform").format({ async = true })
end
local renameCurrentBuffer = function()
local old_name = vim.fn.expand("%:p")
local new_name = vim.fn.input("New name: ", vim.fn.expand("%:p:h") .. "/")
if new_name == "" then
print("No new name provided")
return
elseif new_name == old_name then
return
end
vim.cmd("write")
local success, err = os.rename(old_name, new_name)
if not success then
print("Error renaming file: " .. err)
return
end
vim.cmd("edit " .. new_name)
vim.cmd("bdelete " .. old_name)
end
vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
local leader_general = { local leader_general = {
{ keys = "<space>", cmd = ":Telescope find_files<CR>", desc = "Find Files" }, { keys = "<space>", cmd = ":Telescope find_files<CR>", desc = "Find Files" },
{ keys = "/", cmd = ":Telescope live_grep<CR>", desc = "Grep Files" }, { keys = "/", cmd = ":Telescope live_grep<CR>", desc = "Grep Files" },
{ keys = "-", cmd = ":split<CR>", desc = "Split to down" },
{ keys = "\\", cmd = ":vsplit<CR>", desc = "Split to right" },
{ keys = "|", cmd = ":vsplit<CR>", desc = "Split to right" },
{ keys = "h", cmd = "<C-w>h", desc = "Left Window" },
{ keys = "n", cmd = "<C-w>j", desc = "Down Window" },
{ keys = "e", cmd = "<C-w>k", desc = "Up Window" },
{ keys = "i", cmd = "<C-w>l", desc = "Right Window" },
} }
for _,map in ipairs(leader_general) do for _, map in ipairs(leader_general) do
map.keys = "<leader>" .. map.keys map.keys = "<leader>" .. map.keys
table.insert(M, map) table.insert(M, map)
end end
@ -35,17 +71,28 @@ local leader_w = { -- leader w: Windows Management
{ keys = "I", cmd = ":resize -5<CR>", desc = "Decrease Window Width" }, { keys = "I", cmd = ":resize -5<CR>", desc = "Decrease Window Width" },
} }
local leader_f = { -- leader f: Files/Find local leader_f = { -- <leader>f: +files/find
{ keys = "f", cmd = ":Telescope fd<CR>", desc = "Find Files"}, { keys = "f", cmd = ":Telescope fd<CR>", desc = "Find Files" },
{ keys = "s", cmd = ":Telescope live_grep<CR>", desc = "Grep Files"}, { keys = "s", cmd = ":Telescope live_grep<CR>", desc = "Grep Files" },
{ keys = "b", cmd = ":Telescope buffers<CR>", desc = "List Buffers"}, { keys = "b", cmd = ":Telescope buffers<CR>", desc = "List Buffers" },
{ keys = "e", cmd = ":NvimTreeToggle<CR>", desc = "Toggle File Explorer" }, { keys = "e", cmd = ":NvimTreeToggle<CR>", desc = "Toggle File Explorer" },
{ keys = "t", cmd = ":FloatermToggle<CR>", desc = "toggle visibility of the float terminal" },
{ keys = "T", cmd = ":FloatermNew<CR>", desc = "Spawn a float terminal" },
{ keys = "h", cmd = ":Telescope oldfiles<CR>", desc = "Search history files" },
{ keys = "c", cmd = ":Telescope find_files cwd=~/.config/nvim<CR>", desc = "Search Config" },
{ keys = "o", cmd = ":!open %", desc = "Open file in default program" },
{ keys = "R", cmd = renameCurrentBuffer, desc = "Rename current file" },
} }
local leader_p = { -- leader p: Project local leader_p = { -- leader p: Project
{ keys = "p", cmd = ":Telescope projects<CR>", desc = "List all Projects" },
{ keys = "g", cmd = ":Telescope projects<CR>", desc = "List all Git Projects" },
{ keys = "s", cmd = ":Telescope session-lens<CR>", desc = "List all sessions" },
} }
local leader_b = { -- leader b: Buffer local leader_b = { -- <leader>b: +buffer
{ keys = "a", cmd = ":Alpha<CR>", desc = "Dashboard" },
{ keys = "b", cmd = ":Telescope buffers<CR>", desc = "List Buffers" },
{ keys = "d", cmd = ":bdelete<CR>", desc = "Delete Buffer" }, { keys = "d", cmd = ":bdelete<CR>", desc = "Delete Buffer" },
{ keys = "h", cmd = ":bprevious<CR>", desc = "Previous Buffer" }, { keys = "h", cmd = ":bprevious<CR>", desc = "Previous Buffer" },
{ keys = "i", cmd = ":bnext<CR>", desc = "Next Buffer" }, { keys = "i", cmd = ":bnext<CR>", desc = "Next Buffer" },
@ -54,6 +101,25 @@ local leader_b = { -- leader b: Buffer
{ keys = "0", cmd = ":bfirst<CR>", desc = "First Buffer" }, { keys = "0", cmd = ":bfirst<CR>", desc = "First Buffer" },
{ keys = "^", cmd = ":bfirst<CR>", desc = "First Buffer" }, { keys = "^", cmd = ":bfirst<CR>", desc = "First Buffer" },
{ keys = "$", cmd = ":blast<CR>", desc = "Last Buffer" }, { keys = "$", cmd = ":blast<CR>", desc = "Last Buffer" },
-- { keys = "s", cmd = ":Telescope buffers<CR>", desc = "Search buffers" },
}
local leader_t = { -- <leader>t: +toggle/test
{ keys = "f", cmd = ":NvimTreeToggle", desc = "Toggle File Explorer" },
{ keys = "F", cmd = ":FormatToggle<CR>", desc = "Toggle autoformat-on-save" },
{ keys = "t", cmd = ":FloatermToggle<CR>", desc = "toggle visibility of the float terminal" },
}
local leader_c = { -- <leader>c: +code/compile
{ keys = "r", cmd = ":RunCode<CR>", desc = "Run code" },
{ keys = "e", cmd = ":Telescope diagnostics<CR>", desc = "Navigate errors/warnings" },
{ keys = "f", cmd = formatFx, desc = "Format buffer" },
{ keys = "s", cmd = ":Telescope treesitter<CR>", desc = "Search symbols" },
{ keys = "S", cmd = ":Telescope grep_string<CR>", desc = "Search current symbol" },
}
local leader_u = { -- <leader>u: +ui
{ keys = "i", cmd = ":Telescope colorscheme<CR>", desc = "Change colorscheme" },
} }
for _, map in ipairs(leader_q) do for _, map in ipairs(leader_q) do
@ -76,4 +142,24 @@ for _, map in ipairs(leader_b) do
table.insert(M, map) table.insert(M, map)
end end
for _, map in ipairs(leader_c) do
map.keys = "<leader>c" .. map.keys
table.insert(M, map)
end
for _, map in ipairs(leader_t) do
map.keys = "<leader>t" .. map.keys
table.insert(M, map)
end
for _, map in ipairs(leader_u) do
map.keys = "<leader>u" .. map.keys
table.insert(M, map)
end
for _, map in ipairs(leader_p) do
map.keys = "<leader>p" .. map.keys
table.insert(M, map)
end
return M return M

View file

@ -2,6 +2,7 @@ local M = {}
M.global = { M.global = {
{ mode = "n", keys = "<leader>e", cmd = ":NvimTreeToggle<CR>" }, { mode = "n", keys = "<leader>e", cmd = ":NvimTreeToggle<CR>" },
{ mode = "n", keys = "<A-0>", cmd = ":NvimTreeFocus<CR>" },
} }
function M.plugin(api, opts) function M.plugin(api, opts)
@ -55,6 +56,8 @@ function M.plugin(api, opts)
{ keys = "x", cmd = api.fs.cut, opts = opts("Cut") }, { keys = "x", cmd = api.fs.cut, opts = opts("Cut") },
{ keys = "y", cmd = api.fs.copy.relative_path, opts = opts("Copy Relative Path") }, { keys = "y", cmd = api.fs.copy.relative_path, opts = opts("Copy Relative Path") },
{ keys = "Y", cmd = api.fs.copy.absolute_path, opts = opts("Copy Absolute Path") }, { keys = "Y", cmd = api.fs.copy.absolute_path, opts = opts("Copy Absolute Path") },
-- From Directory Opus
{ keys = "#", cmd = "<Cmd>set relativenumber!<CR>", opts = opts("Toggle Relative Number") },
-- Numeric 数字键 -- Numeric 数字键
{ keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") }, { keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") },
-- Non-Alphanumeric 非字母数字键 -- Non-Alphanumeric 非字母数字键
@ -72,6 +75,7 @@ function M.plugin(api, opts)
{ keys = "<C-t>", cmd = api.node.open.tab, opts = opts("Open: New Tab") }, { keys = "<C-t>", cmd = api.node.open.tab, opts = opts("Open: New Tab") },
{ keys = "<C-v>", cmd = api.node.open.vertical, opts = opts("Open: Vertical Split") }, { keys = "<C-v>", cmd = api.node.open.vertical, opts = opts("Open: Vertical Split") },
{ keys = "<C-h>", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") }, { keys = "<C-h>", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") },
{ keys = "<A-0>", cmd = ":b#<CR>", opts = opts("Focus to previous buffer") },
-- Mouse 鼠标键 -- Mouse 鼠标键
{ keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") }, { keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") },
{ keys = "<2-RightMouse>", cmd = api.tree.change_root_to_node, opts = opts("CD") }, { keys = "<2-RightMouse>", cmd = api.tree.change_root_to_node, opts = opts("CD") },

View file

@ -0,0 +1,30 @@
vim.api.nvim_create_user_command("Format", function(args)
local range = nil
if args.count ~= -1 then
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = {
start = { args.line1, 0 },
["end"] = { args.line2, end_line:len() },
}
end
require("conform").format({ async = true, lsp_format = "fallback", range = range })
end, { range = true })
vim.api.nvim_create_user_command("FormatToggle", function(args)
local buffer_local = args.bang
if buffer_local then
-- Toggle buffer-local formatting
vim.b.disable_autoformat = not vim.b.disable_autoformat
else
-- Toggle global formatting
vim.g.disable_autoformat = not vim.g.disable_autoformat
end
-- Print current status
local scope = buffer_local and "buffer" or "global"
local status = buffer_local and vim.b.disable_autoformat or vim.g.disable_autoformat
print(string.format("Format-on-save %s: %s", scope, status and "disabled" or "enabled"))
end, {
desc = "Toggle autoformat-on-save (use ! for buffer-local)",
bang = true,
})

View file

@ -1,9 +1,11 @@
return { return {
{ "catppuccin/nvim", name = "catppuccin" }, { "catppuccin/nvim", name = "catppuccin" },
{ "olimorris/onedarkpro.nvim" },
{ "rebelot/kanagawa.nvim" },
{ "RRethy/vim-illuminate" }, { "RRethy/vim-illuminate" },
{ {
'nvim-lualine/lualine.nvim', "nvim-lualine/lualine.nvim",
dependencies = { 'nvim-tree/nvim-web-devicons' }, dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
require("plugins.mod.lualine") require("plugins.mod.lualine")
end, end,
@ -18,9 +20,9 @@ return {
timer = 500, timer = 500,
}, },
}) })
end end,
}, },
{ import = "plugins.mod.alpha-nvim" }, { import = "plugins.mod.alpha-nvim" },
{ import = "plugins.mod.winbar-nvim"}, { import = "plugins.mod.winbar-nvim" },
{ import = "plugins.mod.bufferline" }, { import = "plugins.mod.bufferline" },
} }

View file

@ -2,5 +2,48 @@ return {
{ import = "plugins.mod.auto-session" }, { import = "plugins.mod.auto-session" },
{ import = "plugins.mod.nvim-tree" }, { import = "plugins.mod.nvim-tree" },
{ import = "plugins.mod.telescope" }, { import = "plugins.mod.telescope" },
{ import = "plugins.mod.projects" } { import = "plugins.mod.projects" },
{
"lewis6991/hover.nvim",
config = function()
require("hover").setup({
init = function()
-- Require providers
require("hover.providers.lsp")
-- require('hover.providers.gh')
-- require('hover.providers.gh_user')
-- require('hover.providers.jira')
-- require('hover.providers.dap')
-- require('hover.providers.fold_preview')
-- require('hover.providers.diagnostic')
-- require('hover.providers.man')
-- require('hover.providers.dictionary')
end,
preview_opts = {
border = "single",
},
-- Whether the contents of a currently open hover window should be moved
-- to a :h preview-window when pressing the hover keymap.
preview_window = false,
title = true,
mouse_providers = {
"LSP",
},
mouse_delay = 1000,
})
-- Setup keymaps
vim.keymap.set("n", "gE", require("hover").hover_select, { desc = "hover.nvim (select)" })
vim.keymap.set("n", "<C-p>", function()
require("hover").hover_switch("previous")
end, { desc = "hover.nvim (previous source)" })
vim.keymap.set("n", "<C-n>", function()
require("hover").hover_switch("next")
end, { desc = "hover.nvim (next source)" })
-- Mouse support
vim.keymap.set("n", "<MouseMove>", require("hover").hover_mouse, { desc = "hover.nvim (mouse)" })
vim.o.mousemoveevent = true
end,
},
} }

View file

@ -15,7 +15,6 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require("lazy").setup({ require("lazy").setup({
{ import = "plugins.appearance" }, { import = "plugins.appearance" },
{ import = "plugins.completion" }, { import = "plugins.completion" },

View file

@ -1,9 +1,8 @@
return { return {
{ import = "plugins.mod.lspconfig" }, { import = "plugins.mod.lspconfig" },
{ {
"NoahTheDuke/vim-just", "NoahTheDuke/vim-just",
ft = { "just" } ft = { "just" },
}, },
{ import = "plugins.mod.render-markdown" }, { import = "plugins.mod.render-markdown" },
-- { import = "plugins.mod.markview" }, -- { import = "plugins.mod.markview" },
@ -14,16 +13,16 @@ return {
init = function() init = function()
-- VimTeX configuration goes here, e.g. -- VimTeX configuration goes here, e.g.
vim.g.vimtex_view_method = "sioyek" vim.g.vimtex_view_method = "sioyek"
end end,
}, },
{ {
"iurimateus/luasnip-latex-snippets.nvim", "iurimateus/luasnip-latex-snippets.nvim",
-- vimtex isn't required if using treesitter -- vimtex isn't required if using treesitter
requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" }, requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" },
config = function() config = function()
require'luasnip-latex-snippets'.setup() require("luasnip-latex-snippets").setup()
-- or setup({ use_treesitter = true }) -- or setup({ use_treesitter = true })
require("luasnip").config.setup { enable_autosnippets = true } require("luasnip").config.setup({ enable_autosnippets = true })
end, end,
}, },
{ "williamboman/mason.nvim", config = true }, { "williamboman/mason.nvim", config = true },
@ -41,6 +40,27 @@ return {
mason_lspconfig.setup({ mason_lspconfig.setup({
ensure_installed = servers, ensure_installed = servers,
}) })
end end,
}, },
{
"nvim-orgmode/orgmode",
event = "VeryLazy",
ft = { "org" },
config = function()
-- Setup orgmode
require("orgmode").setup({
org_agenda_files = "~/orgfiles/**/*",
org_default_notes_file = "~/orgfiles/refile.org",
})
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option
-- add ~org~ to ignore_install
-- require('nvim-treesitter.configs').setup({
-- ensure_installed = 'all',
-- ignore_install = { 'org' },
-- })
end,
},
{ import = "plugins.mod.conform-nvim" },
{ "nvim-treesitter/nvim-treesitter-context" },
} }

View file

@ -1,7 +1,14 @@
return { return {
{ 'wakatime/vim-wakatime', lazy = false }, { "wakatime/vim-wakatime", lazy = false },
{ "voldikss/vim-floaterm" },
{ "CRAG666/betterTerm.nvim", opts = {
position = "bot",
size = 15,
} },
{ "CRAG666/code_runner.nvim", config = true },
{ import = "plugins.mod.obsidian-nvim" }, { import = "plugins.mod.obsidian-nvim" },
{ {
"folke/which-key.nvim", "folke/which-key.nvim",
event = "VeryLazy", event = "VeryLazy",
opts = { opts = {
@ -22,5 +29,5 @@ return {
{ {
"github/copilot.vim", "github/copilot.vim",
lazy = false, lazy = false,
} },
} }

View file

@ -1,14 +1,14 @@
-- alpha-nvim.lua -- alpha-nvim.lua
return { return {
{ {
'goolord/alpha-nvim', "goolord/alpha-nvim",
dependencies = { dependencies = {
-- 'echasnovski/mini.icons', -- 'echasnovski/mini.icons',
-- 'nvim-lua/plenary.nvim' -- 'nvim-lua/plenary.nvim'
}, },
config = function () config = function()
local alpha = require'alpha' local alpha = require("alpha")
local dashboard = require'alpha.themes.dashboard' local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = { dashboard.section.header.val = {
" ", " ",
"================= =============== =============== ======== ========", "================= =============== =============== ======== ========",
@ -34,11 +34,11 @@ return {
dashboard.section.buttons.val.leader = "SPC" dashboard.section.buttons.val.leader = "SPC"
dashboard.section.buttons.val = { dashboard.section.buttons.val = {
-- leader = "SPC", -- leader = "SPC",
dashboard.button('p', '󰈞 查找项目', ':Telescope projects<CR>'), dashboard.button("p", "󰈞 查找项目", ":Telescope projects<CR>"),
dashboard.button('h', ' 历史文件', ':Telescope oldfiles<CR>'), dashboard.button("h", " 历史文件", ":Telescope oldfiles<CR>"),
dashboard.button('l', ' 加载会话', ':SessionSearch<CR>'), dashboard.button("l", " 加载会话", ":SessionSearch<CR>"),
dashboard.button('c', ' 转到设置', ':Telescope find_files cwd=~/.config/nvim<CR>'), dashboard.button("c", " 转到设置", ":Telescope find_files cwd=~/.config/nvim<CR>"),
dashboard.button('SPC q', '󱊷 退出', ':qa<CR>'), dashboard.button("SPC q", "󱊷 退出", ":qa<CR>"),
} }
dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " " dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " "
@ -47,6 +47,6 @@ return {
-- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']] -- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']]
alpha.setup(dashboard.config) alpha.setup(dashboard.config)
end end,
}; },
} }

View file

@ -1,15 +1,15 @@
---@diagnostic disable: undefined-doc-name ---@diagnostic disable: undefined-doc-name
return { return {
{ {
'rmagatti/auto-session', "rmagatti/auto-session",
lazy = false, lazy = false,
---enables autocomplete for opts ---enables autocomplete for opts
---@module "auto-session" ---@module "auto-session"
---@type AutoSession.Config ---@type AutoSession.Config
opts = { opts = {
suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
-- log_level = 'debug', -- log_level = 'debug',
} },
} },
} }

View file

@ -0,0 +1,38 @@
return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
-- This will provide type hinting with LuaLS
---@module "conform"
---@type conform.setupOpts
opts = {
-- Define your formatters
formatters_by_ft = {
lua = { "stylua" },
python = { "isort", "black" },
javascript = { "prettierd", "prettier", stop_after_first = true },
},
-- Set default options
default_format_opts = {
lsp_format = "fallback",
},
-- Set up format-on-save
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_format = "fallback" }
end,
-- Customize formatters
formatters = {
shfmt = {
prepend_args = { "-i", "2" },
},
},
},
init = function()
-- If you want the formatexpr, here is the place to set it
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
}

View file

@ -1,4 +1,4 @@
return { return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
lazy = false lazy = false,
} }

View file

@ -1,6 +1,6 @@
-- Author: shadmansaleh -- Author: shadmansaleh
-- Credit: glepnir -- Credit: glepnir
local lualine = require('lualine') local lualine = require("lualine")
-- Color table for highlights -- Color table for highlights
-- stylua: ignore -- stylua: ignore
@ -20,14 +20,14 @@ local colors = {
local conditions = { local conditions = {
buffer_not_empty = function() buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
end, end,
hide_in_width = function() hide_in_width = function()
return vim.fn.winwidth(0) > 80 return vim.fn.winwidth(0) > 80
end, end,
check_git_workspace = function() check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h') local filepath = vim.fn.expand("%:p:h")
local gitdir = vim.fn.finddir('.git', filepath .. ';') local gitdir = vim.fn.finddir(".git", filepath .. ";")
return gitdir and #gitdir > 0 and #gitdir < #filepath return gitdir and #gitdir > 0 and #gitdir < #filepath
end, end,
} }
@ -36,11 +36,11 @@ local conditions = {
local config = { local config = {
options = { options = {
disabled_filetypes = { disabled_filetypes = {
statusline = { "NvimTree", "alpha" } statusline = { "NvimTree", "alpha" },
}, },
-- Disable sections and component separators -- Disable sections and component separators
component_separators = '', component_separators = "",
section_separators = '', section_separators = "",
theme = { theme = {
-- We are going to use lualine_c an lualine_x as left and -- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we -- right section. Both are highlighted by c theme . So we
@ -80,18 +80,18 @@ local function ins_right(component)
table.insert(config.sections.lualine_x, component) table.insert(config.sections.lualine_x, component)
end end
ins_left { ins_left({
function() function()
return '' return ""
end, end,
color = { fg = colors.blue }, -- Sets highlighting of component color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this padding = { left = 0, right = 1 }, -- We don't need space before this
} })
ins_left { ins_left({
-- mode component -- mode component
function() function()
return '' return ""
end, end,
color = function() color = function()
-- auto change color according to neovims mode -- auto change color according to neovims mode
@ -99,13 +99,13 @@ ins_left {
n = colors.red, n = colors.red,
i = colors.green, i = colors.green,
v = colors.blue, v = colors.blue,
[''] = colors.blue, [""] = colors.blue,
V = colors.blue, V = colors.blue,
c = colors.magenta, c = colors.magenta,
no = colors.red, no = colors.red,
s = colors.orange, s = colors.orange,
S = colors.orange, S = colors.orange,
[''] = colors.orange, [""] = colors.orange,
ic = colors.yellow, ic = colors.yellow,
R = colors.violet, R = colors.violet,
Rv = colors.violet, Rv = colors.violet,
@ -113,14 +113,14 @@ ins_left {
ce = colors.red, ce = colors.red,
r = colors.cyan, r = colors.cyan,
rm = colors.cyan, rm = colors.cyan,
['r?'] = colors.cyan, ["r?"] = colors.cyan,
['!'] = colors.red, ["!"] = colors.red,
t = colors.red, t = colors.red,
} }
return { fg = mode_color[vim.fn.mode()] } return { fg = mode_color[vim.fn.mode()] }
end, end,
padding = { right = 1 }, padding = { right = 1 },
} })
-- ins_left { -- ins_left {
-- -- filesize component -- -- filesize component
@ -134,42 +134,39 @@ ins_left {
-- color = { fg = colors.magenta, gui = 'bold' }, -- color = { fg = colors.magenta, gui = 'bold' },
-- } -- }
-- ins_left { 'location' } -- ins_left { 'location' }
ins_right { 'progress', color = { fg = colors.fg, gui = 'bold' } } ins_right({ "progress", color = { fg = colors.fg, gui = "bold" } })
ins_left { ins_left({
'diagnostics', "diagnostics",
sources = { 'nvim_diagnostic' }, sources = { "nvim_diagnostic" },
symbols = { error = '', warn = '', info = '' }, symbols = { error = "", warn = "", info = "" },
diagnostics_color = { diagnostics_color = {
error = { fg = colors.red }, error = { fg = colors.red },
warn = { fg = colors.yellow }, warn = { fg = colors.yellow },
info = { fg = colors.cyan }, info = { fg = colors.cyan },
}, },
} })
ins_left { ins_left({
function() function()
return vim.bo.filetype return vim.bo.filetype
end, end,
color = { fg = colors.blue, gui = 'bold' }, color = { fg = colors.blue, gui = "bold" },
} })
ins_left { ins_left({
function() function()
return vim.bo.shiftwidth .. " space" return vim.bo.shiftwidth .. " space"
end, end,
} })
ins_left({
ins_left {
-- Lsp server name . -- Lsp server name .
function() function()
local msg = 'No Active Lsp' local msg = "No Active Lsp"
local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 }) local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 })
local clients = vim.lsp.get_clients() local clients = vim.lsp.get_clients()
if next(clients) == nil then if next(clients) == nil then
return msg return msg
@ -182,59 +179,58 @@ ins_left {
end end
return msg return msg
end, end,
icon = '', icon = "",
color = { fg = '#ffffff', gui = 'bold' }, color = { fg = "#ffffff", gui = "bold" },
} })
-- Insert mid section. You can make any number of sections in neovim :) -- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2 -- for lualine it's any number greater then 2
ins_left { ins_left({
function() function()
return '%=' return "%="
end, end,
} })
-- Add components to right sections -- Add components to right sections
ins_right { ins_right({
'o:encoding', -- option component same as &encoding in viml "o:encoding", -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;) fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width, cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' }, color = { fg = colors.green, gui = "bold" },
} })
ins_right { ins_right({
'fileformat', "fileformat",
fmt = string.upper, fmt = string.upper,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = 'bold' }, color = { fg = colors.green, gui = "bold" },
} })
ins_right { ins_right({
'branch', "branch",
icon = '', icon = "",
color = { fg = colors.violet, gui = 'bold' }, color = { fg = colors.violet, gui = "bold" },
} })
ins_right({
ins_right { "diff",
'diff',
-- Is it me or the symbol for modified us really weird -- Is it me or the symbol for modified us really weird
symbols = { added = '', modified = '󰝤 ', removed = '' }, symbols = { added = "", modified = "󰝤 ", removed = "" },
diff_color = { diff_color = {
added = { fg = colors.green }, added = { fg = colors.green },
modified = { fg = colors.orange }, modified = { fg = colors.orange },
removed = { fg = colors.red }, removed = { fg = colors.red },
}, },
cond = conditions.hide_in_width, cond = conditions.hide_in_width,
} })
ins_right { ins_right({
function() function()
return '' return ""
end, end,
color = { fg = colors.blue }, color = { fg = colors.blue },
padding = { left = 1 }, padding = { left = 1 },
} })
-- Now don't forget to initialize lualine -- Now don't forget to initialize lualine
lualine.setup(config) lualine.setup(config)

View file

@ -15,16 +15,16 @@ return {
shift_width = 1, shift_width = 1,
heading_1 = { heading_1 = {
style = "label", style = "label",
hl = "MarkviewH1" hl = "MarkviewH1",
} },
}, },
code_blocks = { code_blocks = {
style = "language", style = "language",
language_direction = "right", language_direction = "right",
hl = "MarkviewCode", hl = "MarkviewCode",
info_hl = "MarkviewCodeInfo" info_hl = "MarkviewCodeInfo",
} },
}) })
end end,
} },
} }

View file

@ -1,6 +1,6 @@
local function my_on_attach(bufnr) local function my_on_attach(bufnr)
-- local keymaps = require("config.keymaps") -- local keymaps = require("config.keymaps")
local api = require "nvim-tree.api" local api = require("nvim-tree.api")
local default_mode = { "n" } local default_mode = { "n" }
local keymaps = require("keymaps") local keymaps = require("keymaps")
@ -8,7 +8,6 @@ local function my_on_attach(bufnr)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end end
local function set_keymaps(maps) local function set_keymaps(maps)
for _, map in ipairs(maps) do for _, map in ipairs(maps) do
local mode = map.mode or default_mode local mode = map.mode or default_mode
@ -28,10 +27,26 @@ return {
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
}, },
config = function() config = function()
require("nvim-tree").setup { require("nvim-tree").setup({
on_attach = my_on_attach, on_attach = my_on_attach,
sync_root_with_cwd = true, sync_root_with_cwd = true,
respect_buf_cwd = true, respect_buf_cwd = true,
} disable_netrw = true,
end renderer = {
icons = {
glyphs = {
git = { -- https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt#L1077C1-L1077C29
unmerged = "",
renamed = "",
deleted = "",
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
},
},
},
},
})
end,
} }

View file

@ -3,7 +3,7 @@ return {
run = ":TSUpdate", run = ":TSUpdate",
config = function() config = function()
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
ensure_installed = { "markdown", "markdown_inline", "latex", "python"}, ensure_installed = { "markdown", "markdown_inline", "latex", "python" },
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
}) })

View file

@ -26,11 +26,11 @@ return {
}, },
completion = { completion = {
nvim_cmp = true, nvim_cmp = true,
min_chars = 2 min_chars = 2,
}, },
ui = { ui = {
enable = false enable = false,
} },
-- see below for full list of options 👇 -- see below for full list of options 👇
}, },
} }

View file

@ -1,8 +1,19 @@
return { return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
config = function () config = function()
require("telescope").setup { require("telescope").setup({
defaults = { defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
layout_config = { -- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/telescope.lua
horizontal = {
prompt_position = "top",
preview_width = 0.55,
},
width = 0.87,
height = 0.80,
},
mappings = { mappings = {
n = { n = {
["n"] = "move_selection_next", ["n"] = "move_selection_next",
@ -11,11 +22,11 @@ return {
["r"] = "preview_scrolling_down", ["r"] = "preview_scrolling_down",
["a"] = "preview_scrolling_left", ["a"] = "preview_scrolling_left",
["s"] = "preview_scrolling_right", ["s"] = "preview_scrolling_right",
} ["q"] = require("telescope.actions").close,
} },
} },
} },
})
end, end,
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
} }

View file

@ -7,33 +7,32 @@ return {
show_file_path = true, show_file_path = true,
show_symbols = true, show_symbols = true,
colors = { colors = {
path = '#9c1d91', path = "#9c1d91",
file_name = '', file_name = "",
symbols = '', symbols = "",
}, },
icons = { icons = {
file_icon_default = '', file_icon_default = "",
seperator = '>', seperator = ">",
editor_state = '', editor_state = "",
lock_icon = '', lock_icon = "",
}, },
exclude_filetype = { exclude_filetype = {
'help', "help",
'startify', "startify",
'dashboard', "dashboard",
'packer', "packer",
'neogitstatus', "neogitstatus",
'NvimTree', "NvimTree",
'Trouble', "Trouble",
'alpha', "alpha",
'lir', "lir",
'Outline', "Outline",
'spectre_panel', "spectre_panel",
'toggleterm', "toggleterm",
'qf', "qf",
} },
}) })
end, end,
}, },
} }

View file

@ -1,9 +1,10 @@
return { return {
{ import = "plugins.mod.nvim-treesitter", }, { import = "plugins.mod.nvim-treesitter" },
{ 'echasnovski/mini.pairs', version = false, {
"echasnovski/mini.pairs",
version = false,
config = function() config = function()
require("mini.pairs").setup() require("mini.pairs").setup()
end, end,
}, },
} }

View file

@ -50,14 +50,102 @@ noremap gpt editor.action.peekTypeDefinition
noremap gh editor.action.showDefinitionPreviewHover noremap gh editor.action.showDefinitionPreviewHover
noremap <leader><leader> workbench.action.quickOpen noremap <leader><leader> workbench.action.quickOpen
noremap <leader>/ workbench.action.quickTextSearch
noremap <leader>: workbench.action.showCommands noremap <leader>: workbench.action.showCommands
noremap <leader>E workbench.view.explorer noremap <leader>E workbench.view.explorer
noremap <leader>- workbench.action.splitEditorDown
noremap <leader>| workbench.action.splitEditorRight
noremap <leader>\ workbench.action.splitEditorRight
" <leader>a : +ai/action
noremap <leader>aa inlineChat.start
noremap <leader>aA workbench.panel.chat
noremap <leader>ae workbench.action.chat.openEditSession
" <leader>b : +buffer
noremap <leader>bb workbench.action.showAllEditors
noremap <leader>bd :bdelete<CR>
noremap <leader>bh :bprevious<CR>
noremap <leader>bi :bnext<CR>
noremap <leader>bp :bprevious<CR>
noremap <leader>bn :bnext<CR>
" <leader>c : +code/compile
noremap <leader>cr code-runner.run
noremap <leader>cf editor.action.formatDocument
noremap <leader>c<leader> editor.action.trimTrailingWhitespace
noremap <leader>cs workbench.action.gotoSymbol
noremap <leader>cS workbench.action.showAllSymbols
noremap <leader>ce editor.action.marker.next
noremap <leader>cE editor.action.marker.prev
noremap <leader>cg editor.action.dirtydiff.next
noremap <leader>cG editor.action.dirtydiff.previous
noremap <leader>cR editor.action.rename
" <leader>d : +debug
" <leader>f : +file
noremap <leader>ff workbench.action.quickOpen
noremap <leader>fF workbench.view.search
noremap <leader>fc workbench.action.openSettings
noremap <leader>fC workbench.action.openFolderSettingsFile
noremap <leader>fe workbench.view.explorer
noremap <leader>fo openInExternalApp.open
noremap <leader>fr workbench.action.showAllEditorsByMostRecentlyUsed
noremap <leader>fR git.rename " Rename file
" noremap <leader>fs workbench.action.search.toggleQueryDetails
noremap <leader>ft workbench.action.terminal.toggleTerminal
noremap <leader>fx workbench.view.extensions
" <leader>g : +git
noremap <leader>gg workbench.view.scm
noremap <leader>gS git.stageAll
" <leader>h : +help
" <leader>j : +jump
noremap <leader>jj workbench.action.gotoLine
" <leader>l : +language (define in settings.json)
" <leader>p : +project (requires Project Manager extension)
noremap <leader>pp projectManager.listProjects
noremap <leader>pP projectManager.listAnyProjects#sideBarAny
noremap <leader>pc projectManager.openSettings#sideBarAny
noremap <leader>pe projectManager.editProjects
noremap <leader>pf projectManager.addToFavorites
noremap <leader>pF projectManager.filterProjectsByTag
noremap <leader>pg projectManager.listGitProjects#sideBarGit
noremap <leader>pr workbench.action.openRecent
noremap <leader>ps projectManager.saveProject
" <leader>q : +quit " <leader>q : +quit
noremap <leader>qq :quit<CR> noremap <leader>qq :quit<CR>
noremap <leader>qQ :qall<CR> noremap <leader>qQ :qall<CR>
noremap <leader>Q :quit<CR> noremap <leader>Q :quit<CR>
" <leader>r : +refactor
" <leader>s : +search
" <leader>t : +test
noremap <leader>tt testing.runAll
noremap <leader>tT testing.debugAll
noremap <leader>ta testing.runAll
noremap <leader>tA testing.debugAll
noremap <leader>tf testing.reRunFailedTests
noremap <leader>tF testing.debugFailedTests
noremap <leader>tl testing.reRunLastRun
noremap <leader>tL testing.debugLastRun
noremap <leader>tc testing.runCurrentTest
noremap <leader>tC testing.debugCurrentTest
noremap <leader>tx testing.cancelTestRun
" <leader>u : +ui
noremap <leader>ui workbench.action.selectTheme
noremap <leader>uw editor.action.toggleWordWrap
noremap <leader>uz workbench.action.toggleZenMode
" <leader>w : +write/window " <leader>w : +write/window
noremap <leader>ww :write<CR> noremap <leader>ww :write<CR>
noremap <leader>wa :wall<CR> noremap <leader>wa :wall<CR>
@ -71,75 +159,6 @@ noremap <leader>we workbench.action.focusAboveGroup
noremap <leader>wE workbench.action.splitEditorUp noremap <leader>wE workbench.action.splitEditorUp
noremap <leader>wi workbench.action.focusRightGroup noremap <leader>wi workbench.action.focusRightGroup
noremap <leader>wI workbench.action.splitEditorRight noremap <leader>wI workbench.action.splitEditorRight
noremap <leader>w- workbench.action.splitEditorDown
" <leader>f : +find/file noremap <leader>w| workbench.action.splitEditorRight
noremap <leader>ff workbench.action.quickOpen noremap <leader>w\ workbench.action.splitEditorRight
noremap <leader>fF workbench.view.search
noremap <leader>fc workbench.action.openSettings
noremap <leader>fC workbench.action.openFolderSettingsFile
noremap <leader>fe workbench.view.explorer
noremap <leader>fr workbench.action.showAllEditorsByMostRecentlyUsed
noremap <leader>fR workbench.action.openRecent
noremap <leader>fs workbench.action.search.toggleQueryDetails
noremap <leader>ft workbench.action.terminal.toggleTerminal
noremap <leader>fx workbench.view.extensions
" <leader>p : +project (requires Project Manager extension)
noremap <leader>pp projectManager.listProjects
noremap <leader>pP projectManager.listAnyProjects#sideBarAny
noremap <leader>pc projectManager.openSettings#sideBarAny
noremap <leader>pe projectManager.editProjects
noremap <leader>pf projectManager.addToFavorites
noremap <leader>pF projectManager.filterProjectsByTag
noremap <leader>pg projectManager.listGitProjects#sideBarGit
noremap <leader>pr workbench.action.openRecent
noremap <leader>ps projectManager.saveProject
" <leader>g : +git
noremap <leader>gg workbench.view.scm
noremap <leader>gS git.stageAll
" <leader>j : +jump
noremap <leader>jj workbench.action.gotoLine
" <leader>l : +language (define in settings.json)
" <leader>u : +ui
noremap <leader>ui workbench.action.selectTheme
noremap <leader>uw editor.action.toggleWordWrap
noremap <leader>uz workbench.action.toggleZenMode
" <leader>a : +ai/action
noremap <leader>aa inlineChat.start
noremap <leader>aA workbench.panel.chat
noremap <leader>ae workbench.action.chat.openEditSession
" <leader>r : +refactor
" <leader>s : +search
" <leader>t : +test
noremap <leader>tt testing.runAll
noremap <leader>tT testing.debugAll
noremap <leader>ta testing.runAll
noremap <leader>tA testing.debugAll
noremap <leader>tf testing.reRunFailedTests
noremap <leader>tF testing.debugFailedTests
noremap <leader>tl testing.reRunLastRun
noremap <leader>tL testing.debugLastRun
noremap <leader>tc testing.runCurrentTest
noremap <leader>tC testing.debugCurrentTest
noremap <leader>tx testing.cancelTestRun
" <leader>d : +debug
" <leader>h : +help
" <leader>c : +code
noremap <leader>cr code-runner.run
noremap <leader>cf editor.action.formatDocument
noremap <leader>c<leader> editor.action.trimTrailingWhitespace
noremap <leader>cs workbench.action.gotoSymbol
noremap <leader>cS workbench.action.showAllSymbols
" <leader>b : +buffer
noremap <leader>bb workbench.action.showAllEditors
noremap <leader>bd :bdelete<CR>
noremap <leader>bh :bprevious<CR>
noremap <leader>bi :bnext<CR>
" 中文分词测试用例

View file

@ -3,7 +3,7 @@
-- Author: js0ny -- Author: js0ny
--#region Import & Setup --#region Import & Setup
local wezterm = require 'wezterm' local wezterm = require("wezterm")
local action = wezterm.action local action = wezterm.action
local config = {} local config = {}
@ -52,15 +52,13 @@ local function detect_os()
end end
-- OS light/dark theme detection -- OS light/dark theme detection
local function detect_theme() local function detect_theme() end
end
--#endregion --#endregion
--#region Constant --#region Constant
local os_type = detect_os() local os_type = detect_os()
--#endregion --#endregion
--#region Appearance --#region Appearance
-- Font and color scheme -- Font and color scheme
-- config.font = 'FiraCode Nerd Font' -- config.font = 'FiraCode Nerd Font'
@ -88,11 +86,11 @@ config.tab_bar_at_bottom = true
-- config.cursor_blink_rate = 650 -- config.cursor_blink_rate = 650
-- Visual Bell -- Visual Bell
config.visual_bell = { config.visual_bell = {
fade_in_function = 'EaseIn', fade_in_function = "EaseIn",
fade_in_duration_ms = 250, fade_in_duration_ms = 250,
fade_out_function = 'EaseOut', fade_out_function = "EaseOut",
fade_out_duration_ms = 250, fade_out_duration_ms = 250,
target = 'CursorColor', target = "CursorColor",
} }
--#endregion --#endregion
@ -100,111 +98,111 @@ config.visual_bell = {
config.leader = { key = "q", mods = "CTRL" } config.leader = { key = "q", mods = "CTRL" }
config.keys = { config.keys = {
{ {
key = 'q', key = "q",
mods = 'LEADER', mods = "LEADER",
action = action.SendKey { key = 'q', mods = 'CTRL' }, action = action.SendKey({ key = "q", mods = "CTRL" }),
}, },
-- Windows Management -- Windows Management
{ -- leader keys { -- leader keys
key = '|', key = "|",
mods = 'LEADER|SHIFT', mods = "LEADER|SHIFT",
action = action.SplitHorizontal { domain = "CurrentPaneDomain" } action = action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
}, },
{ {
key = '-', key = "-",
mods = 'LEADER', mods = "LEADER",
action = action.SplitVertical { domain = "CurrentPaneDomain" } action = action.SplitVertical({ domain = "CurrentPaneDomain" }),
}, },
{ {
key = 'h', key = "h",
mods = 'LEADER', mods = "LEADER",
action = action.ActivatePaneDirection 'Left' action = action.ActivatePaneDirection("Left"),
}, },
{ {
key = 'n', key = "n",
mods = 'LEADER', mods = "LEADER",
action = action.ActivatePaneDirection 'Down' action = action.ActivatePaneDirection("Down"),
}, },
{ {
key = 'e', key = "e",
mods = 'LEADER', mods = "LEADER",
action = action.ActivatePaneDirection 'Up' action = action.ActivatePaneDirection("Up"),
}, },
{ {
key = 'i', key = "i",
mods = 'LEADER', mods = "LEADER",
action = action.ActivatePaneDirection 'Right' action = action.ActivatePaneDirection("Right"),
}, },
{ {
key = 'H', key = "H",
mods = 'LEADER', mods = "LEADER",
action = action.AdjustPaneSize { 'Left', 5 }, action = action.AdjustPaneSize({ "Left", 5 }),
}, },
{ {
key = 'N', key = "N",
mods = 'LEADER', mods = "LEADER",
action = action.AdjustPaneSize { 'Down', 5 }, action = action.AdjustPaneSize({ "Down", 5 }),
}, },
{ {
key = 'E', key = "E",
mods = 'LEADER', mods = "LEADER",
action = action.AdjustPaneSize { 'Up', 5 }, action = action.AdjustPaneSize({ "Up", 5 }),
}, },
{ {
key = 'I', key = "I",
mods = 'LEADER', mods = "LEADER",
action = action.AdjustPaneSize { 'Right', 5 }, action = action.AdjustPaneSize({ "Right", 5 }),
}, },
{ {
key = "/", key = "/",
mods = "LEADER", mods = "LEADER",
action = action.Search { Regex = "" } action = action.Search({ Regex = "" }),
}, },
{ {
key = "?", key = "?",
mods = "LEADER|SHIFT", mods = "LEADER|SHIFT",
action = action.Search { CaseSensitiveString = "" } action = action.Search({ CaseSensitiveString = "" }),
}, },
{ {
key = ";", key = ";",
mods = "LEADER", mods = "LEADER",
action = action.ShowLauncher action = action.ShowLauncher,
}, },
{ {
key = ":", key = ":",
mods = "LEADER|SHIFT", mods = "LEADER|SHIFT",
action = action.ActivateCommandPalette action = action.ActivateCommandPalette,
}, },
{ {
key = "W", key = "W",
mods = "CTRL", mods = "CTRL",
action = action.CloseCurrentPane { confirm = true } action = action.CloseCurrentPane({ confirm = true }),
}, },
{ -- ^C to copy if selection is active, otherwise send signal { -- ^C to copy if selection is active, otherwise send signal
-- https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearSelection.html?h=selection -- https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearSelection.html?h=selection
key = 'c', key = "c",
mods = 'CTRL', mods = "CTRL",
action = wezterm.action_callback(function(window, pane) action = wezterm.action_callback(function(window, pane)
local has_selection = window:get_selection_text_for_pane(pane) ~= '' local has_selection = window:get_selection_text_for_pane(pane) ~= ""
if has_selection then if has_selection then
window:perform_action(action.CopyTo 'ClipboardAndPrimarySelection', pane) window:perform_action(action.CopyTo("ClipboardAndPrimarySelection"), pane)
window:perform_action(action.ClearSelection, pane) window:perform_action(action.ClearSelection, pane)
else else
window:perform_action(action.SendKey { key = 'c', mods = 'CTRL' }, pane) window:perform_action(action.SendKey({ key = "c", mods = "CTRL" }), pane)
end end
end), end),
}, },
} }
config.mouse_bindings = { config.mouse_bindings = {
{ {
event = { Up = { streak = 1, button = 'Left' } }, event = { Up = { streak = 1, button = "Left" } },
mods = 'CTRL', mods = "CTRL",
action = action.OpenLinkAtMouseCursor, action = action.OpenLinkAtMouseCursor,
}, },
{ {
event = { Up = { streak = 1, button = 'Left' } }, event = { Up = { streak = 1, button = "Left" } },
mods = 'SUPER', mods = "SUPER",
action = action.OpenLinkAtMouseCursor, action = action.OpenLinkAtMouseCursor,
}, },
} }
@ -222,35 +220,35 @@ if os_type == "Windows" then
config.launch_menu = { config.launch_menu = {
{ {
label = "Local - PowerShell", label = "Local - PowerShell",
args = { "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" } args = { "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" },
}, },
{ {
label = "Local - PowerShell Administator", label = "Local - PowerShell Administator",
args = { "sudo.exe", "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" } args = { "sudo.exe", "pwsh.exe", "-NoLogo", "-NoProfileLoadTime" },
}, },
{ {
label = "WSL1 - Arch", label = "WSL1 - Arch",
args = { "wsl.exe", "-d", "Arch" } args = { "wsl.exe", "-d", "Arch" },
}, },
{ {
label = "WSL2 - kali-linux", label = "WSL2 - kali-linux",
args = { "wsl.exe", "-d", "kali-linux" } args = { "wsl.exe", "-d", "kali-linux" },
}, },
{ {
label = "Local - NuShell", label = "Local - NuShell",
args = { "nu" } args = { "nu" },
}, },
{ {
label = "Local - Windows PowerShell", label = "Local - Windows PowerShell",
args = { "powershell.exe" } args = { "powershell.exe" },
}, },
{ {
label = "Local - Command Prompt", label = "Local - Command Prompt",
args = { "cmd.exe" } args = { "cmd.exe" },
}, },
{ {
label = "WSL1 - Arch Zsh", label = "WSL1 - Arch Zsh",
args = { "wsl.exe", "-d", "Arch", "zsh" } args = { "wsl.exe", "-d", "Arch", "zsh" },
}, },
} }
elseif os_type == "macOS" then elseif os_type == "macOS" then
@ -260,23 +258,22 @@ else
config.launch_menu = { config.launch_menu = {
{ {
label = "Local - Fish", label = "Local - Fish",
args = { "fish", "-l" } args = { "fish", "-l" },
}, },
{ {
label = "Local - Zsh", label = "Local - Zsh",
args = { "zsh", "-l" } args = { "zsh", "-l" },
}, },
{ {
label = "Local - PowerShell", label = "Local - PowerShell",
args = { "pwsh", "-NoLogo", "-NoProfileLoadTime", "-Login" } args = { "pwsh", "-NoLogo", "-NoProfileLoadTime", "-Login" },
}, },
{ {
label = "Local - NuShell", label = "Local - NuShell",
args = { "nu", "-l" } args = { "nu", "-l" },
}, },
} }
end end
--#endregion --#endregion
return config return config

View file

@ -3,6 +3,7 @@
# Author: js0ny # Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用 # Sourced by user's zshrc 在用户的 zshrc 中被引用
# export STARSHIP_CONFIG=$DOTFILES/tools/starship/starship_zsh.toml export STARSHIP_CONFIG=$DOTFILES/tools/starship/starship_zsh.toml
eval "$(starship init zsh)" eval "$(starship init zsh)"