mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 00:33:00 +00:00
ime: wrapper helper for fcitx module
This commit is contained in:
parent
20a2dc258f
commit
5c189f5c0f
7 changed files with 147 additions and 104 deletions
|
|
@ -1,5 +1,6 @@
|
|||
local mode_arrow = { "n", "v", "s", "x", "o" }
|
||||
|
||||
-- stylua: ignore
|
||||
local keymaps_basic = {
|
||||
-- https://github.com/LazyVim/LazyVim/blob/d1529f650fdd89cb620258bdeca5ed7b558420c7/lua/lazyvim/config/keymaps.lua#L8
|
||||
{
|
||||
|
|
@ -96,7 +97,7 @@ local keymaps_basic = {
|
|||
opts = { desc = "Down 5 Lines" },
|
||||
},
|
||||
{ keys = "<Tab>", cmd = "<C-w><C-w>", opts = { desc = "Focus on other panel" } },
|
||||
{ keys = "<CR>", cmd = "%" },
|
||||
-- { keys = "<CR>", cmd = "%" },
|
||||
{ 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" },
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ return {
|
|||
openrouter = {
|
||||
__inherited_from = "openai",
|
||||
endpoint = "https://openrouter.ai/api/v1",
|
||||
model = "anthropic/claude-sonnet-4.5",
|
||||
model = "openai/gpt-5.1-codex",
|
||||
api_key_name = "OPENROUTER_API_KEY",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@
|
|||
"ui_font_size": 16,
|
||||
"buffer_font_size": null,
|
||||
"relative_line_numbers": true,
|
||||
"buffer_font_family": "Zed Plex Mono",
|
||||
"buffer_font_family": "Maple Mono NF CN",
|
||||
"remove_trailing_whitespace_on_save": true,
|
||||
"agent": {
|
||||
"default_model": {
|
||||
"provider": "copilot_chat",
|
||||
"model": "claude-3-7-sonnet"
|
||||
"provider": "openrouter",
|
||||
"model": "openai/gpt-5.1-codex"
|
||||
}
|
||||
},
|
||||
"inlay_hints": {
|
||||
|
|
@ -88,7 +88,11 @@
|
|||
"metrics": false
|
||||
},
|
||||
"languages": {
|
||||
"YAML": {
|
||||
"tab_size": 2
|
||||
},
|
||||
"Nix": {
|
||||
"tab_size": 2,
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "alejandra",
|
||||
|
|
@ -98,6 +102,19 @@
|
|||
"completions": {
|
||||
"lsp_insert_mode": "replace"
|
||||
}
|
||||
},
|
||||
"Lua": {
|
||||
"tab_size": 2,
|
||||
"formatter": {
|
||||
"external": {
|
||||
"command": "stylua"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"auto_install_extensions": {
|
||||
"catppuccin": true,
|
||||
"material-icon-theme": true,
|
||||
"git-firefly": true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,3 +77,6 @@ nnoremap ]g editor.action.editor.nextChange
|
|||
" " Use C-w C-w as original C-w
|
||||
" noremap <C-w><C-w> workbench.action.closeActiveEditor
|
||||
" noremap <C-w><A-n> workbench.action.togglePanel
|
||||
|
||||
" camelCaseMotion
|
||||
noremap w <leader>w
|
||||
|
|
@ -55,5 +55,7 @@
|
|||
srm
|
||||
mediainfo
|
||||
exiftool
|
||||
ddgr # DuckDuckGo CLI
|
||||
jujutsu
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,24 @@
|
|||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
mkFcitxIM = builtins.map (
|
||||
p:
|
||||
lib.hiPrio (
|
||||
pkgs.runCommand "${p.name}-wrapped" {nativeBuildInputs = with pkgs; [makeWrapper];} ''
|
||||
mkdir -p $out/bin
|
||||
makeWrapper \
|
||||
${p}/bin/${p.meta.mainProgram or p.pname} \
|
||||
$out/bin/${p.meta.mainProgram or p.pname} \
|
||||
--set GTK_IM_MODULE fcitx \
|
||||
--set QT_IM_MODULE fcitx
|
||||
''
|
||||
)
|
||||
);
|
||||
in {
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
# Terminal Emulator
|
||||
ghostty # default
|
||||
kitty
|
||||
|
|
@ -46,7 +65,6 @@
|
|||
qbittorrent
|
||||
protonvpn-gui
|
||||
proton-pass
|
||||
neovim-qt
|
||||
goldendict-ng
|
||||
kdePackages.kdenlive
|
||||
gimp
|
||||
|
|
@ -60,7 +78,11 @@
|
|||
zotero
|
||||
anki-bin
|
||||
feishin
|
||||
];
|
||||
]
|
||||
++ (mkFcitxIM [
|
||||
pkgs.neovim-qt
|
||||
pkgs.anki
|
||||
]);
|
||||
|
||||
home.sessionVariables = {
|
||||
ANKI_WAYLAND = 1;
|
||||
|
|
@ -68,37 +90,6 @@
|
|||
NIXOS_OZONE_WL = 1;
|
||||
};
|
||||
|
||||
xdg.desktopEntries = {
|
||||
"anki" = {
|
||||
name = "Anki";
|
||||
genericName = "Flashcards";
|
||||
comment = "An intelligent spaced-repetition memory training program";
|
||||
icon = "anki";
|
||||
type = "Application";
|
||||
terminal = false;
|
||||
categories = [
|
||||
"Education"
|
||||
"Languages"
|
||||
"KDE"
|
||||
"Qt"
|
||||
];
|
||||
mimeType = [
|
||||
"application/x-apkg"
|
||||
"application/x-anki"
|
||||
"application/x-ankiaddon"
|
||||
];
|
||||
# Should specify wayland and IME used
|
||||
exec = "env ANKI_WAYLAND=1 QT_IM_MODULE=fcitx anki %f";
|
||||
settings = {
|
||||
"TryExec" = "anki";
|
||||
"Version" = "1.0";
|
||||
"X-GNOME-SingleWindow" = "true";
|
||||
"SingleMainWindow" = "true";
|
||||
"StartupWMClass" = "anki";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: This is a dependency of `feishin` (EOL)
|
||||
# Once the new version is published, delete this
|
||||
nixpkgs.config.permittedInsecurePackages = [
|
||||
|
|
|
|||
|
|
@ -105,17 +105,46 @@ in {
|
|||
source = rimeConfigFiltered;
|
||||
recursive = true;
|
||||
};
|
||||
home.file."${rimePath}/default.custom.yaml" = {
|
||||
# yaml 最后留出一行
|
||||
home.file = {
|
||||
"${rimePath}/default.custom.yaml" = {
|
||||
text = ''
|
||||
patch:
|
||||
# 方案列表
|
||||
schema_list:
|
||||
- schema: wanxiang_pro
|
||||
- schema: latex
|
||||
- schema: jyut6ping3
|
||||
- schema: dioion
|
||||
- schema: gekion
|
||||
# 切换中英:
|
||||
# 不同的选项表示:打字打到一半时按下了 CapsLock、Shift、Control 后:
|
||||
# commit_code 上屏原始的编码,然后切换到英文
|
||||
# commit_text 上屏拼出的词句,然后切换到英文
|
||||
# clear 清除未上屏内容,然后切换到英文
|
||||
# inline_ascii 切换到临时英文模式,按回车上屏后回到中文状态
|
||||
# noop 屏蔽快捷键,不切换中英,但不要屏蔽 CapsLock
|
||||
ascii_composer/switch_key:
|
||||
Shift_L: noop
|
||||
Shift_R: commit_code
|
||||
key_binder/bindings:
|
||||
# emacs editing:
|
||||
- { when: composing, accept: Control+p, send: Up }
|
||||
- { when: composing, accept: Control+n, send: Down }
|
||||
- { when: composing, accept: Control+b, send: Left }
|
||||
- { when: composing, accept: Control+f, send: Right }
|
||||
|
||||
'';
|
||||
enable = true;
|
||||
};
|
||||
"${rimePath}/wanxiang_pro.custom.yaml" = {
|
||||
text = ''
|
||||
patch:
|
||||
key_binder/sequence:
|
||||
pin: "Alt+p" # 使用 Alt-p 而不是 Ctrl-p 置顶候选项(见 ./default.custom.yaml 中 emacs editing)
|
||||
|
||||
'';
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue