sorin-ionescu / prezto

The configuration framework for Zsh
MIT License
13.99k stars 4.49k forks source link

New tab/window doesn't open on current directory on iterm2 #1247

Open gmattar opened 7 years ago

gmattar commented 7 years ago

Even with Preferences -> Profile -> General -> Working Directory set to "Reuse previous session's directory", a new tab or window always open on ~/.

OSX: El Capitan iTerm2: Build 3.0.20161226-nightly

facastagnini commented 7 years ago

Hey @gmattar this repo is not being maintained, see #1239

The community fork is here https://github.com/zsh-users/prezto, please move this issue to zsh-users and we will be able to help you!

zsh-users is an organization dedicated to host Zsh community projects and therefore became the rational home for a community maintained version of prezto.

belak commented 7 years ago

I'm not able to reproduce this with iTerm2 3.0.15. Do you have any additional information for reproducing this?

gmattar commented 7 years ago

I think this must be a problem with my prezto configs, since it doesn't occur to anyone else and oh-my-zsh works fine. I'll play with different config next weekend, see what happens and let you guys know.

This is the basic of it:

.zpreztorc

zstyle ':prezto:*:*' color 'yes'

zstyle ':prezto:load' pmodule \
  'history' \
  'directory' \
  'completion' \
  'syntax-highlighting' \
  'history-substring-search' \
  'prompt'

zstyle ':prezto:module:editor' key-bindings 'emacs'

zstyle ':prezto:module:prompt' theme 'agnoster'

.zprofile

if [[ "$OSTYPE" == darwin* ]]; then
  export BROWSER='open'
fi

export EDITOR='vim'
export VISUAL='nano'
export PAGER='less'

if [[ -z "$LANG" ]]; then
  export LANG='en_US.UTF-8'
fi

typeset -gU cdpath fpath mailpath path

path=(
  /usr/local/{bin,sbin}
  $path
)

export LESS='-F -g -i -M -R -S -w -X -z-4'
if (( $#commands[(i)lesspipe(|.sh)] )); then
  export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"
fi

if [[ ! -d "$TMPDIR" ]]; then
  export TMPDIR="/tmp/$LOGNAME"
  mkdir -p -m 700 "$TMPDIR"
fi

TMPPREFIX="${TMPDIR%/}/zsh"

.zshrc

if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
  source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi

unsetopt CDABLE_VARS
unsetopt AUTO_NAME_DIRS

export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:$PATH"
export EDITOR='vim'

# improve bash history
export HISTFILE=$HOME/.bash_history

# RVM.
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

# NVM.
export NVM_DIR="$HOME/.nvm"
[ -s /nvm.sh ] && . /nvm.sh 
belak commented 7 years ago

Thanks for following up on this!

I unfortunately wasn't able to reproduce it even with your configuration (though I don't have rvm or nvm installed). Maybe it's an issue with the version of iterm or zsh you're using?

Alternatively, maybe enabling the iterm shell integration would help. Browsing through the code this installs, it looks like it uses some magical escape codes to set CurrentDir, which may help it track properly.

belak commented 7 years ago

Ah, here's the other PR I was thinking of. https://github.com/sorin-ionescu/prezto/pull/1226

sorin-ionescu commented 7 years ago

This is real, and I don't remember why it's happens. The iTerm2 shell integration conflicts. The terminal module, prompt themes, will have to be redone.

gmattar commented 7 years ago

I didn't have time to play with settings this weekend but I have good news. I installed shell integration (as @belak suggested) and now the issue is gone.

I'll try to remove shell integration and activate/deactivate modules to see if I can narrow down the origin of the problem in the coming days.

TiuTalk commented 6 years ago

Hey @gmattar did you end up finding this issue root cause?

gmattar commented 6 years ago

No, but I settle down with the shell integration fix. I haven't seen this issue for a long time.