Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc #177

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

doc #177

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/alacritty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ size = 9.0
[font.normal]
family = "FiraCode Nerd Font"

[shell]
[terminal.shell]
program = "zsh"

[window]
Expand Down
4 changes: 3 additions & 1 deletion config/nix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ experimental-features = nix-command flakes
# 1. 发现在虚拟机 nix-channel --update 会立刻跳过,参考
# https://discourse.nixos.org/t/nix-channel-update-doesnt-update-anything-my-nixpkgs-unstable-channel-is-months-old/44039/5
# 发现是由于有了 cache ,就没有更新,将这个配置注释掉之后,channel 立刻更新
# tarball-ttl = 4294967295 # max 32bit integer
tarball-ttl = 4294967295 # max 32bit integer
#
# 这里的配置和 /etc/nix/nix.conf 优先级是什么
# https://nix.dev/manual/nix/2.24/command-ref/conf-file
# TODO 解决这个问题任重道远啊
# https://discourse.nixos.org/t/trusted-user-errors-for-every-nix-command-on-arch/14295/9
build-users-group = nixbld
substituters = https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store https://cache.nixos.org/
1 change: 1 addition & 0 deletions config/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set -g prefix C-h
# 最后参考这个解决 : https://github.com/alacritty/alacritty/issues/1208
set -g default-terminal "tmux-256color"
set-option -sa terminal-features ',xterm-256color:RGB'
set -s set-clipboard on

# 让 window 的编号和 pane 的编号从 0 开始,因为 0 这个键实在是太远了
set -g base-index 1
Expand Down
80 changes: 2 additions & 78 deletions config/zsh
Original file line number Diff line number Diff line change
Expand Up @@ -44,59 +44,6 @@ fi
eval "$(starship init zsh)"


function rpm_extract() {
rpm2cpio $1 | cpio -idmv
}

function initrd_extract() {
zcat $1 | cpio -ivdm
}

function tpx() {
PROXY_SERVER_IP="http://10.0.0.2"
PROXY_SERVER_PORT=8889
while getopts "ga:p:hu" opt; do
case $opt in
g)
PROXY_SERVER_IP="http://10.0.2.2"
PROXY_SERVER_PORT=8889
;;
a)
PROXY_SERVER_IP="http://${OPTARG}"
;;
p)
PROXY_SERVER_PORT=${OPTARG}
;;
u)
export https_proxy=
export http_proxy=
export HTTPS_PROXY=
export HTTP_PROXY=
export ftp_proxy=
export FTP_PROXY=

return
;;
h)
echo "-g : use this in QEMU"
echo "-a : ip address"
echo "-p : ip port"
;;
*)
exit 1
;;
esac # --- end of case ---
done

set -x
export https_proxy="$PROXY_SERVER_IP:$PROXY_SERVER_PORT"
export http_proxy="$PROXY_SERVER_IP:$PROXY_SERVER_PORT"
export HTTPS_PROXY="$PROXY_SERVER_IP:$PROXY_SERVER_PORT"
export HTTP_PROXY="$PROXY_SERVER_IP:$PROXY_SERVER_PORT"
export ftp_proxy="$PROXY_SERVER_IP:$PROXY_SERVER_PORT"
export FTP_PROXY="$PROXY_SERVER_IP:$PROXY_SERVER_PORT"
}

# https://www.reddit.com/r/zellij/comments/10skez0/does_zellij_support_changing_tabs_name_according/
# rename zellij tab automatically
zellij_tab_name_update() {
Expand Down Expand Up @@ -138,7 +85,7 @@ alias gs="tig status"
alias gg="gitui --watcher"
alias kernel_version="git describe --contains"
# https://unix.stackexchange.com/questions/45120/given-a-git-commit-hash-how-to-find-out-which-kernel-release-contains-it
alias ls="exa --icons"
alias ls="eza --icons"
alias m="KBUILD_BUILD_TIMESTAMP='' make LLVM=1 CC='ccache clang' -j$(getconf _NPROCESSORS_ONLN)"
alias im="ibus engine rime"
alias mc="make clean"
Expand All @@ -149,7 +96,7 @@ alias vc="rm -r ~/.local/share/nvim/sessions"
alias he="nvim +10000 $HOME/.dotfiles/sheet.md"
alias kvm_stat="sudo $HOME/data/linux/tools/kvm/kvm_stat/kvm_stat"
alias i="ipython"
alias f="xclip -o >> /home/martins3/core/vn/fun.md && echo '' >> /home/martins3/core/vn/fun.md && cat /home/martins3/core/vn/fun.md"
# alias f="xclip -o >> /home/martins3/core/vn/fun.md && echo '' >> /home/martins3/core/vn/fun.md && cat /home/martins3/core/vn/fun.md"
alias cloc="tokei . -f --sort lines"
alias static="nix-shell -p gcc glibc.static --command zsh"
alias wez=/home/martins3/.dotfiles/config/sh/wez-opacity.sh
Expand All @@ -169,22 +116,6 @@ alias weather="curl wttr.in/beijin"
alias drop_cache="echo 3 | sudo tee /proc/sys/vm/drop_caches"
alias wifi="nmcli dev wifi show-password"

alias f=/home/martins3/.fix.sh
alias mod=$HOME/core/vn/code/src/m/mod.sh


if env | grep container &>/dev/null ; then
function u() {
rsync -avzh --delete --filter="dir-merge,- .gitignore" [email protected]:/home/martins3/.dotfiles ~
}
else
function u() {
# 还是用 git 同步吧,太麻烦了
# rsync -avzh --delete --filter="dir-merge,- .gitignore" [email protected]:/home/martins3/core/vn ~/core
rsync -avzh --delete --filter="dir-merge,- .gitignore" [email protected]:/home/martins3/.dotfiles ~
}
fi

# TODO 我理解应该可以通过 default.nix 自动实现 source .venv/bin/activate
function p(){
if [[ ! -d .venv ]]; then
Expand All @@ -193,13 +124,6 @@ function p(){
source .venv/bin/activate
}

function initrd(){
if [[ ! -f $1 ]]; then
echo "not a file"
return
fi
ln -sf $(realpath $1) initrd
}
export NIXPKGS_ALLOW_INSECURE=1
export EDITOR=nvim
export PATH=$PATH:/usr/share/bcc/tools
Expand Down
19 changes: 10 additions & 9 deletions docs/nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -1218,9 +1218,6 @@ man home-configuration.nix 中搜索 dunst
在 profiles 中右键,参考
https://docs.cfw.lbyczf.com/contents/ui/profiles/rules.html

目前使用: clash-verge

### 只是使用 clash-verge
1. https://github.com/MetaCubeX/meta-rules-dat/releases
```txt
WARN[2024-06-12T21:15:47.692663784+08:00] MMDB invalid, remove and download
Expand All @@ -1230,12 +1227,8 @@ FATA[2024-06-12T21:17:17.693330996+08:00] Parse config error: rules[10045] [GEOI
2. 默认路径: /home/martins3/.config/mihomo
3. 只需要拷贝 config.yaml


### clash-verge

1. 拷贝 https://github.com/MetaCubeX/meta-rules-dat/releases 中的 country.mmdb
.local/share/io.github.clash-verge-rev.clash-verge-rev

拷贝 https://github.com/MetaCubeX/meta-rules-dat/releases 中的 country.mmdb 到
~/.local/share/io.github.clash-verge-rev.clash-verge-rev

## canTouchEfiVariables 到底是什么来头

Expand Down Expand Up @@ -1991,3 +1984,11 @@ https://github.com/nix-community/harmonia

## 仔细看看这个
https://github.com/NixOS-CN

## home manager 可以管理 systemd 吗?

https://news.ycombinator.com/item?id=42666851


## kernel 配置在这里的
kernel-modules/lib/modules/6.12.7/modules.devname
21 changes: 21 additions & 0 deletions docs/nvim-advantace.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ cd $HOME/.local/share/nvim/lazy/ && rm -rf hydra.nvim

找到 nvim/lazy-lock.json ,将其中 hydra.nvim 那个删掉

## 还是有必要看看的
很多东西过时了,但是还是有很多可以参考的
https://danielmiessler.com/study/vim


## 被废弃的方法
### 输入法自动切换

Expand All @@ -339,3 +344,19 @@ cd $HOME/.local/share/nvim/lazy/ && rm -rf hydra.nvim
https://github.com/LintaoAmons/bookmarks.nvim

https://github.com/OXY2DEV/markview.nvim

https://github.com/bash-lsp/bash-language-server

https://news.ycombinator.com/item?id=42674116

https://news.ycombinator.com/item?id=40179194
https://m4xshen.dev/posts/vim-command-workflow

## https://github.com/yetone/avante.nvim
配合 deepseek 用用看看效果,不过可以继续等等
也看看这个 : https://github.com/olimorris/codecompanion.nvim
类似的这个效果有吗? https://github.com/continuedev/continue

https://stackoverflow.com/questions/351161/removing-duplicate-rows-in-vi

https://github.com/prochri/telescope-all-recent.nvim
19 changes: 11 additions & 8 deletions docs/nvim.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* [字符串搜索和替换](#字符串搜索和替换)
* [file tree](#file-tree)
* [window](#window)
* [调整一个 window 的大小](#调整一个-window-的大小)
* [window resize](#window-resize)
* [buffer](#buffer)
* [文件搜索](#文件搜索)
* [导航](#导航)
Expand Down Expand Up @@ -368,10 +368,16 @@ map <leader>d "+d
#### 从远程 server 上复制粘贴本地的剪切板中

假如你在一台 windows 系统的电脑中 ssh 到一台 Linux server 上,在 server 中使用复制,默认会复制到 server 的剪切板中。
neovim 在 0.10 中增加了一个新功能,可以直接复制到 windows 的剪切板中
neovim 在 0.10 中增加了一个新功能 oscyank,通过该功能可以直接复制到你在使用的 windows 电脑的剪切板中

如果 0.10 之前的版本, 使用插件 [ojroques/vim-oscyank](https://github.com/ojroques/vim-oscyank)

如果是在 tmux 中使用,那么 tmux 中需要添加如下配置:
```txt
# Allow clipboard with OSC-52 work, see https://github.com/tmux/tmux/wiki/Clipboard
set -s set-clipboard on
```

原理上参考:
- https://news.ycombinator.com/item?id=32037489
- https://github.com/ojroques/vim-oscyank/issues/24
Expand Down Expand Up @@ -469,7 +475,7 @@ vim 内置了强大的搜索替换功能
| `c` `m` | 当前窗口最大化 |


#### 调整一个 window 的大小
#### window resize

nvim 提供了原生的命令来自动一个 windows 的大小,例如可以使用 `vertical resize +10`
将增大 10 个单位。如果想要调整多次,那么需要执行多次这个命令:
Expand All @@ -496,12 +502,9 @@ telescope 同样可以用于搜索文件使用 `,` `f` + 文件名
| <img src="./img/search-files.png" /> |

### 导航
基于 [lspsaga](https://nvimdev.github.io/lspsaga/outline/)

利用 [aerial.nvim](https://github.com/stevearc/aerial.nvim) 实现函数侧边栏导航(类似于 tagbar) ,打开关闭的快捷键 `c` `n`。

| 基于 stevearc/aerial.nvim 的导航栏 |
| ---------------------------------- |
| <img src="./img/outline.png" /> |
![Image](https://github.com/user-attachments/assets/f01b92ec-1392-4bca-8f81-cf9947d33d5d)

### 代码段

Expand Down
2 changes: 1 addition & 1 deletion nixpkgs/home/app/gnome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# no need log out to reload extension: <alt>+F2 r
{
home.packages = (with pkgs; [
gnome.gnome-sound-recorder
gnome-sound-recorder
])
++ (with pkgs.gnomeExtensions; [
unite
Expand Down
36 changes: 23 additions & 13 deletions nixpkgs/home/cli.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ in
# gnuplot
ccache
opam
busybox # 提供 devmem 等工具
# busybox # 提供 devmem 等工具,但是会覆盖很多工具
yazi
# mold
spin
swarm # 形式化验证工具
Expand All @@ -52,13 +53,14 @@ in
ruby
# procdump 微软的 ProcDump 的 linux 移植
ouch # 简化压缩/解压缩的使用
# xpipe # 管理服务器的工具
# gitea # 好吧,还需要手动搭建数据库才可以
sipcalc
sipcalc # ip 计算
ventoy
rsync
novnc
# postman # 不会用,API 工具
grpcurl
# grpcurl # rpc 相关
# uutils-coreutils # @todo 到时候尝试下 rust 的 coreutils
lua
# zfs
Expand All @@ -72,7 +74,7 @@ in
# libguestfs
# libguestfs-appliance
# cloud-utils
adoptopenjdk-icedtea-web # 用于打开 impi jnlp 文件
# adoptopenjdk-icedtea-web # 用于打开 impi jnlp 文件
ccls
checkmake
# minicom
Expand Down Expand Up @@ -163,7 +165,6 @@ in
rpm
stress-ng
# OVMFFull # 存储在 /run/libvirt/nix-ovmf/ 下
# 通过 tweaks 调整开机自启动
hexyl # 分析二进制
# rasdaemon # @todo 莫名其妙,不知道怎么使用
nvme-cli
Expand All @@ -186,10 +187,13 @@ in
virtiofsd
# podman # 暂时不需要
# podman-tui
# k9s
# minikube
k9s
# minio
# hoard # 暂时不知道怎么使用
kubectl
# kubeadm
kubernetes-helm
kind
minikube
# slirp4netns
# nix-index
nixd
Expand All @@ -208,7 +212,8 @@ in
systeroid
# linuxKernel.packages.linux_5_15.perf
# linuxPackages.perf
linuxKernel.packages.linux_6_6.perf
linuxKernel.packages.linux_6_12.perf
gperftools # 主要提供 pprof 功能,但是没用过
# TODO 怎么将内核和 nixpkgs/sys/kernel-options.nix ,而且 kernel.dev 做啥用的
# linuxPackages_6_10.kernel.dev

Expand All @@ -223,14 +228,15 @@ in
# ERROR: kernel release isn't found in "/nix/store/n3nrix9pc0m1ywzg8dq71bh2xr82c7l5-linux-6.3.5-dev"
# 还是在虚拟机勉强维持生活吧
bpftrace
blktrace
# blktrace
bpftools
bpftune
# kernelshark
trace-cmd
# hotspot
# heaptrack
coccinelle
ltrace # library trace
bpftools
procps
xdp-tools
acpi
Expand Down Expand Up @@ -268,11 +274,11 @@ in
))
# ruff # 类似 pyright,据说很快,但是项目太小,看不出什么优势
# perl
man-pages
# man-pages
# man-pages-posix
pre-commit
atop # 类似 htop ,但是展示的内容不同
nmon
man-pages-posix
lazydocker
docker-compose
runc
Expand Down Expand Up @@ -371,6 +377,10 @@ in
pyright
];

programs.fish = {
enable = true;
};

programs.zsh = {
enable = true;
shellAliases = { };
Expand Down
Loading