mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
feat(nvim): More leader mappings and text objects
This commit is contained in:
parent
aeec1ce5c7
commit
073c60f07d
17 changed files with 264 additions and 130 deletions
|
|
@ -3,7 +3,7 @@
|
|||
# Date: 2024-12-01
|
||||
# Author: js0ny
|
||||
# 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
|
||||
mkdir -p ~/.config/zellij ~/.config/yazi ~/.config/glow
|
||||
# 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/haskeline ~/.haskeline
|
||||
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/npmrc $NPM_CONFIG_USERCONFIG
|
||||
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/yabairc $XDG_CONFIG_HOME/yabai/yabairc
|
||||
else
|
||||
ln -sf $DOTFILES/common/inputrc $XDG_CONFIG_HOME/readline/inputrc
|
||||
ln -sf $DOTFILES/common/inputrc ~/.inputrc
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -8,72 +8,54 @@
|
|||
# Windows: %APPDATA%\lazygit\config.yml
|
||||
|
||||
yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json
|
||||
|
||||
# Config relating to the Lazygit UI
|
||||
gui:
|
||||
# The number of lines you scroll by when scrolling the main window
|
||||
scrollHeight: 2
|
||||
|
||||
# If true, allow scrolling past the bottom of the content in the main window
|
||||
scrollPastBottom: true
|
||||
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#scroll-off-margin
|
||||
scrollOffMargin: 2
|
||||
|
||||
# One of: 'margin' (default) | 'jump'
|
||||
scrollOffBehavior: margin
|
||||
|
||||
# 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.
|
||||
mouseEvents: true
|
||||
|
||||
# If true, do not show a warning when discarding changes in the staging view.
|
||||
skipDiscardChangeWarning: false
|
||||
|
||||
# If true, do not show warning when applying/popping the stash
|
||||
skipStashWarning: false
|
||||
|
||||
# If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files.
|
||||
skipNoStagedFilesWarning: false
|
||||
|
||||
# If true, do not show a warning when rewording a commit via an external editor
|
||||
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.
|
||||
# Number from 0 to 1.0.
|
||||
sidePanelWidth: 0.3333
|
||||
|
||||
# If true, increase the height of the focused side window; creating an accordion effect.
|
||||
expandFocusedSidePanel: false
|
||||
|
||||
# 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.
|
||||
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.
|
||||
# Options are:
|
||||
# - 'horizontal': split the window horizontally
|
||||
# - 'vertical': split the window vertically
|
||||
# - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically
|
||||
mainPanelSplitMode: flexible
|
||||
|
||||
# How the window is split when in half screen mode (i.e. after hitting '+' once).
|
||||
# Possible values:
|
||||
# - '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)
|
||||
enlargedSideViewLocation: left
|
||||
|
||||
# One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru'
|
||||
language: auto
|
||||
|
||||
# Format used when displaying time e.g. commit time.
|
||||
# Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format
|
||||
timeFormat: 02 Jan 06
|
||||
|
||||
# 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
|
||||
shortTimeFormat: 3:04PM
|
||||
|
||||
# Config relating to colors and styles.
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#color-attributes
|
||||
theme:
|
||||
|
|
@ -81,134 +63,99 @@ gui:
|
|||
activeBorderColor:
|
||||
- green
|
||||
- bold
|
||||
|
||||
# Border color of non-focused windows
|
||||
inactiveBorderColor:
|
||||
- default
|
||||
|
||||
# Border color of focused window when searching in that window
|
||||
searchingActiveBorderColor:
|
||||
- cyan
|
||||
- bold
|
||||
|
||||
# Color of keybindings help text in the bottom line
|
||||
optionsTextColor:
|
||||
- blue
|
||||
|
||||
# Background color of selected line.
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line
|
||||
selectedLineBgColor:
|
||||
- blue
|
||||
|
||||
# Background color of selected line when view doesn't have focus.
|
||||
inactiveViewSelectedLineBgColor:
|
||||
- bold
|
||||
|
||||
# Foreground color of copied commit
|
||||
cherryPickedCommitFgColor:
|
||||
- blue
|
||||
|
||||
# Background color of copied commit
|
||||
cherryPickedCommitBgColor:
|
||||
- cyan
|
||||
|
||||
# Foreground color of marked base commit (for rebase)
|
||||
markedBaseCommitFgColor:
|
||||
- blue
|
||||
|
||||
# Background color of marked base commit (for rebase)
|
||||
markedBaseCommitBgColor:
|
||||
- yellow
|
||||
|
||||
# Color for file with unstaged changes
|
||||
unstagedChangesColor:
|
||||
- red
|
||||
|
||||
# Default text color
|
||||
defaultFgColor:
|
||||
- default
|
||||
|
||||
# Config relating to the commit length indicator
|
||||
commitLength:
|
||||
# If true, show an indicator of commit message length
|
||||
show: true
|
||||
|
||||
# If true, show the '5 of 20' footer at the bottom of list views
|
||||
showListFooter: true
|
||||
|
||||
# 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.
|
||||
showFileTree: true
|
||||
|
||||
# If true, show the number of lines changed per file in the Files view
|
||||
showNumstatInFilesView: false
|
||||
|
||||
# If true, show a random tip in the command log when Lazygit starts
|
||||
showRandomTip: true
|
||||
|
||||
# If true, show the command log
|
||||
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.
|
||||
showBottomLine: true
|
||||
|
||||
# If true, show jump-to-window keybindings in window titles.
|
||||
showPanelJumps: true
|
||||
|
||||
# Deprecated: use nerdFontsVersion instead
|
||||
showIcons: false
|
||||
|
||||
# Nerd fonts version to use.
|
||||
# One of: '2' | '3' | empty string (default)
|
||||
# If empty, do not show icons.
|
||||
nerdFontsVersion: ""
|
||||
|
||||
# If true (default), file icons are shown in the file views. Only relevant if NerdFontsVersion is not empty.
|
||||
showFileIcons: true
|
||||
|
||||
# Length of author name in (non-expanded) commits view. 2 means show initials only.
|
||||
commitAuthorShortLength: 2
|
||||
|
||||
# Length of author name in expanded commits view. 2 means show initials only.
|
||||
commitAuthorLongLength: 17
|
||||
|
||||
# Length of commit hash in commits view. 0 shows '*' if NF icons aren't on.
|
||||
commitHashLength: 8
|
||||
|
||||
# If true, show commit hashes alongside branch names in the branches view.
|
||||
showBranchCommitHash: false
|
||||
|
||||
# Whether to show the divergence from the base branch in the branches view.
|
||||
# One of: 'none' | 'onlyArrow' | 'arrowAndNumber'
|
||||
showDivergenceFromBaseBranch: none
|
||||
|
||||
# Height of the command log view
|
||||
commandLogSize: 8
|
||||
|
||||
# Whether to split the main window when viewing file changes.
|
||||
# One of: 'auto' | 'always'
|
||||
# If 'auto', only split the main window when a file has both staged and unstaged changes
|
||||
splitDiff: auto
|
||||
|
||||
# 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'
|
||||
windowSize: normal
|
||||
|
||||
screenMode: normal
|
||||
# Window border style.
|
||||
# One of 'rounded' (default) | 'single' | 'double' | 'hidden'
|
||||
border: rounded
|
||||
|
||||
# If true, show a seriously epic explosion animation when nuking the working tree.
|
||||
animateExplosion: true
|
||||
|
||||
# Whether to stack UI components on top of each other.
|
||||
# One of 'auto' (default) | 'always' | 'never'
|
||||
portraitMode: auto
|
||||
|
||||
# How things are filtered when typing '/'.
|
||||
# One of 'substring' (default) | 'fuzzy'
|
||||
filterMode: substring
|
||||
|
||||
# Config relating to the spinner.
|
||||
spinner:
|
||||
# The frames of the spinner animation.
|
||||
|
|
@ -217,116 +164,86 @@ gui:
|
|||
- /
|
||||
- "-"
|
||||
- \
|
||||
|
||||
# The "speed" of the spinner in milliseconds.
|
||||
rate: 50
|
||||
|
||||
# Status panel view.
|
||||
# One of 'dashboard' (default) | 'allBranchesLog'
|
||||
statusPanelView: dashboard
|
||||
|
||||
# If true, jump to the Files panel after popping a stash
|
||||
switchToFilesAfterStashPop: true
|
||||
|
||||
# If true, jump to the Files panel after applying a stash
|
||||
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
|
||||
switchTabsWithPanelJumpKeys: false
|
||||
|
||||
# Config relating to git
|
||||
git:
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md
|
||||
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'
|
||||
colorArg: always
|
||||
|
||||
# e.g.
|
||||
# diff-so-fancy
|
||||
# delta --dark --paging=never
|
||||
# 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).
|
||||
useConfig: false
|
||||
|
||||
# e.g. 'difft --color=always'
|
||||
externalDiffCommand: ""
|
||||
|
||||
# Config relating to committing
|
||||
commit:
|
||||
# If true, pass '--signoff' flag when committing
|
||||
signOff: false
|
||||
|
||||
# Automatic WYSIWYG wrapping of the commit message as you type
|
||||
autoWrapCommitMessage: true
|
||||
|
||||
# If autoWrapCommitMessage is true, the width to wrap to
|
||||
autoWrapWidth: 72
|
||||
|
||||
# Config relating to merging
|
||||
merging:
|
||||
# If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang
|
||||
# Only applicable to unix users.
|
||||
manualCommit: false
|
||||
|
||||
# Extra args passed to `git merge`, e.g. --no-ff
|
||||
args: ""
|
||||
|
||||
# The commit message to use for a squash merge commit. Can contain "{{selectedRef}}" and "{{currentBranch}}" placeholders.
|
||||
squashMergeMessage: Squash merge {{selectedRef}} into {{currentBranch}}
|
||||
|
||||
# list of branches that are considered 'main' branches, used when displaying commits
|
||||
mainBranches:
|
||||
- master
|
||||
- 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'
|
||||
skipHookPrefix: WIP
|
||||
|
||||
# If true, periodically fetch from remote
|
||||
autoFetch: true
|
||||
|
||||
# If true, periodically refresh files and submodules
|
||||
autoRefresh: true
|
||||
|
||||
# If true, pass the --all arg to git fetch
|
||||
fetchAll: true
|
||||
|
||||
# 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
|
||||
# continue a merge or rebase if you've resolved all conflicts. If false, it
|
||||
# won't do either of these things.
|
||||
autoStageResolvedConflicts: true
|
||||
|
||||
# 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}} --
|
||||
|
||||
# Command used to display git log of all branches in the main window.
|
||||
# Deprecated: Use `allBranchesLogCmds` instead.
|
||||
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
|
||||
overrideGpg: false
|
||||
|
||||
# If true, do not allow force pushes
|
||||
disableForcePushing: false
|
||||
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
|
||||
commitPrefix:
|
||||
# pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*"
|
||||
pattern: ""
|
||||
|
||||
# Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
|
||||
replace: ""
|
||||
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix
|
||||
branchPrefix: ""
|
||||
|
||||
# If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀
|
||||
# (This should really be under 'gui', not 'git')
|
||||
parseEmoji: false
|
||||
|
||||
# Config for showing the log in the commits view
|
||||
log:
|
||||
# One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default'
|
||||
|
|
@ -335,110 +252,84 @@ git:
|
|||
#
|
||||
# Deprecated: Configure this with `Log menu -> Commit sort order` (<c-l> in the commits window by default).
|
||||
order: topo-order
|
||||
|
||||
# This determines whether the git graph is rendered in the commits panel
|
||||
# One of 'always' | 'never' | 'when-maximised'
|
||||
#
|
||||
# Deprecated: Configure this with `Log menu -> Show git graph` (<c-l> in the commits window by default).
|
||||
showGraph: always
|
||||
|
||||
# displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`)
|
||||
showWholeGraph: false
|
||||
|
||||
# When copying commit hashes to the clipboard, truncate them to this
|
||||
# length. Set to 40 to disable truncation.
|
||||
truncateCopiedCommitHashesTo: 12
|
||||
|
||||
# Periodic update checks
|
||||
update:
|
||||
# One of: 'prompt' (default) | 'background' | 'never'
|
||||
method: prompt
|
||||
|
||||
# Period in days between update checks
|
||||
days: 14
|
||||
|
||||
# Background refreshes
|
||||
refresher:
|
||||
# File/submodule refresh interval in seconds.
|
||||
# Auto-refresh can be disabled via option 'git.autoRefresh'.
|
||||
refreshInterval: 10
|
||||
|
||||
# Re-fetch interval in seconds.
|
||||
# Auto-fetch can be disabled via option 'git.autoFetch'.
|
||||
fetchInterval: 60
|
||||
|
||||
# If true, show a confirmation popup before quitting Lazygit
|
||||
confirmOnQuit: false
|
||||
|
||||
# If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close
|
||||
quitOnTopLevelReturn: false
|
||||
|
||||
# Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc
|
||||
os:
|
||||
# Command for editing a file. Should contain "{{filename}}".
|
||||
edit: ""
|
||||
|
||||
# Command for editing a file at a given line number. Should contain
|
||||
# "{{filename}}", and may optionally contain "{{line}}".
|
||||
editAtLine: ""
|
||||
|
||||
# Same as EditAtLine, except that the command needs to wait until the
|
||||
# window is closed.
|
||||
editAtLineAndWait: ""
|
||||
|
||||
# For opening a directory in an editor
|
||||
openDirInEditor: ""
|
||||
|
||||
# A built-in preset that sets all of the above settings. Supported presets
|
||||
# are defined in the getPreset function in editor_presets.go.
|
||||
editPreset: ""
|
||||
|
||||
# Command for opening a file, as if the file is double-clicked. Should
|
||||
# contain "{{filename}}", but doesn't support "{{line}}".
|
||||
open: ""
|
||||
|
||||
# Command for opening a link. Should contain "{{link}}".
|
||||
openLink: ""
|
||||
|
||||
# EditCommand is the command for editing a file.
|
||||
# Deprecated: use Edit instead. Note that semantics are different:
|
||||
# EditCommand is just the command itself, whereas Edit contains a
|
||||
# "{{filename}}" variable.
|
||||
editCommand: ""
|
||||
|
||||
# EditCommandTemplate is the command template for editing a file
|
||||
# Deprecated: use EditAtLine instead.
|
||||
editCommandTemplate: ""
|
||||
|
||||
# OpenCommand is the command for opening a file
|
||||
# Deprecated: use Open instead.
|
||||
openCommand: ""
|
||||
|
||||
# OpenLinkCommand is the command for opening a link
|
||||
# Deprecated: use OpenLink instead.
|
||||
openLinkCommand: ""
|
||||
|
||||
# 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
|
||||
copyToClipboardCmd: ""
|
||||
|
||||
# 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
|
||||
readFromClipboardCmd: ""
|
||||
|
||||
# If true, don't display introductory popups upon opening Lazygit.
|
||||
disableStartupPopups: false
|
||||
|
||||
# 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
|
||||
# - 'create': initialize a new repo
|
||||
# - 'skip': open most recent repo
|
||||
# - 'quit': exit Lazygit
|
||||
notARepository: prompt
|
||||
|
||||
# If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.
|
||||
promptToReturnFromSubprocess: true
|
||||
|
||||
# Keybindings
|
||||
keybinding:
|
||||
universal:
|
||||
|
|
@ -493,10 +384,8 @@ keybinding:
|
|||
scrollDownMain-alt2: <c-d>
|
||||
executeShellCommand: ":"
|
||||
createRebaseOptionsMenu: m
|
||||
|
||||
# 'Files' appended for legacy reasons
|
||||
pushFiles: P
|
||||
|
||||
# 'Files' appended for legacy reasons
|
||||
pullFiles: p
|
||||
refresh: R
|
||||
|
|
|
|||
|
|
@ -139,7 +139,13 @@ end
|
|||
|
||||
# Coursier: Scala dependency manager
|
||||
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
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,13 @@
|
|||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown", -- 指定文件类型
|
||||
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,
|
||||
})
|
||||
|
||||
|
|
@ -24,5 +30,4 @@ require("config.plugins")
|
|||
-- 加载主题
|
||||
require("config.colorscheme")
|
||||
|
||||
|
||||
-- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
vim.cmd.colorscheme("catppuccin")
|
||||
vim.cmd.colorscheme("kanagawa")
|
||||
|
|
|
|||
|
|
@ -1,20 +1,23 @@
|
|||
local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
|
||||
local keymaps_basic = { -- Modification of Original Keymap - Colemak
|
||||
{ mode = mode_arrow, keys = "n", cmd = "j" },
|
||||
{ mode = mode_arrow, keys = "e", cmd = "k" },
|
||||
{ mode = mode_arrow, keys = "i", cmd = "l" },
|
||||
{ mode = mode_arrow, keys = "n", cmd = "j", desc = "Down" },
|
||||
{ mode = mode_arrow, keys = "e", cmd = "k", desc = "Up" },
|
||||
{ mode = mode_arrow, keys = "i", cmd = "l", desc = "Right" },
|
||||
{ keys = "H", cmd = ":bprevious<CR>" },
|
||||
{ keys = "N", cmd = "5j" },
|
||||
{ keys = "E", cmd = "5k" },
|
||||
{ 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 = "k", cmd = "n" },
|
||||
{ keys = "K", cmd = "N" },
|
||||
{ keys = "j", cmd = "e" },
|
||||
{ keys = "J", cmd = "E" },
|
||||
{ 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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
local M = {}
|
||||
local keymaps_user_command = require("keymaps.user-command")
|
||||
local global_default_opts = { noremap = true, silent = true }
|
||||
local global_default_mode = { "n" }
|
||||
-- local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,34 @@
|
|||
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 = {
|
||||
{ keys = "<space>", cmd = ":Telescope find_files<CR>", desc = "Find Files" },
|
||||
{ keys = "/", cmd = ":Telescope live_grep<CR>", desc = "Grep Files" },
|
||||
|
|
@ -42,18 +71,28 @@ local leader_w = { -- leader w: Windows Management
|
|||
{ 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 = "s", cmd = ":Telescope live_grep<CR>", desc = "Grep Files" },
|
||||
{ keys = "b", cmd = ":Telescope buffers<CR>", desc = "List Buffers" },
|
||||
{ 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
|
||||
{ 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
|
||||
{ keys = "a", cmd = ":Alpha", desc = "Dashboard" },
|
||||
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 = "h", cmd = ":bprevious<CR>", desc = "Previous Buffer" },
|
||||
{ keys = "i", cmd = ":bnext<CR>", desc = "Next Buffer" },
|
||||
|
|
@ -62,7 +101,25 @@ local leader_b = { -- leader b: Buffer
|
|||
{ keys = "0", cmd = ":bfirst<CR>", desc = "First Buffer" },
|
||||
{ keys = "^", cmd = ":bfirst<CR>", desc = "First Buffer" },
|
||||
{ keys = "$", cmd = ":blast<CR>", desc = "Last Buffer" },
|
||||
{ keys = "s", cmd = ":Telescope buffers<CR>", desc = "Search buffers" },
|
||||
-- { 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
|
||||
|
|
@ -85,4 +142,24 @@ for _, map in ipairs(leader_b) do
|
|||
table.insert(M, map)
|
||||
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
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ function M.plugin(api, opts)
|
|||
{ 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.absolute_path, opts = opts("Copy Absolute Path") },
|
||||
-- From Directory Opus
|
||||
{ keys = "#", cmd = "<Cmd>set relativenumber!<CR>", opts = opts("Toggle Relative Number") },
|
||||
-- Numeric 数字键
|
||||
{ keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
-- Non-Alphanumeric 非字母数字键
|
||||
|
|
|
|||
30
tools/nvim/lua/keymaps/user-command.lua
Normal file
30
tools/nvim/lua/keymaps/user-command.lua
Normal 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,
|
||||
})
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
return {
|
||||
{ "catppuccin/nvim", name = "catppuccin" },
|
||||
{ "olimorris/onedarkpro.nvim" },
|
||||
{ "rebelot/kanagawa.nvim" },
|
||||
{ "RRethy/vim-illuminate" },
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
|
|
|
|||
|
|
@ -3,4 +3,47 @@ return {
|
|||
{ import = "plugins.mod.nvim-tree" },
|
||||
{ import = "plugins.mod.telescope" },
|
||||
{ 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,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,4 +61,6 @@ return {
|
|||
-- })
|
||||
end,
|
||||
},
|
||||
{ import = "plugins.mod.conform-nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter-context" },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
return {
|
||||
{ "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" },
|
||||
{
|
||||
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
|
|
|
|||
38
tools/nvim/lua/plugins/mod/conform-nvim.lua
Normal file
38
tools/nvim/lua/plugins/mod/conform-nvim.lua
Normal 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,
|
||||
}
|
||||
|
|
@ -31,6 +31,22 @@ return {
|
|||
on_attach = my_on_attach,
|
||||
sync_root_with_cwd = true,
|
||||
respect_buf_cwd = true,
|
||||
disable_netrw = true,
|
||||
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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,17 @@ return {
|
|||
config = function()
|
||||
require("telescope").setup({
|
||||
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 = {
|
||||
n = {
|
||||
["n"] = "move_selection_next",
|
||||
|
|
@ -11,6 +22,7 @@ return {
|
|||
["r"] = "preview_scrolling_down",
|
||||
["a"] = "preview_scrolling_left",
|
||||
["s"] = "preview_scrolling_right",
|
||||
["q"] = require("telescope.actions").close,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue