marlonrichert / zsh-snap

⚡️ Znap! Fast, easy-to-use tools for Zsh dotfiles & plugins, plus git repos
MIT License
1.32k stars 38 forks source link

[tmux/vterm] znap doesn't seem to be initialized #89

Closed seblemaguer closed 3 years ago

seblemaguer commented 3 years ago

Hello,

and thanks for this nice tool :)

I am facing an issue in regard to the integration of znap/zshrc and screen. I have the following zshrc

#!/bin/zsh
# Load znap
export ZDOTDIR="$HOME/.znap"
ZNAPDIR="$ZDOTDIR/zsh-snap"
ZNAP_ZSH="$ZNAPDIR/znap.zsh"
ZNAP_LOG="$ZNAPDIR/znap.log"
if [ ! -d "$ZDOTDIR" ]; then
    mkdir $ZDOTDIR
    git clone --depth 1 -- https://github.com/marlonrichert/zsh-snap.git $ZNAPDIR
    source $ZNAPDIR/install.zsh
fi
source $ZNAP_ZSH

# Aliases
znap source djui/alias-tips

# Completion/helpers
znap source zsh-users/zsh-completions
znap source marlonrichert/zsh-autocomplete

# oh-my-zsh
znap source ohmyzsh/ohmyzsh lib/{git,colored-man-pages,colorize,command-not-found,history,theme-and-appearance} \
     plugins/{archlinux,docker,docker-compose,python,ripgrep,z}

# Highlighting
znap source zsh-users/zsh-syntax-highlighting

# Theme
znap prompt romkatv/powerlevel10k

When I open a terminal (xterm, gnome-terminal, wezterm), everything works fine. When I open tmux or vterm (in emacs), it looks like that none of the configuration is loaded. Indeed prompt is the default one and completion mechanism raise the following error

(eval):1: _autocomplete.command: function definition file not found

Do you have an idea where I should start to have a look ?

Thanks

marlonrichert commented 3 years ago

Can you please reduce your test case above to the bare minimum needed to reproduce the problem?

seblemaguer commented 3 years ago

sure here is the condensed version

# Load znap
export ZDOTDIR="$HOME/.znap"
ZNAPDIR="$ZDOTDIR/zsh-snap"
ZNAP_ZSH="$ZNAPDIR/znap.zsh"
if [ ! -d "$ZDOTDIR" ]; then
    mkdir $ZDOTDIR
    git clone --depth 1 -- https://github.com/marlonrichert/zsh-snap.git $ZNAPDIR
    source $ZNAPDIR/install.zsh
fi
source $ZNAP_ZSH

znap source marlonrichert/zsh-autocomplete
marlonrichert commented 3 years ago

Can you please include the actual steps needed to reproduce the problem?

seblemaguer commented 3 years ago
  1. I put the content of previous post in my ~/.zshrc
  2. I delete the directory ~/.znap
  3. I open a new terminal and follow the instructions (basically as it clones and source znap, I simply validate the proposed directory where the repo/plugins are kept)
  4. I start tmux
  5. I try to run ls and complete and see error mentioned in the first post
marlonrichert commented 3 years ago
export ZDOTDIR="$HOME/.znap"

That tells Zsh to look for your dotfiles in ~/.znap. However:

  1. I put the content of previous post in my ~/.zshrc

When your start tmux, it starts a new zsh session, which then sees your $ZDOTDIR in the environment and thus looks for your dotfiles in ~/.znap, but doesn't find any there.

Why are you setting $ZDOTDIR in the first place, if you keep your .zshrc file in $HOME anyway?

seblemaguer commented 3 years ago

ah yes. Sorry, I was not even seeing it. Thanks for the reply, that solved it :)