mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
breaking: Remove setup script and use chezmoi
This commit is contained in:
parent
02bbb24cac
commit
0051a163c3
190 changed files with 118 additions and 3456 deletions
35
dot_config/doom/beancount.el
Normal file
35
dot_config/doom/beancount.el
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
;;; init-beancount.el --- beancount support -*- lexical-binding: t -*-
|
||||
(after! beancount
|
||||
|
||||
;; 1. 自动启用 outline-minor-mode
|
||||
(add-hook! 'beancount-mode-hook #'outline-minor-mode)
|
||||
|
||||
;; 2. 设置大纲导航快捷键 (使用 Doom 的 map! 宏)
|
||||
(map! :map beancount-mode-map
|
||||
"C-c C-n" #'outline-next-visible-heading
|
||||
"C-c C-p" #'outline-previous-visible-heading)
|
||||
|
||||
;; 3. 核心功能:跨文件账户补全 (这部分逻辑完全保留)
|
||||
(defvar my-beancount-accounts-files nil "List of account files.")
|
||||
(setq my-beancount-accounts-files
|
||||
(directory-files "~/Documents/Finance/Beancount/config/" 'full (rx ".beancount" eos)))
|
||||
|
||||
(defun my-beancount--collect-accounts-from-files (oldfun &rest args)
|
||||
"Collect all accounts from files specified in `my-beancount-accounts-files'."
|
||||
(let ((keys (apply oldfun args))
|
||||
(hash (make-hash-table :test 'equal)))
|
||||
(dolist (key keys)
|
||||
(puthash key nil hash))
|
||||
;; collect accounts from files
|
||||
(save-excursion
|
||||
(dolist (f my-beancount-accounts-files)
|
||||
;; `ignore-errors` is a good practice for file operations
|
||||
(ignore-errors
|
||||
(with-current-buffer (find-file-noselect f)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward beancount-account-regexp nil t)
|
||||
(puthash (match-string-no-properties 1) nil hash))))))
|
||||
(hash-table-keys hash)))
|
||||
|
||||
(advice-add #'beancount-collect
|
||||
:around #'my-beancount--collect-accounts-from-files))
|
||||
79
dot_config/doom/calendar.el
Normal file
79
dot_config/doom/calendar.el
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
;;; ~/.doom.d/+calendar.el -*- lexical-binding: t; -*-
|
||||
;;; https://github.com/cnsunyour/.doom.d/blob/master/modules/cnsunyour/calendar/config.el
|
||||
|
||||
|
||||
;; 日历及纪念日相关设置
|
||||
|
||||
;; 定义可以设置农历纪念日的函数
|
||||
;; (defun cnsunyour/diary-chinese-anniversary (lunar-month lunar-day &optional year mark)
|
||||
;; (if year
|
||||
;; (let* ((d-date (diary-make-date lunar-month lunar-day year))
|
||||
;; (a-date (calendar-absolute-from-gregorian d-date))
|
||||
;; (c-date (calendar-chinese-from-absolute a-date))
|
||||
;; (cycle (car c-date))
|
||||
;; (yy (cadr c-date))
|
||||
;; (y (+ (* 100 cycle) yy)))
|
||||
;; (diary-chinese-anniversary lunar-month lunar-day y mark))
|
||||
;; (diary-chinese-anniversary lunar-month lunar-day year mark)))
|
||||
|
||||
(setq calendar-date-style 'iso)
|
||||
(setq diary-date-forms '((year "年" month "月" day "日" " 星期[" "日一二三四五六" "]") ;; Chinese
|
||||
(year "-" month "-" day) ;; ISO
|
||||
(month "[-/]" day "[^-/0-9]") (year "[-/]" month "[-/]" day "[^0-9]")
|
||||
(monthname " *" day "[^-0-9]") (year " *" monthname " *" day "[^0-9]")
|
||||
(dayname "\\W")))
|
||||
|
||||
(setq calendar-mark-holidays-flag t
|
||||
calendar-week-start-day 1)
|
||||
|
||||
(use-package! cal-china-x
|
||||
:custom
|
||||
(cal-china-x-important-holidays '((holiday-chinese-new-year)
|
||||
(holiday-lunar 12 23 "小年(北)" 1)
|
||||
(holiday-lunar 12 24 "小年(南)" 1)
|
||||
(holiday-lunar 12 30 "除夕" 1)
|
||||
(holiday-lunar 1 1 "春节" 0)
|
||||
(holiday-lunar 1 2 "春节" 0)
|
||||
(holiday-lunar 1 3 "春节" 0)
|
||||
(holiday-lunar 1 4 "春节" 0)
|
||||
(holiday-lunar 1 5 "春节(破五)" 0)
|
||||
(holiday-lunar 1 15 "元宵节" 0)
|
||||
(holiday-lunar 2 2 "龙抬头" 0)
|
||||
(holiday-solar-term "清明" "清明节")
|
||||
(holiday-fixed 5 1 "劳动节")
|
||||
(holiday-lunar 5 5 "端午节" 0)
|
||||
(holiday-lunar 7 7 "七夕节" 0)
|
||||
(holiday-lunar 7 15 "中元节" 0)
|
||||
(holiday-lunar 8 15 "中秋节" 0)
|
||||
(holiday-fixed 10 1 "国庆节")
|
||||
(holiday-fixed 10 2 "国庆节")
|
||||
(holiday-fixed 10 3 "国庆节")
|
||||
(holiday-lunar 9 9 "重阳节" 0)
|
||||
(holiday-lunar 10 1 "寒衣节" 0)
|
||||
(holiday-lunar 12 8 "腊八" 1)
|
||||
(holiday-solar-term "立春" "立春")
|
||||
(holiday-solar-term "立夏" "立夏")
|
||||
(holiday-solar-term "立秋" "立秋")
|
||||
(holiday-solar-term "立冬" "立冬")
|
||||
(holiday-solar-term "春分" "春分")
|
||||
(holiday-solar-term "夏至" "夏至")
|
||||
(holiday-solar-term "秋分" "秋分")
|
||||
(holiday-solar-term "冬至" "冬至")))
|
||||
(cal-china-x-general-holidays '((holiday-fixed 1 1 "元旦")
|
||||
(holiday-fixed 2 14 "情人节")
|
||||
(holiday-fixed 3 8 "妇女节")
|
||||
(holiday-fixed 4 1 "愚人节")
|
||||
(holiday-fixed 5 4 "青年节")
|
||||
(holiday-float 5 0 2 "母亲节")
|
||||
(holiday-fixed 6 1 "儿童节")
|
||||
(holiday-float 6 0 3 "父亲节")
|
||||
(holiday-fixed 9 10 "教师节")
|
||||
(holiday-float 11 4 4 "感恩节")
|
||||
(holiday-fixed 12 25 "圣诞节")))
|
||||
:config
|
||||
(setq calendar-holidays (append cal-china-x-important-holidays
|
||||
cal-china-x-general-holidays)))
|
||||
|
||||
;; diary
|
||||
|
||||
(setq diary-file "~/.local/js0ny/diary")
|
||||
158
dot_config/doom/config.el
Normal file
158
dot_config/doom/config.el
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Place your private configuration here! Remember, you do not need to run 'doom
|
||||
;; sync' after modifying this file!
|
||||
|
||||
|
||||
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
||||
;; clients, file templates and snippets. It is optional.
|
||||
;; (setq user-full-name "John Doe"
|
||||
;; user-mail-address "john@doe.com")
|
||||
|
||||
;; Doom exposes five (optional) variables for controlling fonts in Doom:
|
||||
;;
|
||||
;; - `doom-font' -- the primary font to use
|
||||
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
|
||||
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
||||
;; presentations or streaming.
|
||||
;; - `doom-symbol-font' -- for symbols
|
||||
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
|
||||
;;
|
||||
;; See 'C-h v doom-font' for documentation and more examples of what they
|
||||
;; accept. For example:
|
||||
;;
|
||||
;; https://emacs-china.org/t/doom-emacs/23513/13
|
||||
(setq doom-font (font-spec :family "Maple Mono NF CN" :size 14)
|
||||
doom-serif-font doom-font
|
||||
doom-symbol-font (font-spec :family "Maple Mono NF CN")
|
||||
doom-variable-pitch-font (font-spec :family "Maple Mono NF CN" :weight 'extra-bold))
|
||||
|
||||
;; 如果不把这玩意设置为 nil, 会默认去用 fontset-default 来展示, 配置无效
|
||||
(setq use-default-font-for-symbols nil)
|
||||
|
||||
;; Doom 的字体加载顺序问题, 如果不设定这个 hook, 配置会被覆盖失效
|
||||
;;(add-hook! 'after-setting-font-hook
|
||||
;; (set-fontset-font t 'latin (font-spec :family "Iosevka Nerd Font Propo"))
|
||||
;; (set-fontset-font t 'symbol (font-spec :family "Symbola"))
|
||||
;; (set-fontset-font t 'mathematical (font-spec :family "Symbola"))
|
||||
;; (set-fontset-font t 'emoji (font-spec :family "Symbola")))
|
||||
|
||||
;; (dolist (charset '(kana han cjk-misc bopomofo))
|
||||
;; (set-fontset-font t charset (font-spec :family "LXGW WenKai Mono" :size 16)))
|
||||
;;
|
||||
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
|
||||
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
|
||||
;; refresh your font settings. If Emacs still can't find your font, it likely
|
||||
;; wasn't installed correctly. Font issues are rarely Doom issues!
|
||||
|
||||
;; There are two ways to load a theme. Both assume the theme is installed and
|
||||
;; available. You can either set `doom-theme' or manually load a theme with the
|
||||
;; `load-theme' function. This is the default:
|
||||
(setq doom-theme 'catppuccin)
|
||||
(setq catppuccin-flavor 'mocha)
|
||||
;(catppuccin-reload)
|
||||
|
||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||
(setq display-line-numbers t)
|
||||
(setq display-line-numbers-type 'visual)
|
||||
|
||||
|
||||
|
||||
|
||||
;; Whenever you reconfigure a package, make sure to wrap your config in an
|
||||
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
|
||||
;;
|
||||
;; (after! PACKAGE
|
||||
;; (setq x y))
|
||||
;;
|
||||
;; The exceptions to this rule:
|
||||
;;
|
||||
;; - Setting file/directory variables (like `org-directory')
|
||||
;; - Setting variables which explicitly tell you to set them before their
|
||||
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
|
||||
;; - Setting doom variables (which start with 'doom-' or '+').
|
||||
;;
|
||||
;; Here are some additional functions/macros that will help you configure Doom.
|
||||
;;
|
||||
;; - `load!' for loading external *.el files relative to this one
|
||||
;; - `use-package!' for configuring packages
|
||||
;; - `after!' for running code after a package has loaded
|
||||
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
||||
;; this file. Emacs searches the `load-path' when you load packages with
|
||||
;; `require' or `use-package'.
|
||||
;; - `map!' for binding new keys
|
||||
;;
|
||||
;; To get information about any of these functions/macros, move the cursor over
|
||||
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
||||
;; This will open documentation for it, including demos of how they are used.
|
||||
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
|
||||
;; etc).
|
||||
;;
|
||||
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
||||
;; they are implemented.
|
||||
|
||||
(add-to-list 'load-path (expand-file-name "lisp" doom-user-dir))
|
||||
(setq doom-local-dir (expand-file-name "emacs" (getenv "XDG_DATA_HOME")))
|
||||
(setq doom-data-dir (expand-file-name "etc" doom-local-dir))
|
||||
|
||||
(after! recentf
|
||||
(setq recentf-max-saved-items 200)
|
||||
(add-to-list 'recentf-exclude "\\.revive$")
|
||||
(add-to-list 'recentf-exclude "\\.windows$")
|
||||
(add-to-list 'recentf-exclude "\\.#.+$")
|
||||
(add-to-list 'recentf-exclude "^/tmp/")
|
||||
(add-to-list 'recentf-exclude "COMMIT_EDITMSG\\'")
|
||||
)[1][2]
|
||||
|
||||
|
||||
|
||||
(after! wakatime-mode
|
||||
(global-wakatime-mode)
|
||||
(setq wakatime-cli-path "~/.local/bin/wakatime"))
|
||||
|
||||
;; accept completion from copilot and fallback to company
|
||||
(use-package! copilot
|
||||
:hook (prog-mode . copilot-mode)
|
||||
:bind (:map copilot-completion-map
|
||||
("<tab>" . 'copilot-accept-completion)
|
||||
("TAB" . 'copilot-accept-completion)
|
||||
("C-TAB" . 'copilot-accept-completion-by-word)
|
||||
("C-<tab>" . 'copilot-accept-completion-by-word)))
|
||||
|
||||
(load! "evil.el")
|
||||
|
||||
(load! "treemacs.el")
|
||||
|
||||
(load! "org.el")
|
||||
|
||||
(after! evil-matchit
|
||||
(global-evil-matchit-mode 1)
|
||||
)
|
||||
|
||||
|
||||
(if (eq system-type 'gnu/linux)
|
||||
(use-package! rime
|
||||
:custom
|
||||
(rime-user-data-dir (expand-file-name "emacs-rime" (getenv "XDG_CONFIG_HOME")))
|
||||
; (rime-share-data-dir "~/.local/share/fcitx5/rime")
|
||||
(default-input-method "rime")
|
||||
;; :config
|
||||
;; (add-hook! (org-mode markdown-mode) (activate-input-method default-input-method))
|
||||
))
|
||||
|
||||
(load! "calendar.el")
|
||||
|
||||
(when (file-exists-p (expand-file-name "local.el" doom-user-dir))
|
||||
(load! "local.el"))
|
||||
|
||||
;; (load! "telega.el")
|
||||
|
||||
(use-package! eee
|
||||
:config
|
||||
(if (eq system-type 'gnu/linux)
|
||||
(setq ee-terminal-command "kitty"))
|
||||
)
|
||||
|
||||
|
||||
(load! "beancount.el")
|
||||
13
dot_config/doom/dot_custom.el
Normal file
13
dot_config/doom/dot_custom.el
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
;;; -*- lexical-binding: t -*-
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(auth-source-save-behavior nil))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
)
|
||||
3
dot_config/doom/dot_gitignore
Normal file
3
dot_config/doom/dot_gitignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.custom.el
|
||||
local.el
|
||||
themes/
|
||||
15
dot_config/doom/evil.el
Normal file
15
dot_config/doom/evil.el
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(map!
|
||||
:nvm "H" 'evil-prev-buffer
|
||||
:nvm "L" 'evil-next-buffer
|
||||
:nvom "J" '(lambda () (interactive) (evil-next-line 5)) ; 5j
|
||||
:nvom "K" '(lambda () (interactive) (evil-previous-line 5)) ; 5k
|
||||
)
|
||||
|
||||
;; Swap ; and :
|
||||
(map! :leader
|
||||
";" #'execute-extended-command
|
||||
":" #'pp-eval-expression
|
||||
"f h" #'consult-recent-file
|
||||
"b D" #'kill-some-buffers
|
||||
"f c" #'doom/open-private-config
|
||||
"f C" #'editorconfig-find-current-editorconfig)
|
||||
206
dot_config/doom/init.el
Normal file
206
dot_config/doom/init.el
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
;;; init.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; This file controls what Doom modules are enabled and what order they load
|
||||
;; in. Remember to run 'doom sync' after modifying it!
|
||||
|
||||
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
|
||||
;; documentation. There you'll find a link to Doom's Module Index where all
|
||||
;; of our modules are listed, including what flags they support.
|
||||
|
||||
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
|
||||
;; 'C-c c k' for non-vim users) to view its documentation. This works on
|
||||
;; flags as well (those symbols that start with a plus).
|
||||
;;
|
||||
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
|
||||
;; directory (for easy access to its source code).
|
||||
|
||||
(doom! :input
|
||||
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
|
||||
;;; 关闭 chinese 以启用 best Chinese IME
|
||||
;; chinese
|
||||
;;japanese
|
||||
;;layout ; auie,ctsrnm is the superior home row
|
||||
|
||||
:completion
|
||||
;;company ; the ultimate code completion backend
|
||||
(corfu +orderless) ; complete with cap(f), cape and a flying feather!
|
||||
;;helm ; the *other* search engine for love and life
|
||||
;;ido ; the other *other* search engine...
|
||||
;;ivy ; a search engine for love and life
|
||||
vertico ; the search engine of the future
|
||||
|
||||
:ui
|
||||
;;deft ; notational velocity for Emacs
|
||||
doom ; what makes DOOM look the way it does
|
||||
doom-dashboard ; a nifty splash screen for Emacs
|
||||
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
|
||||
;;(emoji +unicode) ; 🙂
|
||||
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
|
||||
indent-guides ; highlighted indent columns
|
||||
ligatures ; ligatures and symbols to make your code pretty again
|
||||
minimap ; show a map of the code on the side
|
||||
modeline ; snazzy, Atom-inspired modeline, plus API
|
||||
;;nav-flash ; blink cursor line after big motions
|
||||
;;neotree ; a project drawer, like NERDTree for vim
|
||||
ophints ; highlight the region an operation acts on
|
||||
(popup +defaults) ; tame sudden yet inevitable temporary windows
|
||||
tabs ; a tab bar for Emacs
|
||||
treemacs ; a project drawer, like neotree but cooler
|
||||
unicode ; extended unicode support for various languages
|
||||
(vc-gutter +pretty) ; vcs diff in the fringe
|
||||
vi-tilde-fringe ; fringe tildes to mark beyond EOB
|
||||
;;window-select ; visually switch windows
|
||||
workspaces ; tab emulation, persistence & separate workspaces
|
||||
;;zen ; distraction-free coding or writing
|
||||
|
||||
:editor
|
||||
(evil +everywhere); come to the dark side, we have cookies
|
||||
file-templates ; auto-snippets for empty files
|
||||
fold ; (nigh) universal code folding
|
||||
(format +onsave) ; automated prettiness
|
||||
;;god ; run Emacs commands without modifier keys
|
||||
;;lispy ; vim for lisp, for people who don't like vim
|
||||
multiple-cursors ; editing in many places at once
|
||||
;;objed ; text object editing for the innocent
|
||||
;;parinfer ; turn lisp into python, sort of
|
||||
;;rotate-text ; cycle region at point between text candidates
|
||||
snippets ; my elves. They type so I don't have to
|
||||
word-wrap ; soft wrapping with language-aware indent
|
||||
|
||||
:emacs
|
||||
dired ; making dired pretty [functional]
|
||||
electric ; smarter, keyword-based electric-indent
|
||||
;;eww ; the internet is gross
|
||||
;;ibuffer ; interactive buffer management
|
||||
undo ; persistent, smarter undo for your inevitable mistakes
|
||||
vc ; version-control and Emacs, sitting in a tree
|
||||
|
||||
:term
|
||||
eshell ; the elisp shell that works everywhere
|
||||
;;shell ; simple shell REPL for Emacs
|
||||
;;term ; basic terminal emulator for Emacs
|
||||
;;vterm ; the best terminal emulation in Emacs
|
||||
|
||||
:checkers
|
||||
syntax ; tasing you for every semicolon you forget
|
||||
;;(spell +flyspell) ; tasing you for misspelling mispelling
|
||||
grammar ; tasing grammar mistake every you make
|
||||
|
||||
:tools
|
||||
;;ansible
|
||||
;;biblio ; Writes a PhD for you (citation needed)
|
||||
;;collab ; buffers with friends
|
||||
;;debugger ; FIXME stepping through code, to help you add bugs
|
||||
;;direnv
|
||||
;;docker
|
||||
editorconfig ; let someone else argue about tabs vs spaces
|
||||
;;ein ; tame Jupyter notebooks with emacs
|
||||
(eval +overlay) ; run code, run (also, repls)
|
||||
lookup ; navigate your code and its documentation
|
||||
lsp ; M-x vscode
|
||||
magit ; a git porcelain for Emacs
|
||||
;;make ; run make tasks from Emacs
|
||||
;;pass ; password manager for nerds
|
||||
;;pdf ; pdf enhancements
|
||||
;;prodigy ; FIXME managing external services & code builders
|
||||
;;terraform ; infrastructure as code
|
||||
;;tmux ; an API for interacting with tmux
|
||||
tree-sitter ; syntax and parsing, sitting in a tree...
|
||||
;;upload ; map local to remote projects via ssh/ftp
|
||||
|
||||
:os
|
||||
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
|
||||
;;tty ; improve the terminal Emacs experience
|
||||
|
||||
:lang
|
||||
;;agda ; types of types of types of types...
|
||||
beancount ; mind the GAAP
|
||||
(cc +lsp) ; C > C++ == 1
|
||||
;;clojure ; java with a lisp
|
||||
;;common-lisp ; if you've seen one lisp, you've seen them all
|
||||
;;coq ; proofs-as-programs
|
||||
;;crystal ; ruby at the speed of c
|
||||
;;csharp ; unity, .NET, and mono shenanigans
|
||||
data ; config/data formats
|
||||
;;(dart +flutter) ; paint ui and not much else
|
||||
;;dhall
|
||||
;;elixir ; erlang done right
|
||||
;;elm ; care for a cup of TEA?
|
||||
emacs-lisp ; drown in parentheses
|
||||
;;erlang ; an elegant language for a more civilized age
|
||||
;;ess ; emacs speaks statistics
|
||||
;;factor
|
||||
;;faust ; dsp, but you get to keep your soul
|
||||
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
|
||||
;;fsharp ; ML stands for Microsoft's Language
|
||||
;;fstar ; (dependent) types and (monadic) effects and Z3
|
||||
;;gdscript ; the language you waited for
|
||||
;;(go +lsp) ; the hipster dialect
|
||||
;;(graphql +lsp) ; Give queries a REST
|
||||
(haskell +lsp) ; a language that's lazier than I am
|
||||
;;hy ; readability of scheme w/ speed of python
|
||||
;;idris ; a language you can depend on
|
||||
(json +lsp +tree-sitter) ; At least it ain't XML
|
||||
;;(java +lsp) ; the poster child for carpal tunnel syndrome
|
||||
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
|
||||
;;julia ; a better, faster MATLAB
|
||||
;;kotlin ; a better, slicker Java(Script)
|
||||
(latex +latexmk +cdlatex +lsp) ; writing papers in Emacs has never been so fun
|
||||
;;lean ; for folks with too much to prove
|
||||
;;ledger ; be audit you can be
|
||||
;lua ; one-based indices? one-based indices
|
||||
markdown ; writing docs for people to ignore
|
||||
;;nim ; python + lisp at the speed of c
|
||||
nix ; I hereby declare "nix geht mehr!"
|
||||
;;ocaml ; an objective camel
|
||||
(org ; organize your plain life in plain text
|
||||
+pomodoro
|
||||
+dragndrop
|
||||
+noter
|
||||
+pandoc
|
||||
+pretty
|
||||
)
|
||||
;;php ; perl's insecure younger brother
|
||||
;;plantuml ; diagrams for confusing people more
|
||||
;;graphviz ; diagrams for confusing yourself even more
|
||||
;;purescript ; javascript, but functional
|
||||
(python +lsp +tree-sitter +pyright) ; beautiful is better than ugly
|
||||
;;qt ; the 'cutest' gui framework ever
|
||||
;;racket ; a DSL for DSLs
|
||||
;;raku ; the artist formerly known as perl6
|
||||
;;rest ; Emacs as a REST client
|
||||
;;rst ; ReST in peace
|
||||
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
|
||||
;;(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
|
||||
;;scala ; java, but good
|
||||
(scheme +guile) ; a fully conniving family of lisps
|
||||
(sh +lsp +tree-sitter +fish) ; she sells {ba,z,fi}sh shells on the C xor
|
||||
;;sml
|
||||
;;solidity ; do you need a blockchain? No.
|
||||
;;swift ; who asked for emoji variables?
|
||||
;;terra ; Earth and Moon in alignment for performance.
|
||||
;;web ; the tubes
|
||||
(yaml +lsp +tree-sitter) ; JSON, but readable
|
||||
;;zig ; C, but simpler
|
||||
|
||||
:email
|
||||
(mu4e +org +gmail)
|
||||
;;notmuch
|
||||
;;(wanderlust +gmail)
|
||||
|
||||
:app
|
||||
calendar
|
||||
;;emms
|
||||
;;everywhere ; *leave* Emacs!? You must be joking
|
||||
;;irc ; how neckbeards socialize
|
||||
(rss +org) ; emacs as an RSS reader
|
||||
|
||||
:config
|
||||
;;literate
|
||||
(default +bindings +smartparens)
|
||||
:personal
|
||||
telega
|
||||
)
|
||||
|
||||
(setq custom-file (expand-file-name ".custom.el" doom-user-dir))
|
||||
(load custom-file t)
|
||||
84
dot_config/doom/lisp/org-pomodoro-music-controller.el
Normal file
84
dot_config/doom/lisp/org-pomodoro-music-controller.el
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
;;; org-pomodoro-music-controller.el --- Play music during org-pomodoro breaks -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Commentary:
|
||||
;;; Add music control to org-pomodoro breaks.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'org-pomodoro)
|
||||
|
||||
;; Variables
|
||||
|
||||
(defcustom org-pomodoro-music-player-command
|
||||
(cond
|
||||
((eq system-type 'windows-nt) "clmcontrol")
|
||||
((eq system-type 'darwin) "nowplaying-cli")
|
||||
((eq system-type 'gnu/linux) "playerctl")
|
||||
(t "playerctl"))
|
||||
"Command to control the music player."
|
||||
:type 'string
|
||||
:group 'org-pomodoro)
|
||||
|
||||
|
||||
(defcustom org-pomodoro-music-player-args nil
|
||||
"Arguments to pass to the music player command."
|
||||
:type '(repeat string)
|
||||
:group 'org-pomodoro)
|
||||
|
||||
|
||||
(defun org-pomodoro-music-get-status ()
|
||||
"Get thestatus of the music player."
|
||||
(with-temp-buffer
|
||||
(let ((args (append org-pomodoro-music-player-args '("status"))))
|
||||
(apply #'call-process org-pomodoro-music-player-command nil t nil args)
|
||||
(string-trim (buffer-string)))))
|
||||
|
||||
(defun org-pomodoro-music-is-playing-p ()
|
||||
"Check if the music player is playing."
|
||||
(let ((status (org-pomodoro-music-get-status)))
|
||||
(string= status "Playing")))
|
||||
|
||||
(defun org-pomodoro-music-pause ()
|
||||
"Stop the music player."
|
||||
(let ((args (append org-pomodoro-music-player-args '("pause"))))
|
||||
(apply #'call-process org-pomodoro-music-player-command nil nil nil args)))
|
||||
|
||||
(defun org-pomodoro-music-play ()
|
||||
"Start the music player."
|
||||
(let ((args (append org-pomodoro-music-player-args '("play"))))
|
||||
(apply #'call-process org-pomodoro-music-player-command nil nil nil args)))
|
||||
|
||||
;; Defining Hooks
|
||||
(defun org-pomodoro-music-break-started-hook ()
|
||||
"When a break start, pause the music player."
|
||||
(setq org-pomodoro-music-was-playing (org-pomodoro-music-is-playing-p))
|
||||
(when org-pomodoro-music-was-playing
|
||||
(org-pomodoro-music-pause)
|
||||
(message "休息开始,音乐已暂停")))
|
||||
|
||||
;; (defun org-pomodoro-music-break-finished-hook ()
|
||||
;; "When a break finishes, resume the music player."
|
||||
;; (when (and org-pomodoro-music-was-playing
|
||||
;; (not (org-pomodoro-music-is-playing-p)))
|
||||
;; (org-pomodoro-music-play)
|
||||
;; (message "休息结束,音乐已恢复播放"))
|
||||
;; (setq org-pomodoro-music-was-playing nil))
|
||||
|
||||
(defun org-pomodoro-music-started-hook ()
|
||||
"When a pomodoro start, play the music player."
|
||||
(unless (org-pomodoro-music-is-playing-p)
|
||||
(org-pomodoro-music-play)
|
||||
(message "番茄开始,音乐已开始播放"))
|
||||
)
|
||||
|
||||
;; Adding hooks
|
||||
;; (add-hook 'org-pomodoro-break-started-hook #'org-pomodoro-music-break-started-hook)
|
||||
;; (add-hook 'org-pomodoro-break-finished-hook #'org-pomodoro-music-break-finished-hook)
|
||||
|
||||
;; (add-hook 'org-pomodoro-long-break-started-hook #'org-pomodoro-music-break-started-hook)
|
||||
;; (add-hook 'org-pomodoro-long-break-finished-hook #'org-pomodoro-music-break-finished-hook)
|
||||
|
||||
(add-hook 'org-pomodoro-started-hook #'org-pomodoro-music-started-hook)
|
||||
|
||||
(provide 'org-pomodoro-music-controller)
|
||||
;;; org-pomodoro-music-controller.el ends here
|
||||
57
dot_config/doom/lisp/org-pomodoro-telegram-notifier.el
Normal file
57
dot_config/doom/lisp/org-pomodoro-telegram-notifier.el
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
;;; org-pomodoro-telegram-notifier.el --- 为 org-pomodoro 添加发送 Telegram 通知的功能。 -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Commentary:
|
||||
;;; Provide a way to send Telegram notifications when org-pomodoro breaks end.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'org-pomodoro)
|
||||
(require 'request)
|
||||
|
||||
(defcustom org-pomodoro-telegram-bot-token ""
|
||||
"Your Telegram bot token."
|
||||
:type 'string
|
||||
:group 'org-pomodoro)
|
||||
|
||||
(defcustom org-pomodoro-telegram-chat-id ""
|
||||
"Your Telegram chat ID."
|
||||
:type 'string
|
||||
:group 'org-pomodoro)
|
||||
|
||||
(defcustom org-pomodoro-telegram-break-end-message "休息时间结束"
|
||||
"The message to send when a break ends."
|
||||
:type 'string
|
||||
:group 'org-pomodoro)
|
||||
|
||||
(defun org-pomodoro-send-telegram-message (message)
|
||||
"Send a message to the Telegram chat.
|
||||
MESSAGE is the message to send."
|
||||
(interactive)
|
||||
(when (and (not (string-empty-p org-pomodoro-telegram-bot-token))
|
||||
(not (string-empty-p org-pomodoro-telegram-chat-id)))
|
||||
(request
|
||||
(format "https://api.telegram.org/bot%s/sendMessage" org-pomodoro-telegram-bot-token)
|
||||
:type "POST"
|
||||
:data `(("chat_id" . ,org-pomodoro-telegram-chat-id)
|
||||
("text" . ,"⏳<b>[Emacs]</b> <code>org-pomodoro</code>: 休息时间结束")
|
||||
("parse_mode" . "HTML"))
|
||||
:parser 'json-read
|
||||
:success (cl-function
|
||||
(lambda (&key data &allow-other-keys)
|
||||
(message "成功发送 Telegram 通知")))
|
||||
:error (cl-function
|
||||
(lambda (&key error-thrown &allow-other-keys)
|
||||
(message "发送 Telegram 通知失败: %S" error-thrown))))
|
||||
)
|
||||
)
|
||||
|
||||
(defun org-pomodoro-telegram-break-finished-hook ()
|
||||
"Send a Telegram message when a break ends."
|
||||
(org-pomodoro-send-telegram-message org-pomodoro-telegram-break-end-message))
|
||||
|
||||
(add-hook 'org-pomodoro-break-finished-hook #'org-pomodoro-telegram-break-finished-hook)
|
||||
(add-hook 'org-pomodoro-long-break-finished-hook #'org-pomodoro-telegram-break-finished-hook)
|
||||
|
||||
|
||||
(provide 'org-pomodoro-telegram-notifier)
|
||||
;;; org-pomodoro-telegram-notifier.el ends here
|
||||
228
dot_config/doom/org.el
Normal file
228
dot_config/doom/org.el
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
;; If use `org' and don't want your org files in the default location below,
|
||||
;; change `org-directory'. It must be set before org loads!
|
||||
(setq org-directory "~/OrgFiles/")
|
||||
;; (setq org-roam-directory "~/OrgFiles/roam/")
|
||||
|
||||
;;; org general
|
||||
|
||||
(after! org
|
||||
;; For CJK users
|
||||
;; Insert zero width space around the emphasis symbols, this might be useful for
|
||||
;; languages that does not rely on space
|
||||
(defun my/insert-emphasis-with-zws (char)
|
||||
(interactive "c")
|
||||
(insert ?\u200B char)
|
||||
(save-excursion (insert char ?\u200B)))
|
||||
|
||||
;; Directory
|
||||
(setq org-archive-location "~/OrgFiles/.archive/%s_archive::")
|
||||
(setq org-default-notes-file "~/OrgFiles/tasks/inbox.org")
|
||||
|
||||
;; Initial Visibility
|
||||
(setq org-startup-folded "show2levels")
|
||||
|
||||
;; Log into drawer
|
||||
(setq org-log-into-drawer "LOGBOOK")
|
||||
|
||||
;;
|
||||
|
||||
(setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "WAIT(w@/!)" "|" "DONE(d@/!)" "CANCELLED(c@)")
|
||||
))
|
||||
|
||||
(setq org-todo-keyword-faces
|
||||
'(("TODO" . (:foreground "red" :weight bold :background "yellow"))
|
||||
("NEXT" . (:foreground "blue" :weight bold :background "lightgray"))
|
||||
("WAIT" . (:foreground "orange" :weight bold))
|
||||
("DONE" . (:foreground "grey" :weight bold :italic t))
|
||||
("CANCELLED" . (:foreground "grey" :weight bold))
|
||||
))
|
||||
|
||||
;; Keymaps
|
||||
(map! :map org-mode-map
|
||||
:desc "Bold with ZWS" "C-c b" (lambda () (interactive) (my/insert-emphasis-with-zws ?*))
|
||||
:desc "Italic with ZWS" "C-c i" (lambda () (interactive) (my/insert-emphasis-with-zws ?/))
|
||||
:desc "Underline with ZWS" "C-c u" (lambda () (interactive) (my/insert-emphasis-with-zws ?_))
|
||||
:desc "Code with ZWS" "C-c c" (lambda () (interactive) (my/insert-emphasis-with-zws ?~))
|
||||
:nvom "M-n" 'org-metadown
|
||||
:nvom "M-e" 'org-metaup)
|
||||
|
||||
(setq org-capture-templates
|
||||
'(("t" "Task" entry (file+headline "~/OrgFiles/tasks/inbox.org" "Tasks")
|
||||
"* TODO %?\n %U\n %a\n %i"
|
||||
:empty-lines 1)
|
||||
("n" "Note" entry (file+headline "~/OrgFiles/tasks/inbox.org" "Notes"))
|
||||
))
|
||||
|
||||
;; 处理 Zotero 链接
|
||||
(org-link-set-parameters
|
||||
"zotero"
|
||||
:follow (lambda (path) (browse-url (concat "zotero://" path)))
|
||||
:export (lambda (path desc format)
|
||||
(cond
|
||||
((eq format 'html) (format "<a href=\"zotero://%s\">%s</a>" path (or desc path)))
|
||||
((eq format 'latex) (format "\\href{zotero://%s}{%s}" path (or desc path)))
|
||||
(t path))))
|
||||
|
||||
;; 处理 Obsidian 链接
|
||||
(org-link-set-parameters
|
||||
"obsidian"
|
||||
:follow (lambda (path) (browse-url (concat "obsidian://" path)))
|
||||
:export (lambda (path desc format)
|
||||
(cond
|
||||
((eq format 'html) (format "<a href=\"obsidian://%s\">%s</a>" path (or desc path)))
|
||||
((eq format 'latex) (format "\\href{obsidian://%s}{%s}" path (or desc path)))
|
||||
(t path))))
|
||||
|
||||
)
|
||||
|
||||
(after! evil-org
|
||||
(map! :map evil-org-mode-map
|
||||
:n "L" 'evil-org-insert-line
|
||||
:n "I" 'evil-next-buffer
|
||||
)
|
||||
)
|
||||
|
||||
;;; org-agenda
|
||||
|
||||
(after! org-agenda
|
||||
;; (setq org-agenda-files (directory-files-recursively "~/OrgFiles/tasks/" "\\.org$"))
|
||||
(setq org-agenda-files (list (concat org-directory "tasks/")))
|
||||
)
|
||||
|
||||
|
||||
(map! :after org-agenda
|
||||
:map evil-org-agenda-mode-map
|
||||
:m "n" #'org-agenda-next-line
|
||||
:m "e" #'org-agenda-previous-line
|
||||
:m "gn" #'org-agenda-next-item
|
||||
:m "ge" #'org-agenda-previous-item
|
||||
:m "N" #'org-agenda-priority-up
|
||||
:m "E" #'org-agenda-priority-down
|
||||
:m "i" #'evil-forward-char
|
||||
:m "," #'org-agenda-priority
|
||||
:m "x" #'org-agenda-todo
|
||||
:m "t" #'org-agenda-set-tags
|
||||
:m "w" #'org-save-all-org-buffers
|
||||
;; d: date reschedule
|
||||
:m "ds" #'org-agenda-schedule
|
||||
:m "dd" #'org-agenda-deadline
|
||||
:m "$" #'org-agenda-archive
|
||||
:m "!" #'org-agenda-toggle-deadlines
|
||||
;; c: clock
|
||||
:m "cp" #'org-pomodoro
|
||||
:m "vd" #'org-agenda-day-view
|
||||
:m "vw" #'org-agenda-week-view
|
||||
:m "vm" #'org-agenda-month-view
|
||||
:m "vy" #'org-agenda-year-view
|
||||
:m "v." #'org-agenda-reset-view
|
||||
:leader :desc "Org Agenda" "A" #'org-agenda)
|
||||
|
||||
(setq org-agenda-prefix-format '((agenda . " %i %-12:c%?-12t% s")
|
||||
(todo . " %i %-12:c %e")
|
||||
(tags . " %i %-12:c %e ")
|
||||
(search . " %i %-12:c %e ")))
|
||||
|
||||
|
||||
;; https://github.com/AbstProcDo/Master-Emacs-From-Scratch-with-Solid-Procedures/blob/master/06.Emacs-as-Agenda-by-Org.org
|
||||
;;Sunrise and Sunset
|
||||
;;日出而作, 日落而息
|
||||
(defun js0ny/diary-sunrise ()
|
||||
(let ((dss (diary-sunrise-sunset)))
|
||||
(with-temp-buffer
|
||||
(insert dss)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward " ([^)]*)" nil t)
|
||||
(replace-match "" nil nil))
|
||||
(goto-char (point-min))
|
||||
(search-forward ",")
|
||||
(buffer-substring (point-min) (match-beginning 0)))))
|
||||
|
||||
(defun js0ny/diary-sunset ()
|
||||
(let ((dss (diary-sunrise-sunset))
|
||||
start end)
|
||||
(with-temp-buffer
|
||||
(insert dss)
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward " ([^)]*)" nil t)
|
||||
(replace-match "" nil nil))
|
||||
(goto-char (point-min))
|
||||
(search-forward ", ")
|
||||
(setq start (match-end 0))
|
||||
(search-forward " at")
|
||||
(setq end (match-beginning 0))
|
||||
(goto-char start)
|
||||
(capitalize-word 1)
|
||||
(buffer-substring start end))))
|
||||
|
||||
(after! (org-agenda cal-china-x)
|
||||
(setq org-agenda-format-date 'org-agenda-format-date-aligned)
|
||||
|
||||
|
||||
(defun org-agenda-format-date-aligned (date)
|
||||
"Format a DATE string for display in the daily/weekly agenda, or timeline.
|
||||
This function makes sure that dates are aligned for easy reading."
|
||||
(require 'cal-iso)
|
||||
(let* ((dayname (aref cal-china-x-days
|
||||
(calendar-day-of-week date)))
|
||||
(day (cadr date))
|
||||
(month (car date))
|
||||
(year (nth 2 date))
|
||||
(cn-date (calendar-chinese-from-absolute (calendar-absolute-from-gregorian date)))
|
||||
(cn-month (cl-caddr cn-date))
|
||||
(cn-day (cl-cadddr cn-date))
|
||||
(cn-month-string (concat (aref cal-china-x-month-name
|
||||
(1- (floor cn-month)))
|
||||
(if (integerp cn-month)
|
||||
""
|
||||
"(闰月)")))
|
||||
(cn-day-string (aref cal-china-x-day-name
|
||||
(1- cn-day))))
|
||||
(format "%04d-%02d-%02d 周%s %s%s" year month
|
||||
day dayname cn-month-string cn-day-string))))
|
||||
|
||||
|
||||
(setq org-agenda-time-grid (quote ((daily today require-timed)
|
||||
(300 600 900 1200 1500 1800 2100 2400)
|
||||
"......"
|
||||
"-----------------------------------------------------"
|
||||
)))
|
||||
|
||||
;; org-agenda-clockreport
|
||||
|
||||
(setq org-agenda-clockreport-parameter-plist '(:link t :maxlevel 3 :fileskip0 t :compact t :narrow 80))
|
||||
|
||||
;;; org-clock
|
||||
|
||||
;; org-pomodoro
|
||||
|
||||
(after! org-pomodoro
|
||||
(setq org-pomodoro-format "Pomo~%s")
|
||||
(setq org-pomodoro-short-break-format "摸~%s")
|
||||
(setq org-pomodoro-long-break-format "猛摸~%s")
|
||||
)
|
||||
|
||||
|
||||
;;; org-babel
|
||||
|
||||
(if (not (eq system-type 'gnu/linux))
|
||||
(setq org-babel-C-compiler "clang"))
|
||||
|
||||
|
||||
;;; org-export
|
||||
|
||||
;; icalendar
|
||||
|
||||
(setq org-icalendar-use-scheduled '(event-if-todo event-if-not-todo))
|
||||
(setq org-icalendar-use-deadline '(event-if-todo event-if-not-todo))
|
||||
(setq org-icalendar-combined-agenda-file "~/Dropbox/org.ics")
|
||||
|
||||
|
||||
(use-package! org-pomodoro-music-controller
|
||||
:after org-pomodoro
|
||||
:config
|
||||
(customize-set-variable 'org-pomodoro-music-player-args '("--player=cider"))
|
||||
)
|
||||
|
||||
(use-package! org-pomodoro-telegram-notifier
|
||||
:after org-pomodoro
|
||||
)
|
||||
68
dot_config/doom/packages.el
Normal file
68
dot_config/doom/packages.el
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; $DOOMDIR/packages.el
|
||||
|
||||
;; To install a package with Doom you must declare them here and run 'doom sync'
|
||||
;; on the command line, then restart Emacs for the changes to take effect -- or
|
||||
|
||||
|
||||
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
|
||||
;; (package! some-package)
|
||||
|
||||
;; To install a package directly from a remote git repo, you must specify a
|
||||
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
|
||||
;; https://github.com/radian-software/straight.el#the-recipe-format
|
||||
;; (package! another-package
|
||||
;; :recipe (:host github :repo "username/repo"))
|
||||
|
||||
;; If the package you are trying to install does not contain a PACKAGENAME.el
|
||||
;; file, or is located in a subdirectory of the repo, you'll need to specify
|
||||
;; `:files' in the `:recipe':
|
||||
;; (package! this-package
|
||||
;; :recipe (:host github :repo "username/repo"
|
||||
;; :files ("some-file.el" "src/lisp/*.el")))
|
||||
|
||||
;; If you'd like to disable a package included with Doom, you can do so here
|
||||
;; with the `:disable' property:
|
||||
;; (package! builtin-package :disable t)
|
||||
|
||||
;; You can override the recipe of a built in package without having to specify
|
||||
;; all the properties for `:recipe'. These will inherit the rest of its recipe
|
||||
;; from Doom or MELPA/ELPA/Emacsmirror:
|
||||
;; (package! builtin-package :recipe (:nonrecursive t))
|
||||
;; (package! builtin-package-2 :recipe (:repo "myfork/package"))
|
||||
|
||||
;; Specify a `:branch' to install a package from a particular branch or tag.
|
||||
;; This is required for some packages whose default branch isn't 'master' (which
|
||||
;; our package manager can't deal with; see radian-software/straight.el#279)
|
||||
;; (package! builtin-package :recipe (:branch "develop"))
|
||||
|
||||
;; Use `:pin' to specify a particular commit to install.
|
||||
;; (package! builtin-package :pin "1a2b3c4d5e")
|
||||
|
||||
|
||||
;; Doom's packages are pinned to a specific commit and updated from release to
|
||||
;; release. The `unpin!' macro allows you to unpin single packages...
|
||||
;; (unpin! pinned-package)
|
||||
;; ...or multiple packages
|
||||
;; (unpin! pinned-package another-pinned-package)
|
||||
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
|
||||
;; (unpin! t)
|
||||
|
||||
(package! wakatime-mode)
|
||||
(package! copilot
|
||||
:recipe (:host github :repo "copilot-emacs/copilot.el" :files ("*.el")))
|
||||
(package! evil-matchit)
|
||||
(package! rime)
|
||||
(package! ox-typst)
|
||||
(package! cal-china-x)
|
||||
|
||||
(package! telega :recipe (:files (:defaults "contrib/*.el" "etc" "server" "Makefile")))
|
||||
|
||||
|
||||
(package! org-super-agenda)
|
||||
|
||||
(package! catppuccin-theme)
|
||||
|
||||
(package! eee
|
||||
:recipe (:host github :repo "eval-exec/eee.el"
|
||||
:files (:defaults "*.el" "*.sh")))
|
||||
8
dot_config/doom/snippets/org-mode/align-math
Normal file
8
dot_config/doom/snippets/org-mode/align-math
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: align-math
|
||||
# key: ali
|
||||
# expand-env: ((yas-indent-line 'fixed))
|
||||
# --
|
||||
\\begin{align*}
|
||||
$1
|
||||
\\end{align*}
|
||||
8
dot_config/doom/snippets/org-mode/display-math
Normal file
8
dot_config/doom/snippets/org-mode/display-math
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: display-math
|
||||
# key: dm
|
||||
# expand-env: ((yas-indent-line 'fixed))
|
||||
# --
|
||||
\\[
|
||||
$1
|
||||
\\]
|
||||
6
dot_config/doom/snippets/org-mode/inline-math
Normal file
6
dot_config/doom/snippets/org-mode/inline-math
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: inline-math
|
||||
# key: mk
|
||||
# expand-env: ((yas-indent-line 'fixed))
|
||||
# --
|
||||
\\( $1 \\)
|
||||
6
dot_config/doom/snippets/org-mode/limit
Normal file
6
dot_config/doom/snippets/org-mode/limit
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Limit
|
||||
# key: lim
|
||||
# condition: (org-inside-LaTeX-fragment-p)
|
||||
# --
|
||||
\\lim_{$1 \to $2} $0
|
||||
6
dot_config/doom/snippets/org-mode/summation
Normal file
6
dot_config/doom/snippets/org-mode/summation
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: Summation
|
||||
# key: sum
|
||||
# condition: (org-inside-LaTeX-fragment-p)
|
||||
# --
|
||||
\\sum_{$1}^{$2} $0
|
||||
7
dot_config/doom/snippets/org-mode/unnumbered
Normal file
7
dot_config/doom/snippets/org-mode/unnumbered
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# -*- mode: snippet -*-
|
||||
# name: unnumbered
|
||||
# key: unnumbered
|
||||
# --
|
||||
:PROPERTIES:
|
||||
:UNNUMBERED: t
|
||||
:END:
|
||||
72
dot_config/doom/telega.el
Normal file
72
dot_config/doom/telega.el
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
;; -*- lexical-binding: t; -*-
|
||||
;; telegram client for emacs
|
||||
(use-package! telega
|
||||
:init
|
||||
(setq telega-server-libs-prefix "/usr")
|
||||
(setq telega-directory (expand-file-name "~/.local/share/telega"))
|
||||
|
||||
|
||||
;; (prefix-key global-map (kbd "C-c t") telega-prefix-map)
|
||||
(unless (display-graphic-p) (setq telega-use-images nil))
|
||||
(when (modulep! :editor evil)
|
||||
(cl-pushnew 'telega +evil-collection-disabled-list :test #'equal)
|
||||
(setq evil-collection-mode-list (remove 'telega evil-collection-mode-list))
|
||||
(set-evil-initial-state! '(telega-root-mode telega-chat-mode) 'emacs))
|
||||
|
||||
:hook
|
||||
(telega-load . telega-mode-line-mode)
|
||||
(telega-load . global-telega-url-shorten-mode)
|
||||
(telega-load . global-telega-mnz-mode)
|
||||
(telega-load . telega-autoplay-mode)
|
||||
(telega-load . telega-transient-mode)
|
||||
(telega-load . telega-adblock-mode)
|
||||
(telega-chat-mode . (lambda ()
|
||||
(setq-local visual-fill-column-extra-text-width
|
||||
'(0 . 2))))
|
||||
|
||||
:config
|
||||
(add-hook 'telega-msg-ignore-predicates
|
||||
(telega-match-gen-predicate 'msg '(sender is-blocked)))
|
||||
(setq telega-chat-show-deleted-messages-for '(me-is-owner OR-ADMIN)
|
||||
;; telega-use-tracking-for '(or mention (and unread unmuted))
|
||||
telega-open-file-function 'org-open-file
|
||||
;; telega-open-message-as-file '(video video-note)
|
||||
telega-translate-to-language-by-default "zh"
|
||||
telega-avatar-workaround-gaps-for `(return t)
|
||||
telega-mode-line-string-format (remove
|
||||
'(:eval (telega-mode-line-icon))
|
||||
telega-mode-line-string-format))
|
||||
|
||||
(map! (:prefix "C-c"
|
||||
:desc "Telega all chats"
|
||||
"c" #'telega-chat-with
|
||||
:desc "Telega important chats"
|
||||
"v" #'telega-switch-important-chat
|
||||
:desc "Telega next important chat"
|
||||
"SPC" (cmd! (let ((current-prefix-arg '(4)))
|
||||
(call-interactively #'telega-switch-important-chat))))
|
||||
(:map telega-chat-mode-map
|
||||
(:prefix ("C-t" . "Telega chat topic")
|
||||
:desc "Telega filter by chat topic"
|
||||
"C-t" #'telega-chatbuf-filter-by-topic
|
||||
:desc "Telega clear chat topic"
|
||||
"C-c" #'telega-chatbuf-thread-cancel)))
|
||||
|
||||
; (load! "+telega-auto-input-method")
|
||||
|
||||
(set-popup-rule! (regexp-quote telega-root-buffer-name)
|
||||
:slot 10 :vslot 10 :side 'right :size 90 :ttl nil :quit 'current :modeline t)
|
||||
(set-popup-rule! "^◀[^◀\[]*[\[({<].+[\])}>]"
|
||||
:slot 10 :vslot 10 :side 'right :size 90 :ttl 10 :quit 'current :modeline t)
|
||||
(set-popup-rule! (regexp-quote "*Telega User*")
|
||||
:slot 20 :vslot 10 :side 'right :height .5 :ttl 10 :quit t :modeline nil :select t)
|
||||
(set-popup-rule! (regexp-quote "*Telegram Chat Info*")
|
||||
:slot 20 :vslot 10 :side 'right :height .5 :ttl 10 :quit t :modeline nil :select t))
|
||||
|
||||
;; (load! "+telega-addition")
|
||||
|
||||
(use-package! telega-dired-dwim
|
||||
:after telega dired)
|
||||
|
||||
(use-package! telega-bridge-bot
|
||||
:after telega)
|
||||
24
dot_config/doom/treemacs.el
Normal file
24
dot_config/doom/treemacs.el
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
(after! treemacs
|
||||
(map! :map evil-treemacs-state-map
|
||||
"n" #'treemacs-next-line
|
||||
"e" #'treemacs-previous-line
|
||||
"N" #'treemacs-next-neighbour
|
||||
"E" #'treemacs-previous-neighbour
|
||||
"H" #'treemacs-toggle-show-dotfiles
|
||||
"I" #'treemacs-hide-gitignored-files-mode
|
||||
"i" #'treemacs-RET-action
|
||||
"a" #'treemacs-create-file
|
||||
"A" #'treemacs-create-dir
|
||||
"c" #'treemacs-copy-file
|
||||
"x" #'treemacs-move-file
|
||||
"d" #'treemacs-delete-file
|
||||
"r" #'treemacs-rename-file
|
||||
"q" #'treemacs-quit
|
||||
"y" #'treemacs-copy-relative-path-at-point
|
||||
"Y" #'treemacs-copy-absolute-path-at-point
|
||||
"m" #'treemacs-mark-or-unmark-path-at-point
|
||||
)
|
||||
)
|
||||
|
||||
(map! :leader
|
||||
:desc "Toggle Treemacs" "f t" #'+treemacs/toggle)
|
||||
0
dot_config/fish/completions/.keep
Normal file
0
dot_config/fish/completions/.keep
Normal file
176
dot_config/fish/conf.d/0init.fish
Normal file
176
dot_config/fish/conf.d/0init.fish
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
# $DOTFILES/tools/fish/conf.d/0init.fish
|
||||
# Date: 2024-12-19
|
||||
# Author: js0ny
|
||||
# By dictionary order, this file is sourced first in fish shell
|
||||
# Define user-specific environment variables for fish
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/0init.fish (default location)
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
set -gx DOTFILES $HOME/.dotfiles
|
||||
# XDG Base Directory Specification
|
||||
set -gx XDG_CONFIG_HOME (set -q XDG_CONFIG_HOME; and echo $XDG_CONFIG_HOME; or echo $HOME/.config)
|
||||
set -gx XDG_DATA_HOME (set -q XDG_DATA_HOME; and echo $XDG_DATA_HOME; or echo $HOME/.local/share)
|
||||
set -gx XDG_STATE_HOME (set -q XDG_STATE_HOME; and echo $XDG_STATE_HOME; or echo $HOME/.local/state)
|
||||
set -gx XDG_CACHE_HOME (set -q XDG_CACHE_HOME; and echo $XDG_CACHE_HOME; or echo $HOME/.local/cache)
|
||||
|
||||
if test (uname) = "Darwin"
|
||||
set -gx XDG_RUNTIME_DIR $HOME/.tmp/run/
|
||||
else
|
||||
set -gx XDG_RUNTIME_DIR /run/user/(id -u)
|
||||
end
|
||||
|
||||
set -gx GHCUP_USE_XDG_DIRS 1
|
||||
|
||||
set -gx PAGER "less -R"
|
||||
set -gx EDITOR nvim
|
||||
set -gx VISUAL nvim
|
||||
|
||||
# Minimal PATH for early commands
|
||||
for dir in /usr/local/bin /usr/bin /bin /usr/sbin /sbin "$HOME/.local/bin" /opt/share/bin
|
||||
if test -d "$dir" -a ! -L "$dir"
|
||||
fish_add_path "$dir"
|
||||
end
|
||||
end
|
||||
|
||||
# Homebrew/Linuxbrew
|
||||
test -d /opt/homebrew/bin && fish_add_path /opt/homebrew/bin
|
||||
test -d /home/linuxbrew/.linuxbrew/bin && fish_add_path /home/linuxbrew/.linuxbrew/bin
|
||||
|
||||
if command -v brew > /dev/null
|
||||
set -gx HOMEBREW_NO_ENV_HINTS
|
||||
end
|
||||
|
||||
# Azure CLI
|
||||
if command -v az > /dev/null
|
||||
set -gx AZURE_CONFIG_DIR $XDG_DATA_HOME/azure
|
||||
end
|
||||
# Bun JS
|
||||
if command -v bun > /dev/null
|
||||
set -gx BUN_INSTALL "$XDG_DATA_HOME/bun"
|
||||
set -gx PATH $BUN_INSTALL/bin $PATH
|
||||
end
|
||||
# Rust Cargo
|
||||
if command -v cargo > /dev/null
|
||||
set -gx CARGO_HOME $XDG_DATA_HOME/cargo
|
||||
set -gx PATH $CARGO_HOME/bin $PATH
|
||||
end
|
||||
# CGDB
|
||||
if command -v cgdb > /dev/null
|
||||
set -gx CGDB_DIR $XDG_CONFIG_HOME/cgdb
|
||||
end
|
||||
# .NET
|
||||
if command -v dotnet > /dev/null
|
||||
set -gx DOTNET_CLI_HOME $XDG_DATA_HOME/dotnet
|
||||
set -gx PATH $DOTNET_CLI_HOME/.dotnet/tools $PATH
|
||||
end
|
||||
# Docker
|
||||
if command -v docker > /dev/null
|
||||
set -gx DOCKER_CONFIG $XDG_CONFIG_HOME/docker
|
||||
end
|
||||
# GnuPG
|
||||
if command -v gpg > /dev/null
|
||||
set -gx GNUPGHOME $XDG_DATA_HOME/gnupg
|
||||
end
|
||||
# Go
|
||||
if command -v go > /dev/null
|
||||
set -gx GOPATH $XDG_DATA_HOME/go
|
||||
set PATH $GOPATH/bin $PATH
|
||||
end
|
||||
# Julia
|
||||
if command -v julia > /dev/null
|
||||
set -gx JULIA_DEPOT_PATH $XDG_DATA_HOME/julia
|
||||
end
|
||||
# Node.js
|
||||
if command -v node > /dev/null
|
||||
set -gx NODE_REPL_HISTORY $XDG_STATE_HOME/node/repl_history
|
||||
set -gx TS_NODE_REPL_HISTORY $XDG_STATE_HOME/node/ts_repl_history
|
||||
set -gx NPM_CONFIG_USERCONFIG $XDG_CONFIG_HOME/npm/npmrc
|
||||
set -gx NPM_CONFIG_INIT_MODULE $XDG_CONFIG_HOME/npm/config/npm-init.js
|
||||
set -gx NPM_CONFIG_CACHE $XDG_CACHE_HOME/npm
|
||||
set -gx NPM_CONFIG_TMP $XDG_RUNTIME_DIR/npm
|
||||
end
|
||||
# Parallel
|
||||
if command -v parallel > /dev/null
|
||||
set -gx PARALLEL_CONFIG $XDG_CONFIG_HOME/parallel
|
||||
end
|
||||
# Python
|
||||
# Works only with Python 3.13.0a3 and later
|
||||
if command -v python3 > /dev/null
|
||||
set -gx PYTHON_HISTORY $XDG_DATA_HOME/python/history
|
||||
end
|
||||
# GNU Screen
|
||||
if command -v screen > /dev/null
|
||||
set -gx SCREENRC $XDG_CONFIG_HOME/screen/screenrc
|
||||
set -gx SCREENDIR $XDG_RUNTIME_DIR/screen
|
||||
end
|
||||
# Ruby Gem
|
||||
if command -v gem > /dev/null
|
||||
for dir in $HOME/.local/share/gem/ruby/*/bin
|
||||
if test -d $dir
|
||||
set -gx PATH $dir $PATH
|
||||
end
|
||||
end
|
||||
set -gx PATH $HOME/.local/share/gem/ruby/3.3.0/bin $PATH
|
||||
end
|
||||
# Spacemacs
|
||||
if command -v emacs > /dev/null
|
||||
set -gx SPACEMACSDIR $XDG_CONFIG_HOME/spacemacs
|
||||
end
|
||||
# tldr
|
||||
if command -v tldr > /dev/null
|
||||
set -gx TLDR_CACHE_DIR $XDG_CACHE_HOME/tldr
|
||||
end
|
||||
# W3M
|
||||
if command -v w3m > /dev/null
|
||||
set -gx W3M_DIR $XDG_DATA_HOME/w3m
|
||||
end
|
||||
# Wakatime
|
||||
if command -v wakatime > /dev/null
|
||||
set -gx WAKATIME_HOME $XDG_CONFIG_HOME/wakatime
|
||||
end
|
||||
# Wget
|
||||
if command -v wget > /dev/null
|
||||
alias wget="wget --hsts-file=$XDG_CACHE_HOME/wget-hsts"
|
||||
end
|
||||
# z
|
||||
if command -v z > /dev/null
|
||||
set -gx _Z_DATA $XDG_DATA_HOME/z
|
||||
end
|
||||
if command -v tldr > /dev/null
|
||||
set -gx TLDR_CACHE_DIR $XDG_CACHE_HOME/tldr
|
||||
end
|
||||
if status is-interactive
|
||||
if command -v ipython > /dev/null
|
||||
set IPYTHONDIR $XDG_CONFIG_HOME/ipython
|
||||
end
|
||||
end
|
||||
|
||||
if command -v opam > /dev/null
|
||||
set OPAMROOT $XDG_DATA_HOME/opam
|
||||
test -r $OPAMROOT/opam-init/init.fish && source $OPAMROOT/opam-init/init.fish > /dev/null 2> /dev/null; or true
|
||||
end
|
||||
|
||||
# Coursier: Scala dependency manager
|
||||
if command -v coursier > /dev/null
|
||||
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
|
||||
|
||||
test -f /opt/miniconda3/etc/fish/conf.d/conda.fish && source /opt/miniconda3/etc/fish/conf.d/conda.fish
|
||||
|
||||
# User-specific PATH
|
||||
test -d $HOME/.local/scripts && fish_add_path $HOME/.local/scripts
|
||||
test -d $HOME/.local/build && fish_add_path $HOME/.local/build
|
||||
|
||||
source "/home/js0ny/.deno/env.fish"
|
||||
179
dot_config/fish/conf.d/alias.fish
Normal file
179
dot_config/fish/conf.d/alias.fish
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
# $DOTFILES/tools/fish/conf.d/alias.fish
|
||||
# Date: 2024-12-22
|
||||
# Author: js0ny
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/alias.fish
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
switch (uname)
|
||||
case "Darwin"
|
||||
# macOS Specific
|
||||
#abbr --add clip pbcopy
|
||||
#abbr --add paste pbpaste
|
||||
alias clip="pbcopy"
|
||||
alias paste="pbpaste"
|
||||
# Use GNU Coreutils
|
||||
alias cp=gcp
|
||||
alias ln=gln
|
||||
alias mkdir=gmkdir
|
||||
alias mv=gmv
|
||||
alias rm=grm
|
||||
alias rmdir=grmdir
|
||||
alias touch=gtouch
|
||||
alias clip=pbcopy
|
||||
alias paste=pbpaste
|
||||
alias sed=gsed
|
||||
abbr --add reboot "sudo reboot"
|
||||
case "Linux"
|
||||
# Linux Specific
|
||||
#switch($XDG_SESSION_TYPE)
|
||||
#case "wayland"
|
||||
# Wayland Specific
|
||||
alias clip="wl-copy"
|
||||
alias paste="wl-paste"
|
||||
#case "x11"
|
||||
# # X11 Specific
|
||||
# alias clip="xclip -selection clipboard"
|
||||
# alias paste="xclip -selection clipboard -o"
|
||||
case '*'
|
||||
# Default / Fallback case
|
||||
alias clip="xclip -selection clipboard"
|
||||
alias paste="xclip -selection clipboard -o"
|
||||
end
|
||||
|
||||
# Powershell equivalent
|
||||
abbr --add ni touch
|
||||
abbr --add cls clear
|
||||
abbr --add ii open
|
||||
|
||||
# Editors #
|
||||
abbr --add v nvim
|
||||
abbr --add c code
|
||||
alias svi="sudo vim -u ~/.dotfiles/common/vim.noxdg.vimrc" # Prevent conflicts with svelte-cli
|
||||
|
||||
# Dev #
|
||||
abbr --add py python3
|
||||
abbr --add ipy ipython
|
||||
|
||||
abbr --add g lazygit
|
||||
|
||||
abbr --add aic "aichat -s"
|
||||
|
||||
# lsd - modern ls
|
||||
if command -v lsd > /dev/null
|
||||
alias ls='lsd'
|
||||
abbr --add l 'lsd -lah'
|
||||
abbr --add ll 'lsd -l'
|
||||
abbr --add la 'lsd -A'
|
||||
abbr --add l. 'lsd -d .*'
|
||||
abbr --add tree 'ls --tree'
|
||||
else
|
||||
abbr --add l 'ls -lah'
|
||||
abbr --add ll 'ls -l'
|
||||
end
|
||||
|
||||
# Functions #
|
||||
function mkcd
|
||||
mkdir -p $argv[1] && cd $argv[1]
|
||||
end
|
||||
function cdls
|
||||
cd $argv[1] && ls
|
||||
end
|
||||
function tc
|
||||
touch $argv[1] && code $argv[1]
|
||||
end
|
||||
function tv
|
||||
touch $argv[1] && nvim $argv[1]
|
||||
end
|
||||
|
||||
# Create a new file, if the directory does not exist, create it
|
||||
# Arg: a file name
|
||||
function mt
|
||||
mkdir -p (dirname $argv[1]) && touch $argv[1]
|
||||
end
|
||||
|
||||
function mtv
|
||||
mkdir -p (dirname $argv[1]) && touch $argv[1] && nvim $argv[1]
|
||||
end
|
||||
|
||||
abbr --add bcat "bat --style=plain"
|
||||
|
||||
# Use neovide as gVim
|
||||
abbr --add gvi "neovide"
|
||||
|
||||
if command -v brew > /dev/null
|
||||
abbr --add brewi "brew install"
|
||||
abbr --add brewu "brew upgrade && brew update"
|
||||
abbr --add brewr "brew remove"
|
||||
abbr --add brewc "brew cleanup"
|
||||
abbr --add brewl "brew list"
|
||||
end
|
||||
|
||||
if command -v pacman > /dev/null
|
||||
abbr --add pac "sudo pacman"
|
||||
abbr --add paci "sudo pacman -S"
|
||||
abbr --add pacr "sudo pacman -R"
|
||||
abbr --add pacu "sudo pacman -Syu"
|
||||
abbr --add pacl "pacman -Q"
|
||||
if command -v paru > /dev/null
|
||||
abbr --add pacs "paru -Ss"
|
||||
else if command -v yay > /dev/null
|
||||
abbr --add pacs "yay -Ss"
|
||||
else
|
||||
abbr --add pacs "pacman -Ss"
|
||||
end
|
||||
end
|
||||
|
||||
if command -v apt > /dev/null
|
||||
abbr --add apt "sudo apt"
|
||||
abbr --add apti "sudo apt install"
|
||||
abbr --add aptr "sudo apt remove"
|
||||
abbr --add aptu "sudo apt update && sudo apt upgrade"
|
||||
abbr --add apts "apt search"
|
||||
abbr --add aptl "apt list --installed"
|
||||
end
|
||||
|
||||
|
||||
if command -v dnf > /dev/null
|
||||
abbr --add dnf "sudo dnf"
|
||||
abbr --add dnfi "sudo dnf install"
|
||||
abbr --add dnfr "sudo dnf remove"
|
||||
abbr --add dnfu "sudo dnf update"
|
||||
abbr --add dnfs "dnf search"
|
||||
abbr --add dnfl "dnf list --installed"
|
||||
end
|
||||
|
||||
if test "$TERM" = "xterm-ghostty" -o "$TERM" = "xterm-kitty"
|
||||
abbr --add icat "kitten icat"
|
||||
else if test "$TERM_PROGRAM" = "WezTerm"
|
||||
if test "$WSL_DISTRO_NAME"
|
||||
abbr --add icat "wezterm.exe imgcat"
|
||||
else
|
||||
abbr --add icat "wezterm imgcat"
|
||||
end
|
||||
end
|
||||
|
||||
# Bash Style Command Substitution
|
||||
# https://github.com/fish-shell/fish-shell/wiki/Bash-Style-Command-Substitution-and-Chaining-(!!-!$)
|
||||
|
||||
function __last_history_item; echo $history[1]; end
|
||||
|
||||
abbr -a !! --position anywhere --function __last_history_item
|
||||
|
||||
function y
|
||||
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
||||
yazi $argv --cwd-file="$tmp"
|
||||
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||
builtin cd -- "$cwd"
|
||||
end
|
||||
rm -f -- "$tmp"
|
||||
end
|
||||
|
||||
abbr --add bcnt "emacs -nw $HOME/Documents/Finance/Beancount/"
|
||||
|
||||
if command -v chezmoi > /dev/null
|
||||
alias pmoi="chezmoi --source ~/.local/share/pmoi --config ~/.config/chezmoi/pmoi.toml"
|
||||
end
|
||||
18
dot_config/fish/conf.d/colorscheme.fish
Normal file
18
dot_config/fish/conf.d/colorscheme.fish
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
switch (uname)
|
||||
case "Linux"
|
||||
set SYSTEM_COLOR_SCHEME (gsettings get org.gnome.desktop.interface color-scheme)
|
||||
if test $SYSTEM_COLOR_SCHEME = "'prefer-dark'"
|
||||
fish_config theme choose "Catppuccin Mocha"
|
||||
else
|
||||
fish_config theme choose "Catppuccin Latte"
|
||||
end
|
||||
case "Darwin"
|
||||
set SYSTEM_COLOR_SCHEME (defaults read -g AppleInterfaceStyle)
|
||||
if test $SYSTEM_COLOR_SCHEME = "Dark"
|
||||
fish_config theme choose "Catppuccin Mocha"
|
||||
else
|
||||
fish_config theme choose "Catppuccin Latte"
|
||||
end
|
||||
case '*'
|
||||
fish_config theme choose "Catppuccin Mocha"
|
||||
end
|
||||
49
dot_config/fish/conf.d/keymap.fish
Normal file
49
dot_config/fish/conf.d/keymap.fish
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# $DOTFILES/tools/fish/conf.d/keymap.fish
|
||||
# Date: 2024-12-22
|
||||
# Author: js0ny
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/keymap.fish
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
|
||||
# read key: `fish_key_reader`
|
||||
# get current bindings: `bind`
|
||||
|
||||
fish_vi_key_bindings
|
||||
|
||||
# source $DOTFILES/tools/fish/conf.d/keymap/+colemak.fish
|
||||
|
||||
# Emacs Hybrid
|
||||
bind -M default ctrl-p up-or-search
|
||||
bind -M default ctrl-n down-or-search
|
||||
bind -M default ctrl-f forward-char
|
||||
bind -M default ctrl-b backward-char
|
||||
bind -M default ctrl-a beginning-of-line
|
||||
bind -M default ctrl-e end-of-line
|
||||
bind -M default ctrl-k kill-line
|
||||
|
||||
bind -M insert ctrl-p up-or-search
|
||||
bind -M insert ctrl-n down-or-search
|
||||
bind -M insert ctrl-f forward-char
|
||||
bind -M insert ctrl-b backward-char
|
||||
bind -M insert ctrl-a beginning-of-line
|
||||
bind -M insert ctrl-e end-of-line
|
||||
bind -M insert ctrl-k kill-line
|
||||
bind -M insert ctrl-w backward-kill-path-component
|
||||
|
||||
|
||||
# ctrl + backspace
|
||||
bind -M insert ctrl-backspace backward-kill-path-component
|
||||
# alt + backspace
|
||||
bind -M insert alt-backspace backward-kill-line
|
||||
# ctrl + delete
|
||||
bind -M insert ctrl-delete kill-word
|
||||
# alt + delete (d$)
|
||||
bind -M insert alt-delete kill-line
|
||||
|
||||
fzf --fish | source
|
||||
# C-r : fzf history search
|
||||
# C-t : fzf file search
|
||||
# A-c : fzf directory search
|
||||
23
dot_config/fish/conf.d/keymap/+colemak.fish
Normal file
23
dot_config/fish/conf.d/keymap/+colemak.fish
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Colemak hnei
|
||||
# ^
|
||||
# e
|
||||
# < h i >
|
||||
# n
|
||||
# v
|
||||
# bind -M default 'h' backward-char
|
||||
bind -M default n down-or-search
|
||||
bind -M default e up-or-search
|
||||
bind -M default i forward-char
|
||||
|
||||
# Similar position to [i] in QWERTY
|
||||
bind -M default -m insert l repaint-mode
|
||||
bind -M default -m insert L beginning-of-line repaint-mode
|
||||
|
||||
# Ne{[k]s}t -> fish doesnt have this feature
|
||||
|
||||
# [J]ump
|
||||
bind -M default j forward-word
|
||||
bind -M default J forward-bigword
|
||||
|
||||
# Use N to Join
|
||||
bind -M default N end-of-line delete-char
|
||||
47
dot_config/fish/conf.d/navi.fish
Normal file
47
dot_config/fish/conf.d/navi.fish
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# $DOTFILES/tools/fish/conf.d/navi.fish
|
||||
# Date: 2024-12-22
|
||||
# Author: js0ny
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/navi.fish
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
set __CD_CMD "cd"
|
||||
|
||||
|
||||
if command -v zoxide > /dev/null
|
||||
set __CD_CMD "z"
|
||||
zoxide init fish | source
|
||||
end
|
||||
|
||||
|
||||
alias ..="$__CD_CMD .."
|
||||
alias ...="$__CD_CMD ../.."
|
||||
alias ....="$__CD_CMD ../../.."
|
||||
alias .....="$__CD_CMD ../../../.."
|
||||
alias ......="$__CD_CMD ../../../../.."
|
||||
|
||||
abbr --add \- "$__CD_CMD -"
|
||||
|
||||
|
||||
function zls
|
||||
$__CD_CMD $argv[1] && ls
|
||||
end
|
||||
|
||||
alias cdls=zls
|
||||
|
||||
function __source_quick_jump
|
||||
set dir (fd --type d --max-depth 1 . ~/Source/ | fzf --preview 'lsd --color always --icon always {}')
|
||||
if test -n "$dir"
|
||||
cd "$dir"
|
||||
end
|
||||
end
|
||||
# Quick Jump Directories
|
||||
test -d $DOTFILES && abbr --add dot "$__CD_CMD $DOTFILES"
|
||||
test -d $HOME/Downloads && abbr --add down "$__CD_CMD $HOME/Downloads"
|
||||
test -d $HOME/.config && abbr --add conf "$__CD_CMD $HOME/.config"
|
||||
test -d $HOME/Obsidian && abbr --add ob "$__CD_CMD $HOME/Obsidian"
|
||||
test -d $HOME/Source && alias src="__source_quick_jump"
|
||||
test -d $HOME/Source/Scripts && alias scr="fd --type f --hidden --exclude .git --exclude '.*' . ~/Source/Scripts/ | fzf --preview 'bat --color=always --style=numbers {}' | xargs -r nvim"
|
||||
test -d $HOME/OrgFiles && abbr --add org "$__CD_CMD $HOME/OrgFiles"
|
||||
13
dot_config/fish/conf.d/prompt.fish
Normal file
13
dot_config/fish/conf.d/prompt.fish
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# $DOTFILES/tools/fish/conf.d/prompt.fish
|
||||
# Date: 2024-12-22
|
||||
# Author: js0ny
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/conf.d/prompt.fish
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
if command -v starship > /dev/null
|
||||
starship init fish | source
|
||||
end
|
||||
|
||||
13
dot_config/fish/conf.d/winterop.fish
Normal file
13
dot_config/fish/conf.d/winterop.fish
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
if command -v wslpath > /dev/null
|
||||
function cdw
|
||||
cd (wslpath -u $argv)
|
||||
end
|
||||
function zw
|
||||
z (wslpath -u $argv)
|
||||
end
|
||||
alias psw="tasklist.exe"
|
||||
alias killw="taskkill.exe"
|
||||
alias winget="winget.exe"
|
||||
# https://github.com/stuartleeks/wsl-notify-send
|
||||
alias notify-send="wsl-notify-send.exe"
|
||||
end
|
||||
22
dot_config/fish/config.fish
Normal file
22
dot_config/fish/config.fish
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# $DOTFILES/tools/fish/config.fish
|
||||
# Date: 2024-12-15
|
||||
# Author: js0ny
|
||||
# Define interactive shell configurations for fish
|
||||
|
||||
# Location:
|
||||
# ~/.config/fish/config.fish (default location)
|
||||
# Linking: Link the whole directory for submodules
|
||||
# ln -sf $DOTFILES/tools/fish ~/.config/fish
|
||||
|
||||
if status is-interactive
|
||||
# Commands to run in interactive sessions can go here
|
||||
set fish_greeting
|
||||
end
|
||||
|
||||
# bun
|
||||
set --export BUN_INSTALL "$HOME/.bun"
|
||||
set --export PATH $BUN_INSTALL/bin $PATH
|
||||
|
||||
# moonbit
|
||||
fish_add_path "$HOME/.moon/bin"
|
||||
|
||||
4
dot_config/fish/dot_gitignore
Normal file
4
dot_config/fish/dot_gitignore
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fish_variables
|
||||
completions
|
||||
functions/br.fish
|
||||
functions/dotenv.fish
|
||||
0
dot_config/fish/functions/.keep
Normal file
0
dot_config/fish/functions/.keep
Normal file
39
dot_config/fish/private_fish_variables
Normal file
39
dot_config/fish/private_fish_variables
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR __fish_initialized:3800
|
||||
SETUVAR fish_color_autosuggestion:brblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:normal
|
||||
SETUVAR fish_color_comment:red
|
||||
SETUVAR fish_color_cwd:green
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:green
|
||||
SETUVAR fish_color_error:brred
|
||||
SETUVAR fish_color_escape:brcyan
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_host_remote:yellow
|
||||
SETUVAR fish_color_normal:normal
|
||||
SETUVAR fish_color_operator:brcyan
|
||||
SETUVAR fish_color_param:cyan
|
||||
SETUVAR fish_color_quote:yellow
|
||||
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
|
||||
SETUVAR fish_color_search_match:white\x1e\x2d\x2dbackground\x3dbrblack\x1e\x2d\x2dbold
|
||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbackground\x3dbrblack\x1e\x2d\x2dbold
|
||||
SETUVAR fish_color_status:red
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_background:\x1d
|
||||
SETUVAR fish_pager_color_completion:normal
|
||||
SETUVAR fish_pager_color_description:yellow\x1e\x2di
|
||||
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan\x1e\x2d\x2dbold
|
||||
SETUVAR fish_pager_color_secondary_background:\x1d
|
||||
SETUVAR fish_pager_color_secondary_completion:\x1d
|
||||
SETUVAR fish_pager_color_secondary_description:\x1d
|
||||
SETUVAR fish_pager_color_secondary_prefix:\x1d
|
||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
||||
SETUVAR fish_pager_color_selected_completion:\x1d
|
||||
SETUVAR fish_pager_color_selected_description:\x1d
|
||||
SETUVAR fish_pager_color_selected_prefix:\x1d
|
||||
SETUVAR fish_user_paths:/home/js0ny/\x2elocal/bin\x1e/home/js0ny/\x2elocal/build\x1e/usr/bin\x1e/usr/local/bin
|
||||
29
dot_config/fish/readme.md
Normal file
29
dot_config/fish/readme.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
## `type -q` vs `command -v`
|
||||
|
||||
```shell
|
||||
> time for i in (seq 1 10000)
|
||||
type -q vim
|
||||
end
|
||||
|
||||
time for i in (seq 1 10000)
|
||||
command -v vim >/dev/null
|
||||
end
|
||||
|
||||
|
||||
________________________________________________________
|
||||
Executed in 545.79 millis fish external
|
||||
usr time 177.62 millis 174.28 millis 3.34 millis
|
||||
sys time 367.72 millis 366.16 millis 1.56 millis
|
||||
|
||||
|
||||
________________________________________________________
|
||||
Executed in 292.97 millis fish external
|
||||
usr time 71.23 millis 69.31 millis 1.93 millis
|
||||
sys time 215.22 millis 214.78 millis 0.44 millis
|
||||
```
|
||||
|
||||
`command -v` is faster
|
||||
30
dot_config/fish/themes/Catppuccin Latte.theme
Normal file
30
dot_config/fish/themes/Catppuccin Latte.theme
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# name: 'Catppuccin Latte'
|
||||
# url: 'https://github.com/catppuccin/fish'
|
||||
# preferred_background: eff1f5
|
||||
|
||||
fish_color_normal 4c4f69
|
||||
fish_color_command 1e66f5
|
||||
fish_color_param dd7878
|
||||
fish_color_keyword d20f39
|
||||
fish_color_quote 40a02b
|
||||
fish_color_redirection ea76cb
|
||||
fish_color_end fe640b
|
||||
fish_color_comment 8c8fa1
|
||||
fish_color_error d20f39
|
||||
fish_color_gray 9ca0b0
|
||||
fish_color_selection --background=ccd0da
|
||||
fish_color_search_match --background=ccd0da
|
||||
fish_color_option 40a02b
|
||||
fish_color_operator ea76cb
|
||||
fish_color_escape e64553
|
||||
fish_color_autosuggestion 9ca0b0
|
||||
fish_color_cancel d20f39
|
||||
fish_color_cwd df8e1d
|
||||
fish_color_user 179299
|
||||
fish_color_host 1e66f5
|
||||
fish_color_host_remote 40a02b
|
||||
fish_color_status d20f39
|
||||
fish_pager_color_progress 9ca0b0
|
||||
fish_pager_color_prefix ea76cb
|
||||
fish_pager_color_completion 4c4f69
|
||||
fish_pager_color_description 9ca0b0
|
||||
30
dot_config/fish/themes/Catppuccin Mocha.theme
Normal file
30
dot_config/fish/themes/Catppuccin Mocha.theme
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# name: 'Catppuccin Mocha'
|
||||
# url: 'https://github.com/catppuccin/fish'
|
||||
# preferred_background: 1e1e2e
|
||||
|
||||
fish_color_normal cdd6f4
|
||||
fish_color_command 89b4fa
|
||||
fish_color_param f2cdcd
|
||||
fish_color_keyword f38ba8
|
||||
fish_color_quote a6e3a1
|
||||
fish_color_redirection f5c2e7
|
||||
fish_color_end fab387
|
||||
fish_color_comment 7f849c
|
||||
fish_color_error f38ba8
|
||||
fish_color_gray 6c7086
|
||||
fish_color_selection --background=313244
|
||||
fish_color_search_match --background=313244
|
||||
fish_color_option a6e3a1
|
||||
fish_color_operator f5c2e7
|
||||
fish_color_escape eba0ac
|
||||
fish_color_autosuggestion 6c7086
|
||||
fish_color_cancel f38ba8
|
||||
fish_color_cwd f9e2af
|
||||
fish_color_user 94e2d5
|
||||
fish_color_host 89b4fa
|
||||
fish_color_host_remote a6e3a1
|
||||
fish_color_status f38ba8
|
||||
fish_pager_color_progress 6c7086
|
||||
fish_pager_color_prefix f5c2e7
|
||||
fish_pager_color_completion cdd6f4
|
||||
fish_pager_color_description 6c7086
|
||||
41
dot_config/fish/themes/Rosé Pine Dawn.theme
Normal file
41
dot_config/fish/themes/Rosé Pine Dawn.theme
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# syntax highlighting variables
|
||||
# https://fishshell.com/docs/current/interactive.html#syntax-highlighting-variables
|
||||
fish_color_normal 575279
|
||||
fish_color_command 907aa9
|
||||
fish_color_keyword 56949f
|
||||
fish_color_quote ea9d34
|
||||
fish_color_redirection 286983
|
||||
fish_color_end 797593
|
||||
fish_color_error b4637a
|
||||
fish_color_param d7827e
|
||||
fish_color_comment 797593
|
||||
# fish_color_match --background=brblue
|
||||
fish_color_selection --reverse
|
||||
# fish_color_history_current --bold
|
||||
fish_color_operator 575279
|
||||
fish_color_escape 286983
|
||||
fish_color_autosuggestion 797593
|
||||
fish_color_cwd d7827e
|
||||
# fish_color_cwd_root red
|
||||
fish_color_user ea9d34
|
||||
fish_color_host 56949f
|
||||
fish_color_host_remote 907aa9
|
||||
fish_color_cancel 575279
|
||||
fish_color_search_match --background=faf4ed
|
||||
fish_color_valid_path
|
||||
|
||||
# pager color variables
|
||||
# https://fishshell.com/docs/current/interactive.html#pager-color-variables
|
||||
fish_pager_color_progress d7827e
|
||||
fish_pager_color_background --background=fffaf3
|
||||
fish_pager_color_prefix 56949f
|
||||
fish_pager_color_completion 797593
|
||||
fish_pager_color_description 797593
|
||||
fish_pager_color_secondary_background
|
||||
fish_pager_color_secondary_prefix
|
||||
fish_pager_color_secondary_completion
|
||||
fish_pager_color_secondary_description
|
||||
fish_pager_color_selected_background --background=f2e9e1
|
||||
fish_pager_color_selected_prefix 56949f
|
||||
fish_pager_color_selected_completion 575279
|
||||
fish_pager_color_selected_description 575279
|
||||
81
dot_config/kitty/dark-theme.auto.conf
Normal file
81
dot_config/kitty/dark-theme.auto.conf
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# vim:ft=kitty
|
||||
|
||||
## name: Catppuccin-Mocha
|
||||
## author: Pocco81 (https://github.com/Pocco81)
|
||||
## license: MIT
|
||||
## upstream: https://github.com/catppuccin/kitty/blob/main/mocha.conf
|
||||
## blurb: Soothing pastel theme for the high-spirited!
|
||||
|
||||
# Accent: Lavender #B4BEFE
|
||||
|
||||
|
||||
# The basic colors
|
||||
foreground #CDD6F4
|
||||
background #1E1E2E
|
||||
selection_foreground #1E1E2E
|
||||
selection_background #F5E0DC
|
||||
|
||||
# Cursor colors
|
||||
cursor #F5E0DC
|
||||
cursor_text_color #1E1E2E
|
||||
|
||||
# URL underline color when hovering with mouse
|
||||
url_color #F5E0DC
|
||||
|
||||
# Kitty window border colors
|
||||
active_border_color #B4BEFE
|
||||
inactive_border_color #6C7086
|
||||
bell_border_color #F9E2AF
|
||||
|
||||
# OS Window titlebar colors
|
||||
wayland_titlebar_color system
|
||||
macos_titlebar_color system
|
||||
|
||||
# Tab bar colors
|
||||
active_tab_foreground #11111B
|
||||
active_tab_background #B4BEFE
|
||||
inactive_tab_foreground #CDD6F4
|
||||
inactive_tab_background #1E1E2E
|
||||
tab_bar_background #181825
|
||||
|
||||
# Colors for marks (marked text in the terminal)
|
||||
mark1_foreground #1E1E2E
|
||||
mark1_background #B4BEFE
|
||||
mark2_foreground #1E1E2E
|
||||
mark2_background #B4BEFE
|
||||
mark3_foreground #1E1E2E
|
||||
mark3_background #74C7EC
|
||||
|
||||
# The 16 terminal colors
|
||||
|
||||
# black
|
||||
color0 #45475A
|
||||
color8 #585B70
|
||||
|
||||
# red
|
||||
color1 #F38BA8
|
||||
color9 #F38BA8
|
||||
|
||||
# green
|
||||
color2 #A6E3A1
|
||||
color10 #A6E3A1
|
||||
|
||||
# yellow
|
||||
color3 #F9E2AF
|
||||
color11 #F9E2AF
|
||||
|
||||
# blue
|
||||
color4 #89B4FA
|
||||
color12 #89B4FA
|
||||
|
||||
# magenta
|
||||
color5 #F5C2E7
|
||||
color13 #F5C2E7
|
||||
|
||||
# cyan
|
||||
color6 #94E2D5
|
||||
color14 #94E2D5
|
||||
|
||||
# white
|
||||
color7 #BAC2DE
|
||||
color15 #A6ADC8
|
||||
82
dot_config/kitty/kitty.conf
Normal file
82
dot_config/kitty/kitty.conf
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
# Fonts {{{
|
||||
|
||||
# Family
|
||||
font_family family="Maple Mono NF CN"
|
||||
bold_font auto
|
||||
italic_font auto
|
||||
bold_italic_font auto
|
||||
|
||||
# Ligature
|
||||
disable_ligatures never
|
||||
font_size 12.0
|
||||
# }}}
|
||||
|
||||
# Text Cursor {{{
|
||||
# Cursor Trail
|
||||
cursor_trail 1
|
||||
cursor_trail_decay 0.1 0.4
|
||||
cursor_trail_start_threshold 2
|
||||
# }}}
|
||||
|
||||
# Tab Bar {{{
|
||||
tab_bar_edge top
|
||||
tab_bar_align left
|
||||
tab_bar_style powerline
|
||||
# Hide tab bar when there is only one tab
|
||||
tab_bar_min_tabs 2
|
||||
tab_title_template "{f'{title[:30]}…' if title.rindex(title[-1]) + 1 > 30 else (title.center(6) if (title.rindex(title[-1]) + 1) % 2 == 0 else title.center(5))}"
|
||||
active_tab_font_style bold
|
||||
# }}}
|
||||
|
||||
# Color Scheme {{{
|
||||
# BEGIN_KITTY_THEME
|
||||
# Rosé Pine Dawn
|
||||
include current-theme.conf
|
||||
# END_KITTY_THEME
|
||||
# }}}
|
||||
|
||||
|
||||
# macOS {{{
|
||||
macos_option_as_alt yes
|
||||
macos_quit_when_last_window_closed yes
|
||||
# }}}
|
||||
|
||||
# Keyboard Shortcuts {{{
|
||||
map alt+t new_tab
|
||||
map alt+w close_tab
|
||||
map ctrl+c copy_and_clear_or_interrupt
|
||||
map alt+1 goto_tab 1
|
||||
map alt+2 goto_tab 2
|
||||
map alt+3 goto_tab 3
|
||||
map alt+4 goto_tab 4
|
||||
map alt+5 goto_tab 5
|
||||
map alt+6 goto_tab 6
|
||||
map alt+7 goto_tab 7
|
||||
map alt+8 goto_tab 8
|
||||
map alt+9 goto_tab -1
|
||||
# Leader: ctrl+q
|
||||
# https://github.com/sxyazi/dotfiles
|
||||
map ctrl+q noop
|
||||
map ctrl+q>| kitten window.py +split right
|
||||
map ctrl+q>\ kitten window.py +split right
|
||||
map ctrl+q>- kitten window.py +split bottom
|
||||
map ctrl+q>h kitten window.py -jump left
|
||||
map ctrl+q>n kitten window.py -jump bottom
|
||||
map ctrl+q>e kitten window.py -jump top
|
||||
map ctrl+q>i kitten window.py -jump right
|
||||
map alt+shift+h kitten window.py -jump left
|
||||
map alt+shift+n kitten window.py -jump bottom
|
||||
map alt+shift+e kitten window.py -jump top
|
||||
map alt+shift+i kitten window.py -jump right
|
||||
map ctrl+q>shift+H kitten window.py -resize left
|
||||
map ctrl+q>shift+N kitten window.py -resize bottom
|
||||
map ctrl+q>shift+E kitten window.py -resize top
|
||||
map ctrl+q>shift+I kitten window.py -resize right
|
||||
map cmd+enter toggle_layout stack
|
||||
map ctrl+shift+enter toggle_layout stack
|
||||
# }}}
|
||||
|
||||
|
||||
shell fish
|
||||
80
dot_config/kitty/light-theme.auto.conf
Normal file
80
dot_config/kitty/light-theme.auto.conf
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# vim:ft=kitty
|
||||
|
||||
## name: Catppuccin-Latte
|
||||
## author: Pocco81 (https://github.com/Pocco81)
|
||||
## license: MIT
|
||||
## upstream: https://github.com/catppuccin/kitty/blob/main/latte.conf
|
||||
## blurb: Soothing pastel theme for the high-spirited!
|
||||
|
||||
|
||||
|
||||
# The basic colors
|
||||
foreground #4C4F69
|
||||
background #EFF1F5
|
||||
selection_foreground #EFF1F5
|
||||
selection_background #DC8A78
|
||||
|
||||
# Cursor colors
|
||||
cursor #DC8A78
|
||||
cursor_text_color #EFF1F5
|
||||
|
||||
# URL underline color when hovering with mouse
|
||||
url_color #DC8A78
|
||||
|
||||
# Kitty window border colors
|
||||
active_border_color #7287FD
|
||||
inactive_border_color #9CA0B0
|
||||
bell_border_color #DF8E1D
|
||||
|
||||
# OS Window titlebar colors
|
||||
wayland_titlebar_color system
|
||||
macos_titlebar_color system
|
||||
|
||||
# Tab bar colors
|
||||
active_tab_foreground #EFF1F5
|
||||
active_tab_background #8839EF
|
||||
inactive_tab_foreground #4C4F69
|
||||
inactive_tab_background #9CA0B0
|
||||
tab_bar_background #BCC0CC
|
||||
|
||||
# Colors for marks (marked text in the terminal)
|
||||
mark1_foreground #EFF1F5
|
||||
mark1_background #7287fD
|
||||
mark2_foreground #EFF1F5
|
||||
mark2_background #8839EF
|
||||
mark3_foreground #EFF1F5
|
||||
mark3_background #209FB5
|
||||
|
||||
# The 16 terminal colors
|
||||
|
||||
# black
|
||||
color0 #5C5F77
|
||||
color8 #6C6F85
|
||||
|
||||
# red
|
||||
color1 #D20F39
|
||||
color9 #D20F39
|
||||
|
||||
# green
|
||||
color2 #40A02B
|
||||
color10 #40A02B
|
||||
|
||||
# yellow
|
||||
color3 #DF8E1D
|
||||
color11 #DF8E1D
|
||||
|
||||
# blue
|
||||
color4 #1E66F5
|
||||
color12 #1E66F5
|
||||
|
||||
# magenta
|
||||
color5 #EA76CB
|
||||
color13 #EA76CB
|
||||
|
||||
# cyan
|
||||
color6 #179299
|
||||
color14 #179299
|
||||
|
||||
# white
|
||||
color7 #ACB0BE
|
||||
color15 #BCC0CC
|
||||
103
dot_config/kitty/window.py
Normal file
103
dot_config/kitty/window.py
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
# https://github.com/sxyazi/dotfiles
|
||||
from kittens.tui.handler import result_handler
|
||||
|
||||
directions = {
|
||||
"top": "u",
|
||||
"bottom": "e",
|
||||
"left": "n",
|
||||
"right": "i",
|
||||
}
|
||||
|
||||
|
||||
def main(args):
|
||||
pass
|
||||
|
||||
|
||||
@result_handler(no_ui=True)
|
||||
def handle_result(args, answer, target_window_id, boss):
|
||||
window = boss.active_window
|
||||
if window is None:
|
||||
return
|
||||
|
||||
cmd = window.child.foreground_cmdline[0]
|
||||
act = args[1] # e.g. -jump
|
||||
if act[0] == "-" and cmd[-4:] == "nvim":
|
||||
second = directions[args[2]] if len(args) > 2 else ""
|
||||
window.write_to_child(f"\x1b[119;8u{act[1]}{second}")
|
||||
return
|
||||
|
||||
if (act == "-close" or act == "-quit") and cmd[-7:] == "joshuto":
|
||||
window.write_to_child(f"\x1b{act[1]}")
|
||||
return
|
||||
|
||||
def split(direction):
|
||||
if direction == "top" or direction == "bottom":
|
||||
boss.launch("--cwd=current", "--location=hsplit")
|
||||
else:
|
||||
boss.launch("--cwd=current", "--location=vsplit")
|
||||
|
||||
if direction == "top" or direction == "left":
|
||||
boss.active_tab.move_window(direction)
|
||||
|
||||
def close():
|
||||
boss.close_window()
|
||||
|
||||
def quit():
|
||||
boss.quit()
|
||||
|
||||
def jump(direction):
|
||||
boss.active_tab.neighboring_window(direction)
|
||||
|
||||
# https://github.com/chancez/dotfiles/blob/master/kitty/.config/kitty/relative_resize.py
|
||||
def resize(direction):
|
||||
neighbors = boss.active_tab.current_layout.neighbors_for_window(
|
||||
window, boss.active_tab.windows
|
||||
)
|
||||
top, bottom = neighbors.get("top"), neighbors.get("bottom")
|
||||
left, right = neighbors.get("left"), neighbors.get("right")
|
||||
|
||||
if direction == "top":
|
||||
if top and bottom:
|
||||
boss.active_tab.resize_window("shorter", 10)
|
||||
elif top:
|
||||
boss.active_tab.resize_window("taller", 10)
|
||||
elif bottom:
|
||||
boss.active_tab.resize_window("shorter", 10)
|
||||
elif direction == "bottom":
|
||||
if top and bottom:
|
||||
boss.active_tab.resize_window("taller", 10)
|
||||
elif top:
|
||||
boss.active_tab.resize_window("shorter", 10)
|
||||
elif bottom:
|
||||
boss.active_tab.resize_window("taller", 10)
|
||||
elif direction == "left":
|
||||
if left and right:
|
||||
boss.active_tab.resize_window("narrower", 10)
|
||||
elif left:
|
||||
boss.active_tab.resize_window("wider", 10)
|
||||
elif right:
|
||||
boss.active_tab.resize_window("narrower", 10)
|
||||
elif direction == "right":
|
||||
if left and right:
|
||||
boss.active_tab.resize_window("wider", 10)
|
||||
elif left:
|
||||
boss.active_tab.resize_window("narrower", 10)
|
||||
elif right:
|
||||
boss.active_tab.resize_window("wider", 10)
|
||||
|
||||
def move(direction):
|
||||
boss.active_tab.move_window(direction)
|
||||
|
||||
act = act[1:]
|
||||
if act == "split":
|
||||
split(args[2])
|
||||
elif act == "close":
|
||||
close()
|
||||
elif act == "quit":
|
||||
quit()
|
||||
elif act == "jump":
|
||||
jump(args[2])
|
||||
elif act == "resize":
|
||||
resize(args[2])
|
||||
elif act == "move":
|
||||
move(args[2])
|
||||
12
dot_config/nvim/dot_editorconfig
Normal file
12
dot_config/nvim/dot_editorconfig
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.lua]
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
36
dot_config/nvim/init.lua
Normal file
36
dot_config/nvim/init.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
--[[
|
||||
-*- coding: utf-8 -*-
|
||||
@Filename init.lua
|
||||
@Author js0ny
|
||||
@Date 2024-11-27
|
||||
@Description neovim 配置文件
|
||||
]]
|
||||
|
||||
-- Entry point of neovim configuration
|
||||
require("config.options")
|
||||
if vim.g.vscode then -- TODO: VSCode Neovim Integration
|
||||
require("config.vscode")
|
||||
else
|
||||
require("config.plugins")
|
||||
require("config.colorscheme")
|
||||
end
|
||||
require("config.keymaps")
|
||||
require("config.diagnostics")
|
||||
require("config.migration")
|
||||
|
||||
-- If current session is spawn by neovide, do:
|
||||
if vim.g.neovide then
|
||||
-- Enable input method
|
||||
vim.g.neovide_input_ime = true
|
||||
vim.g.neovide_transparency = 0.85
|
||||
vim.g.transparency = 0.85
|
||||
vim.g.neovide_normal_opacity = 0.85
|
||||
vim.g.neovide_window_blurred = true -- macOS only
|
||||
vim.g.neovide_floating_blur_amount_x = 2.0
|
||||
vim.g.neovide_floating_blur_amount_y = 2.0
|
||||
vim.g.neovide_floating_shadow = true
|
||||
vim.g.neovide_floating_z_height = 10
|
||||
vim.g.neovide_light_angle_degrees = 45
|
||||
vim.g.neovide_light_radius = 5
|
||||
vim.g.neovide_input_macos_option_key_is_meta = "only_left"
|
||||
end
|
||||
53
dot_config/nvim/lazy-lock.json
Normal file
53
dot_config/nvim/lazy-lock.json
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" },
|
||||
"auto-session": { "branch": "main", "commit": "7d37d1cae7a39ff57da9a452d21b5dbfc5636c18" },
|
||||
"avante.nvim": { "branch": "main", "commit": "2791db9984d01674c3a507cc1a522ad7234f400a" },
|
||||
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"bullets.vim": { "branch": "master", "commit": "1c13e510e11d08b0259e8e627f128359c5521962" },
|
||||
"catppuccin": { "branch": "main", "commit": "30fa4d122d9b22ad8b2e0ab1b533c8c26c4dde86" },
|
||||
"conform.nvim": { "branch": "master", "commit": "a0ab60ed666c56b37fd7ed1847d2ac52f2482ce0" },
|
||||
"copilot.lua": { "branch": "master", "commit": "f0c0d981de2737abc50bd7b5bb034ae440826827" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||
"flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" },
|
||||
"fzf-lua": { "branch": "main", "commit": "7d66cd81cf485fb17c22d82021cc166ce332a14c" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "385d1949dc21d0c39e7a74b4f4a25da18817bc86" },
|
||||
"image.nvim": { "branch": "master", "commit": "5cbb891eb8dde53f350dde69e23106d4e85d898b" },
|
||||
"img-clip.nvim": { "branch": "main", "commit": "d8b6b030672f9f551a0e3526347699985a779d93" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"leetcode.nvim": { "branch": "master", "commit": "422b6beb4a64eca0524fbff94edd9550c156afc5" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||
"luasnip-latex-snippets.nvim": { "branch": "main", "commit": "d3dd5223ef37a99c4adf3b5c7844fc760751b397" },
|
||||
"multiple-cursors.nvim": { "branch": "main", "commit": "1ac15d047a4b265cc2389957bcc56ee561b29e02" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "cea666ef965884414b1b71f6b39a537f9238bdb2" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-dap": { "branch": "master", "commit": "968f89f8aac11b6bdbfc942c71d3436658c1435f" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "bd771691da93846b0fc7e095512146a150218bfd" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-surround": { "branch": "main", "commit": "d56752df477ebd808cb82cea2fc68cf7455abb21" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "dca8726fea2c14e1ce6adbaa76a04816fbfaff61" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "705cc9b4f66eca1e54040ac819102e80a32896d3" },
|
||||
"org-bullets.nvim": { "branch": "main", "commit": "21437cfa99c70f2c18977bffd423f912a7b832ea" },
|
||||
"orgmode": { "branch": "master", "commit": "b924cbb7e9c5f2c34f84d92e49dc76e01f32cad9" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "8074a9cc9a6f737320b7a0d76b2c4c3485155688" },
|
||||
"rose-pine": { "branch": "main", "commit": "72befaffeac38db7bdd49e0549eaa2c4806dd878" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" },
|
||||
"vim-beancount": { "branch": "master", "commit": "589a4f06f3b2fd7cd2356c2ef1dafadf6b7a97cf" },
|
||||
"vim-just": { "branch": "main", "commit": "04b0f122f14c83f55a0f8bb2a087754dc98cdccc" },
|
||||
"vim-wakatime": { "branch": "master", "commit": "3403495670f0ee08887401a28f8430dc4ac67429" },
|
||||
"vimtex": { "branch": "master", "commit": "dc90feacb86f7b85b0b791d8073eefc769a23725" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
15
dot_config/nvim/lsp/bashls.lua
Normal file
15
dot_config/nvim/lsp/bashls.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-- Bash
|
||||
--[[ Installation
|
||||
brew install bash-language-server
|
||||
npm i -g bash-language-server
|
||||
dnf install -y nodejs-bash-language-server # Fedora Linux
|
||||
--]]
|
||||
return {
|
||||
cmd = { "bash-language-server", "start" },
|
||||
filetypes = { "bash", "sh" },
|
||||
settings = {
|
||||
bashIde = {
|
||||
globPattern = vim.env.GLOB_PATTERN or "*@(.sh|.inc|.bash|.command)",
|
||||
},
|
||||
},
|
||||
}
|
||||
16
dot_config/nvim/lsp/beancount.lua
Normal file
16
dot_config/nvim/lsp/beancount.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
-- Beancount
|
||||
--[[ Installation:
|
||||
Dependency:
|
||||
uv tool install beancount
|
||||
LSP:
|
||||
cargo install beancount-language-server
|
||||
brew install beancount-language-server
|
||||
--]]
|
||||
|
||||
|
||||
return {
|
||||
cmd = { "beancount-language-server" },
|
||||
filetypes = { "beancount" },
|
||||
settings = {
|
||||
},
|
||||
}
|
||||
30
dot_config/nvim/lsp/clangd.lua
Normal file
30
dot_config/nvim/lsp/clangd.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
-- C/C++
|
||||
-- Clangd requires compile_commands.json to work and the easiest way to generate it is to use CMake.
|
||||
-- How to use clangd C/C++ LSP in any project: https://gist.github.com/Strus/042a92a00070a943053006bf46912ae9
|
||||
|
||||
return {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--clang-tidy",
|
||||
"--header-insertion=iwyu",
|
||||
"--completion-style=detailed",
|
||||
"--function-arg-placeholders",
|
||||
"--fallback-style=none",
|
||||
},
|
||||
filetypes = { "c", "cpp" },
|
||||
root_markers = {
|
||||
".clangd",
|
||||
".clang-format",
|
||||
"compile_commands.json",
|
||||
"compile_flags.txt",
|
||||
".git",
|
||||
},
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
editsNearCursor = true,
|
||||
},
|
||||
},
|
||||
offsetEncoding = { "utf-8", "utf-16" },
|
||||
},
|
||||
}
|
||||
19
dot_config/nvim/lsp/gopls.lua
Normal file
19
dot_config/nvim/lsp/gopls.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-- Golang
|
||||
--[[ Installation
|
||||
go install golang.org/x/tools/gopls@latest
|
||||
brew install gopls
|
||||
--]]
|
||||
return {
|
||||
cmd = { "gopls" },
|
||||
filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
||||
root_markers = { "go.work", "go.mod", ".git" },
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
-- semanticTokens = true, -- go's semantic token highlight is not accurate so far
|
||||
},
|
||||
},
|
||||
}
|
||||
12
dot_config/nvim/lsp/jdtls.lua
Normal file
12
dot_config/nvim/lsp/jdtls.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-- Java
|
||||
--[[ Installation
|
||||
go install golang.org/x/tools/gopls@latest
|
||||
brew install gopls
|
||||
--]]
|
||||
return {
|
||||
cmd = { "jdtls" },
|
||||
filetypes = { "java" },
|
||||
root_markers = { ".git", "build.gradle", "build.gradle.kts", "build.xml", "pom.xml"},
|
||||
settings = {
|
||||
},
|
||||
}
|
||||
18
dot_config/nvim/lsp/jsonls.lua
Normal file
18
dot_config/nvim/lsp/jsonls.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
-- JSON
|
||||
--[[
|
||||
npm i vscode-json-languageserver
|
||||
--]]
|
||||
return {
|
||||
cmd = { "vscode-json-language-server", "--stdio" },
|
||||
filetypes = { "json", "jsonc" },
|
||||
root_markers = { ".git" },
|
||||
init_options = {
|
||||
provideFormatter = true,
|
||||
},
|
||||
settings = {
|
||||
-- See setting options
|
||||
-- https://github.com/microsoft/vscode/tree/main/extensions/json-language-features/server#settings
|
||||
json = {
|
||||
},
|
||||
},
|
||||
}
|
||||
37
dot_config/nvim/lsp/luals.lua
Normal file
37
dot_config/nvim/lsp/luals.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
-- Lua
|
||||
--[[ Installation
|
||||
scoop install lua-language-server
|
||||
brew install lua-language-server
|
||||
sudo port install lua-language-server
|
||||
--]]
|
||||
--[[ Build: Ninja & C++17 Required
|
||||
git clone https://github.com/LuaLS/lua-language-server --depth 1
|
||||
cd lua-language-server
|
||||
./make.sh
|
||||
--]]
|
||||
--[[ Note: For building from source, wrapper script is required
|
||||
Accompanied with a wrapper script
|
||||
#!/bin/bash
|
||||
exec "$HOME/.local/build/lua-language-server/bin/lua-language-server" "$@"
|
||||
--]]
|
||||
return {
|
||||
cmd = { "lua-language-server" },
|
||||
root_markers = {
|
||||
".luarc.json",
|
||||
".luarc.jsonc",
|
||||
".luacheckrc",
|
||||
".stylua.toml",
|
||||
"stylua.toml",
|
||||
"selene.toml",
|
||||
"selene.yml",
|
||||
},
|
||||
filetypes = { "lua" },
|
||||
settings = {
|
||||
Lua = {
|
||||
hint = {
|
||||
enable = true,
|
||||
setType = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
15
dot_config/nvim/lsp/markdown_oxide.lua
Normal file
15
dot_config/nvim/lsp/markdown_oxide.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-- Markdown PKM
|
||||
--[[ Installation:
|
||||
cargo install --locked --git https://github.com/Feel-ix-343/markdown-oxide.git markdown-oxide
|
||||
--]]
|
||||
return {
|
||||
cmd = { "markdown-oxide" },
|
||||
root_markers = {
|
||||
".obsidian",
|
||||
},
|
||||
filetypes = { "markdown" },
|
||||
settings = {
|
||||
Markdown = {
|
||||
},
|
||||
},
|
||||
}
|
||||
27
dot_config/nvim/lsp/pyright.lua
Normal file
27
dot_config/nvim/lsp/pyright.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
-- Python
|
||||
--[[ Installation
|
||||
uv tool install pyright
|
||||
--]]
|
||||
return {
|
||||
cmd = { "pyright-langserver", "--stdio" },
|
||||
filetypes = { "python" },
|
||||
root_markers = {
|
||||
".python_version",
|
||||
"pyproject.toml",
|
||||
"setup.py",
|
||||
"setup.cfg",
|
||||
"requirements.txt",
|
||||
"Pipfile",
|
||||
"pyrightconfig.json",
|
||||
".git",
|
||||
},
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = "openFilesOnly",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
33
dot_config/nvim/lsp/rust_analyzer.lua
Normal file
33
dot_config/nvim/lsp/rust_analyzer.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
-- Rust
|
||||
--[[ Installation
|
||||
rustup component add rust-src
|
||||
--]]
|
||||
return {
|
||||
cmd = { "rust-analyzer" },
|
||||
filetypes = { "rust" },
|
||||
root_dir = function(bufnr, cb)
|
||||
local root = vim.fs.root(bufnr, { "Cargo.toml" })
|
||||
if root then
|
||||
vim.system({ "cargo", "metadata", "--no-depts", "--format-version", "1" }, { cwd = root }, function(obj)
|
||||
if obj.code ~= 0 then
|
||||
cb(root)
|
||||
else
|
||||
local success, result = pcall(vim.json.decode, obj.stdout)
|
||||
if success and result.workspace_root then
|
||||
cb(result.workspace_root)
|
||||
else
|
||||
cb(root)
|
||||
end
|
||||
end
|
||||
end)
|
||||
else
|
||||
cb(vim.fs.root(bufnr, { "rust-project.json", ".git" }))
|
||||
end
|
||||
end,
|
||||
before_init = function(init_params, config)
|
||||
-- See https://github.com/rust-lang/rust-analyzer/blob/eb5da56d839ae0a9e9f50774fa3eb78eb0964550/docs/dev/lsp-extensions.md?plain=1#L26
|
||||
if config.settings and config.settings["rust-analyzer"] then
|
||||
init_params.initializationOptions = config.settings["rust-analyzer"]
|
||||
end
|
||||
end,
|
||||
}
|
||||
32
dot_config/nvim/lsp/taplo.lua
Normal file
32
dot_config/nvim/lsp/taplo.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
-- TOML
|
||||
--[[ Installation
|
||||
cargo install taplo-cli --locked
|
||||
brew install taplo
|
||||
pnpm install -g @taplo/cli
|
||||
--]]
|
||||
return {
|
||||
cmd = { "taplo", "lsp", "stdio" },
|
||||
filetypes = { "toml" },
|
||||
root_markers = { ".git" },
|
||||
settings = {
|
||||
-- See all the setting options
|
||||
-- https://github.com/tamasfe/taplo/blob/master/editors/vscode/package.json
|
||||
evenBetterToml = {
|
||||
taplo = {
|
||||
configFile = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
schema = {
|
||||
enabled = true,
|
||||
catalogs = {
|
||||
"https://www.schemastore.org/api/json/catalog.json",
|
||||
},
|
||||
cache = {
|
||||
memoryExpiration = 60,
|
||||
diskExpiration = 600,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
19
dot_config/nvim/lsp/vimls.lua
Normal file
19
dot_config/nvim/lsp/vimls.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
cmd = { "vim-language-server", "--stdio" },
|
||||
filetypes = { "vim" },
|
||||
root_markers = { ".git" },
|
||||
init_options = {
|
||||
isNeovim = true,
|
||||
iskeyword = "@,48-57,_,192-255,-#",
|
||||
vimruntime = "",
|
||||
runtimepath = "",
|
||||
diagnostic = { enable = true },
|
||||
indexes = {
|
||||
runtimepath = true,
|
||||
gap = 100,
|
||||
count = 3,
|
||||
projectRootPatterns = { "runtime", "nvim", ".git", "autoload", "plugin" },
|
||||
},
|
||||
suggest = { fromVimruntime = true, fromRuntimepath = true },
|
||||
},
|
||||
}
|
||||
9
dot_config/nvim/lsp/yamlls.lua
Normal file
9
dot_config/nvim/lsp/yamlls.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
cmd = { "yaml-language-server", "--stdio" },
|
||||
filetypes = { "yaml", "yaml.docker-compose", "yaml.gitlab" },
|
||||
root_markers = { ".git" },
|
||||
settings = {
|
||||
yaml = {
|
||||
},
|
||||
},
|
||||
}
|
||||
37
dot_config/nvim/lua/config/colors.lua
Normal file
37
dot_config/nvim/lua/config/colors.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
-- This file *currently* contains the colorscheme for lualine (status line)
|
||||
|
||||
local M = {}
|
||||
-- TODO: Change the palatte when the colorscheme changes
|
||||
|
||||
if vim.g.colors_name == "catppuccin-latte" then
|
||||
M.scheme = require("catppuccin.palettes.latte")
|
||||
else
|
||||
M.scheme = require("catppuccin.palettes.mocha")
|
||||
end
|
||||
|
||||
M.accent = M.scheme.lavender
|
||||
|
||||
M.mode = {
|
||||
n = M.scheme.sky,
|
||||
i = M.scheme.green,
|
||||
v = M.scheme.mauve,
|
||||
[""] = M.scheme.mauve,
|
||||
V = M.scheme.mauve,
|
||||
c = M.scheme.mauve,
|
||||
no = M.scheme.red,
|
||||
s = M.scheme.orange,
|
||||
S = M.scheme.orange,
|
||||
[""] = M.scheme.orange,
|
||||
ic = M.scheme.yellow,
|
||||
R = M.scheme.violet,
|
||||
Rv = M.scheme.violet,
|
||||
cv = M.scheme.red,
|
||||
ce = M.scheme.red,
|
||||
r = M.scheme.cyan,
|
||||
rm = M.scheme.cyan,
|
||||
["r?"] = M.scheme.cyan,
|
||||
["!"] = M.scheme.red,
|
||||
t = M.scheme.red,
|
||||
}
|
||||
|
||||
return M
|
||||
43
dot_config/nvim/lua/config/colorscheme.lua
Normal file
43
dot_config/nvim/lua/config/colorscheme.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
-- Change the colorscheme here, use SPACE u i or :FzfLua colorscheme to change colorscheme
|
||||
|
||||
-- https://www.reddit.com/r/neovim/comments/1d3hk1t/automatic_dark_mode_following_system_theme_on/
|
||||
local function get_system_theme()
|
||||
-- Default value
|
||||
local background = 'light'
|
||||
-- First check whether we are on MacOS
|
||||
if vim.loop.os_uname().sysname == "Darwin" then
|
||||
-- Check if 'defaults' is executable
|
||||
if vim.fn.executable('defaults') ~= 0 then
|
||||
-- Execute command to check if the macOS appearance is set to Dark
|
||||
local appleInterfaceStyle = vim.fn.system({ "defaults", "read", "-g", "AppleInterfaceStyle" })
|
||||
if appleInterfaceStyle:find("Dark") then
|
||||
background = 'dark'
|
||||
end
|
||||
end
|
||||
-- Check if 'busctl' is executable (part of systemd)
|
||||
elseif vim.fn.executable('busctl') ~= 0 then
|
||||
-- Get the current color scheme from xdg-desktop-portal using busctl
|
||||
local result = vim.fn.system({
|
||||
"busctl", "--user", "call", "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop",
|
||||
"org.freedesktop.portal.Settings", "ReadOne", "ss", "org.freedesktop.appearance", "color-scheme"
|
||||
})
|
||||
-- The result is in the form of "v u 0" for light and "v u 1" for dark
|
||||
local color_scheme = result:match("u%s+(%d+)")
|
||||
|
||||
if color_scheme == '1' then
|
||||
background = 'dark'
|
||||
end
|
||||
else
|
||||
end
|
||||
|
||||
return background
|
||||
end
|
||||
|
||||
if get_system_theme() == 'dark' then
|
||||
vim.o.background = 'dark'
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
else
|
||||
vim.o.background = 'light'
|
||||
-- vim.cmd.colorscheme("rose-pine")
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end
|
||||
7
dot_config/nvim/lua/config/diagnostics.lua
Normal file
7
dot_config/nvim/lua/config/diagnostics.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
local signs = require("config.icons").diagnostics
|
||||
|
||||
-- This provides the diagnostics signs near the line numbers
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
51
dot_config/nvim/lua/config/icons.lua
Normal file
51
dot_config/nvim/lua/config/icons.lua
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
-- icons.lua
|
||||
-- All icons used in the configuration are defined in this file.
|
||||
-- Currently are only used in diagnostics, lualine, gitsigns
|
||||
local M = {
|
||||
diagnostics = {
|
||||
Error = "",
|
||||
Warning = "",
|
||||
Hint = "",
|
||||
Information = "",
|
||||
},
|
||||
lsp = "",
|
||||
indent = "",
|
||||
git = {
|
||||
Change = "",
|
||||
Add = "",
|
||||
Delete = "",
|
||||
Rename = "",
|
||||
Branch = "",
|
||||
},
|
||||
lsp_kind = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
Copilot = "",
|
||||
},
|
||||
telescope = " ",
|
||||
}
|
||||
|
||||
return M
|
||||
2
dot_config/nvim/lua/config/keymaps.lua
Normal file
2
dot_config/nvim/lua/config/keymaps.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
-- Entry point of keymaps configuration
|
||||
require("keymaps")
|
||||
31
dot_config/nvim/lua/config/migration.lua
Normal file
31
dot_config/nvim/lua/config/migration.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
local nvim_version = vim.version()
|
||||
|
||||
|
||||
if nvim_version.minor ~= 11 then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_lines = true,
|
||||
})
|
||||
|
||||
-- vim.lsp.enable({
|
||||
-- "clangd",
|
||||
-- "luals",
|
||||
-- })
|
||||
|
||||
local lsp_configs = {}
|
||||
for _, v in ipairs(vim.api.nvim_get_runtime_file('lsp/*', true)) do
|
||||
local name = vim.fn.fnamemodify(v, ':t:r')
|
||||
lsp_configs[name] = true
|
||||
end
|
||||
|
||||
vim.lsp.enable(vim.tbl_keys(lsp_configs))
|
||||
|
||||
-- Delete 0.11 new gr- keymaps
|
||||
vim.keymap.del({ "n" }, "grn")
|
||||
vim.keymap.del({ "n", "x" }, "gra")
|
||||
vim.keymap.del({ "n" }, "gri")
|
||||
|
||||
|
||||
86
dot_config/nvim/lua/config/options.lua
Normal file
86
dot_config/nvim/lua/config/options.lua
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
-- <leader> is space
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
-- Disable netrw (file explorer) use NvimTree instead
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
-- Disable Perl
|
||||
vim.g.loaded_perl_provider = 0 -- Don't load Perl
|
||||
|
||||
-- Format on save
|
||||
vim.g.autoformat = true
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
-- Clipboard
|
||||
-- `unnamedplus` for system clipboard
|
||||
opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus"
|
||||
-- Line number
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
-- Confirm before dangerous operations
|
||||
opt.confirm = true
|
||||
|
||||
-- Word wrap
|
||||
opt.linebreak = true
|
||||
|
||||
-- Indentation
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
opt.shiftround = true
|
||||
|
||||
-- Case
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- Highlight current line
|
||||
opt.cursorline = true
|
||||
-- opt.cursorcolumn = true -- Highlight current column
|
||||
-- Terminal GUI
|
||||
opt.termguicolors = true
|
||||
|
||||
--- Fold
|
||||
opt.foldmethod = "expr"
|
||||
-- Folding provided by treesitter
|
||||
opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
-- Disable fold at start
|
||||
opt.foldlevelstart = 99
|
||||
opt.foldlevel = 99
|
||||
opt.foldenable = false
|
||||
opt.foldlevelstart = 1
|
||||
|
||||
-- Hide Command Line if empty
|
||||
opt.cmdheight = 0
|
||||
|
||||
-- Scroll
|
||||
opt.scrolloff = 5 -- Always show 5 lines above/below cursor
|
||||
opt.sidescrolloff = 10 -- Always show 10 columns left/right of cursor
|
||||
|
||||
-- Conceal: Hide some characters, might be useful for markdown and LaTeX
|
||||
opt.conceallevel = 2
|
||||
|
||||
-- `laststatus`
|
||||
-- Disable status line: Use `lualine` instead
|
||||
-- opt.laststatus = 0
|
||||
-- 3: Global status line (always at the bottom)
|
||||
opt.laststatus = 3
|
||||
|
||||
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||
-- hover.nvim
|
||||
vim.o.mousemoveevent = true
|
||||
|
||||
-- Hide zero-width space
|
||||
-- vim.api.nvim_create_autocmd("FileType", {
|
||||
-- pattern = "*",
|
||||
-- callback = function()
|
||||
-- vim.opt_local.conceallevel = 2
|
||||
-- vim.cmd([[
|
||||
-- syntax match ZeroWidthSpace /\%u200b/ conceal
|
||||
-- highlight link ZeroWidthSpace Conceal
|
||||
-- ]])
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
vim.fn.matchadd("Conceal", [[\%u200b]], 10, -1, { conceal = "" })
|
||||
2
dot_config/nvim/lua/config/plugins.lua
Normal file
2
dot_config/nvim/lua/config/plugins.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
-- Entry point for all plugins
|
||||
require("plugins")
|
||||
36
dot_config/nvim/lua/config/servers.lua
Normal file
36
dot_config/nvim/lua/config/servers.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
--- Available LSP goes here
|
||||
--- Check https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
--- for available server and name
|
||||
local M = {}
|
||||
-- Ensure that the following servers are installed and set
|
||||
-- Use :Mason to list all available servers
|
||||
M.servers = {
|
||||
"bashls", -- Bash
|
||||
"clangd", -- C/C++
|
||||
"gopls", -- Go
|
||||
"html", -- HTML
|
||||
"jsonls", -- JSON
|
||||
"lua_ls", -- Lua
|
||||
-- "markdown_oxide", -- Markdown
|
||||
"pyright", -- Python
|
||||
"rust_analyzer", -- Rust
|
||||
"taplo", -- TOML
|
||||
"ts_ls", -- TypeScript
|
||||
"vimls", -- vimscript
|
||||
"yamlls", -- YAML
|
||||
"beancount", -- Beancount
|
||||
}
|
||||
|
||||
-- Configuration for each server defines here
|
||||
M.server_config = {
|
||||
lua_ls = {
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities(),
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
16
dot_config/nvim/lua/config/vscode.lua
Normal file
16
dot_config/nvim/lua/config/vscode.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
require("plugins.lazy-nvim")
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
-- { import = "plugins.completion" },
|
||||
-- { import = "plugins.fileutils" },
|
||||
-- { import = "plugins.lsp" },
|
||||
-- { import = "plugins.edit" },
|
||||
-- { import = "plugins.misc" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
76
dot_config/nvim/lua/keymaps/basic.lua
Normal file
76
dot_config/nvim/lua/keymaps/basic.lua
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
local mode_arrow = { "n", "v", "s", "x", "o" }
|
||||
|
||||
local keymaps_basic = { -- Modification of Original Keymap - Colemak
|
||||
-- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L8
|
||||
{
|
||||
mode = mode_arrow,
|
||||
keys = "j",
|
||||
cmd = "v:count == 0 ? 'gj' : 'j'",
|
||||
opts = { desc = "Down", expr = true, silent = true },
|
||||
},
|
||||
{
|
||||
mode = mode_arrow,
|
||||
keys = "<Down>",
|
||||
cmd = "v:count == 0 ? 'gj' : 'j'",
|
||||
opts = { desc = "Down", expr = true, silent = true },
|
||||
},
|
||||
{
|
||||
mode = mode_arrow,
|
||||
keys = "k",
|
||||
cmd = "v:count == 0 ? 'gk' : 'k'",
|
||||
opts = { desc = "Up", expr = true, silent = true },
|
||||
},
|
||||
{
|
||||
mode = mode_arrow,
|
||||
keys = "<Up>",
|
||||
cmd = "v:count == 0 ? 'gk' : 'k'",
|
||||
opts = { desc = "Up", expr = true, silent = true },
|
||||
},
|
||||
|
||||
{
|
||||
mode = "o",
|
||||
keys = "j",
|
||||
cmd = "j",
|
||||
opts = { desc = "Down", silent = true },
|
||||
},
|
||||
{
|
||||
mode = "o",
|
||||
keys = "<Down>",
|
||||
cmd = "j",
|
||||
opts = { desc = "Down", silent = true },
|
||||
},
|
||||
{
|
||||
mode = "o",
|
||||
keys = "k",
|
||||
cmd = "k",
|
||||
opts = { desc = "Up", silent = true },
|
||||
},
|
||||
{
|
||||
mode = "o",
|
||||
keys = "<Up>",
|
||||
cmd = "k",
|
||||
opts = { desc = "Up", silent = true },
|
||||
},
|
||||
|
||||
{ mode = mode_arrow, keys = "h", cmd = "h", opts = { desc = "Left", silent = true } },
|
||||
-- { mode = mode_arrow, keys = "i", cmd = "l", opts = { desc = "Right", silent = true } },
|
||||
{ mode = { "n" }, keys = "H", cmd = "<cmd>bprevious<CR>", opts = { desc = "Previous Buffer" } },
|
||||
{ mode = { "n" }, keys = "L", cmd = "<cmd>bnext<CR>", opts = { desc = "Next Buffer" } },
|
||||
{ mode = { "v", "o", "x" }, keys = "H", cmd = "^", opts = { desc = "Start of Line" } },
|
||||
{ mode = { "v", "o", "x" }, keys = "L", cmd = "$", opts = { desc = "End of Line" } },
|
||||
{ mode = mode_arrow, keys = "J", cmd = "5j", opts = { desc = "Up 5 Lines" } },
|
||||
{ mode = mode_arrow, keys = "K", cmd = "5e", opts = { desc = "Down 5 Lines" } },
|
||||
{ keys = "Y", cmd = "y$", opts = { desc = "Yank to End of Line" } },
|
||||
{ mode = mode_arrow, keys = "J", cmd = "5j" },
|
||||
{ mode = mode_arrow, keys = "K", cmd = "5k" },
|
||||
-- { mode = { "n", "o", "x" }, keys = "l", cmd = "i", opts = { desc = "Insert" } },
|
||||
-- { keys = "L", cmd = "I", opts = { desc = "Insert at Start of Line" } },
|
||||
-- { mode = mode_arrow, keys = "k", cmd = "n", opts = { desc = "Next Search" } },
|
||||
-- { mode = mode_arrow, keys = "K", cmd = "N", opts = { desc = "Previous Search" } },
|
||||
-- { mode = mode_arrow, keys = "j", cmd = "e", opts = { desc = "jump to end of word" } },
|
||||
-- { mode = mode_arrow, keys = "J", cmd = "E", opts = { desc = "jump to end of WORD" } },
|
||||
-- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L60
|
||||
{ keys = "<Esc>", cmd = "<Cmd>nohlsearch<Bar>diffupdate<CR>", opts = { desc = "Clear Search Highlight" } },
|
||||
}
|
||||
|
||||
return keymaps_basic
|
||||
71
dot_config/nvim/lua/keymaps/buffer.lua
Normal file
71
dot_config/nvim/lua/keymaps/buffer.lua
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
local bufmap = {
|
||||
markdown = {
|
||||
{ mode = "x", keys = "i", cmd = 'c*<C-r>"*', opt = { desc = "Add italic to selected text" } },
|
||||
{ mode = "x", keys = "b", cmd = 'c**<C-r>"**', opt = { desc = "Add bold to selected text" } },
|
||||
{ mode = "x", keys = "c", cmd = 'c`<CR><C-r>"<CR>`', opt = { desc = "Add code block to selected text" } },
|
||||
{ mode = "x", keys = "d", cmd = 'c~~<C-r>"~~', opt = { desc = "Add strikethrough to selected text" } },
|
||||
{ mode = "x", keys = "h", cmd = 'c==<C-r>"==', opt = { desc = "Add highlight to selected text" } },
|
||||
},
|
||||
tex = {
|
||||
{ mode = "x", keys = "i", cmd = 'c\\textit{<C-r>"}', opt = { desc = "Add italic to selected text" } },
|
||||
{ mode = "x", keys = "b", cmd = 'c\\textbf{<C-r>"}', opt = { desc = "Add bold to selected text" } },
|
||||
{
|
||||
mode = "x",
|
||||
keys = "c",
|
||||
cmd = 'c\\begin{verbatim}<CR><C-r>"<CR>\\end{verbatim}',
|
||||
opt = { desc = "Add code block to selected text" },
|
||||
},
|
||||
{ mode = "x", keys = "d", cmd = 'c\\sout{<C-r>"}', opt = { desc = "Add strikethrough to selected text" } },
|
||||
{ mode = "x", keys = "h", cmd = 'c\\hl{<C-r>"}', opt = { desc = "Add highlight to selected text" } },
|
||||
{ mode = "n", keys = "<leader>cc", cmd = "<cmd>w<CR>", opt = { desc = "Save and compile tex file" } },
|
||||
-- { mode = "i", keys = "<C-m><C-m>", cmd = "<cmd>w<CR>", opt = { desc = "Save and compile tex file" } },
|
||||
},
|
||||
org = {
|
||||
{ mode = "x", keys = "i", cmd = 'c/<C-r>/"', opt = { desc = "Add italic to selected text" } },
|
||||
{ mode = "x", keys = "b", cmd = 'c*<C-r>"*', opt = { desc = "Add bold to selected text" } },
|
||||
-- {
|
||||
-- mode = "x",
|
||||
-- keys = "c",
|
||||
-- cmd = 'c#+BEGIN_SRC<CR><C-r>"<CR>#+END_SRC',
|
||||
-- opt = { desc = "Add code block to selected text" },
|
||||
-- },
|
||||
{ mode = "x", keys = "d", cmd = 'c+<C-r>"+', opt = { desc = "Add strikethrough to selected text" } },
|
||||
{ mode = "x", keys = "h", cmd = 'c~<C-r>"~', opt = { desc = "Add highlight to selected text" } },
|
||||
},
|
||||
}
|
||||
|
||||
local function setup_buffer_maps(buffer_map)
|
||||
-- 遍历 buffer_map 中的每个文件类型
|
||||
for ft, mappings in pairs(buffer_map) do
|
||||
-- 1. 为现有缓冲区设置键位映射
|
||||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.api.nvim_buf_get_option(buf, "filetype") == ft then
|
||||
for _, mapping in ipairs(mappings) do
|
||||
-- 合并选项,添加 buffer 以确保映射是缓冲区局部的
|
||||
if mapping.mode ~= "n" then
|
||||
mapping.keys = "<C-m>" .. mapping.keys
|
||||
end
|
||||
local opts = vim.tbl_extend("force", mapping.opt, { buffer = buf })
|
||||
vim.keymap.set(mapping.mode, mapping.keys, mapping.cmd, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 2. 为未来缓冲区设置自动命令
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = ft, -- 匹配文件类型,例如 "markdown"
|
||||
callback = function(args)
|
||||
local buf = args.buf -- 获取触发事件的缓冲区号
|
||||
for _, mapping in ipairs(mappings) do
|
||||
local opts = vim.tbl_extend("force", mapping.opt, { buffer = buf })
|
||||
if mapping.mode ~= "n" then
|
||||
mapping.keys = "<C-m>" .. mapping.keys
|
||||
end
|
||||
vim.keymap.set(mapping.mode, mapping.keys, mapping.cmd, opts)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
setup_buffer_maps(bufmap)
|
||||
40
dot_config/nvim/lua/keymaps/init.lua
Normal file
40
dot_config/nvim/lua/keymaps/init.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
local M = {}
|
||||
-- local keymaps_user_command = require("keymaps.user-command")
|
||||
require("keymaps.user-command")
|
||||
local utils = require("keymaps.utils")
|
||||
|
||||
local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global
|
||||
|
||||
local keymaps_general = vim.tbl_extend("force", {}, require("keymaps.leaders"), require("keymaps.lspkeys"))
|
||||
-- Tables cannot be merged since `mode` are set in some keymaps of `keymaps_basic`
|
||||
local keymaps_basic = require("keymaps.basic")
|
||||
local keymaps_modifier = require("keymaps.modifier")
|
||||
|
||||
require("keymaps.buffer")
|
||||
|
||||
utils.set_keymaps(keymaps_general)
|
||||
utils.set_keymaps(keymaps_basic)
|
||||
utils.set_keymaps(keymaps_nvim_tree_general)
|
||||
utils.set_keymaps(keymaps_modifier)
|
||||
|
||||
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin
|
||||
|
||||
-- local function set_markdown_keymaps(bufnr)
|
||||
-- local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
-- vim.keymap.set("v", "`", 'c`<C-r>"`<Esc>', opts)
|
||||
-- end
|
||||
|
||||
-- vim.api.nvim_create_autocmd("FileType", {
|
||||
-- pattern = "markdown",
|
||||
-- callback = function()
|
||||
-- set_markdown_keymaps(0)
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- which-key.nvim
|
||||
if vim.g.loaded_which_key then
|
||||
require("keymaps.which")
|
||||
end
|
||||
require("keymaps.visual-multi")
|
||||
|
||||
return M
|
||||
28
dot_config/nvim/lua/keymaps/language.lua
Normal file
28
dot_config/nvim/lua/keymaps/language.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
local M = {}
|
||||
|
||||
-- Markdown
|
||||
|
||||
local function set_markdown_keymaps(bufnr)
|
||||
local markdown_opt = { noremap = true, silent = true, buffer = bufnr }
|
||||
for _, map in ipairs(M.markdown) do
|
||||
local opts = vim.tbl_extend("force", markdown_opt, map.opts or {})
|
||||
vim.keymap.set(map.mode, map.keys, map.cmd, opts)
|
||||
end
|
||||
end
|
||||
|
||||
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 bold" },
|
||||
{ mode = "v", keys = "_", cmd = "c*<Esc>pi*<Esc>", desc = "Wrap selection in * for italic" },
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
set_markdown_keymaps(0)
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
end,
|
||||
})
|
||||
|
||||
return M
|
||||
194
dot_config/nvim/lua/keymaps/leaders.bak
Normal file
194
dot_config/nvim/lua/keymaps/leaders.bak
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
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
|
||||
|
||||
-- 通用映射函数
|
||||
local function apply_mappings(maps, prefix)
|
||||
for _, map in ipairs(maps) do
|
||||
local new_map = {
|
||||
keys = prefix .. map.keys,
|
||||
cmd = map.cmd,
|
||||
opts = map.opts,
|
||||
}
|
||||
table.insert(M, new_map)
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
|
||||
|
||||
local leader_mappings = {
|
||||
general = {
|
||||
{ keys = "<leader>", cmd = ":Telescope find_files<CR>", opts = { desc = "Find Files" } },
|
||||
{ keys = "/", cmd = ":Telescope live_grep<CR>", opts = { desc = "Grep Files" } },
|
||||
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
|
||||
{ keys = "\\", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
|
||||
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
|
||||
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
|
||||
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
|
||||
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
|
||||
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
|
||||
{ keys = "F", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Explorer" } },
|
||||
{ keys = "<Tab>", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
|
||||
{ keys = "!", cmd = ":FloatermToggle<CR>", opts = { desc = "Toggle Terminal" } },
|
||||
{ keys = '"', cmd = ":!wezterm-gui &<CR>", pots = { desc = "Open External Terminal(wezterm)" } },
|
||||
{ keys = ";", cmd = ":Telescope<CR>", pots = { desc = "Show Telescope Commands" } },
|
||||
},
|
||||
b = { -- +buffer
|
||||
{ keys = "0", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
|
||||
{ keys = "1", cmd = ":BufferLineGotoBuffer 1<CR>", opts = { desc = "Switch to Buffer #1" } },
|
||||
{ keys = "2", cmd = ":BufferLineGotoBuffer 2<CR>", opts = { desc = "Switch to Buffer #2" } },
|
||||
{ keys = "3", cmd = ":BufferLineGotoBuffer 3<CR>", opts = { desc = "Switch to Buffer #3" } },
|
||||
{ keys = "4", cmd = ":BufferLineGotoBuffer 4<CR>", opts = { desc = "Switch to Buffer #4" } },
|
||||
{ keys = "5", cmd = ":BufferLineGotoBuffer 5<CR>", opts = { desc = "Switch to Buffer #5" } },
|
||||
{ keys = "6", cmd = ":BufferLineGotoBuffer 6<CR>", opts = { desc = "Switch to Buffer #6" } },
|
||||
{ keys = "7", cmd = ":BufferLineGotoBuffer 7<CR>", opts = { desc = "Switch to Buffer #7" } },
|
||||
{ keys = "8", cmd = ":BufferLineGotoBuffer 8<CR>", opts = { desc = "Switch to Buffer #8" } },
|
||||
{ keys = "9", cmd = ":BufferLineGotoBuffer 9<CR>", opts = { desc = "Switch to Buffer #9" } },
|
||||
{ keys = "a", cmd = ":Alpha<CR>", opts = { desc = "Dashboard" } },
|
||||
{ keys = "b", cmd = ":BufferLinePick<CR>", opts = { desc = "Quick Switch Buffers" } },
|
||||
{ keys = "B", cmd = ":Telescope buffers<CR>", opts = { desc = "List Buffers" } },
|
||||
{ keys = "d", cmd = ":bdelete<CR>", opts = { desc = "Delete Buffer" } },
|
||||
{ keys = "D", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
|
||||
{ keys = "xx", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
|
||||
{ keys = "xh", cmd = ":BufferLineCloseLeft<CR>", opts = { desc = "Delete Buffers Left" } },
|
||||
{ keys = "xi", cmd = ":BufferLineCloseRight<CR>", opts = { desc = "Delete Buffers Right" } },
|
||||
{ keys = "X", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
|
||||
{ keys = "h", cmd = ":bprevious<CR>", opts = { desc = "Previous Buffer" } },
|
||||
{ keys = "i", cmd = ":bnext<CR>", opts = { desc = "Next Buffer" } },
|
||||
{ keys = "H", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
|
||||
{ keys = "I", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
|
||||
{ keys = "0", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
|
||||
{ keys = "^", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
|
||||
{ keys = "$", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
|
||||
{ keys = "s", cmd = ":new<CR>", opts = { desc = "Scratch buffers" } },
|
||||
{ keys = "t", cmd = ":BufferLineTogglePin<CR>", opts = { desc = "Pin Buffer" } },
|
||||
{ keys = "y", cmd = ":%y+<CR>", opts = { desc = "Copy Buffer to Clipboard" } },
|
||||
},
|
||||
c = { -- +code/compile
|
||||
{ keys = "r", cmd = ":RunCode<CR>", opts = { desc = "Run code" } },
|
||||
{ keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } },
|
||||
{ keys = "e", cmd = ":Telescope diagnostics<CR>", opts = { desc = "Navigate errors/warnings" } },
|
||||
{ keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } },
|
||||
{ keys = "s", cmd = ":Telescope treesitter<CR>", opts = { desc = "Search symbols" } },
|
||||
{ keys = "S", cmd = ":Telescope grep_string<CR>", opts = { desc = "Search current symbol" } },
|
||||
},
|
||||
f = { -- +file/find
|
||||
{ keys = "f", cmd = ":Telescope fd<CR>", opts = { desc = "Find Files" } },
|
||||
{ keys = "F", cmd = ":GrugFar<CR>", opts = { desc = "Search & Replace" } },
|
||||
{ keys = "l", cmd = ":set filetype=", opts = { desc = "Set Filetype to ..." } },
|
||||
{ keys = "n", cmd = ":new<CR>", opts = { desc = "New File" } },
|
||||
{ keys = "s", cmd = ":write<CR>", opts = { desc = "Save File" } },
|
||||
{ keys = "S", cmd = ":wall<CR>", opts = { desc = "Save All Files" } },
|
||||
{ keys = "b", cmd = ":Telescope buffers<CR>", opts = { desc = "List Buffers" } },
|
||||
{ keys = "D", cmd = "!trash-rm %<CR>", opts = { desc = "Delete current file" } },
|
||||
{ keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } },
|
||||
{ keys = "T", cmd = ":FloatermNew<CR>", opts = { desc = "Spawn a float terminal" } },
|
||||
{ keys = "h", cmd = ":Telescope oldfiles<CR>", opts = { desc = "Search history files" } },
|
||||
{ keys = "c", cmd = ":Telescope find_files cwd=~/.config/nvim<CR>", opts = { desc = "Search Config" } },
|
||||
{ keys = "o", cmd = ":!open %<CR>", opts = { desc = "Open file in default program" } },
|
||||
{ keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } },
|
||||
{ keys = "x", cmd = ":Lazy<CR>", opts = { desc = "Open extension view" } },
|
||||
{ keys = "yy", cmd = ":let @+ = expand('%:p')<CR>", opts = { desc = "Copy file path" } },
|
||||
{ keys = "yY", cmd = ":let @+ = expand('%')<CR>", opts = { desc = "Copy relative file path" } },
|
||||
{ keys = "yn", cmd = ":let @+ = expand('%:t')<CR>", opts = { desc = "Copy file name" } },
|
||||
{ keys = "yN", cmd = ":let @+ = expand('%:t:r')<CR>", opts = { desc = "Copy file name without extension" } },
|
||||
{ keys = "yd", cmd = ":let @+ = expand('%:p:h')<CR>", opts = { desc = "Copy directory path" } },
|
||||
{
|
||||
keys = "yl",
|
||||
cmd = ":let @+ = expand('%:p') . ':' . line('.')<CR>",
|
||||
opts = { desc = "Copy file path with line number" },
|
||||
},
|
||||
{
|
||||
keys = "yL",
|
||||
cmd = ":let @+ = expand('%') . ':' . line('.')<CR>",
|
||||
opts = { desc = "Copy relative file path with line number" },
|
||||
},
|
||||
},
|
||||
g = { -- +git/version control
|
||||
{ keys = "g", cmd = ":LazyGit<CR>", opts = { desc = "Toggle LazyGit" } },
|
||||
{ keys = "c", cmd = ":Telescope git_commits<CR>", opts = { desc = "Show commits" } },
|
||||
{ keys = "b", cmd = ":Gitsigns blame<CR>", opts = { desc = "Blame file" } },
|
||||
{ keys = "d", cmd = ":Gitsigns diffthis<CR>", opts = { desc = "Diff file" } },
|
||||
{ keys = "B", cmd = ":Gitsigns toggle_current_line_blame<CR>", opts = { desc = "Toggle line blame" } },
|
||||
{ keys = "s", cmd = ":Telescope git_status<CR>", opts = { desc = "Git Status" } },
|
||||
{ keys = "t", cmd = ":Telescope git_branches<CR>", opts = { desc = "Git Branches" } },
|
||||
},
|
||||
j = { -- +lsp
|
||||
{ keys = "r", cmd = vim.lsp.buf.references, opts = { desc = "Show current reference" } },
|
||||
},
|
||||
p = { -- +project
|
||||
{ keys = "p", cmd = ":Telescope projects<CR>", opts = { desc = "List all Projects" } },
|
||||
{ keys = "g", cmd = ":Telescope projects<CR>", opts = { desc = "List all Git Projects" } },
|
||||
{ keys = "s", cmd = ":Telescope session-lens<CR>", opts = { desc = "List all sessions" } },
|
||||
},
|
||||
q = { -- +quit
|
||||
{ keys = "q", cmd = ":q<CR>", opts = { desc = "Quit" } },
|
||||
{ keys = "Q", cmd = ":qa!<CR>", opts = { desc = "Force Quit" } },
|
||||
{ keys = "w", cmd = ":wq<CR>", opts = { desc = "Write and Quit" } },
|
||||
{ keys = "W", cmd = ":wall<CR>:qa!<CR>", opts = { desc = "Write all and Force Quit" } },
|
||||
},
|
||||
t = { -- +toggle/test
|
||||
{ keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } },
|
||||
{ keys = "F", cmd = ":FormatToggle<CR>", opts = { desc = "Toggle autoformat-on-save" } },
|
||||
{ keys = "t", cmd = ":FloatermToggle<CR>", opts = { desc = "toggle visibility of the float terminal" } },
|
||||
},
|
||||
u = { -- +ui
|
||||
{ keys = "i", cmd = ":Telescope colorscheme<CR>", opts = { desc = "Change colorscheme" } },
|
||||
{ keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } },
|
||||
},
|
||||
w = { -- +window
|
||||
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
|
||||
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
|
||||
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
|
||||
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
|
||||
{ keys = "H", cmd = "<C-w>H", opts = { desc = "Move Window Left" } },
|
||||
{ keys = "N", cmd = "<C-w>J", opts = { desc = "Move Window Down" } },
|
||||
{ keys = "E", cmd = "<C-w>K", opts = { desc = "Move Window Up" } },
|
||||
{ keys = "I", cmd = "<C-w>L", opts = { desc = "Move Window Right" } },
|
||||
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
|
||||
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
|
||||
{ keys = "/", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
|
||||
{ keys = "d", cmd = "<C-w>c", opts = { desc = "Close Window" } },
|
||||
{ keys = "D", cmd = "<C-w>o", opts = { desc = "Close Other Windows" } },
|
||||
{ keys = "r", cmd = "<C-w>r", opts = { desc = "Rotate Windows" } },
|
||||
{ keys = "R", cmd = "<C-w>R", opts = { desc = "Reverse Rotate Windows" } },
|
||||
{ keys = "t", cmd = "<C-w>T", opts = { desc = "Move Window to New Tab" } },
|
||||
{ keys = "]", cmd = ":resize +5<CR>", opts = { desc = "Increase Window Size" } },
|
||||
{ keys = "[", cmd = ":resize -5<CR>", opts = { desc = "Decrease Window Size" } },
|
||||
{ keys = "M", cmd = ":resize<CR>:vertical resize<CR>", opts = { desc = "Maximize window size" } },
|
||||
},
|
||||
}
|
||||
|
||||
for key, maps in pairs(leader_mappings) do
|
||||
if key == "general" then
|
||||
apply_mappings(maps, "<leader>")
|
||||
else
|
||||
apply_mappings(maps, "<leader>" .. key)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
164
dot_config/nvim/lua/keymaps/leaders.lua
Normal file
164
dot_config/nvim/lua/keymaps/leaders.lua
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
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
|
||||
|
||||
-- 通用映射函数
|
||||
local function apply_mappings(maps, prefix)
|
||||
for _, map in ipairs(maps) do
|
||||
local new_map = {
|
||||
keys = prefix .. map.keys,
|
||||
cmd = map.cmd,
|
||||
opts = map.opts,
|
||||
}
|
||||
table.insert(M, new_map)
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_user_command("Rename", renameCurrentBuffer, {})
|
||||
|
||||
local leader_mappings = {
|
||||
general = {
|
||||
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
|
||||
{ keys = "\\", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
|
||||
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
|
||||
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
|
||||
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
|
||||
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
|
||||
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
|
||||
{ keys = "<Tab>", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
|
||||
{ keys = '"', cmd = ":!wezterm-gui &<CR>", pots = { desc = "Open External Terminal(wezterm)" } },
|
||||
},
|
||||
b = { -- +buffer
|
||||
{ keys = "0", cmd = "<Cmd>b#<CR>", opts = { desc = "Switch to last buffer" } },
|
||||
{ keys = "1", cmd = ":BufferLineGotoBuffer 1<CR>", opts = { desc = "Switch to Buffer #1" } },
|
||||
{ keys = "2", cmd = ":BufferLineGotoBuffer 2<CR>", opts = { desc = "Switch to Buffer #2" } },
|
||||
{ keys = "3", cmd = ":BufferLineGotoBuffer 3<CR>", opts = { desc = "Switch to Buffer #3" } },
|
||||
{ keys = "4", cmd = ":BufferLineGotoBuffer 4<CR>", opts = { desc = "Switch to Buffer #4" } },
|
||||
{ keys = "5", cmd = ":BufferLineGotoBuffer 5<CR>", opts = { desc = "Switch to Buffer #5" } },
|
||||
{ keys = "6", cmd = ":BufferLineGotoBuffer 6<CR>", opts = { desc = "Switch to Buffer #6" } },
|
||||
{ keys = "7", cmd = ":BufferLineGotoBuffer 7<CR>", opts = { desc = "Switch to Buffer #7" } },
|
||||
{ keys = "8", cmd = ":BufferLineGotoBuffer 8<CR>", opts = { desc = "Switch to Buffer #8" } },
|
||||
{ keys = "9", cmd = ":BufferLineGotoBuffer 9<CR>", opts = { desc = "Switch to Buffer #9" } },
|
||||
{ keys = "b", cmd = ":BufferLinePick<CR>", opts = { desc = "Quick Switch Buffers" } },
|
||||
{ keys = "d", cmd = ":bdelete<CR>", opts = { desc = "Delete Buffer" } },
|
||||
{ keys = "D", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
|
||||
{ keys = "xx", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
|
||||
{ keys = "xh", cmd = ":BufferLineCloseLeft<CR>", opts = { desc = "Delete Buffers Left" } },
|
||||
{ keys = "xi", cmd = ":BufferLineCloseRight<CR>", opts = { desc = "Delete Buffers Right" } },
|
||||
{ keys = "X", cmd = ":BufferLineCloseOthers<CR>", opts = { desc = "Delete Other Buffers" } },
|
||||
{ keys = "h", cmd = ":bprevious<CR>", opts = { desc = "Previous Buffer" } },
|
||||
{ keys = "i", cmd = ":bnext<CR>", opts = { desc = "Next Buffer" } },
|
||||
{ keys = "H", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
|
||||
{ keys = "I", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
|
||||
{ keys = "0", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
|
||||
{ keys = "^", cmd = ":bfirst<CR>", opts = { desc = "First Buffer" } },
|
||||
{ keys = "$", cmd = ":blast<CR>", opts = { desc = "Last Buffer" } },
|
||||
{ keys = "s", cmd = ":new<CR>", opts = { desc = "Scratch buffers" } },
|
||||
{ keys = "t", cmd = ":BufferLineTogglePin<CR>", opts = { desc = "Pin Buffer" } },
|
||||
{ keys = "y", cmd = ":%y+<CR>", opts = { desc = "Copy Buffer to Clipboard" } },
|
||||
},
|
||||
c = { -- +code/compile
|
||||
{ keys = "R", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } },
|
||||
{ keys = "f", cmd = formatFx, opts = { desc = "Format buffer" } },
|
||||
},
|
||||
f = { -- +file/find
|
||||
{ keys = "n", cmd = ":new<CR>", opts = { desc = "New File" } },
|
||||
{ keys = "s", cmd = ":write<CR>", opts = { desc = "Save File" } },
|
||||
{ keys = "S", cmd = ":wall<CR>", opts = { desc = "Save All Files" } },
|
||||
{ keys = "D", cmd = "!trash-rm %<CR>", opts = { desc = "Delete current file" } },
|
||||
-- { keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } },
|
||||
-- { keys = "o", cmd = ":!open %<CR>", opts = { desc = "Open file in default program" } },
|
||||
{ keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } },
|
||||
{ keys = "x", cmd = ":Lazy<CR>", opts = { desc = "Open extension view" } },
|
||||
{ keys = "yy", cmd = ":let @+ = expand('%:p')<CR>", opts = { desc = "Copy file path" } },
|
||||
{ keys = "yY", cmd = ":let @+ = expand('%')<CR>", opts = { desc = "Copy relative file path" } },
|
||||
{ keys = "yn", cmd = ":let @+ = expand('%:t')<CR>", opts = { desc = "Copy file name" } },
|
||||
{ keys = "yN", cmd = ":let @+ = expand('%:t:r')<CR>", opts = { desc = "Copy file name without extension" } },
|
||||
{ keys = "yd", cmd = ":let @+ = expand('%:p:h')<CR>", opts = { desc = "Copy directory path" } },
|
||||
{
|
||||
keys = "yl",
|
||||
cmd = ":let @+ = expand('%:p') . ':' . line('.')<CR>",
|
||||
opts = { desc = "Copy file path with line number" },
|
||||
},
|
||||
{
|
||||
keys = "yL",
|
||||
cmd = ":let @+ = expand('%') . ':' . line('.')<CR>",
|
||||
opts = { desc = "Copy relative file path with line number" },
|
||||
},
|
||||
},
|
||||
g = { -- +git/version control
|
||||
},
|
||||
j = { -- +lsp
|
||||
{ keys = "r", cmd = vim.lsp.buf.references, opts = { desc = "Show current reference" } },
|
||||
},
|
||||
p = { -- +project
|
||||
},
|
||||
q = { -- +quit
|
||||
{ keys = "q", cmd = ":q<CR>", opts = { desc = "Quit" } },
|
||||
{ keys = "Q", cmd = ":qa!<CR>", opts = { desc = "Force Quit" } },
|
||||
{ keys = "w", cmd = ":wq<CR>", opts = { desc = "Write and Quit" } },
|
||||
{ keys = "W", cmd = ":wall<CR>:qa!<CR>", opts = { desc = "Write all and Force Quit" } },
|
||||
},
|
||||
t = { -- +toggle/test
|
||||
{ keys = "f", cmd = ":NvimTreeToggle", opts = { desc = "Toggle File Explorer" } },
|
||||
{ keys = "F", cmd = ":FormatToggle<CR>", opts = { desc = "Toggle autoformat-on-save" } },
|
||||
},
|
||||
u = { -- +ui
|
||||
{ keys = " ", cmd = ":set list!", opts = { desc = "Toggle show all symbols" } },
|
||||
},
|
||||
w = { -- +window
|
||||
{ keys = "h", cmd = "<C-w>h", opts = { desc = "Left Window" } },
|
||||
{ keys = "n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
|
||||
{ keys = "e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
|
||||
{ keys = "i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
|
||||
{ keys = "H", cmd = "<C-w>H", opts = { desc = "Move Window Left" } },
|
||||
{ keys = "N", cmd = "<C-w>J", opts = { desc = "Move Window Down" } },
|
||||
{ keys = "E", cmd = "<C-w>K", opts = { desc = "Move Window Up" } },
|
||||
{ keys = "I", cmd = "<C-w>L", opts = { desc = "Move Window Right" } },
|
||||
{ keys = "-", cmd = ":split<CR>", opts = { desc = "Split to down" } },
|
||||
{ keys = "|", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
|
||||
{ keys = "/", cmd = ":vsplit<CR>", opts = { desc = "Split to right" } },
|
||||
{ keys = "d", cmd = "<C-w>c", opts = { desc = "Close Window" } },
|
||||
{ keys = "D", cmd = "<C-w>o", opts = { desc = "Close Other Windows" } },
|
||||
{ keys = "r", cmd = "<C-w>r", opts = { desc = "Rotate Windows" } },
|
||||
{ keys = "R", cmd = "<C-w>R", opts = { desc = "Reverse Rotate Windows" } },
|
||||
{ keys = "t", cmd = "<C-w>T", opts = { desc = "Move Window to New Tab" } },
|
||||
{ keys = "]", cmd = ":resize +5<CR>", opts = { desc = "Increase Window Size" } },
|
||||
{ keys = "[", cmd = ":resize -5<CR>", opts = { desc = "Decrease Window Size" } },
|
||||
{ keys = "M", cmd = ":resize<CR>:vertical resize<CR>", opts = { desc = "Maximize window size" } },
|
||||
},
|
||||
}
|
||||
|
||||
for key, maps in pairs(leader_mappings) do
|
||||
if key == "general" then
|
||||
apply_mappings(maps, "<leader>")
|
||||
else
|
||||
apply_mappings(maps, "<leader>" .. key)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
43
dot_config/nvim/lua/keymaps/lspkeys.lua
Normal file
43
dot_config/nvim/lua/keymaps/lspkeys.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
local M = {
|
||||
{ keys = "gd", cmd = vim.lsp.buf.definition, opts = { desc = "Goto Definition" } },
|
||||
{ keys = "<C-CR>", cmd = vim.lsp.buf.definition, opts = { desc = "Goto Definition" } },
|
||||
{ keys = "gD", cmd = vim.lsp.buf.declaration, opts = { desc = "Goto Declaration" } },
|
||||
{ keys = "gr", cmd = vim.lsp.buf.references, opts = { desc = "Goto References" } },
|
||||
{ keys = "gi", cmd = vim.lsp.buf.implementation, opts = { desc = "Goto Implementation" } },
|
||||
{ keys = "<leader>,", cmd = vim.lsp.buf.code_action, opts = { desc = "Code Action" } },
|
||||
{ keys = "ga", cmd = vim.lsp.buf.code_action, opts = { desc = "Code Action" } },
|
||||
{ keys = "gh", cmd = vim.lsp.buf.hover, opts = { desc = "Show hover" } },
|
||||
-- [c]hange [d]efinition
|
||||
{ keys = "cd", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } },
|
||||
}
|
||||
|
||||
-- local function smart_split_definition()
|
||||
-- local width = vim.api.nvim_win_get_width(0)
|
||||
-- if width > 80 then -- Adjust 80 to your preference
|
||||
-- vim.api.nvim_command("vsp")
|
||||
-- else
|
||||
-- vim.api.nvim_command("sp")
|
||||
-- end
|
||||
-- vim.lsp.buf.definition()
|
||||
-- end
|
||||
-- vim.keymap.set("n", "<C-w>d", smart_split_definition, { desc = "Go to Definition (Smart Split)" })
|
||||
|
||||
local function smart_split(func)
|
||||
local width = vim.api.nvim_win_get_width(0)
|
||||
if width > 80 then
|
||||
vim.api.nvim_command("vsp")
|
||||
else
|
||||
vim.api.nvim_command("sp")
|
||||
end
|
||||
func()
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<C-w>d", function()
|
||||
smart_split(vim.lsp.buf.definition)
|
||||
end, { desc = "Go to Definition (Smart Split)" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>D", function()
|
||||
smart_split(vim.lsp.buf.declaration)
|
||||
end, { desc = "Go to Declaration (Smart Split)" })
|
||||
|
||||
return M
|
||||
10
dot_config/nvim/lua/keymaps/modifier.lua
Normal file
10
dot_config/nvim/lua/keymaps/modifier.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
local keymaps_modifier = {
|
||||
-- Use C-w to move between windows
|
||||
-- { keys = "<C-w>h", cmd = "<C-w>h", opts = { desc = "left Window" } },
|
||||
-- { keys = "<C-w>n", cmd = "<C-w>j", opts = { desc = "Down Window" } },
|
||||
-- { keys = "<C-w>e", cmd = "<C-w>k", opts = { desc = "Up Window" } },
|
||||
-- { keys = "<C-w>i", cmd = "<C-w>l", opts = { desc = "Right Window" } },
|
||||
{ keys = "<A-x>", cmd = "<Cmd>FzfLua commands<CR>", opts = { desc = "Commands" } },
|
||||
}
|
||||
|
||||
return keymaps_modifier
|
||||
87
dot_config/nvim/lua/keymaps/nvim-tree.lua
Normal file
87
dot_config/nvim/lua/keymaps/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
local M = {}
|
||||
|
||||
M.event = "BufEnter"
|
||||
|
||||
M.global = {
|
||||
{ mode = "n", keys = "<leader>E", cmd = ":NvimTreeToggle<CR>" },
|
||||
{ mode = "n", keys = "<A-0>", cmd = ":NvimTreeFindFileToggle<CR>" },
|
||||
}
|
||||
|
||||
function M.plugin(api, opts)
|
||||
-- mode is set to "n" by default, in `./lua/plugins/nvim-tree.lua`
|
||||
return {
|
||||
-- Toggle
|
||||
{ keys = "<leader>e", cmd = ":NvimTreeToggle<CR>", opts = opts("Toggle") },
|
||||
-- Arrow 箭头 hnei
|
||||
{ keys = "h", cmd = api.node.navigate.parent_close, opts = opts("Close node") },
|
||||
{ keys = "i", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "H", cmd = api.tree.toggle_hidden_filter, opts = opts("Toggle Dotfiles") },
|
||||
{ keys = "N", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") },
|
||||
{ keys = "E", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") },
|
||||
{ keys = "I", cmd = api.tree.toggle_gitignore_filter, opts = opts("Toggle GitIgnored") },
|
||||
-- CONTROL KEYS 控制键
|
||||
{ keys = "<BS>", cmd = api.node.navigate.parent_close, opts = opts("Close node") },
|
||||
{ keys = "<CR>", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "<Tab>", cmd = api.node.open.preview, opts = opts("Open Preview") },
|
||||
-- Alpha 字母键
|
||||
{ keys = "a", cmd = api.fs.create, opts = opts("Create") },
|
||||
{ keys = "A", cmd = api.fs.create, opts = opts("Create") },
|
||||
{ keys = "bd", cmd = api.marks.bulk.delete, opts = opts("Delete Bookmarked") },
|
||||
{ keys = "bt", cmd = api.marks.bulk.trash, opts = opts("Trash Bookmarked") },
|
||||
{ keys = "bmv", cmd = api.marks.bulk.move, opts = opts("Move Bookmarked") },
|
||||
{ keys = "B", cmd = api.tree.toggle_no_buffer_filter, opts = opts("Toggle Filter: No Buffer") },
|
||||
{ keys = "c", cmd = api.fs.copy.node, opts = opts("Copy") },
|
||||
{ keys = "C", cmd = api.fs.copy.filename, opts = opts("Copy") },
|
||||
{ keys = "d", cmd = api.fs.remove, opts = opts("Delete") },
|
||||
{ keys = "D", cmd = api.fs.trash, opts = opts("Trash") },
|
||||
{ keys = "]e", cmd = api.node.navigate.diagnostics.next, opts = opts("Next Diagnostic") },
|
||||
{ keys = "[e", cmd = api.node.navigate.diagnostics.prev, opts = opts("Prev Diagnostic") },
|
||||
{ keys = "F", cmd = api.live_filter.clear, opts = opts("Live Filter: Clear") },
|
||||
{ keys = "f", cmd = api.live_filter.start, opts = opts("Live Filter: Start") },
|
||||
{ keys = "[g", cmd = api.node.navigate.git.prev, opts = opts("Prev Git") },
|
||||
{ keys = "]g", cmd = api.node.navigate.git.next, opts = opts("Next Git") },
|
||||
{ keys = "L", cmd = api.node.open.toggle_group_empty, opts = opts("Toggle Group Empty") },
|
||||
{ keys = "M", cmd = api.tree.toggle_no_bookmark_filter, opts = opts("Toggle Filter: No Bookmark") },
|
||||
{ keys = "m", cmd = api.marks.toggle, opts = opts("Toggle Bookmark") },
|
||||
{ keys = "o", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "O", cmd = api.node.open.no_window_picker, opts = opts("Open: No Window Picker") },
|
||||
{ keys = "p", cmd = api.fs.paste, opts = opts("Paste") },
|
||||
{ keys = "P", cmd = api.node.navigate.parent, opts = opts("Parent Directory") },
|
||||
{ keys = "q", cmd = api.tree.close, opts = opts("Close") },
|
||||
{ keys = "r", cmd = api.fs.rename, opts = opts("Rename") },
|
||||
{ keys = "R", cmd = api.tree.reload, opts = opts("Refresh") },
|
||||
{ keys = "s", cmd = api.node.run.system, opts = opts("Run System") },
|
||||
{ keys = "S", cmd = api.tree.search_node, opts = opts("Search") },
|
||||
{ keys = "u", cmd = api.fs.rename_full, opts = opts("Rename: Full Path") },
|
||||
{ keys = "U", cmd = api.tree.toggle_custom_filter, opts = opts("Toggle Filter: Hidden") },
|
||||
{ keys = "W", cmd = api.tree.collapse_all, opts = opts("Collapse") },
|
||||
{ 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 非字母数字键
|
||||
{ keys = "?", cmd = api.tree.toggle_help, opts = opts("Help") },
|
||||
{ keys = ">", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") },
|
||||
{ keys = "<", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") },
|
||||
{ keys = ".", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
{ keys = ";", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
{ keys = "-", cmd = api.tree.change_root_to_parent, opts = opts("Up") },
|
||||
-- MOD KEYS Ctrl+
|
||||
{ keys = "<C-]>", cmd = api.tree.change_root_to_node, opts = opts("CD") },
|
||||
{ keys = "<C-e>", cmd = api.node.open.replace_tree_buffer, opts = opts("Open: In Place") },
|
||||
{ keys = "<C-k>", cmd = api.node.show_info_popup, opts = opts("Info") },
|
||||
{ keys = "<C-r>", cmd = api.fs.rename_sub, opts = opts("Rename: Omit Filename") },
|
||||
{ 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-h>", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") },
|
||||
{ keys = "<A-0>", cmd = ":b#<CR>", opts = opts("Focus to previous buffer") },
|
||||
-- Mouse 鼠标键
|
||||
{ keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "<2-RightMouse>", cmd = api.tree.change_root_to_node, opts = opts("CD") },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
36
dot_config/nvim/lua/keymaps/user-command.lua
Normal file
36
dot_config/nvim/lua/keymaps/user-command.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("Reload", function()
|
||||
vim.cmd("luafile ~/.config/nvim/init.lua")
|
||||
end, {
|
||||
desc = "Reload Neovim configuration",
|
||||
})
|
||||
33
dot_config/nvim/lua/keymaps/utils.lua
Normal file
33
dot_config/nvim/lua/keymaps/utils.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
local M = {}
|
||||
-- local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
|
||||
local default_opts = { noremap = true, silent = true }
|
||||
local default_mode = { "n" }
|
||||
|
||||
M.set_keymaps = function(maps)
|
||||
for _, map in ipairs(maps) do
|
||||
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
|
||||
local mode = map.mode or default_mode
|
||||
vim.keymap.set(mode, map.keys, map.cmd, opts)
|
||||
end
|
||||
end
|
||||
|
||||
M.set_lang_keymaps = function(maps)
|
||||
vim.api.create_autocmd("FileType", {
|
||||
pattern = maps.filetype,
|
||||
callback = function()
|
||||
M.set_keymaps(maps.keymaps)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
M.set_buf_keymaps = function(maps)
|
||||
vim.api.create_autocmd("BufEnter", {
|
||||
pattern = maps.filetype,
|
||||
callback = function()
|
||||
M.set_keymaps(maps.keymaps)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
9
dot_config/nvim/lua/keymaps/visual-multi.lua
Normal file
9
dot_config/nvim/lua/keymaps/visual-multi.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-- Note that this plugin is a fork for colemak
|
||||
-- Use mouse to select multiple cursors
|
||||
vim.g.VM_mouse_mappings = 1
|
||||
-- Disable default mappings
|
||||
|
||||
vim.g.VM_maps = {
|
||||
["Add Cursor Down"] = "<A-n>",
|
||||
["Add Cursor Up"] = "<A-e>",
|
||||
}
|
||||
42
dot_config/nvim/lua/keymaps/which.lua
Normal file
42
dot_config/nvim/lua/keymaps/which.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
-- local wk = require("which-key")
|
||||
-- wk.add({
|
||||
-- -- https://github.com/folke/which-key.nvim/tree/main?tab=readme-ov-file#%EF%B8%8F-mappings
|
||||
-- {
|
||||
-- -- Nested mappings are allowed and can be added in any order
|
||||
-- -- Most attributes can be inherited or overridden on any level
|
||||
-- -- There's no limit to the depth of nesting
|
||||
-- mode = { "n" },
|
||||
-- { "<leader>b", group = "Buffer" }, -- no need to specify mode since it's inherited
|
||||
-- { "<leader>c", group = "Code/Compile" },
|
||||
-- { "<leader>f", group = "File" },
|
||||
-- { "<leader>p", group = "Project", icon = "" },
|
||||
-- { "<leader>q", group = "Quit" },
|
||||
-- { "<leader>t", group = "Toggle" },
|
||||
-- { "<leader>u", group = "UI" },
|
||||
-- { "<leader>w", group = "Window" },
|
||||
-- },
|
||||
-- { -- https://github.com/folke/which-key.nvim/blob/1f8d414f61e0b05958c342df9b6a4c89ce268766/lua/which-key/plugins/presets.lua#L57-L98
|
||||
-- -- text objects
|
||||
-- mode = { "o", "x" },
|
||||
-- { "l", group = "inside" },
|
||||
-- { 'l"', desc = 'inner " string' },
|
||||
-- { "l'", desc = "inner ' string" },
|
||||
-- { "l(", desc = "inner [(])" },
|
||||
-- { "l)", desc = "inner [(])" },
|
||||
-- { "l<", desc = "inner <>" },
|
||||
-- { "l>", desc = "inner <>" },
|
||||
-- { "lB", desc = "inner [{]}" },
|
||||
-- { "lW", desc = "inner WORD" },
|
||||
-- { "l[", desc = "inner []" },
|
||||
-- { "l]", desc = "inner []" },
|
||||
-- { "l`", desc = "inner ` string" },
|
||||
-- { "lb", desc = "inner [(])" },
|
||||
-- { "lp", desc = "inner paragraph" },
|
||||
-- { "ls", desc = "inner sentence" },
|
||||
-- { "lt", desc = "inner tag block" },
|
||||
-- { "lw", desc = "inner word" },
|
||||
-- { "l{", desc = "inner [{]}" },
|
||||
-- { "l}", desc = "inner [{]}" },
|
||||
-- { "i", desc = "Right" },
|
||||
-- },
|
||||
-- })
|
||||
100
dot_config/nvim/lua/plugins/appearance.lua
Normal file
100
dot_config/nvim/lua/plugins/appearance.lua
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
-- https://stackoverflow.com/a/73365602
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
group = vim.api.nvim_create_augroup("highlight_yank", {}),
|
||||
desc = "Hightlight selection on yank",
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 500 })
|
||||
end,
|
||||
})
|
||||
|
||||
return {
|
||||
-- Colorschemes
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = true,
|
||||
opts = {
|
||||
flavor = "auto",
|
||||
background = {
|
||||
light = "latte",
|
||||
dark = "mocha",
|
||||
},
|
||||
integrations = {
|
||||
-- lualine = true,
|
||||
"lualine",
|
||||
"blink_cmp"
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
opts = {
|
||||
variant = "dawn",
|
||||
},
|
||||
cmd = "FzfLua colorschemes",
|
||||
},
|
||||
{ "rebelot/kanagawa.nvim", cmd = "FzfLua colorschemes" },
|
||||
{ -- Modern Status Line
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("plugins.mod.lualine")
|
||||
end,
|
||||
},
|
||||
-- { -- Breadcrumb
|
||||
-- "Bekaboo/dropbar.nvim",
|
||||
-- dependencies = {
|
||||
-- "nvim-telescope/telescope-fzf-native.nvim",
|
||||
-- build = "make",
|
||||
-- },
|
||||
-- opts = {},
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<Leader>+",
|
||||
-- function()
|
||||
-- require("dropbar.api").pick()
|
||||
-- end,
|
||||
-- desc = "Pick symbols in winbar",
|
||||
-- },
|
||||
-- {
|
||||
-- "[;",
|
||||
-- function()
|
||||
-- require("dropbar.api").goto_context_start()
|
||||
-- end,
|
||||
-- desc = "Go to start of current context",
|
||||
-- },
|
||||
-- {
|
||||
-- "];",
|
||||
-- function()
|
||||
-- require("dropbar.api").select_next_context()
|
||||
-- end,
|
||||
-- desc = "Select next context",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
{ import = "plugins.mod.bufferline" }, -- Buffer Top Bar
|
||||
{ -- Git Blames, Changes
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
current_line_blame = true,
|
||||
},
|
||||
event = "BufReadPre",
|
||||
keys = {
|
||||
{ "<leader>gb", "<cmd>Gitsigns blame<CR>", desc = "Blame file" },
|
||||
{ "<leader>gd", "<cmd>Gitsigns diffthis<CR>", desc = "Diff file" },
|
||||
{ "<leader>gB", "<cmd>Gitsigns toggle_current_line_blame<CR>", desc = "Toggle line blame" },
|
||||
{ "[g", "<cmd>Gitsigns prev_hunk<CR>", desc = "Prev hunk" },
|
||||
{ "]g", "<cmd>Gitsigns next_hunk<CR>", desc = "Next hunk" },
|
||||
},
|
||||
},
|
||||
-- { -- Highlight and navigate between TODOs
|
||||
-- "folke/todo-comments.nvim",
|
||||
-- cmd = { "TodoTelescope" },
|
||||
-- event = "BufRead",
|
||||
-- opts = {},
|
||||
-- dependencies = { "nvim-lua/plenary.nvim" },
|
||||
-- },
|
||||
}
|
||||
24
dot_config/nvim/lua/plugins/completion.lua
Normal file
24
dot_config/nvim/lua/plugins/completion.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
return {
|
||||
{ import = "plugins.mod.blink-cmp" },
|
||||
-- { import = "plugins.mod.nvim-cmp" },
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
build = "make install_jsregexp",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load({ paths = "~/.config/lsp-snippets" })
|
||||
require("luasnip").setup({
|
||||
history = true,
|
||||
enable_autosnippets = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"js0ny/luasnip-latex-snippets.nvim",
|
||||
dependencies = { "L3MON4D3/LuaSnip", "lervag/vimtex" },
|
||||
ft = { "tex", "latex", "markdown", "org" },
|
||||
opts = {},
|
||||
-- dev = true,
|
||||
-- dir = "~/Source/Forks/luasnip-latex-snippets.nvim/"
|
||||
}
|
||||
}
|
||||
43
dot_config/nvim/lua/plugins/dap.lua
Normal file
43
dot_config/nvim/lua/plugins/dap.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
-- Debugger setups
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
event = "BufReadPre",
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
dap.adapters.codelldb = {
|
||||
type = "executable",
|
||||
command = "codelldb",
|
||||
}
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "Launch file",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
dap.configurations.rust = dap.configurations.cpp
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
opts = {},
|
||||
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
||||
cmd = "DapNew",
|
||||
},
|
||||
{ "theHamsta/nvim-dap-virtual-text", opts = {}, cmd = "DapNew" },
|
||||
{
|
||||
"mfussenegger/nvim-dap-python",
|
||||
event = "BufReadPost",
|
||||
ft = "python",
|
||||
config = function()
|
||||
require("dap-python").setup("uv")
|
||||
end,
|
||||
},
|
||||
}
|
||||
46
dot_config/nvim/lua/plugins/edit.lua
Normal file
46
dot_config/nvim/lua/plugins/edit.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
return {
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
event = "BufEnter",
|
||||
opts = {},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||
},
|
||||
},
|
||||
{ import = "plugins.mod.img-clip" },
|
||||
{ import = "plugins.mod.mc" }, -- Multiple-cursors
|
||||
{ import = "plugins.mod.autopairs" },
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||
event = "BufEnter",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"MagicDuck/grug-far.nvim",
|
||||
opts = { headerMaxWidth = 80 },
|
||||
cmd = "GrugFar",
|
||||
keys = {
|
||||
{
|
||||
"<leader>fF",
|
||||
function()
|
||||
local grug = require("grug-far")
|
||||
local ext = vim.bo.buftype == "" and vim.fn.expand("%:e")
|
||||
grug.open({
|
||||
transient = true,
|
||||
prefills = {
|
||||
filesFilter = ext and ext ~= "" and "*." .. ext or nil,
|
||||
},
|
||||
})
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Search and Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
39
dot_config/nvim/lua/plugins/fileutils.lua
Normal file
39
dot_config/nvim/lua/plugins/fileutils.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
return {
|
||||
{
|
||||
"rmagatti/auto-session",
|
||||
event = "BufReadPre",
|
||||
cmd = {
|
||||
"SessionSearch",
|
||||
"SessionSave",
|
||||
},
|
||||
opts = {
|
||||
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
|
||||
},
|
||||
},
|
||||
-- { import = "plugins.mod.nvim-tree" },
|
||||
-- { import = "plugins.mod.telescope" },
|
||||
{ import = "plugins.mod.fzf" },
|
||||
-- {
|
||||
-- "ahmedkhalf/project.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- opts = {
|
||||
-- detection_methods = { "lsp", "pattern" },
|
||||
-- patterns = { ".git", "Makefile", "package.json" },
|
||||
-- sync_root_with_cwd = true,
|
||||
-- silent_chdir = true,
|
||||
-- scope_chdir = "global",
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require("telescope").load_extension("projects")
|
||||
-- end,
|
||||
-- dependencies = { "nvim-telescope/telescope.nvim" },
|
||||
-- },
|
||||
-- {
|
||||
-- "NeogitOrg/neogit",
|
||||
-- config = true,
|
||||
-- cmd = {
|
||||
-- "Neogit",
|
||||
-- },
|
||||
-- },
|
||||
{ import = "plugins.mod.neo-tree" }
|
||||
}
|
||||
15
dot_config/nvim/lua/plugins/init.lua
Normal file
15
dot_config/nvim/lua/plugins/init.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
require("plugins.lazy-nvim")
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ import = "plugins.appearance" },
|
||||
{ import = "plugins.completion" },
|
||||
{ import = "plugins.fileutils" },
|
||||
{ import = "plugins.lang" },
|
||||
{ import = "plugins.dap" },
|
||||
{ import = "plugins.edit" },
|
||||
{ import = "plugins.misc" },
|
||||
},
|
||||
checker = { enabled = false },
|
||||
})
|
||||
12
dot_config/nvim/lua/plugins/lang/beancount.lua
Normal file
12
dot_config/nvim/lua/plugins/lang/beancount.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||
pattern = "*.bean",
|
||||
callback = function()
|
||||
vim.bo.filetype = "beancount"
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
return {
|
||||
"nathangrigg/vim-beancount",
|
||||
ft = "beancount",
|
||||
}
|
||||
22
dot_config/nvim/lua/plugins/lang/init.lua
Normal file
22
dot_config/nvim/lua/plugins/lang/init.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
{ import = "plugins.lang.org" },
|
||||
{ import = "plugins.lang.markdown" },
|
||||
{ import = "plugins.lang.just" },
|
||||
{ import = "plugins.lang.typst" },
|
||||
{ import = "plugins.lang.beancount" },
|
||||
{ import = "plugins.lang.tex" },
|
||||
{ import = "plugins.lang.lua" },
|
||||
{ import = "plugins.lang.treesitter" },
|
||||
{ import = "plugins.mod.trouble-nvim" },
|
||||
-- Remove mason and use system package manager
|
||||
-- {
|
||||
-- "williamboman/mason.nvim",
|
||||
-- cmd = "Mason",
|
||||
-- build = ":MasonUpdate",
|
||||
-- -- opts_extend = { "ensure_installed" },
|
||||
-- opts = {
|
||||
-- -- ensure_installed = require("config.servers").servers,
|
||||
-- },
|
||||
-- },
|
||||
{ import = "plugins.mod.conform-nvim" },
|
||||
}
|
||||
4
dot_config/nvim/lua/plugins/lang/just.lua
Normal file
4
dot_config/nvim/lua/plugins/lang/just.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"NoahTheDuke/vim-just",
|
||||
ft = { "just" },
|
||||
}
|
||||
9
dot_config/nvim/lua/plugins/lang/lua.lua
Normal file
9
dot_config/nvim/lua/plugins/lang/lua.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"folke/lazydev.nvim",
|
||||
ft = "lua", -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||
},
|
||||
},
|
||||
}
|
||||
6
dot_config/nvim/lua/plugins/lang/markdown/init.lua
Normal file
6
dot_config/nvim/lua/plugins/lang/markdown/init.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
{ import = "plugins.lang.markdown.render-markdown" },
|
||||
-- { import = "plugins.mod.lang.markdown.markview" },
|
||||
{ import = "plugins.lang.markdown.obsidian-nvim" },
|
||||
{ "bullets-vim/bullets.vim", ft = "markdown" },
|
||||
}
|
||||
29
dot_config/nvim/lua/plugins/lang/markdown/markview.lua.bak
Normal file
29
dot_config/nvim/lua/plugins/lang/markdown/markview.lua.bak
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
-- This won't be loaded
|
||||
-- I keep this since render-markdown sometimes buggy
|
||||
return {
|
||||
{
|
||||
"OXY2DEV/markview.nvim",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
opts = {
|
||||
checkboxes = require("markview-presets").checkboxes.nerd,
|
||||
headings = {
|
||||
enable = true,
|
||||
shift_width = 1,
|
||||
heading_1 = {
|
||||
style = "label",
|
||||
hl = "MarkviewH1",
|
||||
},
|
||||
},
|
||||
code_blocks = {
|
||||
style = "language",
|
||||
language_direction = "right",
|
||||
hl = "MarkviewCode",
|
||||
info_hl = "MarkviewCodeInfo",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
145
dot_config/nvim/lua/plugins/lang/markdown/obsidian-nvim.lua
Normal file
145
dot_config/nvim/lua/plugins/lang/markdown/obsidian-nvim.lua
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
local uuid = function()
|
||||
local template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
|
||||
return string.gsub(template, '[xy]', function(c)
|
||||
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
|
||||
return string.format('%x', v)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
"obsidian-nvim/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
-- lazy = false,
|
||||
ft = "markdown",
|
||||
|
||||
cmd = {
|
||||
"ObsidianNewFromTemplate",
|
||||
"ObsidianToggleCheckbox",
|
||||
"ObsidianQuickSwitch",
|
||||
"ObsidianExtractNote",
|
||||
"ObsidianFollowLink",
|
||||
"ObsidianBacklinks",
|
||||
"ObsidianWorkspace",
|
||||
"ObsidianYesterday",
|
||||
"ObsidianPasteImg",
|
||||
"ObsidianTomorrow",
|
||||
"ObsidianTemplate",
|
||||
"ObsidianDailies",
|
||||
"ObsidianLinkNew",
|
||||
"ObsidianRename",
|
||||
"ObsidianSearch",
|
||||
"ObsidianCheck",
|
||||
"ObsidianLinks",
|
||||
"ObsidianToday",
|
||||
"ObsidianDebug",
|
||||
"ObsidianOpen",
|
||||
"ObsidianTags",
|
||||
"ObsidianLink",
|
||||
"ObsidianNew",
|
||||
"ObsidianTOC",
|
||||
},
|
||||
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
||||
-- event = {
|
||||
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
||||
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
|
||||
-- -- refer to `:h file-pattern` for more examples
|
||||
-- "BufReadPre path/to/my-vault/*.md",
|
||||
-- "BufNewFile path/to/my-vault/*.md",
|
||||
-- },
|
||||
keys = {
|
||||
{ "<leader>fo", "<cmd>ObsidianQuickSwitch<CR>", desc = "Obsidian: Quick Switch" },
|
||||
},
|
||||
dependencies = {
|
||||
-- Required.
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- see below for full list of optional dependencies 👇
|
||||
"ibhagwan/fzf-lua",
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = "personal",
|
||||
path = "~/Obsidian",
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
nvim_cmp = false,
|
||||
blink = true,
|
||||
min_chars = 2,
|
||||
},
|
||||
ui = {
|
||||
enable = false,
|
||||
},
|
||||
templates = {
|
||||
folder = "_Global/LuaTemplates",
|
||||
date_format = "%Y-%m-%d",
|
||||
time_format = "%H:%M",
|
||||
substitutions = {
|
||||
yesterday = function()
|
||||
return os.date("%Y-%m-%d", os.time() - 86400)
|
||||
end,
|
||||
uuid = uuid()
|
||||
},
|
||||
},
|
||||
---@return table
|
||||
note_frontmatter_func = function(note)
|
||||
-- Add the title of the note as an alias.
|
||||
if note.title then
|
||||
note:add_alias(note.title)
|
||||
end
|
||||
|
||||
-- Force to use UUID as the note id.
|
||||
local note_id
|
||||
if note.metadata then
|
||||
note_id = note.id
|
||||
else
|
||||
note_id = uuid()
|
||||
end
|
||||
|
||||
local out = {
|
||||
id = note_id,
|
||||
aliases = note.aliases,
|
||||
tags = note.tags,
|
||||
title = note.id,
|
||||
date = os.date(
|
||||
"%Y-%m-%dT00:00:00"),
|
||||
}
|
||||
|
||||
-- `note.metadata` contains any manually added fields in the frontmatter.
|
||||
-- So here we just make sure those fields are kept in the frontmatter.
|
||||
if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then
|
||||
for k, v in pairs(note.metadata) do
|
||||
out[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
-- Force to update mtime.
|
||||
out.mtime = os.date("%Y-%m-%dT%H:%M:%S")
|
||||
return out
|
||||
end,
|
||||
daily_notes = {
|
||||
folder = "_Global/Periodic",
|
||||
date_format = "%Y-%m-%d",
|
||||
default_tags = { "daily" },
|
||||
template = nil,
|
||||
},
|
||||
-- see below for full list of options 👇
|
||||
attachments = {
|
||||
img_folder = "_Global/Assets",
|
||||
img_name_func = function()
|
||||
return string.format("%s-", os.time())
|
||||
end,
|
||||
},
|
||||
mappings = {
|
||||
["<cr>"] = {
|
||||
action = function()
|
||||
require("obsidian").util.smart_action()
|
||||
end,
|
||||
opts = { buffer = true, expr = true },
|
||||
},
|
||||
},
|
||||
new_notes_location = "current_dir",
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
return {
|
||||
{
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
event = "BufRead",
|
||||
ft = { "markdown", "Avante" },
|
||||
opts = {
|
||||
file_types = { "markdown", "Avante" },
|
||||
render_modes = { "n", "c", "t" },
|
||||
latex = {
|
||||
-- enabled = true,
|
||||
enabled = false,
|
||||
converter = "latex2text",
|
||||
highlight = "RenderMarkdownMath",
|
||||
top_pad = 0,
|
||||
bottom_pad = 0,
|
||||
},
|
||||
-- heading = {
|
||||
-- position = "overlay",
|
||||
-- width = "block",
|
||||
-- left_margin = 0.5,
|
||||
-- left_pad = 0.2,
|
||||
-- right_pad = 0.2,
|
||||
-- },
|
||||
link = {
|
||||
custom = {
|
||||
python = { pattern = "%.py", icon = " " },
|
||||
lua = { pattern = "%.lua", icon = " " },
|
||||
markdown = { pattern = "%.md", icon = " " },
|
||||
},
|
||||
},
|
||||
bullet = {
|
||||
icons = { " ", "●", "○", "◆", "◇" },
|
||||
},
|
||||
checkbox = {
|
||||
checked = { scope_highlight = "@markup.strikethrough" },
|
||||
unchecked = { scope_highlight = "@comment.todo" },
|
||||
},
|
||||
code = {
|
||||
position = "right",
|
||||
width = "block",
|
||||
right_pad = 10,
|
||||
},
|
||||
callout = {
|
||||
note = { raw = "[!NOTE]", rendered = " Note", highlight = "RenderMarkdownInfo" },
|
||||
tip = { raw = "[!TIP]", rendered = " Tip", highlight = "RenderMarkdownSuccess" },
|
||||
important = { raw = "[!IMPORTANT]", rendered = " Important", highlight = "RenderMarkdownHint" },
|
||||
warning = { raw = "[!WARNING]", rendered = " Warning", highlight = "RenderMarkdownWarn" },
|
||||
caution = { raw = "[!CAUTION]", rendered = " Caution", highlight = "RenderMarkdownError" },
|
||||
abstract = { raw = "[!ABSTRACT]", rendered = " Abstract", highlight = "RenderMarkdownInfo" },
|
||||
summary = { raw = "[!SUMMARY]", rendered = " Summary", highlight = "RenderMarkdownInfo" },
|
||||
tldr = { raw = "[!TLDR]", rendered = " Tldr", highlight = "RenderMarkdownInfo" },
|
||||
info = { raw = "[!INFO]", rendered = " Info", highlight = "RenderMarkdownInfo" },
|
||||
todo = { raw = "[!TODO]", rendered = " Todo", highlight = "RenderMarkdownInfo" },
|
||||
hint = { raw = "[!HINT]", rendered = " Hint", highlight = "RenderMarkdownSuccess" },
|
||||
success = { raw = "[!SUCCESS]", rendered = " Success", highlight = "RenderMarkdownSuccess" },
|
||||
check = { raw = "[!CHECK]", rendered = " Check", highlight = "RenderMarkdownSuccess" },
|
||||
done = { raw = "[!DONE]", rendered = " Done", highlight = "RenderMarkdownSuccess" },
|
||||
question = { raw = "[!QUESTION]", rendered = " Question", highlight = "RenderMarkdownWarn" },
|
||||
help = { raw = "[!HELP]", rendered = " Help", highlight = "RenderMarkdownWarn" },
|
||||
faq = { raw = "[!FAQ]", rendered = " Faq", highlight = "RenderMarkdownWarn" },
|
||||
attention = { raw = "[!ATTENTION]", rendered = " Attention", highlight = "RenderMarkdownWarn" },
|
||||
failure = { raw = "[!FAILURE]", rendered = " Failure", highlight = "RenderMarkdownError" },
|
||||
fail = { raw = "[!FAIL]", rendered = " Fail", highlight = "RenderMarkdownError" },
|
||||
missing = { raw = "[!MISSING]", rendered = " Missing", highlight = "RenderMarkdownError" },
|
||||
danger = { raw = "[!DANGER]", rendered = " Danger", highlight = "RenderMarkdownError" },
|
||||
error = { raw = "[!ERROR]", rendered = " Error", highlight = "RenderMarkdownError" },
|
||||
bug = { raw = "[!BUG]", rendered = " Bug", highlight = "RenderMarkdownError" },
|
||||
example = { raw = "[!EXAMPLE]", rendered = " Example", highlight = "RenderMarkdownHint" },
|
||||
quote = { raw = "[!QUOTE]", rendered = " Quote", highlight = "RenderMarkdownQuote" },
|
||||
cite = { raw = "[!CITE]", rendered = " Cite", highlight = "RenderMarkdownQuote" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
88
dot_config/nvim/lua/plugins/lang/org.lua
Normal file
88
dot_config/nvim/lua/plugins/lang/org.lua
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
return {
|
||||
{
|
||||
"nvim-orgmode/orgmode",
|
||||
dependencies = {
|
||||
-- "nvim-telescope/telescope.nvim",
|
||||
-- "nvim-orgmode/telescope-orgmode.nvim",
|
||||
"nvim-orgmode/org-bullets.nvim",
|
||||
"Saghen/blink.cmp",
|
||||
},
|
||||
cmd = {
|
||||
"Org",
|
||||
},
|
||||
ft = {
|
||||
"org",
|
||||
"orgagenda",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>A", "<cmd>Org agenda<CR>", desc = "Org Agenda" },
|
||||
},
|
||||
event = "BufEnter *.org",
|
||||
config = function()
|
||||
require("orgmode").setup({
|
||||
org_agenda_files = "~/OrgFiles/tasks/*",
|
||||
org_default_notes_file = "~/OrgFiles/tasks/inbox.org",
|
||||
org_archive_location = "~/OrgFiles/.archive/%s_archive::",
|
||||
org_todo_keywords = { "TODO(t)", "NEXT(n)", "WAIT(w)", "|", "DONE(d)", "CANCELLED(c)" },
|
||||
org_hide_leading_stars = true,
|
||||
org_hide_emphasis_markers = true,
|
||||
org_log_into_drawer = "LOGBOOK",
|
||||
org_highlight_latex_and_related = "native",
|
||||
org_startup_indented = true,
|
||||
org_deadline_warning_days = 10,
|
||||
mappings = {
|
||||
agenda = {
|
||||
org_agenda_schedule = "<C-c><C-s>",
|
||||
org_agenda_deadline = "<C-c><C-d>",
|
||||
org_agenda_todo = "<C-c><C-t>",
|
||||
org_agenda_set_tags = "<C-c><C-c>",
|
||||
org_agenda_earlier = { "[[", "<" },
|
||||
org_agenda_later = { "]]", ">" },
|
||||
org_agenda_archive = "$",
|
||||
},
|
||||
org = {
|
||||
org_deadline = "<C-c><C-d>",
|
||||
org_schedule = "<C-c><C-s>",
|
||||
org_todo = "<C-c><C-t>",
|
||||
org_set_tags_command = "<C-c><C-c>",
|
||||
org_archive_subtree = "<C-c>$",
|
||||
},
|
||||
},
|
||||
})
|
||||
require("org-bullets").setup()
|
||||
require("blink.cmp").setup({
|
||||
sources = {
|
||||
per_filetype = {
|
||||
org = { "orgmode" },
|
||||
},
|
||||
providers = {
|
||||
orgmode = {
|
||||
name = "Orgmode",
|
||||
module = "orgmode.org.autocompletion.blink",
|
||||
fallbacks = { "buffer" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- require("telescope").setup()
|
||||
-- require("telescope").load_extension("orgmode")
|
||||
-- vim.keymap.set("n", "<leader>r", require("telescope").extensions.orgmode.refile_heading)
|
||||
-- vim.keymap.set("n", "<leader>oP", require("telescope").extensions.orgmode.search_headings)
|
||||
vim.keymap.set("n", "<leader>op", "<cmd>FzfLua files cwd=~/OrgFiles<CR>")
|
||||
-- vim.keymap.set("n", "<leader>li", require("telescope").extensions.orgmode.insert_link)
|
||||
end,
|
||||
},
|
||||
-- {
|
||||
-- dir = "~/Source/org-pomodoro.nvim",
|
||||
-- name = "org-pomodoro.nvim",
|
||||
-- lazy = false,
|
||||
-- opts = {},
|
||||
-- dependencies = {
|
||||
-- "nvim-orgmode/orgmode",
|
||||
-- },
|
||||
-- cmd = {
|
||||
-- "OrgPomodoro",
|
||||
-- },
|
||||
-- },
|
||||
}
|
||||
7
dot_config/nvim/lua/plugins/lang/tex.lua
Normal file
7
dot_config/nvim/lua/plugins/lang/tex.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"lervag/vimtex",
|
||||
ft = { "tex", "bib" },
|
||||
init = function()
|
||||
vim.g.vimtex_view_method = "okular"
|
||||
end,
|
||||
}
|
||||
23
dot_config/nvim/lua/plugins/lang/treesitter.lua
Normal file
23
dot_config/nvim/lua/plugins/lang/treesitter.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
return {
|
||||
{ "nvim-treesitter/nvim-treesitter-context", lazy = true },
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
cmd = {
|
||||
"TSInstall",
|
||||
"TSUpdate",
|
||||
"TSUpdateSync",
|
||||
},
|
||||
event = {
|
||||
"BufReadPre",
|
||||
},
|
||||
opts = {
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline", "latex" },
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
},
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup({ highlight = { enable = true } })
|
||||
end
|
||||
},
|
||||
}
|
||||
6
dot_config/nvim/lua/plugins/lang/typst.lua
Normal file
6
dot_config/nvim/lua/plugins/lang/typst.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
'chomosuke/typst-preview.nvim',
|
||||
ft = { 'typst' },
|
||||
version = '1.*',
|
||||
opts = {}, -- lazy.nvim will implicitly calls `setup {}`
|
||||
}
|
||||
22
dot_config/nvim/lua/plugins/lazy-nvim.lua
Normal file
22
dot_config/nvim/lua/plugins/lazy-nvim.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
-- This is also a good place to setup other settings (vim.opt)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
28
dot_config/nvim/lua/plugins/misc.lua
Normal file
28
dot_config/nvim/lua/plugins/misc.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
return {
|
||||
{ "nvim-lua/plenary.nvim", lazy = true },
|
||||
{ "wakatime/vim-wakatime", lazy = false },
|
||||
{ import = "plugins.mod.toggleterm" },
|
||||
{ import = "plugins.mod.which-keys-nvim" },
|
||||
{ import = "plugins.mod.copilot-lua" },
|
||||
{ import = "plugins.mod.avante-nvim" },
|
||||
{
|
||||
"kawre/leetcode.nvim",
|
||||
build = ":TSUpdate html", -- if you have `nvim-treesitter` installed
|
||||
cmd = {
|
||||
"Leet",
|
||||
},
|
||||
lazy = true,
|
||||
-- event = "VeryLazy",
|
||||
dependencies = {
|
||||
-- "nvim-telescope/telescope.nvim",
|
||||
"ibhagwan/fzf-lua",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
opts = {
|
||||
-- configuration goes here
|
||||
},
|
||||
},
|
||||
{ import = "plugins.mod.image-nvim" },
|
||||
{ import = "plugins.mod.snacks-nvim" },
|
||||
}
|
||||
56
dot_config/nvim/lua/plugins/mod/alpha-nvim.lua
Normal file
56
dot_config/nvim/lua/plugins/mod/alpha-nvim.lua
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
-- alpha-nvim.lua
|
||||
return {
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = {},
|
||||
keys = {
|
||||
{ "<leader>ba", "<cmd>Alpha<CR>", desc = "Toggle Alpha Dashboard" },
|
||||
},
|
||||
cmd = {
|
||||
"Alpha",
|
||||
},
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
dashboard.section.header.val = {
|
||||
" ",
|
||||
"================= =============== =============== ======== ========",
|
||||
"\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //",
|
||||
"||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||",
|
||||
"|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||",
|
||||
"||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||",
|
||||
"|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||",
|
||||
"||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||",
|
||||
"|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||",
|
||||
"||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||",
|
||||
"|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||",
|
||||
"|| `' || || `' || || `' || || | \\ / | ||",
|
||||
"|| .===' `===. .==='.`===. .===' /==. | \\/ | ||",
|
||||
"|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||",
|
||||
"|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||",
|
||||
"|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||",
|
||||
"||.==' _-' `' | /==.||",
|
||||
"==' _-' j s 0 n y N E O V I M \\/ `==",
|
||||
"\\ _-' `-_ /",
|
||||
" `'' ``' ",
|
||||
}
|
||||
dashboard.section.buttons.val.leader = "SPC"
|
||||
dashboard.section.buttons.val = {
|
||||
-- leader = "SPC",
|
||||
dashboard.button("p", " 查找项目", "<cmd>Telescope projects<CR>"),
|
||||
dashboard.button("h", " 历史文件", "<cmd>Telescope oldfiles<CR>"),
|
||||
dashboard.button("l", " 加载会话", "<cmd>SessionSearch<CR>"),
|
||||
-- FIXME: This does not work on Windows - Make it more portable
|
||||
dashboard.button("c", " 转到设置", "<cmd>Telescope find_files cwd=~/.config/nvim<CR>"),
|
||||
dashboard.button("SPC q", " 退出", "<cmd>qa<CR>"),
|
||||
}
|
||||
dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " "
|
||||
|
||||
dashboard.config.opts.noautocmd = true
|
||||
|
||||
-- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']]
|
||||
|
||||
alpha.setup(dashboard.config)
|
||||
end,
|
||||
},
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue