本系列的上一篇用wezterm、fish和tmux大大改善了终端的使用体验,随着最近对vim的操作变得熟练,以前依旧要依赖GUI的IDE似乎也可以搬进终端里了
故事的起因是有些作业相比于手写,还是打字更舒服,但是学校的作业平台又不能直接提交markdown,于是……
md -> pdf
在~/.config/lvim里增加插件:
lvim.plugins = {
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && npm install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = { "markdown" },
}
}
再增加一个快捷键:
lvim.builtin.which_key.mappings["m"] = {
name = "Markdown",
m = { "<cmd>MarkdownPreviewToggle<cr>", "Toggle Preview" },
}
于是可以
更多lvim操作
space + e 打开目录 a新建文件,可以方便地编辑多个文件
ctrl + /打开浮窗终端,默认应该是insert模式,如果不是按i进入。这样写完代码运行,一般情况下就不用单开一页了
gd go to definition,跳转到函数定义,可以跨文件操作,K 查看声明
ctrl w + v竖直分屏,ctrl + 左右方向移动窗口
还有一揽子vim快捷键
ctrl d下翻半屏
e下一个单词末尾,b上一个单词开头,w下一个单词开头
V进入View模式,然后选中多行<或>调整缩进
.在当前位置应用上一次操作
*跳转到选中词出现的其他位置
cw改词(删除当前指向的词并进入insert模式)ciw change inner word 不需要让光标置于当前词的开头
r替换
/name 文件内名称搜索
一二事
分屏
经过一些简单的配置wezterm是可以很方便地分屏的
在熟悉了tmux的快捷键之后,tmux分屏用起来更加舒服
再加上lvim也能分屏
Win11本来也支持分屏
嗯……
wezterm动态改透明度
有的时候截屏终端,透明的背景会泄露不必要的信息,不透明的又不好看,这就体现出lua做配置文件的灵活之处了:
-- .wezterm.lua
table.insert(config.keys, {
key = '-',
mods = 'ALT',
action = wezterm.action_callback(function(window)
local overrides = window:get_config_overrides() or {}
local current = overrides.window_background_opacity or config.window_background_opacity or 1.0
overrides.window_background_opacity = math.max(0.3, current - 0.03)
window:set_config_overrides(overrides)
end),
})
table.insert(config.keys, {
key = '=',
mods = 'ALT',
action = wezterm.action_callback(function(window, pane)
local overrides = window:get_config_overrides() or {}
local current = overrides.window_background_opacity or config.window_background_opacity or 1.0
overrides.window_background_opacity = current + 0.03
window:set_config_overrides(overrides)
end),
})
二编
2026.8.25
三个月前从在wsl玩这些变成了在纯linux下玩, 感觉就像从住在别人家回到了自己家, 还是很舒服的
从wezterm 搬到了kitty, 原因是运行codex 时卡得不行, 再排查了散热CPU内存等问题后, 一搜发现wezterm的性能问题一直饱受诟病
从我的体验来看, wezterm确有很大的问题, 跳车了
lvim在同学的推荐下换成了lazyvim, 开箱即用, 使用体验还是不错的, 比已经多年无人维护的lunarvim强
贴个kitty的配置文件吧
# -----------------------------------------------------------------------------
# Shell and terminal capabilities
# -----------------------------------------------------------------------------
shell fish
term xterm-kitty
shell_integration no-cursor
# Native Wayland keeps Fcitx5 IME working in the current KDE session.
linux_display_server wayland
wayland_enable_ime yes
# -----------------------------------------------------------------------------
# Font
# -----------------------------------------------------------------------------
font_family family="Cascadia Code" features="+calt +clig +liga"
bold_font auto
italic_font auto
bold_italic_font auto
font_size 14.0
# Match WezTerm's 1.2 line height and normal cell width.
modify_font cell_height 120%
modify_font cell_width 100%
# WezTerm used Windows CJK fallbacks. On this Arch installation the native
# monospace Chinese fallback is Noto Sans Mono CJK SC. Keep Nerd Font symbols
# in Cascadia Code NF without changing the primary text font.
symbol_map U+3000-U+30FF,U+31F0-U+31FF,U+3400-U+4DBF,U+4E00-U+9FFF,U+F900-U+FAFF,U+20000-U+2FA1F Noto Sans Mono CJK SC
symbol_map U+E000-U+F8FF,U+F0000-U+FFFFD,U+100000-U+10FFFD Cascadia Code NF
# -----------------------------------------------------------------------------
# Window and layout
# -----------------------------------------------------------------------------
remember_window_size no
initial_window_width 120c
initial_window_height 30c
window_padding_width 0 10 10 10
placement_strategy top-left
confirm_os_window_close 0
hide_window_decorations no
enabled_layouts splits,stack,fat,tall,grid
active_border_color #7aa2f7
inactive_border_color #414868
# -----------------------------------------------------------------------------
# Tabs
# -----------------------------------------------------------------------------
tab_bar_edge top
tab_bar_min_tabs 2
tab_bar_style powerline
tab_powerline_style slanted
tab_title_max_length 25
tab_title_template " {title} "
active_tab_title_template " {title} "
tab_bar_background #16161e
active_tab_foreground #1a1b26
active_tab_background #7aa2f7
active_tab_font_style bold
inactive_tab_foreground #a9b1d6
inactive_tab_background #292e42
inactive_tab_font_style normal
# -----------------------------------------------------------------------------
# Cursor, scrollback and rendering
# -----------------------------------------------------------------------------
cursor_shape block
cursor_blink_interval 0.5
cursor_beam_thickness 1.5
cursor_underline_thickness 2.0
scrollback_lines 5000
scrollbar never
# Lower latency than the old 60 FPS WezTerm setup while retaining vsync.
repaint_delay 5
input_delay 1
sync_to_monitor yes
# -----------------------------------------------------------------------------
# Tokyo Night
# -----------------------------------------------------------------------------
foreground #c0caf5
background #1a1b26
selection_foreground #c0caf5
selection_background #33467c
cursor #c0caf5
cursor_text_color #1a1b26
url_color #73daca
color0 #15161e
color8 #414868
color1 #f7768e
color9 #f7768e
color2 #9ece6a
color10 #9ece6a
color3 #e0af68
color11 #e0af68
color4 #7aa2f7
color12 #7aa2f7
color5 #bb9af7
color13 #bb9af7
color6 #7dcfff
color14 #7dcfff
color7 #a9b1d6
color15 #c0caf5
background_opacity 0.93
dynamic_background_opacity yes
# -----------------------------------------------------------------------------
# Mouse
# -----------------------------------------------------------------------------
copy_on_select clipboard
mouse_map right press ungrabbed paste_from_clipboard
mouse_map ctrl+left click ungrabbed mouse_handle_click selection link
# -----------------------------------------------------------------------------
# Key bindings migrated from WezTerm
# -----------------------------------------------------------------------------
# Font size
map ctrl+alt+equal change_font_size all +1.0
map ctrl+alt+plus change_font_size all +1.0
map ctrl+alt+minus change_font_size all -1.0
map ctrl+0 change_font_size all 0
# Reload. WezTerm assigned Ctrl+Shift+L twice; pane-right wins there, so reload
# moves to Ctrl+Shift+R and Ctrl+Shift+L remains pane navigation.
map ctrl+shift+r load_config_file
# Tabs; inherit the working directory of the active pane.
map ctrl+shift+t new_tab_with_cwd
map ctrl+shift+n new_tab_with_cwd
map ctrl+shift+w close_tab
map ctrl+tab next_tab
map ctrl+shift+tab previous_tab
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
# Splits; inherit the active pane's working directory.
map ctrl+shift+\ launch --location=vsplit --cwd=current
map ctrl+shift+` launch --location=hsplit --cwd=current
map ctrl+shift+x close_window
map ctrl+shift+h neighboring_window left
map ctrl+shift+l neighboring_window right
map ctrl+shift+k neighboring_window up
map ctrl+shift+j neighboring_window down
# Clipboard, scrollback and window controls
map alt+c copy_to_clipboard
map ctrl+shift+v paste_from_clipboard
map ctrl+shift+f search_scrollback
map ctrl+alt+k clear_terminal clear active
map alt+enter toggle_fullscreen
# Dynamic opacity
map alt+minus set_background_opacity -0.03
map alt+equal set_background_opacity +0.03