开发环境配置

开发环境配置

ohmyzsh安装

安装

1
2
sudo apt-get install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

字体安装解决乱码(https://github.com/powerline/fonts)

1
sudo apt-get install fonts-powerline

插件安装

1
2
3
4
sudo apt install autojump
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

设置默认终端

1
chsh -s /bin/zsh

.zshrc配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH

# enable glob
setopt nonomatch
setopt EXTENDED_GLOB
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="powerlevel10k/powerlevel10k"

plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)

source $ZSH/oh-my-zsh.sh

Tmux 安装及配置

安装

1
sudo apt-get install tmux

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Start windows and panes index at 1, not 0.
set -g base-index 1
setw -g pane-base-index 1

# Ensure window index numbers get reordered on delete.
set-option -g renumber-windows on

# Enable mouse mode (tmux 2.1 and above)
set -g mouse on

# set window index from 1
set -g base-index 1
setw -g pane-base-index 1

# enable vim mode
set -g status-keys vi

# set the status line's colors
set -g status-style fg=white,bg=blue

# Set different background color for active window
set -g window-status-style bg=yellow
set -g window-status-current-style bg=red,fg=white


##################################################
# Themes
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'xamut/tmux-network-bandwidth'

set -g status-style "fg=#2188ff,bg=#1f2428"
set -g status-left-length "100"
set -g status-right-length "100"
set -g status-left-length 20
set -g status-left "#[fg=#1f2428,bg=#2188ff,bold] #S #[fg=#2188ff,bg=#1f2428,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#1f2428,bg=#1f2428,nobold,nounderscore,noitalics]#[fg=#1f2428,bg=#1f2428] #{prefix_highlight} #[fg=#e1e4e8,bg=#1f2428,nobold,nounderscore,noitalics]#[fg=#586069,bg=#e1e4e8] %Y-%m-%d  %I:%M %p #[fg=#2188ff,bg=#e1e4e8,nobold,nounderscore,noitalics]#[fg=#1f2428,bg=#2188ff,bold] CPU: #{cpu_percentage}#[fg=#1f2428,bg=#2188ff,bold] MEM: #{ram_percentage}#[fg=#2188ff,bg=#2188ff,bold] "

#################################################
# SPLIT WINDOW
new -s lz -n win1 -c ~ # ... create new session (1) with new window (0)

select-window -t win1 # select myWindow (0)
splitw -v -p 50 -t win1 -c ~/ # split myWindow (0) vertically into halves(50 percent)
#send-keys -t lz:win1.1 "conda deactivate &&source ./install/setup.zsh&&source /opt/ros/foxy/setup.zsh" Enter
#send-keys -t lz:win1.2 "conda deactivate &&source ./install/setup.zsh&&source /opt/ros/foxy/setup.zsh" Enter

new-window -n win2 -c ~/
select-window -t win2
splitw -v -p 50 -t win2 -c ~/

new-window -n sys -c ~/
select-window -t sys
splitw -h -p 50 -t sys
send-keys -t lz:sys.2 "htop" Enter

select-window -t win1
select-pane -t 1

解决ROS2终端无法tab补全

1
2
3
sudo vim /opt/ros/humble/setup.zsh
# 末尾添加下面指令
complete -o nospace -o default -F _python_argcomplete "ros2"