feat(emacs) rime

This commit is contained in:
js0ny 2025-02-10 04:26:16 +00:00
parent 214f23425d
commit da0cc1d6e8
11 changed files with 100 additions and 29 deletions

3
.gitignore vendored
View file

@ -33,8 +33,5 @@ common/fzfrc
gitconfig gitconfig
spacemacs/
lazy-lock.json lazy-lock.json
tools/doom/custom.el
tools/doom/custom.el

View file

@ -36,39 +36,50 @@ linkDots=(
["$DOTFILES/common/tmux.conf"]="$XDG_CONFIG_HOME/tmux/tmux.conf" ["$DOTFILES/common/tmux.conf"]="$XDG_CONFIG_HOME/tmux/tmux.conf"
["$DOTFILES/common/vimrc"]="$XDG_CONFIG_HOME/vim/vimrc" ["$DOTFILES/common/vimrc"]="$XDG_CONFIG_HOME/vim/vimrc"
["$DOTFILES/common/zellij.config.kdl"]="$HOME/.config/zellij/config.kdl" ["$DOTFILES/common/zellij.config.kdl"]="$HOME/.config/zellij/config.kdl"
["$DOTFILES/tools/emacs.d"]="$HOME/.emacs.d" # ["$DOTFILES/tools/emacs.d"]="$HOME/.emacs.d"
["$DOTFILES/tools/doom"]="$HOME/.config/doom"
["$DOTFILES/tools/fish"]="$HOME/.config/fish" ["$DOTFILES/tools/fish"]="$HOME/.config/fish"
["$DOTFILES/tools/ipython"]="$XDG_CONFIG_HOME/ipython" ["$DOTFILES/tools/ipython"]="$XDG_CONFIG_HOME/ipython"
["$DOTFILES/tools/nvim"]="$XDG_CONFIG_HOME/nvim" ["$DOTFILES/tools/nvim"]="$XDG_CONFIG_HOME/nvim"
["$DOTFILES/tools/wezterm"]="$HOME/.config/wezterm"
["$DOTFILES/tools/yazi"]="$HOME/.config/yazi" ["$DOTFILES/tools/yazi"]="$HOME/.config/yazi"
["$DOTFILES/tools/zed"]="$HOME/.config/zed"
["$DOTFILES/tools/zsh/common.zshrc"]="$ZDOTDIR/.zshrc" ["$DOTFILES/tools/zsh/common.zshrc"]="$ZDOTDIR/.zshrc"
["$DOTFILES/tools/zsh/.zshenv"]="$ZDOTDIR/.zshenv" ["$DOTFILES/tools/zsh/zshenv"]="$ZDOTDIR/.zshenv"
["$DOTFILES/platforms/mac/pwshProfile.ps1"]="$HOME/.config/powershell/Microsoft.PowerShell_profile.ps1"
) )
if [ $(uname) = "Darwin" ]; then if [ $(uname) = "Darwin" ]; then
echo "[INFO] Running on macOS"
linkDots+=( linkDots+=(
["$DOTFILES/platforms/mac/karabiner"]="$HOME/.config/karabiner" ["$DOTFILES/platforms/mac/karabiner"]="$HOME/.config/karabiner"
["$DOTFILES/platforms/mac/skhdrc"]="$XDG_CONFIG_HOME/skhd/skhdrc" ["$DOTFILES/platforms/mac/skhdrc"]="$XDG_CONFIG_HOME/skhd/skhdrc"
["$DOTFILES/platforms/mac/sketchybarrc"]="$XDG_CONFIG_HOME/sketchybar/sketchybarrc" ["$DOTFILES/platforms/mac/sketchybarrc"]="$XDG_CONFIG_HOME/sketchybar/sketchybarrc"
["$DOTFILES/platforms/mac/yabairc"]="$XDG_CONFIG_HOME/yabai/yabairc" ["$DOTFILES/platforms/mac/yabairc"]="$XDG_CONFIG_HOME/yabai/yabairc"
["$DOTFILES/tools/wezterm"]="$HOME/.config/wezterm"
["$DOTFILES/tools/zed"]="$HOME/.config/zed"
["$DOTFILES/tools/sioyek"]="$HOME/.config/sioyek"
) )
else else
echo "[INFO] Running on Linux"
linkDots+=( linkDots+=(
["$DOTFILES/common/inputrc"]="$HOME/.inputrc" ["$DOTFILES/common/inputrc"]="$HOME/.inputrc"
) )
if [ -n "$WSL_DISTRO_NAME" ]; then if [ "$(uname -r)" = *Microsoft* ]; then
echo "[INFO] Running on WSL1"
: # NOP
else else
echo "[INFO] Running on Native Linux"
linkDots+=( linkDots+=(
["$DOTFILES/platforms/linux/awesome"]="$HOME/.config/awesome" ["$DOTFILES/platforms/linux/awesome"]="$HOME/.config/awesome"
["$DOTFILES/platforms/linux/hypr"]="$HOME/.config/hypr" ["$DOTFILES/platforms/linux/hypr"]="$HOME/.config/hypr"
["$DOTFILES/platforms/linux/waybar"]="$HOME/.config/waybar" ["$DOTFILES/platforms/linux/waybar"]="$HOME/.config/waybar"
["$DOTFILES/platforms/linux/wlogout"]="$HOME/.config/wlogout" ["$DOTFILES/platforms/linux/wlogout"]="$HOME/.config/wlogout"
["$DOTFILES/platforms/linux/mako-config"]="$HOME/.config/mako/config" ["$DOTFILES/platforms/linux/mako-config"]="$HOME/.config/mako/config"
["$DOTFILES/tools/wezterm"]="$HOME/.config/wezterm"
["$DOTFILES/tools/zed"]="$HOME/.config/zed"
["$DOTFILES/tools/sioyek"]="$HOME/.config/sioyek"
) )
for kde in "$DOTFILES/platforms/linux/kde/"*; do for kde in "$DOTFILES/platforms/linux/kde/"*; do
linkDots=["$kde"]="$HOME/.config/kde/$(basename $kde)" linkDots+=["$kde"]="$HOME/.config/kde/$(basename $kde)"
# echo "Linking $kde to $HOME/.config/kde/$(basename $kde)" # echo "Linking $kde to $HOME/.config/kde/$(basename $kde)"
done done
echo "[INFO] Setting up system environment variables" echo "[INFO] Setting up system environment variables"
@ -79,14 +90,15 @@ fi
echo "[INFO] Setting up symbolic links" echo "[INFO] Setting up symbolic links"
for src in "${!linkDots[@]}"; do for src in "${!linkDots[@]}"; do
echo "Linking $src to ${linkDots[$src]}"
dest="${linkDots[$src]}" dest="${linkDots[$src]}"
if [ -d "$src" ]; then if [ -d "$src" ]; then
mv $dest $dest.bak test -d $dest && mv $dest $dest.bak
mkdir -p $dest mkdir -p $dest
ln -sf $src $dest ln -sf $src $dest
elif [ -f "$src" ]; then elif [ -f "$src" ]; then
dest_parent=$(dirname $dest) dest_parent=$(dirname $dest)
mkdir -p $dest_parent test -d $dest_parent || mkdir -p $dest_parent
ln -sf $src $dest ln -sf $src $dest
else else
echo "[ERROR] $src does not exist" echo "[ERROR] $src does not exist"
@ -94,12 +106,36 @@ for src in "${!linkDots[@]}"; do
done done
echo "[INFO] Installing zsh plugins" echo "[INFO] Installing zsh plugins"
git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions test -d $ZDOTDIR/plugins/zsh-autosuggestions || git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions.git $ZDOTDIR/plugins/zsh-autosuggestions
git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting test -d $ZDOTDIR/plugins/zsh-syntax-highlighting || git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git $ZDOTDIR/plugins/zsh-syntax-highlighting
git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git $ZDOTDIR/plugins/zsh-history-substring-search test -d $ZDOTDIR/plugins/zsh-history-substring-search || git clone --depth 1 https://github.com/zsh-users/zsh-history-substring-search.git $ZDOTDIR/plugins/zsh-history-substring-search
test -d $ZDOTDIR/plugins/zsh-completions || git clone --depth 1 https://github.com/zsh-users/zsh-completions.git $ZDOTDIR/plugins/zsh-completions
echo "[INFO] Setting up some local directories"
test -d $XDG_CACHE_HOME || mkdir -p $XDG_CACHE_HOME
test -d $XDG_DATA_HOME || mkdir -p $XDG_DATA_HOME
test -d $XDG_STATE_HOME || mkdir -p $XDG_STATE_HOME
test -d ~/.local/state/zsh || mkdir -p ~/.local/state/zsh
echo "[INFO] Copying example files" echo "[INFO] Copying example files"
test -d $XDG_CONFIG_HOME/git || mkdir -p $XDG_CONFIG_HOME/git
cp $DOTFILES/common/gitconfig.example $XDG_CONFIG_HOME/git/config cp $DOTFILES/common/gitconfig.example $XDG_CONFIG_HOME/git/config
echo "[INFO] Don't forget to update your gitconfig!"
echo "[INFO] Installing DOOM Emacs"
echo "[ACTION] Request Human Takeover"
test -d ~/.config/emacs && mv ~/.config/emacs ~/.config/emacs.bak
git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
~/.config/emacs/bin/doom install
~/.config/emacs/bin/doom sync
echo "[INFO] Installing Emacs-Rime"
git clnh https://github.com/js0ny/Rime.git ~/.config/emacs/.local/cache/rime
echo "[INFO] Done!"
export ZDOTDIR export ZDOTDIR
export DOTFILES export DOTFILES

View file

@ -256,10 +256,10 @@ keybindings:
bindings: ["lwin+r"] bindings: ["lwin+r"]
# Focus the next/previous active workspace defined in `workspaces` config. # Focus the next/previous active workspace defined in `workspaces` config.
- commands: ["focus --next-active-workspace"] # - commands: ["focus --next-active-workspace"]
bindings: ["alt+s"] # bindings: ["alt+s"]
- commands: ["focus --prev-active-workspace"] # - commands: ["focus --prev-active-workspace"]
bindings: ["alt+a"] # bindings: ["alt+a"]
# Focus the workspace that last had focus. # Focus the workspace that last had focus.
- commands: ["focus --recent-workspace"] - commands: ["focus --recent-workspace"]

2
platforms/win/wslgconfig Normal file
View file

@ -0,0 +1,2 @@
[system-distro-env]
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=200

View file

@ -21,8 +21,24 @@
;; See 'C-h v doom-font' for documentation and more examples of what they ;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example: ;; accept. For example:
;; ;;
(setq doom-font (font-spec :family "Iosevka Nerd Font Propo" :size 14 :weight 'semi-light) ;; https://emacs-china.org/t/doom-emacs/23513/13
doom-variable-pitch-font (font-spec :family "JetBrainsMono Nerd Font" :size 13)) (setq doom-font (font-spec :family "Iosevka Nerd Font Propo" :size 14)
doom-serif-font doom-font
doom-symbol-font (font-spec :family "LXGW WenKai Mono")
doom-variable-pitch-font (font-spec :family "LXGW WenKai Mono" :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 ;; 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 ;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
@ -94,5 +110,12 @@
(load! "org.el") (load! "org.el")
(after! evil-matchit (after! evil-matchit
(global-evil-matchit-mode 1) (global-evil-matchit-mode 1)
) )
(use-package! rime
:config
(setq default-input-method "rime")
(add-hook! (org-mode markdown-mode) (activate-input-method default-input-method))
)

View file

@ -12,4 +12,7 @@
:nv "I" 'evil-next-buffer :nv "I" 'evil-next-buffer
:nvom "N" '(lambda () (interactive) (evil-next-line 5)) ; 5n :nvom "N" '(lambda () (interactive) (evil-next-line 5)) ; 5n
:nvom "E" '(lambda () (interactive) (evil-previous-line 5)) ; 5e :nvom "E" '(lambda () (interactive) (evil-previous-line 5)) ; 5e
:nvom "C-w n" 'evil-window-down
:nvom "C-w e" 'evil-window-up
:nvom "C-w i" 'evil-window-right
) )

View file

@ -16,7 +16,8 @@
(doom! :input (doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh ;;bidi ; (tfel ot) thgir etirw uoy gnipleh
chinese ;;; 关闭 chinese 以启用 best Chinese IME
;; chinese
;;japanese ;;japanese
;;layout ; auie,ctsrnm is the superior home row ;;layout ; auie,ctsrnm is the superior home row
@ -75,7 +76,7 @@
vc ; version-control and Emacs, sitting in a tree vc ; version-control and Emacs, sitting in a tree
:term :term
;;eshell ; the elisp shell that works everywhere eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs ;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs ;;term ; basic terminal emulator for Emacs
;;vterm ; the best terminal emulation in Emacs ;;vterm ; the best terminal emulation in Emacs

View file

@ -52,3 +52,4 @@
(package! copilot (package! copilot
:recipe (:host github :repo "copilot-emacs/copilot.el" :files ("*.el"))) :recipe (:host github :repo "copilot-emacs/copilot.el" :files ("*.el")))
(package! evil-matchit) (package! evil-matchit)
(package! rime)

View file

@ -31,12 +31,15 @@
(:map global-map (:map global-map
("M-0" . treemacs-select-window) ("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows) ("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs) ;; ("C-x t t" . treemacs)
("C-x t d" . treemacs-select-directory) ("C-x t d" . treemacs-select-directory)
("C-x t B" . treemacs-bookmark) ("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file) ("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag) ("C-x t M-t" . treemacs-find-tag)
) )
:config
(evil-leader/set-key
"ft" 'treemacs)
) )
(use-package treemacs-evil (use-package treemacs-evil

View file

@ -8,5 +8,8 @@
# ln -sf $DOTFILES/tools/wezterm $XDG_CONFIG_HOME/wezterm # ln -sf $DOTFILES/tools/wezterm $XDG_CONFIG_HOME/wezterm
# New-Item -ItemType SymbolicLink -Target $DOTFILES\tools\wezterm -Path $Env:XDG_CONFIG_HOME\wezterm # New-Item -ItemType SymbolicLink -Target $DOTFILES\tools\wezterm -Path $Env:XDG_CONFIG_HOME\wezterm
# In windows, many cache & logs are stored in %APPDATA%\wezterm
*.json *.json
check_update check_update
plugins

View file

@ -23,10 +23,12 @@ return function(config)
} }
-- Cursor -- Cursor
config.animation_fps = 120 config.animation_fps = 120
config.cursor_blink_ease_in = "EaseOut" if not os_type.is_win then -- This is sooooooo slow on Windows
config.cursor_blink_ease_out = "EaseOut" config.cursor_blink_ease_in = "EaseOut"
config.default_cursor_style = "BlinkingBlock" config.cursor_blink_ease_out = "EaseOut"
config.cursor_blink_rate = 650 config.default_cursor_style = "BlinkingBlock"
config.cursor_blink_rate = 650
end
-- Visual Bell -- Visual Bell
config.visual_bell = { config.visual_bell = {
fade_in_function = "EaseIn", fade_in_function = "EaseIn",