W

wentao's blog

feedId:79765201172692992+userId:79764570702557184

解决armbian更新报不能验证个别公钥

近期把rock5b升级 armbian 的 bookworm 版本的时候,不管是官方的源还是国内,都会在执行 apt update 的时候会出现如下的错误: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://mirrors.aliyun.com/armbian bookworm InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 93D6889F9F0E78D5 解决办法如下: curl 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xdf00faf1c577104b50bf1d0093d6889f9f0e78d5' |gpg --dearmor| sudo tee /etc/apt/trusted.gpg.d/armbian.gpg 简单的说就是把在keyserver.ubuntu.com上的公钥手动放到受信任的公钥列表里面. 对于其他的类似报错可以 https://keyserver.ubuntu.com/ 上查找并导入. 参考资料: GPG key used to sign debian packages is expired · Issue #6175 · cli/cli CSC Armbian for RK3318/RK3328 TV box boards - Page 34 - Rockchip CPU Boxes - Armbian Community Forums

2023/7/11
articleCard.readMore

nyagos增加zoxide的支持

介绍 zoxide 提供了 z jump 的功能.能够记录就访问的路径,并通过其中的关键词快速的定位到你想要的文件夹. nyagos 是一个支持使用 lua 配置的 shell. 快速、稳定.但是使用圈子很小. zoxide 提供了常见的 shell 整合,在 nyagos 下面没有相关的支持. 步骤 由于主要是自用,简单的通过 lua 和 nyagos.alias 功能实现了一个简单的版本. 其中 z 跳转的时候只支持一个参数. nyagos.alias.z = function (args) local rest = args[1] local path = rest if (string.len(rest) > 1) then path = nyagos.eval("zoxide query --exclude '".. (nyagos.getwd()) .."' -- " .. rest) end nyagos.chdir(path) end nyagos.alias.zi=function(args) local rest = args[1] if rest==nil then rest = "" end path = nyagos.eval("zoxide query -i -- " .. rest .. "| fzf" ) nyagos.chdir(path) end 利用 postexechook 功能,实现了自动更新 zoxide 数据. nyagos.postexechook = function(args) if "cd" == args[1] then nyagos.eval("zoxide add -- " .. nyagos.getwd()) end end

2023/4/27
articleCard.readMore

快速查找PowerShell的历史命令

在 bash 或者 fish 这些shell下面可以通过 history 来显示历史命令.在 PowerShell 下也可以通过 Get-History 来获取. 不过毕竟功能有点单一,写了个函数来扩展一下. function hist { $find = $args; Get-Content (Get-PSReadlineOption).HistorySavePath | ? { $_ -like "*$find*" } | Get-Unique | more } 这样就可以通过 hist 关键词 来搜索历史命令 如果你安装了 fzf 的话,可以使用如下的版本 function hist { $find = $args; Get-Content (Get-PSReadlineOption).HistorySavePath | ? { $_ -like "*$find*" } | Get-Unique | fzf } 这样可以利用 fzf 的模糊查询来缩小范围.

2022/11/23
articleCard.readMore

denote

近期把笔记软件从Org-roam迁移到了Denote (denote.el),主要是有以下几个考虑: org-roam在windows下面的性能堪忧,即使使用了emacs内置的sqlite性能还是不太行. 酷炫的org-roam/org-roam-ui其实没啥用 denote性能和命名规范都挺合心意, 以下是我的配置: (use-package denote :bind (("C-c n n" . denote) ("C-c n i" . denote-link-or-create) ("C-c n I" . denote-link) ("C-c n b" . denote-link-backlinks) ("C-c n a" . denote-add-front-matter) ("C-c n r" . denote-rename-file) ("C-c n R" . denote-rename-file-using-front-matter) ) ) (setq denote-directory (expand-file-name "~/Org/notes/") denote-known-keywords '("dev" "read" "report" "cslp") denote-infer-keywords t denote-sort-keywords t denote-allow-multi-word-keywords t denote-date-prompt-use-org-read-date t denote-link-fontify-backlinks t denote-front-matter-date-format 'org-timestamp denote-prompts '(title keywords)) ;; 在work目录下创建标签为work的笔记 (defun my-work-notes () "Create an entry tagged 'journal', while prompting for a title." (interactive) (denote (denote--title-prompt) '("work") 'denote-file-type '"./work")) 笔记查找使用的是mclear-tools/consult-notes: Use consult to search notes (setq xref-search-program 'ripgrep) (use-package consult-notes :commands (consult-notes consult-notes-search-in-all-notes consult-notes-org-roam-find-node consult-notes-org-roam-find-node-relation) :config (setq consult-notes-sources '( ("notes" ?o "~/Org/notes") )) :bind ( ("C-c n F" . consult-notes)) ) (use-package consult-denote :bind ( ("C-c n f" . consult-denote)) ) 参考资料 Emacs: demonstration of my Denote package (simple note-taking) | Protesilaos Stavrou bitspook/notes-migrator: Migrate your notes b/w different note-taking software (only org-roam to denote supported for now) Migration Plan for Org-Roam Notes to Denote // Take on Rules 有人尝试过laos大佬的笔记新插件“denote”吗 - Emacs-general - Emacs China

2022/11/20
articleCard.readMore

利用PowerShell来进行端口连通性测试

一般情况下在是使用 telnet 来做网络连通性的测试. PowerShell 也可以实现类似的功能.而且由于本身和 .Net 的关系,还可以通过 .Net 的支持来完成. 原生的方案:Test-Connection 连接成功 Measure-Command {Test-NetConnection wentao.org -Port 80} | % TotalSeconds 连接失败 Measure-Command {Test-NetConnection wentao.2org -Port 80} | % TotalSeconds 使用System.Net.Sockets.TcpClient的方案 function Test-Port { [CmdletBinding()] param ( [Parameter(ValueFromPipeline = $true, HelpMessage = 'Could be suffixed by :Port')] [String[]]$ComputerName, [Parameter(HelpMessage = 'Will be ignored if the port is given in the param ComputerName')] [Int]$Port = 5985, [Parameter(HelpMessage = 'Timeout in millisecond. Increase the value if you want to test Internet resources.')] [Int]$Timeout = 1000 ) begin { $result = [System.Collections.ArrayList]::new() } process { foreach ($originalComputerName in $ComputerName) { $remoteInfo = $originalComputerName.Split(":") if ($remoteInfo.count -eq 1) { # In case $ComputerName in the form of 'host' $remoteHostname = $originalComputerName $remotePort = $Port } elseif ($remoteInfo.count -eq 2) { # In case $ComputerName in the form of 'host:port', # we often get host and port to check in this form. $remoteHostname = $remoteInfo[0] $remotePort = $remoteInfo[1] } else { $msg = "Got unknown format for the parameter ComputerName: " ` + "[$originalComputerName]. " ` + "The allowed formats is [hostname] or [hostname:port]." Write-Error $msg return } $tcpClient = New-Object System.Net.Sockets.TcpClient $portOpened = $tcpClient.ConnectAsync($remoteHostname, $remotePort).Wait($Timeout) $null = $result.Add([PSCustomObject]@{ RemoteHostname = $remoteHostname RemotePort = $remotePort PortOpened = $portOpened TimeoutInMillisecond = $Timeout SourceHostname = $env:COMPUTERNAME OriginalComputerName = $originalComputerName }) } } end { return $result } }

2022/7/17
articleCard.readMore

wezterm的workspace配置

wezterm里个特性是workspace,类似虚拟桌面的概念.可以在不同的workspace之间切换.这段时间工作上除了日常的开发以外,还有一些服务器的维护.这个时候这个workspace就会很方便. 另外可以根据 lua 来获取环境变量,来区分个人电脑、办公电脑做到能够一套配置多处使用.在 DUMMY 的机器上启动一个 Meta 的配置 if "DUMMY" == os.getenv("USERDOMAIN") then local tab, pane, window = mux.spawn_window { workspace = "Meta", cwd = "d:/soft/Meta/", } pane:send_text(".\\meta.exe -d .\n") end 官方有如下的一个配置示例. local wezterm = require 'wezterm' local mux = wezterm.mux wezterm.on("gui-startup", function() -- Set a workspace for coding on a current project -- Top pane is for the editor, bottom pane is for the build tool local project_dir = wezterm.home_dir .. "/wezterm" local tab, build_pane, window = mux.spawn_window{ workspace="coding", cwd=project_dir, } local editor_pane = build_pane:split{ direction="Top", size=0.6, cwd=project_dir } -- may as well kick off a build in that pane build_pane:send_text("cargo build\n") -- A workspace for interacting with a local machine that -- runs some docker containners for home automation local tab, pane, window = mux.spawn_window{ workspace="automation", args={"ssh", "vault"}, } -- We want to startup in the coding workspace mux.set_active_workspace("coding") end) return {} 参考资料 gui-startup - Wez’s Terminal Emulator

2022/7/13
articleCard.readMore

PSReadLine最强PowerShell模块

PowerShell其实从设计理念上来说是一直强于bash的.毕竟不是一个时代的产物.但是bash的好处是经历了足够长的时间发展,有良好的周边支持. Readline 就是其中一个很棒的功能.主要包含了根据你输入的内容进行搜索历史,提示命令,删除文字之类的功能.能够在日常使用的时候大大的提升便利性. PSReadLine 则是 A bash inspired readline implementation for PowerShell. 提供了增加的Tab 自动补全和命令预测功能.最新的版本v2.2.6还提供了插件来增强不全功能. 安装的话只需要owerShellGet的版本高于 1.6.0 就可以通过如下的命令安装或者升级 Install-Module -Name PowerShellGet -Force PSReadLine 的可配置项可以参考sample profile file. 下面是我的配置. Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward Set-PSReadLineOption -EditMode Emacs Set-PSReadLineOption -PredictionSource HistoryAndPlugin Set-PSReadLineKeyHandler -Chord 'Ctrl+d,Ctrl+c' -Function CaptureScreen Set-PSReadLineKeyHandler -Key Alt+d -Function ShellKillWord Set-PSReadLineKeyHandler -Key Alt+Backspace -Function ShellBackwardKillWord Set-PSReadLineKeyHandler -Key Alt+b -Function ShellBackwardWord Set-PSReadLineKeyHandler -Key Alt+f -Function ShellForwardWord Set-PSReadLineKeyHandler -Key Alt+B -Function SelectShellBackwardWord Set-PSReadLineKeyHandler -Key Alt+F -Function SelectShellForwardWord #endregion #region git #git status Set-PSReadLineKeyHandler -Key Alt+s -LongDescription "git status" ` -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() [Microsoft.PowerShell.PSConsoleReadLine]::Insert("git status") [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() } # git pull Set-PSReadLineKeyHandler -Key Alt+p -LongDescription "git pull" ` -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() [Microsoft.PowerShell.PSConsoleReadLine]::Insert("git pull") [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() } # git push Set-PSReadLineKeyHandler -Key Alt+P -LongDescription "git push" ` -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() [Microsoft.PowerShell.PSConsoleReadLine]::Insert("git push") [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() } #git show Set-PSReadLineKeyHandler -Key Ctrl+Alt+s -LongDescription "git show" ` -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() [Microsoft.PowerShell.PSConsoleReadLine]::Insert("git show") [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine() } #endregion #region utils # 保存当前命令到历史中,但是并不执行 Set-PSReadLineKeyHandler -Key Alt+w ` -BriefDescription SaveInHistory ` -LongDescription "Save current line in history but do not execute" ` -ScriptBlock { param($key, $arg) $line = $null $cursor = $null [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor) [Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($line) [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() } # Insert text from the clipboard as a here string Set-PSReadLineKeyHandler -Key Ctrl+V ` -BriefDescription PasteAsHereString ` -LongDescription "Paste the clipboard text as a here string" ` -ScriptBlock { param($key, $arg) Add-Type -Assembly PresentationCore if ([System.Windows.Clipboard]::ContainsText()) { # Get clipboard text - remove trailing spaces, convert \r\n to \n, and remove the final \n. $text = ([System.Windows.Clipboard]::GetText() -replace "\p{Zs}*`r?`n", "`n").TrimEnd() [Microsoft.PowerShell.PSConsoleReadLine]::Insert("@'`n$text`n'@") } else { [Microsoft.PowerShell.PSConsoleReadLine]::Ding() } } # F7 弹出一个GUI的历史命令列表 Set-PSReadLineKeyHandler -Key F7 ` -BriefDescription History ` -LongDescription 'Show command history' ` -ScriptBlock { $pattern = $null [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$pattern, [ref]$null) if ($pattern) { $pattern = [regex]::Escape($pattern) } $history = [System.Collections.ArrayList]@( $last = '' $lines = '' foreach ($line in [System.IO.File]::ReadLines((Get-PSReadLineOption).HistorySavePath)) { if ($line.EndsWith('`')) { $line = $line.Substring(0, $line.Length - 1) $lines = if ($lines) { "$lines`n$line" } else { $line } continue } if ($lines) { $line = "$lines`n$line" $lines = '' } if (($line -cne $last) -and (!$pattern -or ($line -match $pattern))) { $last = $line $line } } ) $history.Reverse() $command = $history | Out-GridView -Title History -PassThru if ($command) { [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine() [Microsoft.PowerShell.PSConsoleReadLine]::Insert(($command -join "`n")) } } # # Ctrl+Shift+j then type a key to mark the current directory. # Ctrj+j then the same key will change back to that directory without # needing to type cd and won't change the command line. $global:PSReadLineMarks = @{} Set-PSReadLineKeyHandler -Key Ctrl+J ` -BriefDescription MarkDirectory ` -LongDescription "Mark the current directory" ` -ScriptBlock { param($key, $arg) $key = [Console]::ReadKey($true) $global:PSReadLineMarks[$key.KeyChar] = $pwd } Set-PSReadLineKeyHandler -Key Ctrl+j ` -BriefDescription JumpDirectory ` -LongDescription "Goto the marked directory" ` -ScriptBlock { param($key, $arg) $key = [Console]::ReadKey() $dir = $global:PSReadLineMarks[$key.KeyChar] if ($dir) { cd $dir [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt() } } Set-PSReadLineKeyHandler -Key Alt+j ` -BriefDescription ShowDirectoryMarks ` -LongDescription "Show the currently marked directories" ` -ScriptBlock { param($key, $arg) $global:PSReadLineMarks.GetEnumerator() | % { [PSCustomObject]@{Key = $_.Key; Dir = $_.Value } } | Format-Table -AutoSize | Out-Host [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt() } #endregion

2022/7/10
articleCard.readMore

读《万千微尘纷坠心田》

《万千微尘纷坠心田》的副标题是-文学阅读的生命化.讲我们应该如何读书、怎么从读书变成读进一本书.可以说是一本怎么讲吃书的一本书了.现在这个时代可能最不缺的就是书了,但是各类统计又在说读书的人少了.一方面获取咨询、知识的渠道多了.阅读不再是唯一的渠道了. 其中有一篇有如下的内容: 小说的创作,意味着我们从日常现实的领域纵身一跳,进入一个想象的生活的领域.想象并不意味着轻盈,一篇能够称之为好的小说,也绝不是任由想象的线索,安排词句和时间进行组合. 小说的阅读其实也是这样,读一些大部头小说的时候,了解当时的时空背景是很重要的.好的文字给人的带入感要远远高于视频的.读《战争与和平》,《飘》这些的时候,了解当时的历史背景对阅读会有很大的帮助.但是在一些科幻小说的时候,就可能不能这么做了.不过好的科幻小说,除了本身一个很重的概念一直支撑这整本小说.作者在构建整个环境的时候也会投入很多的笔墨.整体是自洽的这点很重要. 其中有篇讲了文本细读.这个其实用到编程中也是一样的.看别人写的代码,其实就跟读小说一样,有好有坏.但是如果真的代入进去,去发现他当时为什么这么写.看到代码之外的内容.和用户讨论需求的时候也是如此,透过讨论真正的看到他们内心想要的内容. 后面有篇分析石黑一雄的《远山深影》,又从另外一个角度理解了下这篇小说.

2022/5/28
articleCard.readMore

Emacs添加腾讯会议连接

这段时间因为疫情居家办公的时候太多了,各种腾讯会议不断.用了 org-mode 来做待办的提醒.但是在电脑上怎么快速进入会议呢?想着通过External Links (The Org Manual)的方式来实现快速打开腾讯会议. (defun make-wemeet-link (meet_id) (browse-url (concat "wemeet://page/inmeeting?meeting_code=" (s-replace "-" "" meet_id)))) (org-add-link-type "wemeet" 'make-wemeet-link) 这样之后通过创建一个 [[wemeet:123-345-128]] 的连接.就能够通过 url scheme 来快速启动腾讯会议并入会.

2022/5/26
articleCard.readMore

一个新的终端模拟器WezTerm

wezterm 是@wez利用Rust开发的一款终端模拟器.和microsoft/terminal还有 ITerm 类似. 支持的特性也特别多,比较有特色的是可以通过 lua 来配置或者增加一些特性.比方把 ~/.ssh/config 中的host直插入到 wezterm 中的 launch_menu ,在打开 launch_menu 的时候可以通过 / 来查找. 在快捷键支持这块有一个 leader key 的设定类似 vim 或者 emacs 里面的快捷键配置. 下面是鼓捣出来一个配置,如果有兴趣尝试的话可以试试看.把这个配置放到 ~/.config/wezterm/wezterm.lua 就可以了. local function basename(s) return string.gsub(s, "(.*[/\\])(.*)", "%2") end local wezterm = require "wezterm" local SOLID_LEFT_ARROW = utf8.char(0xe0ba) local SOLID_LEFT_MOST = utf8.char(0x2588) local SOLID_RIGHT_ARROW = utf8.char(0xe0bc) local ADMIN_ICON = utf8.char(0xf49c) local CMD_ICON = utf8.char(0xe62a) local NU_ICON = utf8.char(0xe7a8) local PS_ICON = utf8.char(0xe70f) local ELV_ICON = utf8.char(0xfc6f) local WSL_ICON = utf8.char(0xf83c) local YORI_ICON = utf8.char(0xf1d4) local NYA_ICON = utf8.char(0xf61a) local VIM_ICON = utf8.char(0xe62b) local PAGER_ICON = utf8.char(0xf718) local FUZZY_ICON = utf8.char(0xf0b0) local HOURGLASS_ICON = utf8.char(0xf252) local SUNGLASS_ICON = utf8.char(0xf9df) local PYTHON_ICON = utf8.char(0xf820) local NODE_ICON = utf8.char(0xe74e) local DENO_ICON = utf8.char(0xe628) local LAMBDA_ICON = utf8.char(0xfb26) local SUP_IDX = {"¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","¹⁰", "¹¹","¹²","¹³","¹⁴","¹⁵","¹⁶","¹⁷","¹⁸","¹⁹","²⁰"} local SUB_IDX = {"₁","₂","₃","₄","₅","₆","₇","₈","₉","₁₀", "₁₁","₁₂","₁₃","₁₄","₁₅","₁₆","₁₇","₁₈","₁₉","₂₀"} local launch_menu = {} local ssh_cmd = {"ssh"} if wezterm.target_triple == "x86_64-pc-windows-msvc" then ssh_cmd = {"powershell.exe", "ssh"} table.insert( launch_menu, { label = "PowerShell Core", args = {"pwsh.exe", "-NoLogo"} } ) table.insert( launch_menu, { label = "NyaGOS", args = {"nyagos.exe", "--glob"}, } ) end local ssh_config_file = wezterm.home_dir .. "/.ssh/config" local f = io.open(ssh_config_file) if f then local line = f:read("*l") while line do if line:find("Host ") == 1 then local host = line:gsub("Host ", "") table.insert( launch_menu, { label = "SSH " .. host, args = {"ssh", host} } ) end line = f:read("*l") end f:close() end local mouse_bindings = { { event = {Down = {streak = 1, button = "Right"}}, mods = "NONE", action = wezterm.action {PasteFrom = "Clipboard"} }, -- Change the default click behavior so that it only selects -- text and doesn't open hyperlinks { event = {Up = {streak = 1, button = "Left"}}, mods = "NONE", action = wezterm.action {CompleteSelection = "PrimarySelection"} }, -- and make CTRL-Click open hyperlinks { event = {Up = {streak = 1, button = "Left"}}, mods = "CTRL", action = "OpenLinkAtMouseCursor" } } wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width) local edge_background = "#121212" local background = "#4E4E4E" local foreground = "#1C1B19" local dim_foreground = "#3A3A3A" if tab.is_active then background = "#FBB829" foreground = "#1C1B19" elseif hover then background = "#FF8700" foreground = "#1C1B19" end local edge_foreground = background local process_name = tab.active_pane.foreground_process_name local pane_title = tab.active_pane.title local exec_name = basename(process_name):gsub("%.exe$", "") local title_with_icon if exec_name == "nu" then title_with_icon = NU_ICON .. " NuShell" elseif exec_name == "pwsh" then title_with_icon = PS_ICON .. " PS" elseif exec_name == "cmd" then title_with_icon = CMD_ICON .. " CMD" elseif exec_name == "elvish" then title_with_icon = ELV_ICON .. " Elvish" elseif exec_name == "wsl" or exec_name == "wslhost" then title_with_icon = WSL_ICON .. " WSL" elseif exec_name == "nyagos" then title_with_icon = NYA_ICON .. " " .. pane_title:gsub(".*: (.+) %- .+", "%1") elseif exec_name == "yori" then title_with_icon = YORI_ICON .. " " .. pane_title:gsub(" %- Yori", "") elseif exec_name == "nvim" then title_with_icon = VIM_ICON .. pane_title:gsub("^(%S+)%s+(%d+/%d+) %- nvim", " %2 %1") elseif exec_name == "bat" or exec_name == "less" or exec_name == "moar" then title_with_icon = PAGER_ICON .. " " .. exec_name:upper() elseif exec_name == "fzf" or exec_name == "hs" or exec_name == "peco" then title_with_icon = FUZZY_ICON .. " " .. exec_name:upper() elseif exec_name == "btm" or exec_name == "ntop" then title_with_icon = SUNGLASS_ICON .. " " .. exec_name:upper() elseif exec_name == "python" or exec_name == "hiss" then title_with_icon = PYTHON_ICON .. " " .. exec_name elseif exec_name == "node" then title_with_icon = NODE_ICON .. " " .. exec_name:upper() elseif exec_name == "deno" then title_with_icon = DENO_ICON .. " " .. exec_name:upper() elseif exec_name == "bb" or exec_name == "cmd-clj" or exec_name == "janet" or exec_name == "hy" then title_with_icon = LAMBDA_ICON .. " " .. exec_name:gsub("bb", "Babashka"):gsub("cmd%-clj", "Clojure") else title_with_icon = HOURGLASS_ICON .. " " .. exec_name end if pane_title:match("^Administrator: ") then title_with_icon = title_with_icon .. " " .. ADMIN_ICON end local left_arrow = SOLID_LEFT_ARROW if tab.tab_index == 0 then left_arrow = SOLID_LEFT_MOST end local id = SUB_IDX[tab.tab_index+1] local pid = SUP_IDX[tab.active_pane.pane_index+1] local title = " " .. wezterm.truncate_right(title_with_icon, max_width-6) .. " " return { {Attribute={Intensity="Bold"}}, {Background={Color=edge_background}}, {Foreground={Color=edge_foreground}}, {Text=left_arrow}, {Background={Color=background}}, {Foreground={Color=foreground}}, {Text=id}, {Text=title}, {Foreground={Color=dim_foreground}}, {Text=pid}, {Background={Color=edge_background}}, {Foreground={Color=edge_foreground}}, {Text=SOLID_RIGHT_ARROW}, {Attribute={Intensity="Normal"}}, } end) wezterm.on( "update-right-status", function(window) local date = wezterm.strftime("%Y-%m-%d %H:%M:%S ") window:set_right_status( wezterm.format( { {Text = date} } ) ) end ) local default_prog = {"pwsh.exe"} return { set_environment_variables = { PATH = wezterm.executable_dir .. ";" .. os.getenv("PATH"), }, window_frame = window_frame, -- needed only if using fancy tab window_background_opacity = 0.8, launch_menu = launch_menu, mouse_bindings = mouse_bindings, disable_default_key_bindings = true, default_prog = default_prog, font = wezterm.font("Fira Code"), colors = { tab_bar = { background = TAB_BAR_BG, }, }, text_background_opacity = 0.95, leader = { key="x", mods = "CTRL"}, keys = { { key = "`", mods = "LEADER|CTRL", action=wezterm.action{SendString="`"}}, { key = "v", mods = "CTRL", action=wezterm.action{PasteFrom = "Clipboard"}}, { key = "-", mods = "LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}}, { key = "\\",mods = "LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}}, { key = "c", mods = "LEADER", action=wezterm.action{SpawnTab="CurrentPaneDomain"}}, {key="h",mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Left"}}, {key="j", mods = "LEADER",action=wezterm.action{ActivatePaneDirection="Up"}}, {key="k", mods = "LEADER",action=wezterm.action{ActivatePaneDirection="Down"}}, {key="l", mods = "LEADER",action=wezterm.action{ActivatePaneDirection="Right"}}, {key = ",", mods = "LEADER", action = "ShowLauncher"}, {key = "b", mods = "LEADER", action = "ShowTabNavigator"}, { key = "f", mods = "LEADER", action = "QuickSelect" }, { key = "\t", mods = "LEADER", action="ActivateLastTab"}, { key = "1", mods = "LEADER", action=wezterm.action{ActivateTab=0}}, { key = "2", mods = "LEADER", action=wezterm.action{ActivateTab=1}}, { key = "3", mods = "LEADER", action=wezterm.action{ActivateTab=2}}, { key = "4", mods = "LEADER", action=wezterm.action{ActivateTab=3}}, { key = "5", mods = "LEADER", action=wezterm.action{ActivateTab=4}}, { key = "6", mods = "LEADER", action=wezterm.action{ActivateTab=5}}, { key = "7", mods = "LEADER", action=wezterm.action{ActivateTab=6}}, { key = "8", mods = "LEADER", action=wezterm.action{ActivateTab=7}}, { key = "9", mods = "LEADER", action=wezterm.action{ActivateTab=8}}, -- { key = "l", mods = "LEADER", action=wezterm.action{EmitEvent="toggle-ligature"}}, { key = "n", mods = "LEADER", action=wezterm.action{ActivateTabRelative=1}}, { key = "p", mods = "LEADER", action=wezterm.action{ActivateTabRelative=-1}}, { key = "&", mods = "LEADER|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}}, { key = "x", mods = "LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}}, { key = "w", mods = "ALT", action = wezterm.action({ CopyTo = "Clipboard" }) }, { key = "y", mods = "CTRL", action = wezterm.action({ PasteFrom = "Clipboard" }) }, { key = "Tab", mods = "LEADER", action = wezterm.action({ ActivateTabRelative = 1 }) }, }, }

2022/5/15
articleCard.readMore