zsh-syntax-highlighting
zsh-syntax-highlighting copied to clipboard
docs: add debian / ubuntu instructions to source .zshrc file after package …
…install.
related issue: https://github.com/zsh-users/zsh-syntax-highlighting/issues/828
Thanks for the PR!
Could we word it to cater to users of other OSes as well? I think the installation path is /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh on most Linuxes (except perhaps NixOS), /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh on BSD (and for people who ran make install manually), and somewhere under /opt under Homebrew (@phy1729?).
Since it's also generally good to avoid conditionals in documentation, I'm thinking that section could go like this:
[[[ First, install the package:
[bullet point per distro]
Second, enable zsh-syntax-highlighting by adding the following line to the end of your .zshrc:
[bullet point per distro] ]]]
But, obviously, TIMTOWTDI. Whoever writes the patch gets to decide the details :)
Hey Daniel, sounds perfect. Whatever works best for all distros is fine. I just put debian/Ubuntu because that's the only thing I know it's install location, and was assuming someone more knowledgeable would suggest a broader solution.
Can you amend my changes to reflect the idea? I'm not sure how to go about it.
Can you amend my changes to reflect the idea? I'm not sure how to go about it.
I can, but so can you :)
The easiest way is to go to your local clone, make changes, commit them, and then push them to the right branch in your fork on GitHub. (GitHub's UI will tell you that branch in this case is the master branch, as opposed to another named branch.) We can squash the commits for you before we merge.
Some projects will ask you to squash every time you push, or to squash when the PR is ready to be merged. git rebase -i is the workhorse for this. Personally, I recommend to enable vcs_info before using that, since there's statefulness involved.
As far as pushing, I am not familiar with squashing (rebasing?) yet but I have been doing some reading. Regardless, I'll do as you suggested since I don't wanna mess up.
But what I was wondering with my previous message is rather, do you want me to just put the same line for all distros in bullet points? like so?
First, install the package:
[bullet point per distro]
Second, enable zsh-syntax-highlighting by adding the following line to the end of your .zshrc:
- Arch Linux:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- Debian:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- Fedora:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- FreeBSD:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- Gentoo:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- Mac OS X / Homebrew: ???
- NetBSD: ???
- OpenBSD: ???
- openSUSE / SLE:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- RHEL / CentOS / Scientific Linux:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- Ubuntu:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- Void Linux:
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
isn't this a bit redundant? by avoiding conditionals, you mean not doing like this?
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
I saw it was done that way on another part of this document so I thought this would work for everyone with a Linux distro... sorry for so many questions but I'm not sure which way is the best. I'm open to any option, whichever one is best and easiest for the users.
As far as pushing, I am not familiar with squashing (rebasing?) yet but I have been doing some reading. Regardless, I'll do as you suggested since I don't wanna mess up.
Squashing and rebasing are two different manipulations both done through git rebase. However, don't worry about them. Just use git commit and git push for now; we'll worry about the rest.
isn't this a bit redundant?
Yes, and that's why it's not what I suggested :)
What I suggested in https://github.com/zsh-users/zsh-syntax-highlighting/pull/830#issuecomment-902633713 is to have two sets of bullet points: first, the existing one, and second, a new one. I.e., to add the "First…" line, the "Second…" line, and the bullets after the latter, and keep the existing bullets. This way, the second list of bullets could just say "On most Linux distributions, …" and be much easier to follow. Makes sense?
by avoiding conditionals, you mean not doing like this?
I mean, not telling the user "If your system has property X, then do Y" — because then they have to figure out whether their system has property X, and if not, what that means for them.
sorry for so many questions but I'm not sure which way is the best. I'm open to any option, whichever one is best and easiest for the users.
No worries! It's good to take a bit more time now to get this right, since dozens of people will be reading the result in the future.
Okay, does this look right?
First, install the package:
- Arch Linux: community/zsh-syntax-highlighting / AUR/zsh-syntax-highlighting-git
- Debian:
zsh-syntax-highlightingpackage instretch(or in OBS repository)- Fedora: zsh-syntax-highlighting package in Fedora 24+ (or in OBS repository)
- FreeBSD:
pkg install zsh-syntax-highlighting(port name:shells/zsh-syntax-highlighting)- Gentoo: app-shells/zsh-syntax-highlighting
- Mac OS X / Homebrew: brew install zsh-syntax-highlighting
- NetBSD:
pkg_add zsh-syntax-highlighting(port name:shells/zsh-syntax-highlighting)- OpenBSD:
pkg_add zsh-syntax-highlighting(port name:shells/zsh-syntax-highlighting)- openSUSE / SLE:
zsh-syntax-highlightingpackage in OBS repository- RHEL / CentOS / Scientific Linux:
zsh-syntax-highlightingpackage in OBS repository- Ubuntu:
zsh-syntax-highlightingpackage in Xenial (or in OBS repository)- Void Linux:
zsh-syntax-highlighting packagein XBPSSee also repology's cross-distro index
Second, enable zsh-syntax-highlighting by adding the following line to the end of your .zshrc,
- On most Linux distributions (except perhaps NixOS):
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- Mac OS X / Homebrew:
somewhere under /opt under Homebrew (please confirm)- NetBSD and OpenBSD:
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zshThen restart zsh (such as by opening a new instance of your terminal emulator).
Yes :) Push that to the branch, please?
Any OS X users following: could you fill in blank, please?
Cool, it's looking good so far. One last thing, I was thinking it would be a good idea to use echo to add the line through the terminal, as opposed to tediously doing it manually through the filesystem or through nano. Would this version work okay?
Second, enable zsh-syntax-highlighting by sourcing the script. Running this command on the terminal will add the source line to the end of your .zshrc:
- On most Linux distributions (except perhaps NixOS):
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
- Mac OS X / Homebrew, NetBSD and OpenBSD:
echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrcThen restart zsh (such as by opening a new instance of your terminal emulator).
If your .zshrc file is somewhere other than
/home, or if above the command fails, add thesourcecommand manually at the end of.zshrc:
- On most Linux distributions (except perhaps NixOS):
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh- Mac OS X / Homebrew, NetBSD and OpenBSD:
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax->highlighting.zsh
Also, I searched online and it seems that the script location for MacOS is same as the one for BSD (which makes sense as MacOS is on the BSD family). let me know :+1:
Cool, it's looking good so far. One last thing, I was thinking it would be a good idea to use echo to add the line through the terminal, as opposed to tediously doing it manually through the filesystem or through nano. Would this version work okay?
Yes. (It does have a theoretical bug in case the last line of .zshrc doesn't end with a newline, but we needn't worry about that in this context.)
Also, I searched online and it seems that the script location for MacOS is same as the one for BSD (which makes sense as MacOS is on the BSD family). let me know 👍
Thanks for looking. However, "I searched online" does not sound like the most trustworthy of sources. It feels like the difference between translating a single sentence (a) using machine translation, v. (b) by asking a native speaker. I do tend to prefer (b) as it results in higher quality output. (Unless your summary glossed over some details…?)
True, I only found three sources and there is no guarantee they are correct. I don't have a macOS machine to test this so the only thing we can do is wait for an OS X user to fill in.
these are my sources: https://www.reddit.com/r/commandline/comments/l6cpu1/ohmyzsh_plugin_zshsyntaxhighlighting_not_found/ https://blog.bullgare.com/2018/12/setting-zsh-on-you-mac/ https://0n3z3r0n3.medium.com/oh-my-zsh-configuration-guide-for-macos-terminal-3ee6003b09d5
for now I guess this pull request will have to stay in limbo. I'm gonna push my changes to my fork, and if someone can confirm it's correct then we can just go ahead and merge. otherwise if there needs to be a correction I can fix it before merge time. let me know if anything
No reason for the pull request to remain on hold indefinitely. Feel free to fill in the information we know (Linux and BSD) and for OS X, either omit it entirely (leaving it unspecified), or write something to the effect of "We don't know; please submit a documentation patch if you do". Your call ☺
Oh, that's perfect then. There is a higher chance that someone can help if I leave a breadcrumb, so I put a separate bullet for OS X with the info in your quote.
Final push committed. If someone finds the correct script location, I'll be glad to patch it. Otherwise, it's been a pleasure working with you :smile:
Re homebrew, the default location is /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh; however, it seems that homebrew can use other prefixes and does (did?) for newer macs. I believe that
echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
will work in all cases (which is similar to what brew suggests after installation).
Re homebrew, the default location is
/usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh; however, it seems that homebrew can use other prefixes and does (did?) for newer macs. I believe thatecho "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrcwill work in all cases (which is similar to what brew suggests after installation).
Fantastic, added command to the install file. Thanks for the info!
Should be squashed down to one commit, but otherwise LGTM.
Hey, is this PR good to be merged or is there any help needed? I was pointed to this PR following #828 but not sure if any further review is needed here
Merged in 6507190.