william

Keep Calm and Markdown.

nvim bufferline 设置过滤条件

今天在写代码的时候,遇到一个有趣的事情:有时候我们只打开一个文件,但是 bufferline 也会显示该文件相关的操作。

docker 占用磁盘空间太大

一觉醒来发现天塌了:我的 Linux Mint 机器无法登录。联想到昨天启动了一个 Docker 用于测试更新 gcc14,因而有可能是编译导致的临时目标文件太大,占用磁盘空间,导致系统启动无法正常读写相关启动的配置文件。

入坑 HHKB 无刻键盘

决定在新的一年折腾一下自己,学习一些新的技能,比如

  • 使用 c++ 开发一个高性能、低延迟的通信系统
  • 更加了解 Linux 操作系统底层涉及
  • 熟练使用 nvim 以及学习 lua 语言开发插件
  • ……

再比如,本篇博客的主题:入坑 HHKB 无刻键盘,强迫自己在盲打情况下的写代码能力。

zsh auto suggestion with key binding

We could bind key to zsh-autosuggestions. This is especially helpful when we use HHKB, whereas there is no such thing as left-arrow or right-arrow.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 自动建议
# zinit wait lucid light-mode for \
#     atload"_zsh_autosuggest_start; \
#         ZSH_AUTOSUGGEST_STRATEGY=(history completion) \
#         ZSH_AUTOSUGGEST_MANUAL_REBIND=0 \
#         ZSH_AUTOSUGGEST_HISTORY_IGNORE=' *' \
#         bindkey '^p' history-search-backward; \
#         bindkey '^o' history-search-forward; \
#         bindkey '^n' autosuggest-accept; \
#         bindkey '^e' autosuggest-execute; \
#         bindkey '^a' autosuggest-toggle; \
#         bindkey '^ ' autosuggest-accept" \
#     zsh-users/zsh-autosuggestions
# https://github.com/zsh-users/zsh-autosuggestions/issues/642
# For example, this would bind ctrl + space to accept the current suggestion.
zinit wait lucid light-mode for \
    atload"_zsh_autosuggest_start; \
        ZSH_AUTOSUGGEST_STRATEGY=(history completion) \
        ZSH_AUTOSUGGEST_MANUAL_REBIND=0 \
        ZSH_AUTOSUGGEST_HISTORY_IGNORE=' *' \
        bindkey '^ ' autosuggest-accept;" \
    zsh-users/zsh-autosuggestions
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=yellow'

crti.so 找不到的解决方法

在编译一个代码模块的是否,gcc 报错

1
/usr/bin/ld: cannot find crt1.o: No such file or directory

我们需要让 gcc 识别到 crt 的路径

1
2
3
4
5
6
find /usr -name crti*

/usr/lib32/crti.o
/usr/lib/i386-linux-gnu/crti.o
/usr/lib/x86_64-linux-gnu/crti.o
/usr/libx32/crti.o

可以看到,在默认的路径找到了 /usr/lib32/crt1.o,但是由于这个指向的是 32 位操作系统的动态库(可能是当前系统安装了多个编译环境),导致 gcc 编译文件无法使用 64 位的动态库。同时,我们还发现 /usr/lib/x86_64-linux-gnu/crti.o 这个版本是 64 位动态库,因此需要让 gcc 使用该版本

1
2
3
4
5
6
sudo apt-get install libc6-dev

export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}
export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:${LIBRARY_PATH}

sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
0%