Terminal

青蛙小白的Terminal #

基于ohmyzsh+alacritty+tmux,打造高效美观的终端工具,效果图如下。

terminal.png

1.ohmyzsh #

1.1 安装ohmyzsh #

1sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

1.2 powerlevel10k主题 #

MesloLGS NF字体安装,下载这四个 ttf 文件:

双击每个文件,然后点击“安装”。这将使 MesloLGS NF 字体在系统上的所有应用程序中可用。

后边将在终端模拟器Alacritty的配置文件中配置Alacritty使用MesloLGS NF字体。

为zsh安装powerlevel10k主题:

1git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

~/.zshrc中设置ZSH_THEME="powerlevel10k/powerlevel10k"

执行exec zsh重启zsh,如果配置向导没有自动启动,请输入 p10k configure

按照配置向导定制主题配置。

升级可用:

1git -C ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k pull

注意在~/.zshrc的最后一行加上下面的配置,禁用为每个终端都启动的gitstatusd进程:

1POWERLEVEL9K_DISABLE_GITSTATUS=true

1.3 插件 #

zsh-autosuggestionszsh-syntax-highlighting插件安装

1git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
2git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

~/.zshrc中配置插件:

1plugins=(
2    git
3    zsh-autosuggestions
4    zsh-syntax-highlighting
5)

2.alacritty - 终端模拟器 #

1brew install --cask alacritty

配置文件.config/alacritty目录下:

使用了hardhackerlabs的theme-alacritty主题hardhacker.toml:

 1[colors.bright]
 2black = "0x3f3951"
 3blue = "0xb1baf4"
 4cyan = "0xb3f4f3"
 5green = "0xb1f2a7"
 6magenta = "0xe192ef"
 7red = "0xe965a5"
 8white = "0xeee9fc"
 9yellow = "0xebde76"
10
11[colors.cursor]
12cursor = "0xeee9fc"
13text = "0xeee9fc"
14
15[colors.normal]
16black = "0x282433"
17blue = "0xb1baf4"
18cyan = "0xb3f4f3"
19green = "0xb1f2a7"
20magenta = "0xe192ef"
21red = "0xe965a5"
22white = "0xeee9fc"
23yellow = "0xebde76"
24
25[colors.primary]
26background = "0x282433"
27foreground = "0xeee9fc"

alacritty.toml:

 1import = ["/Users/<YourName>/.config/alacritty/hardhacker.toml"]
 2working_directory = "/Users/<YourName>/Desktop"
 3
 4[env]
 5TERM = "xterm-256color"
 6
 7[font]
 8size = 15.0
 9
10[font.bold]
11family = "MesloLGS NF"
12style = "Bold"
13
14[font.bold_italic]
15family = "MesloLGS NF"
16style = "Bold Italic"
17
18[font.italic]
19family = "MesloLGS NF"
20style = "Italic"
21
22[font.normal]
23family = "MesloLGS NF"
24style = "Regular"
25
26[window]
27decorations = "transparent"
28startup_mode = "Maximized"
29
30[window.padding]
31x = 5
32y = 30

另一个终端模拟器Starship

Starship,快真的很快,但暂时不喜欢配置出的外观,关注中…

3.vim高亮 #

1git clone https://github.com/hardhackerlabs/theme-vim.git
2cp -r theme-vim/colors  ~/.vim/
3cp -r theme-vim/autoload  ~/.vim/

安装vi ~/.vimrc:

1syntax      enable
2syntax      on
3set         t_Co=256
4" let g:hardhacker_darker = 1
5colorscheme hardhacker
6
7
8" 解决插入模式下delete/backspce键失效问题
9set backspace=2

4.tmux - 终端复用神器 #

1brew install tmux

插件管理器tpm:

1git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

配置文件~/.tumx.conf

 1set -g pane-border-status bottom
 2set -g pane-border-format " #{pane_index} #{pane_current_command}"
 3
 4set-option -g mouse on
 5set-option default-terminal "xterm-256color"
 6
 7set -g display-panes-time 3000 # PREFIX-Q 显示编号的驻留时长,单位 ms
 8set -g renumber-windows   on    # 关掉某个窗口后,编号重排
 9
10
11# https://draculatheme.com/tmux
12set -g @plugin 'dracula/tmux'
13set -g @dracula-plugins "battery"
14set -g @dracula-show-powerline true
15set -g @dracula-refresh-rate 60
16set -g @dracula-show-left-icon session
17set -g @dracula-border-contrast true
18set -g @dracula-left-icon-padding 0
19set -g @dracula-show-empty-plugins false
20set -g @dracula-show-left-sep 
21set -g @dracula-show-right-sep  
22
23
24set -g @plugin 'tmux-plugins/tpm'
25set -g @plugin 'tmux-plugins/tmux-sensible'
26run '~/.tmux/plugins/tpm/tpm'

上面的配置文件对tmux做了基本的配置,并将使用tpm安装了主题插件dracula/tmux

使用下面的命令安装插件。

1tmux new -t mac
2
3tmux source ~/.tmux.conf

按tmux前缀键control+b,再按Shift + I即可自动安装配置文件中配置的插件。

参考链接 #

© 2024 青蛙小白
comments powered by Disqus