工作流: WSL+ZSH+TMUX+NeoVIM
- 环境: WSL
- 工具
- zsh , oh my zsh
- starship, Meslo Nerd Fonts
- tmux
- neovim
Zsh
bash
是默认shell,改用zsh
。
sudo apt-get install zsh
chsh -s $(which zsh)
配置oh my zsh!
直接执行sh文件
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)
tips: wsl可以使用主机的代理
但export只对当前会话有效,若要长期保存:
修改/etc/environment文件
Prompt:Starship
使用Starship作为我的Zsh提示工具
sh -c "$(curl -fsSL https://starship.rs/install.sh)"
~/.config/starship.toml
, 复制以下内容,后续安装字体可以解决乱码:# ~/.config/starship.toml
[aws]
symbol = " "
[conda]
symbol = " "
[dart]
symbol = " "
format = "via [$symbol]($style)"
[directory]
read_only = " "
truncation_length = 1
[docker_context]
symbol = " "
[elixir]
symbol = " "
format = 'via [$symbol]($style)'
[elm]
symbol = " "
[git_branch]
symbol = " "
[golang]
symbol = " "
format = 'via [$symbol]($style)'
[hg_branch]
symbol = " "
[java]
symbol = " "
format = 'via [$symbol]($style)'
[julia]
symbol = " "
[memory_usage]
symbol = " "
[nim]
symbol = " "
[nix_shell]
symbol = " "
[nodejs]
symbol = " "
format = 'via [$symbol]($style)'
[package]
symbol = " "
[perl]
symbol = " "
[php]
symbol = " "
[python]
symbol = " "
format = 'via [$symbol]($style)'
[ruby]
symbol = " "
[rust]
format = 'via [$symbol]($style)'
[scala]
symbol = " "
[shlvl]
symbol = " "
[swift]
symbol = "ﯣ "
format = 'via [$symbol]($style)'
[git_status]
disabled = true
启用Starship
在.zshrc
末尾加上一句eval "$(starship init zsh)"
初步显示如下
添加字体
1)在Windows中
安装Meslo Nerd Fonts压缩包
解压到C:/Windows/Fonts
2)回到WSL
修改.zshrc文件
修改starship.toml文件
3)生效
tmux
sudo apt-get install tmux
会话Session
启动
键入tmux,自动生成id为0的session
自定义会话id,tmux new -s halo
重命名,tmux rename-session -t halo hello
查看使用tmux ls
分离/解绑
ctrl+b d会话转到后台执行
本质是将会话进行解绑tmux detach
重绑
tmux attach -t hello
退出
ctrl+d 关闭该会话的所有窗口
窗口Window
创建
tmux new-window -n hello
(适合窗口名自定义)
tmux rename-window -t hello newhello
(重命名)
Ctrl+b +c,创建新窗口create
(窗口名默认) Ctrl+d销毁窗口
切换窗口
*
指示当前位置 ctrl+b p上个窗口pre
ctrl+b n下个窗口next
ctrl+b w列表,这个好~
窗格Pane
分裂
tmux split-window
默认上下, 快捷键ctrl+b "
-h
左右,快捷键ctrl+b %
ctrl+b 方向键四个方向切换,好方便~ ctrl+d销毁窗格
移动当前窗格
tmux swap-pane -U
与前面窗格对换
tmux swap-pane -D
与后面窗格对换
滚屏
ctrl+b [ 方向键可滚屏,翻页键也可用 Esc
NeoVim
安装
sudo apt-get install neovim
创建配置文件
git clone https://github.com/nexxeln/nvim ~/.config/nvim
zoxide工具
z: 智能版的cd
安装
wget https://github.com/ajeetdsouza/zoxide/releases/download/v0.9.1/zoxide-0.9.1-x86_64-unknown-linux-musl.tar.gz
mkdir zoxide
tar -xvf zoxide-0.9.1-x86_64-unknown-linux-musl.tar.gz -C zoxide/
cd zoxide
sudo mv zoxide /usr/local/bin/
快速的目录导航工具,更快地切换和浏览目录。记录你最常用的目录,根据历史使用情况来推断可能想要访问的目录。z 快速跳转到匹配的目录。
配置
在~/.zshrc
末尾加上eval "$(zoxide init zsh)"