.zsh | zsh setup for revtel | Command Line Interface library
kandi X-RAY | .zsh Summary
kandi X-RAY | .zsh Summary
zsh setup for revtel
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of .zsh
.zsh Key Features
.zsh Examples and Code Snippets
Community Discussions
Trending Discussions on .zsh
QUESTION
I noticed that tab completion for the source
command in Zsh tries to complete a LOT of files. Maybe everything in $PATH? I tried using a blank .zshrc
file to make sure it wasn't anything in there.
ANSWER
Answered 2021-Jun-02 at 07:46Maybe everything in $PATH?
Yes, that is correct. It offers those, because source
will search your the current dir and your $PATH
for any file name you pass it.
To apply your change without modifying the original file, add this to your .zshrc
file after calling compinit
:
QUESTION
This is my full .zshrc:
...ANSWER
Answered 2021-Jun-02 at 07:14plugins
is an array used by $ZSH/oh-my-zsh.sh
. You need to initialize the former before calling the latter. Just initializing plugins
by itself doesn't do anything in Zsh (apart from creating a plain old array).
zsh-syntax-highlighting
and zsh-autosuggestions
mention explicitly in their documentation that they should be sourced after any other plugins.
Finally, if you're going to manually source
a plugin, then you do not need to add it to Oh-My-Zsh's plugins
array.
So, therefore, for your setup, this is the correct way to do things:
QUESTION
I just got a Mac and I'm trying to customize my Zsh prompt with colors but I can't get colors to work. I'm not sure if its because of LS_COLORS or what.
Here's my .zshrc
...ANSWER
Answered 2021-May-30 at 04:46%F
and %f
act more like 'start color' and 'stop color', so they need to surround the text and operators that you want to colorize. Also, very few named colors are supported (just black, red, green, yellow, blue, magenta, cyan and white); you'll have better luck with the numeric values from the xterm column of this table.
Try this:
QUESTION
I have written a script for use internally in my job (it's not much use to anyone outside of my work). I've got a decent zsh completion script for it now which works great.
I'd like to make a --install-zsh-completions
option on the script, which sets up completions automatically.
I see that there are a variety of different ways that zsh can be set up, depending on whether you use oh-my-zsh, prezto or your own configuration. For example, in oh-my-zsh
, you can just put completion scripts in ~/.oh-my-zsh/completions
and they are loaded.
Is there a standard place or way in zsh to install zsh custom completion scripts? For example, should I just modify the .zshrc and add to the fpath
?
ANSWER
Answered 2021-May-29 at 07:25Is there a standard place or way in zsh to install zsh custom completion scripts?
Yes, there is: Just create a symlink in /usr/local/share/zsh/site-functions
that points to your completion function. That's all there is to it.
This dir is by default in every user's $fpath
. So, when they (or whatever framework they're using) calls compinit
, it will be picked up automatically.
QUESTION
I am trying to get git autocomplete working with zsh and am running into a weird error (even though the autocomplete appears to complete successfully):
Installation:
...ANSWER
Answered 2021-May-20 at 19:51Zsh comes with excellent Git completion out of the box. Just throw everything you posted away, except this:
QUESTION
I have oh my zsh installed on mac OS catalina and using iTerm2 as terminal. I am using robbyrussell.zsh-theme
theme and have modified it to print git email in the prompt (More info here). I have modified robbyrussell.zsh-theme
to this:
ANSWER
Answered 2021-May-13 at 09:25This happens because ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}$(git_current_user_email)["
uses double quotes, which causes $(git_current_user_email)
to be evaluated only once when robbyrussell.zsh-theme
gets sourced, not for every prompt.
You can confirm this by running echo "$ZSH_THEME_GIT_PROMPT_PREFIX"
, which should now contain the email address, instead of a literal $(git_current_user_email)
.
Unfortunately you can't use single quotes (which do not evaluate substitutions) either here. As then you'll see a literal $(git_current_user_email)
in your prompt, as the git_prompt_info
function (which uses ZSH_THEME_GIT_PROMPT_PREFIX
internally) does not evaluate it.
What you can do however is to put $(git_current_user_email)
directly into PROMPT
, which does get evaluated on each new prompt.
But we'll need to disable it ourselves when not in a git repository and can't rely on the git plugin.
Something like this:
QUESTION
a simple summary is in the title but to further explain:
Whenever i open my terminal (iterm2) i load into zsh but completions don't seem to work, then when i manually run source .zshrc
it does fully load. I've tried moving stuff around in my .zshrc file to see if the order of loading was incorrect but it didn't fix anything.
My .zshrc file:
...ANSWER
Answered 2021-May-11 at 10:39You're making two mistakes in your .zshrc
file:
- If you do
source $ZSH/oh-my-zsh.sh
, then you shouldn't also doautoload -U compinit && compinit
, because the former includes the latter. plugins=( ... )
should be done before doingsource $ZSH/oh-my-zsh.sh
. The former does not do anything by itself.
So, change the top of your .zshrc
file to this:
QUESTION
I have a function defined in my .zshenv
like this:
ANSWER
Answered 2021-May-05 at 10:28Bash itself can export its functions to other bash shells. It does so by exporting a string environmental variable of the form:
QUESTION
Currently in my .zshrc
I have the following lines to provide some git info:
ANSWER
Answered 2021-May-03 at 18:10That happens because the statement setopt promptsubst
in your function is executed inside the prompt
function, which does setopt localoptions
. So, when prompt
returns, the option gets reset to default.
Instead of setting shell options directly, promptinit
themes are supposed to set the prompt_opts
array:
The array
prompt_opts
may be assigned any of"bang"
,"cr"
,"percent"
,"sp"
, and/or"subst"
as values. The corresponding setopts (promptbang, etc.) are turned on, all other prompt-related options are turned off.
So, for your prompt to use setopt promptsubst
, you should do something like this in your setup
function:
QUESTION
I have a repository where I store all my dotfiles so it's easier to setup a new computer. The repository also contains scripts that install apps, modify my dock, set preferences, update SSH keys, etc. Since the repository updates my SSH keys and modifies my git config, I've found it easier to just download the repository as a ZIP file and then run the starting script (vs. setting up Git manually and then cloning the repository).
However, I just did this to setup a new computer and used unzip dotfiles.zip
to unzip the repository and it looked like some of my setup actually ran (setting up sym-links).
ANSWER
Answered 2021-May-03 at 15:53Most likely because the zip file was created with symlinks.
From the zip man page:
-y | --symlinks
For UNIX and VMS (V8.3 and later), store symbolic links as such in the zip archive, instead of compressing and storing the file referred to by the link. This can avoid multiple copies of files being included in the archive as zip recurses the directory trees and accesses files directly and by links.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install .zsh
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page