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

ROS2 #39

Merged
merged 3 commits into from
Oct 30, 2023
Merged

ROS2 #39

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
11 changes: 11 additions & 0 deletions roles/zsh/config/p10k.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
# cpu_arch # CPU architecture
# time # current time
ros_workspace
colcon_workspace
# =========================[ Line #2 ]=========================
newline
# ip # ip address and bandwidth usage for a specified network interface
Expand Down Expand Up @@ -1595,11 +1596,21 @@
p10k segment -f 208 -i '⭐' -t 'hello, %n'
}

# For ROS 1
function prompt_ros_workspace() {
if [[ -n "$ROS_WORKSPACE_DISPLAY" ]]; then
p10k segment -f green -i '🤖' -t "${ROS_WORKSPACE_DISPLAY}"
fi
}

# For ROS 2
function prompt_colcon_workspace(){
if [[ -n "$COLCON_PREFIX_PATH" ]]; then
local ws_name=$(basename ${COLCON_PREFIX_PATH%/*})
p10k segment -f green -i '🤖2️⃣' -t "${ws_name}"
fi
}

# User-defined prompt segments may optionally provide an instant_prompt_* function. Its job
# is to generate the prompt segment for display in instant prompt. See
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
Expand Down
18 changes: 8 additions & 10 deletions roles/zsh/config/rc.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,14 @@ source ${zsh_personal_config_dir}/ros.zsh
if [ -z "$HISTFILE" ]; then
HISTFILE=$HOME/.zsh_history
fi
setopt HISTVERIFY
setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_NO_STORE
unsetopt SHARE_HISTORY

setopt histappend
setopt inc_append_history
setopt hist_verify
setopt extended_history
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_ignore_all_dups

PROMPT_COMMAND='history -a'
HISTSIZE=500000
Expand Down
6 changes: 6 additions & 0 deletions roles/zsh/config/ros.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ _ross() {
# ros2 completion
complete -o nospace -o default -F _python_argcomplete "ros2"

# colcon completion
if type colcon &> /dev/null; then
source /usr/share/colcon_cd/function/colcon_cd.sh
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
fi

if [ -d /opt/ros ]; then
init_ros_zsh
fi