Closed Ahira-hub closed 4 years ago
Where do I edit which plugins are being loaded?
See how it's done with ohmyzsh
and do the same.
I want to use marlonrichert / zsh-autocomplete
In a nutshell:
z4h install marlonrichert/zsh-autocomplete || return
source
plugins from ohmyzsh:
z4h source $Z4H/marlonrichert/zsh-autocomplete/zsh-autocomplete.zsh
_zsh_autocomplete__main
I took these from the documentation on https://github.com/marlonrichert/zsh-autocomplete and replaced git clone
with z4h install
and source
with z4h source
. You can also follow the documentation literally and do plain git clone
and source
.
and I believe it interferes with the built-in autocomplete.
The built-in autocomplete in zsh4humans is just a binding for Tab. If this binding is overridden, then the built-in autocomplete is disabled.
That said, marlonrichert/zsh-autocomplete doesn't integrate well with other plugins and settings, so if you attempt to use it in zsh4humans you'll likely run into issues. Looking at the source code of marlonrichert/zsh-autocomplete, it's not at the point of maturity where I could recommend it to anyone other than hardcore experts who understand how zsh works and can patch marlonrichert/zsh-autocomplete to make it compatible with the rest of their setup.
The primary value of zsh4humans comes from careful integration of all parts that it uses. You can freely add extra plugins (pyenv, nvm, z, etc.) and they will work fine. However, if you decide to replace some core part (such as completion or syntax highlighting), then it'll be your job to ensure it plays well with everything else.
I've sourced zinit in the .zshrc file, but I'm not sure if this is proper and will cause issue.
You can use zinit but it'll mostly defeat the point of using zsh4humans.
is possible to isolate your SSH functionality (take your zsh settings with you) and use it in a new setup?
Yes, this should be possible if you have enough determination. zsh4humans is released under MIT license, so you can copy and modify parts of its code.
Thank you for the input. I'll stick with z4h as is. You're right about the other plugin, it doesn't play nice with anything else, not just z4h.
If there is something you do with zinit that you aren't sure how to do without, please post the zinit
command and I'll do my best to help you translate it.
Hello @romkatv I've been using Z4H since opening this ticket and it's been great! Thank you so much for your efforts in this. It's greatly appreciated by noobs like me! One issue I've run into is adding the below lines to my .zshrc:
######## Things I've added########
(cat ~/.cache/wal/sequences &)
###Polybar - pywal transparency###
z4h source ~/.cache/wal/colors.sh
##22 is the amount of transparancy. From 00-FF
export color0_alpha="#22${color0/'#'}"
neofetch
Neofetch is running, but I don't believe the cat statement or export are. The end result should be that any new terminal I open will have the colors generated by pywal. Also, when I echo the color0_alpha, it is not changing. To test this, I added the same lines to my .zshrc backup from before z4h and it worked as intended. Any input you can provide on what I'm doing wrong would be great! Thank you again :).
(cat ~/.cache/wal/sequences &)
This line doesn't make sense to me. Why double fork and cat in the background? Did you mean this?
>$TTY <~/.cache/wal/sequences
It should be 100+ times faster and won't randomly crash cat
.
z4h source ~/.cache/wal/colors.sh
This looks fine. Note that it does nothing unless TERM
is linux
.
export color0_alpha="#22${color0/'#'}"
Where does color0
come from? The only thing you've sourced is ~/.cache/wal/colors.sh
and it doesn't export anything, at least it doesn't in my setup.
So this line ends up being:
export color0_alpha="#22"
Thanks for the reply. The color0 is coming from the pywal scrip colors.sh. This link I think will give it more sense: https://github.com/dylanaraps/pywal/issues/132 `# Shell variables
wallpaper='/home/XXXX/.config/wpg/wallpapers/kame.jpg'
background='#25243e' foreground='#e8cac0' cursor='#e8cac0'
color0='#25243e' color1='#5A8FE6' color2='#9C738F' color3='#435BB1' color4='#5566A5' color5='#4D75CC' color6='#5686D5' color7='#e8cac0' color8='#a28d86' color9='#5A8FE6' color10='#9C738F' color11='#435BB1' color12='#5566A5' color13='#4D75CC' color14='#5686D5' color15='#e8cac0'
export FZF_DEFAULT_OPTS=" $FZF_DEFAULT_OPTS --color fg:7,bg:0,hl:1,fg+:232,bg+:1,hl+:255 --color info:7,prompt:2,spinner:1,pointer:232,marker:1 "
export LS_COLORS="${LS_COLORS}:su=30;41:ow=30;42:st=30;44:" `
Thanks for the reply. The color0 is coming from the pywal scrip colors.sh.
I see. I confused ~/.cache/wal/colors.sh
with ~/.cache/wal/colors-tty.sh
.
So, do you have a question?
Is there a certain order where the cat statement needs to be? In a blank .zshrc it works, in Z4H .zshrc, it doesn't. I'm trying to troubleshoot why. I see your examples in the .zshrc, and add the above lines in the correct places, but they don't seem to have an effect. What I want to happen;
New st terminals spawn with the colors indicated in colors.sh. In the pywal documentaion, it states the cat statement is necessary for this.
https://github.com/dylanaraps/pywal/wiki/Getting-Started
Add this line to your shell startup file. (.bashrc, .zshrc, .mkshrc etc.)
# Import colorscheme from 'wal' asynchronously
# & # Run the process in the background.
# ( ) # Hide shell job control messages.
(cat ~/.cache/wal/sequences &)
# Alternative (blocks terminal for 0-3ms)
cat ~/.cache/wal/sequences
# To add support for TTYs this line can be optionally added.
source ~/.cache/wal/colors-tty.sh`
Is there a certain order where the cat statement needs to be? In a blank .zshrc it works, in Z4H .zshrc, it doesn't. I'm trying to troubleshoot why. I see your examples in the .zshrc, and add the above lines in the correct places, but they don't seem to have an effect. What I want to happen;
New st terminals spawn with the colors indicated in colors.sh. In the pywal documentaion, it states the cat statement is necessary for this.
This documentation is incorrect. Please see my previous comment and replace the cat
line as indicated.
Does it work if you do that?
Unfortunately, it did not.
I went ahead and tried your command with my old .zshrc, it DOES work there.
Please post your .zshrc
(the one which doesn't work) and describe what you expect and what actually happens.
What is happening:
$TTY <~/.cache/wal/sequences is not being executed.
What I expect: Upon starting a new terminal, the above command will run and in conjuction with pywal, will update the terminal colors.
Note: if I run this command directly in a terminal session, it does update the color.
# Export XDG environment variables. Other environment variables are exported later.
export XDG_CACHE_HOME="$HOME/.cache"
# URL of zsh4humans repository. Used during initial installation and updates.
Z4H_URL="https://raw.githubusercontent.com/romkatv/zsh4humans/v2"
# Cache directory. Gets recreated if deleted. If already set, must not be changed.
: "${Z4H:=${XDG_CACHE_HOME:-$HOME/.cache}/zsh4humans}"
# Do not create world-writable files by default.
umask o-w
# Fetch z4h.zsh if it doesn't exist yet.
if [ ! -e "$Z4H"/z4h.zsh ]; then
mkdir -p -- "$Z4H" || return
>&2 printf '\033[33mz4h\033[0m: fetching \033[4mz4h.zsh\033[0m\n'
if command -v curl >/dev/null 2>&1; then
curl -fsSL -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
else
wget -O- -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
fi
mv -- "$Z4H"/z4h.zsh.$$ "$Z4H"/z4h.zsh || return
fi
# Code prior to this line should not assume the current shell is Zsh.
# Afterwards we are in Zsh.
. "$Z4H"/z4h.zsh || return
# 'ask': ask to update; 'no': disable auto-update.
zstyle ':z4h:' auto-update ask
# Auto-update this often; has no effect if auto-update is 'no'.
zstyle ':z4h:' auto-update-days 28
# Stability vs freshness of plugins: stable, testing or dev.
zstyle ':z4h:*' channel stable
# Bind alt-arrows or ctrl-arrows to change current directory?
# The other key modifier will be bound to cursor movement by words.
zstyle ':z4h:' cd-key alt
# Right-arrow key accepts one character ('partial-accept') from
# command autosuggestions or the whole thing ('accept')?
zstyle ':z4h:autosuggestions' forward-char partial-accept
if (( UID && UID == EUID && ! Z4H_SSH )); then
# When logged in as a regular user and not via `z4h ssh`, check that
# login shell is zsh and offer to change it if it isn't.
z4h chsh
fi
# Clone additional Git repositories from GitHub. This doesn't do anything
# apart from cloning the repository and keeping it up-to-date. Cloned
# files can be used after `z4h init`.
#
# This is just an example. If you don't plan to use Oh My Zsh, delete this.
z4h install ohmyzsh/ohmyzsh || return
>$TTY <~/.cache/wal/sequences
# Install or update core components (fzf, zsh-autosuggestions, etc.) and
# initialize Zsh. After this point console I/O is unavailable. Everything
# that requires user interaction or can perform network I/O must be done
# above. Everything else is best done below.
z4h init || return
# Enable emacs (-e) or vi (-v) keymap.
bindkey -e
# Export environment variables.
export EDITOR=nano
export GPG_TTY=$TTY
export color0_alpha="#00${color0/'#'}"
# Extend PATH.
path=(~/bin $path)
# Use additional Git repositories pulled in with `z4h install`.
#
# This is just an example that you should delete. It doesn't do anything useful.
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/diagnostics.zsh
z4h source $Z4H/ohmyzsh/ohmyzsh/plugins/emoji-clock/emoji-clock.plugin.zsh
fpath+=($Z4H/ohmyzsh/ohmyzsh/plugins/supervisor)
# Source additional local files.
if [[ $LC_TERMINAL == iTerm2 ]]; then
# Enable iTerm2 shell integration (if installed).
z4h source ~/.iterm2_shell_integration.zsh
fi
# Define key bindings.
bindkey -M emacs '^H' backward-kill-word # Ctrl-H and Ctrl-Backspace: Delete previous word.
# Sort completion candidates when pressing Tab?
zstyle ':completion:*' sort false
# Should cursor go to the end when Up/Down/Ctrl-Up/Ctrl-Down fetches a command from history?
zstyle ':zle:(up|down)-line-or-beginning-search' leave-cursor no
# When presented with the list of choices upon hitting Tab, accept selection and
# trigger another completion with this key binding. Great for completing file paths.
zstyle ':fzf-tab:*' continuous-trigger tab
# Autoload functions.
autoload -Uz zmv
# Define functions and completions.
function md() { [[ $# == 1 ]] && mkdir -p -- "$1" && cd -- "$1" }
compdef _directories md
# Define aliases.
alias tree='tree -a -I .git'
# Add flags to existing aliases.
alias ls="${aliases[ls]:-ls} -A"
# Set shell options: http://zsh.sourceforge.net/Doc/Release/Options.html.
setopt glob_dots # glob matches files starting with dot; `ls *` becomes equivalent to `ls *(D)`
######## Things I've added########
###Polybar - pywal transparency###
z4h source ~/.cache/wal/colors.sh
>$TTY <~/.cache/wal/sequences
##22 is the amount of transparancy. From 00-FF
export color0_alpha="#00${color0/'#'}"
neofetch
Do I understand correctly that the problem is that >$TTY <~/.cache/wal/sequences
in your .zshrc
has no effect? Can you remove all other customizations from .zshrc
? Can you add this command only once (currently you have it twice)?
Please post ~/.cache/wal/sequences
here.
How did you create t?
Yes, that is exactly the issue. I have reinstalled Z4H and only added >$TTY command. Behavior is still the same (no effect).
~/.cache/wal/sequences
4;0;#0000004;1;#5f87874;2;#fbcb974;3;#e78a534;4;#8888884;5;#9999994;6;#aaaaaa4;7;#c1c1c14;8;#3333334;9;#5f87874;10;#fbcb974;11;#e78a534;12;#8888884;13;#9999994;14;#aaaaaa4;15;#c1c1c110;#c1c1c111;#00000012;#c1c1c113;#c1c1c117;#c1c1c119;#0000004;232;#0000004;256;#c1c1c1708;#000000
This file is created by the pywal app. It generates a series of colors based off a wallpaper image.
Is that really the content of ~/.cache/wal/sequences
? It looks corrupted.
Could you run ( cd ~/.cache/wal && tar -czf sequences.tar.gz sequences )
and then attach ~/.cache/wal/sequences.tar.gz
to this issue?
I cannot reproduce this with a valid ~/.cache/wal/sequences
.
I've added the following line to .zshrc
just after . "$Z4H"/z4h.zsh || return
:
[[ -r ~/.cache/wal/sequences ]] && <~/.cache/wal/sequences
Works fine. If this doesn't work for you, my only explanation is that your ~/.cache/wal/sequences
is corrupted.
Understood. Thank you for all the help! I'll get this figured out :).
Can you please try what I suggested?
I’m sorry I didn’t say, I did try it immediately, but it still did not work. I will spin up a vm and do a clean install to test. This must be something on my machine.
Hello, First thank you for a wonderful ZSH experience for beginners. I wish I'd found it earlier. Just a couple questions, and sorry in advance if this is really basic: