You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to show some colors for the project names for a command I use frequently. I have the following code which works for the custom completions, but I can't figure out the colors. Using typical color codes doesn't work and I'm at a loss.
Any help/suggestions?
Thanks!
# Define the autocomplete function_complete_projects() {
# Ensure the environment variable is setif [[ -z"$P_ITERM_PROJECTS_DIR" ]];thenreturn 1
fi# Use the find command to list all .sh project files and top-level directorieslocal projects
projects=$(find "$P_ITERM_PROJECTS_DIR" -maxdepth 1 \( -type f -name '*.sh' -o -type d \)! -path "$P_ITERM_PROJECTS_DIR" -print 2>/dev/null)# Extract the project names from the full pathslocal project_names
project_names=()
forprojectin${(f)projects};do
project_name="${project#$P_ITERM_PROJECTS_DIR/}"
project_name="${project_name}"
project_names+=("$project_name")
done# Remove duplicates and prepare the completion list
project_names=("${(@u)project_names}")
# Provide the completion options
_describe 'projects' project_names
}
# Bind the function to the restore_project command
compdef _complete_projects restore_project
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to show some colors for the project names for a command I use frequently. I have the following code which works for the custom completions, but I can't figure out the colors. Using typical color codes doesn't work and I'm at a loss.
Any help/suggestions?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions