Posts

Showing posts with the label Zsh

Add Timestamp To Oh-my-zsh Robbyrussell Theme

Image
Answer : According to the zshmisc man page there are several % codes for date and time, eg: %D The date in yy-mm-dd format. %T Current time of day, in 24-hour format. %t %@ Current time of day, in 12-hour, am/pm format. %* Current time of day in 24-hour format, with seconds. %w The date in day-dd format. %W The date in mm/dd/yy format. %D{strftime-format} The last one allows codes listed in the strftime(3) man page. Edit your ~/.zshrc file and add at the end a new PROMPT value, eg: PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} %D %T % %{$reset_color%}' If you want add date/time to the right, you set RPROMPT local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' RPROMPT="[%D{%y/%m/%f}|%@]" I added this %D{%m/%f/%y}|%D{%L:%M:%S} to the main theme to disp...

Conda Command Not Found

Answer : If you're using zsh and it has not been set up to read .bashrc, you need to add the Miniconda directory to the zsh shell PATH environment variable. Add this to your .zshrc : export PATH="/home/username/miniconda/bin:$PATH" Make sure to replace /home/username/miniconda with your actual path . Save, exit the terminal and then reopen the terminal. conda command should work. If you have the PATH in your .bashrc file and are still getting conda: command not found Your terminal might not be looking for the bash file. Type bash in the terminal to insure you are in bash and then try: conda --version For those experiencing issues after upgrading to MacOS Catalina. Short version: # 1a) Use tool: conda-prefix-replacement - # Restores: Desktop -> Relocated Items -> Security -> anaconda3 curl -L https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe -o cpr && chmod +x cpr ./cpr rehome ~/anaconda3 # or if fails #./cpr rehome ~/anaconda3 --old...

Add Newline To Oh My ZSH Theme

Image
Answer : I was actually searching for the same answer. But my needs was a little more specific since I only wanted to add a newline in the agnoster theme, the one I'm using now. In my research, I find a lot of forked themes that already do it, but I thought that this was an overkill solution for only add a new line. So I read the agnoster code and come up with this simple solution of overwrite the prompt_end() function in my .zshrc file. To do it, just add the code bellow in your .zshrc file: prompt_end() { if [[ -n $CURRENT_BG ]]; then print -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" else print -n "%{%k%}" fi print -n "%{%f%}" CURRENT_BG='' #Adds the new line and ➜ as the start character. printf "\n ➜"; } Hope it helps you to have a clue on how to customize your chosen theme. Here is the result: I think the proper place to change one's prompt is in the theme itself. On my syst...