面向终端的IDE

安装

# alacritty
brew install --cask alacritty

# tmux、neovim
brew install tmux neovim

# depends
brew install fzf
$(brew --prefix)/opt/fzf/install

brew install ripgrep ag bottom fd lazygit

配置

alacritty 配置

# ~/.config/alacritty/alacritty.toml
live_config_reload = true
working_directory = "None"

[bell]
animation = "EaseOutExpo"
duration = 0

[colors]
draw_bold_text_with_bright_colors = true

[colors.bright]
black = "0x928374"
blue = "0x83a598"
cyan = "0x8ec07c"
green = "0xb8bb26"
magenta = "0xd3869b"
red = "0xfb4934"
white = "0xebdbb2"
yellow = "0xfabd2f"

[colors.normal]
black = "0x282828"
blue = "0x458588"
cyan = "0x689d6a"
green = "0x98971a"
magenta = "0xb16286"
red = "0xcc241d"
white = "0xa89984"
yellow = "0xd79921"

[colors.primary]
background = "0x282828"
foreground = "0xebdbb2"

[env]
TERM = "xterm-256color"

[font]
size = 21.0

[font.bold]
family = "JetBrainsMono Nerd Font"
style = "Bold"

[font.bold_italic]
family = "JetBrainsMono Nerd Font"
style = "Bold Italic"

[font.italic]
family = "JetBrainsMono Nerd Font"
style = "Italic"

[font.normal]
family = "JetBrainsMono Nerd Font"
style = "Regular"

[[keyboard.bindings]]
action = "Paste"
key = "V"
mods = "Command"

[[keyboard.bindings]]
action = "Copy"
key = "C"
mods = "Command"

[[keyboard.bindings]]
action = "Quit"
key = "Q"
mods = "Command"

[[keyboard.bindings]]
chars = "\u0001|"
key = "D"
mods = "Command"

[[keyboard.bindings]]
chars = "\u0001-"
key = "D"
mods = "Command|Shift"

[[keyboard.bindings]]
chars = "\u0001s"
key = "S"
mods = "Command"

[[keyboard.bindings]]
chars = "\u0001c"
key = "T"
mods = "Command"

[[keyboard.bindings]]
chars = "\u0001z"
key = "Z"
mods = "Command"

[[keyboard.bindings]]
chars = "\u0001h"
key = "H"
mods = "Command|Shift"

[[keyboard.bindings]]
chars = "\u0001j"
key = "J"
mods = "Command|Shift"

[[keyboard.bindings]]
chars = "\u0001k"
key = "K"
mods = "Command|Shift"

[[keyboard.bindings]]
chars = "\u0001l"
key = "L"
mods = "Command|Shift"

[[keyboard.bindings]]
chars = "\u0001\b"
key = "H"
mods = "Control|Shift"

[[keyboard.bindings]]
chars = """
\u0001
"""
key = "J"
mods = "Control|Shift"

[[keyboard.bindings]]
chars = "\u0001\u000B"
key = "K"
mods = "Control|Shift"

[[keyboard.bindings]]
chars = "\u0001\f"
key = "L"
mods = "Control|Shift"

[[keyboard.bindings]]
chars = "\u00011"
key = "Key1"
mods = "Command"

[[keyboard.bindings]]
chars = "\u00012"
key = "Key2"
mods = "Command"

[[keyboard.bindings]]
chars = "\u00013"
key = "Key3"
mods = "Command"

[[keyboard.bindings]]
chars = "\u00014"
key = "Key4"
mods = "Command"

[[keyboard.bindings]]
chars = "\u00015"
key = "Key5"
mods = "Command"

[[keyboard.bindings]]
chars = "\u00016"
key = "Key6"
mods = "Command"

[[keyboard.bindings]]
chars = "\u00017"
key = "Key7"
mods = "Command"

[[keyboard.bindings]]
chars = "\u00018"
key = "Key8"
mods = "Command"

[[keyboard.bindings]]
chars = "\u00019"
key = "Key9"
mods = "Command"

[[keyboard.bindings]]
action = "ResetFontSize"
key = "Key0"
mods = "Command"

[[keyboard.bindings]]
action = "IncreaseFontSize"
key = "Equals"
mods = "Command"

[[keyboard.bindings]]
action = "DecreaseFontSize"
key = "Minus"
mods = "Command"

[[keyboard.bindings]]
action = "ToggleSimpleFullscreen"
key = 36
mods = "Command"

[mouse]
hide_when_typing = true

[[mouse.bindings]]
action = "PasteSelection"
mouse = "Right"

[scrolling]
history = 10000
multiplier = 3

[selection]
save_to_clipboard = true
semantic_escape_chars = ",│`|:\"' ()[]{}<>\t"

[shell]
args = ["--login"]
program = "/bin/zsh"

[window]
dynamic_padding = true
dynamic_title = true

[window.padding]
x = 0
y = 0

tmux 配置

状态栏配置有参考 qingshan/dotfiles

# base settings
set -s escape-time 0

set -g default-terminal "screen-256color"
set -ga terminal-overrides ",rxvt-unicode-256color:Tc"

set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
setw -g automatic-rename off
setw -g allow-rename off

# enable clipboard
set-option -g set-clipboard on

# bindkeys
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix

# Use vim keybindings in copy mode
set-window-option -g mode-keys vi

# Update default binding of `Enter` and `Space to also use copy-pipe
unbind-key -T copy-mode-vi Enter
unbind-key -T copy-mode-vi Space

bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down

# begin selection as in Vim
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send -X rectangle-toggle

# copy text in copy mode
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel

# split window
unbind '"'
bind '-' splitw -v -c '#{pane_current_path}'
unbind %
bind '|' splitw -h -c '#{pane_current_path}'

# select pane
bind h selectp -L
bind j selectp -D
bind k selectp -U
bind l selectp -R

bind S command-prompt -p "new session:" "new-session -A -s '%%'"
bind K confirm kill-session

bind f set-option -g status
bind C-f set-option -g status

# statusbar
set -g status-interval 1
set -g status-keys vi
set -g status-bg black
set -g status-fg white
set-option -g status-position top
set-option -g status-justify left

# status variables format
if-shell 'test "$(uname)" = "Darwin"' {
  set-option -g @OS ""
  set-option -g @IM "  #(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleCurrentKeyboardLayoutInputSourceID | awk -F. '{print $4}' | sed s/PinyinKeyboard/中/)"
} {
  set-option -g @OS ""
  set-option -g @IM " #(whoami)#{?SSH_CLIENT,@#h,}"
}
%hidden GIT_BRANCH="#(git -C #{pane_current_path} rev-parse --abbrev-ref HEAD)"

# status bar left
set-option -g status-left-length 100
set-option -g status-left-style none
set-option -g status-left "#[fg=#282828,bg=#a89984,nobold] #{E:@OS} #S ﬿ #[fg=#a89984,bg=#3c3836,nobold]"

# status bar right
set-option -g status-right-length 150
set-option -g status-right-style none
set-option -g status-right "#[fg=#504945,bg=#3c3836]#[fg=#a89984,bg=#504945] %H:%M #[fg=#3c3836,bg=#504945]#[fg=#a89984,bg=#3c3836]#[fg=#282828,bg=#a89984] #{?$GIT_BRANCH, $GIT_BRANCH #[fg=#3c3836] ,}#[fg=#282828,bg=#a89984]#{E:@IM} "

# window bar style
set-option -g window-status-style "fg=#3c3836,bg=#504945"
set-option -g window-status-current-style "fg=#ebdbb2,bg=#49556a"
set-option -g window-status-activity-style "fg=#3c3836,bg=#504945"

set-option -g window-status-format '#[fg=#3c3836,nobold]#[fg=#a89984] #I: #W #{?window_last_flag, ,}#{?window_activity_flag,#[fg=#d79921] ,}#[fg=#504945,bg=#3c3836,nobold]'
set-option -g window-status-current-format '#[fg=#3c3836,nobold]#[fg=#ebdbb2] #I: #W #[fg=#689d6a]#{?window_zoomed_flag,,} #[fg=#49556a,bg=#3c3836,nobold]'
set-option -g window-status-separator ''

# pane border style
set-option -g pane-active-border-style fg='#fe8019'
set-option -g pane-border-style fg='#3c3836'

# message style
set-option -g message-style none,fg='#fe8010',bg='#504945'
set-option -g message-command-style none,fg='#fe8010',bg='#504945'

neovim 配置

windrivder/nvim

说明

  • 统一 gruvbox 配色
  • 部分快捷键与 iTerm2 保持一致
  • 开箱即用
  • 请自行安装 Nerd Font 字体,推荐 JetBrains Mono,Source Code Pro 等
  • neovim 配置亲测 mac、ubuntu 22.04 可用