script
ohmyzsh
script | ohmyzsh | |
---|---|---|
1 | 566 | |
46 | 169,325 | |
- | 0.8% | |
0.0 | 9.5 | |
over 1 year ago | 2 days ago | |
PowerShell | Shell | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
script
-
What’s so special about PS1? Fun with customizing Bash command prompts
warp_escape_ps1 () { tr '\n\n' ' ' <<< "$*" | xxd -p | tr -d '\n' } # Format a string value according to JSON syntax - Adapted from https://github.com/lework/script. warp_escape_json () { # Explanation of the sed replacements (each command is separated by a `;`): # s/(["\\])/\\\1/g - Replace all double-quote (") and backslash (\) characters with the escaped versions (\" and \\) # s/\b/\\b/g - Replace all backspace characters with \b # s/\t/\\t/g - Replace all tab characters with \t # s/\f/\\f/g - Replace all form feed characters with \f # s/\r/\\r/g - Replace all carriage return characters with \r # $!s/$/\\n/ - On every line except the last, insert the \n escape at the end of the line # Note: sed acts line-by-line, so it doesn't see the literal newline characters to replace # # tr -d '\n' - Remove the literal newlines from the final output # # Additional note: In a shell script between single quotes ('), no escape sequences are interpreted. # To work around that and insert the literal values into the regular expressions, we stop the single-quote, # then add the literal using ANSI-C syntax ($'\t'), then start a new single-quote. That is the meaning # behind the various `'$'\b''` blocks in the command. All of these separate strings are then concatenated # together to form the full argument to send to sed. sed -E 's/(["\\])/\\\1/g; s/'$'\b''/\\b/g; s/'$'\t''/\\t/g; s/'$'\f''/\\f/g; s/'$'\r''/\\r/g; $!s/$/\\n/' <<<"$*" | tr -d '\n' } warp_precmd () { # $? is relative to the process so we MUST check this first # or else the exit code will correspond to the commands # executed within this block instead of the actual last # command that was run. local exit_code=$? # Clear the prompt again before the command is rendered as it could # have been reset by the user's bashrc or by setting the variable # on the command line. if [[ -n $PS1 ]]; then WARP_PS1="$PS1" fi unset PS1 unset PROMPT # Escaped PS1 variable local escaped_ps1 if [[ $WARP_FEATURE_FLAG_HONOR_PS1 == "1" ]]; then # Tricking the shell into rendering the prompt # Note that in more modern versions of bash we could use ${PS1@P} to achieve the same, # but macOs comes by default with a much older version of bash, and we want to be compatible. deref_ps1=$(echo -e "\n" | PS1="$WARP_PS1" bash --norc -i 2>&1 | head -2 | tail -1) escaped_ps1=$(warp_escape_ps1 "$(echo "$deref_ps1")") fi # Flush history history -a # Reset the custom kill-whole-line binding as the user's bashrc (which is sourced after bashrc_warp) # could have added another bind. This won't have any user-impact because these shortcuts are only run # in the context of the bash editor, which isn't displayed in Warp. bind -r '"\C-p"' bind "\C-p":kill-whole-line local escaped_pwd escaped_pwd=$(warp_escape_json "$PWD") local escaped_virtual_env="" if [ ! -z "$VIRTUAL_ENV" ]; then escaped_virtual_env=$(warp_escape_json "$VIRTUAL_ENV") fi local escaped_conda_env="" if [ ! -z "$CONDA_DEFAULT_ENV" ]; then escaped_conda_env=$(warp_escape_json "$CONDA_DEFAULT_ENV") fi local git_branch git_branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "") local escaped_git_branch escaped_git_branch=$(warp_escape_json "$git_branch") # At this point, escaped prompt looks something like # \\u{001B}\\u{005B}\\u{0030}\\u{0031}\\u{003B} ... # We need to maintain the double quoting of \\u in the message that # is sent otherwise the receiving side will interpret the value # as JS string literals of the form \uHEX, and will include # ctrl characters (like ESC) in the json, which will cause a JSON # parse error. # Note WARP_SESSION_ID doesn't need to be escaped since it's a number local escaped_json="{\"hook\": \"Precmd\", \"value\": {\"pwd\": \"$escaped_pwd\", \"ps1\": \"$escaped_ps1\", \"git_branch\": \"$escaped_git_branch\", \"virtual_env\": \"$escaped_virtual_env\", \"conda_env\": \"$escaped_conda_env\", \"exit_code\": $exit_code, \"session_id\": $WARP_SESSION_ID}}" warp_send_message "$escaped_json" }
ohmyzsh
-
Essential Tools & Technologies for New Developers
For Linux users, your default terminal is just fine. The only thing I would install is oh-my-zsh with the autocomplete plugin. For my Mac friends out there, iTerm is an amazing software that works well with oh-my-zsh as well.
- Melhorando e configurando seu novo Shell linux. Pt-2
-
Improve your productivity by using more terminal and less mouse (🚀).
If you are not using oh-my-zsh, you are missing out on some amazing plugins. One feature most people wish the terminal had is autocompletion. With the zsh-autosuggestions plugin, your terminal will autocomplete most commands and remember previous ones.
-
Terminal commands I use as a frontend developer
That’s the minimum terminal setup. You can modify the look and add plugins such as autocompletion to your terminal by installing ohmyzsh and using themes such as powerlevel10k. I am already using them.
-
Zshell
Somewhat related is "Oh My ZSH!" which is basically zsh on steroids, it's always one of the first things I install on a new computer. It gives things like new colors, themes, plugins, and more. Highly recommend you check it out.
https://ohmyz.sh/
-
ohmyzsh VS atuin - a user suggested alternative
2 projects | 22 Feb 2024
- Oh My Zsh
-
Weird Color Stuff In The Terminal
I had just gone through a fun tutorial for setting up oh-my-zsh with a nice color scheme from iterm2colorschemes.com and a decent prompt and I was wondering: can I make my oblique strategy look nice? how can you actually use the colors from your scheme in the output in your cli?
-
Make Your Linux Terminal Enjoyable to Use
After this you going to visit Oh-My-Zsh which is where the magic will happen.
-
Using Linux Full-Time 2 years later
after automating my dotfiles, I want to automate my installations, after that I want to make my terminal easier to use so I add OMZ with many plugins, after that, I try to automate the backup of my setting on my Gnome but failed, then try using git-lfs for my big files but it turned out to be idiotic moves, bla bla bla many try and fail.
What are some alternatives?
starship - ☄🌌️ The minimal, blazing-fast, and infinitely customizable prompt for any shell!
oh-my-posh - The most customisable and low-latency cross platform/shell prompt renderer
oh-my-bash - A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
powerlevel10k - A Zsh theme
oh-my-fish - The Fish Shell Framework
spaceship-prompt - :rocket::star: Minimalistic, powerful and extremely customizable Zsh prompt
zsh-autocomplete - 🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.
zimfw - Zim: Modular, customizable, and blazing fast Zsh framework
powerline-shell - A beautiful and useful prompt for your shell
alacritty - A cross-platform, OpenGL terminal emulator.
thefuck - Magnificent app which corrects your previous console command.