Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New terminal tabs do not retain current directory (linux/ubuntu) #2887

Closed
fearphage opened this issue Jun 16, 2014 · 14 comments
Closed

New terminal tabs do not retain current directory (linux/ubuntu) #2887

fearphage opened this issue Jun 16, 2014 · 14 comments

Comments

@fearphage
Copy link

Steps to repro

  1. Open Terminal
  2. Change directory (cd ~/Downloads)
  3. Open a new tab (ctrl-T)

Expected Results

New tab is opened from current directory (~/Downloads).

Actual Results

New tab opens in home directory (~).

This affects all directories (git and otherwise). I'm using Ubuntu 14.04 although I saw similar behavior in 13.10.

Related to #1489, #1527, #2646. I've checked these issues, but all they all seem to be OS X specific.

@mcornella
Copy link
Member

There's a bug in gnome-terminal [1][2], but a fix is already available.

From StackExchange:

add this to .zshrc:

. /etc/profile.d/vte.sh

We could probably add this somewhere, as a plugin or in a lib file. Please confirm that it works for you (it does for me on debian).

[1] https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1132700
[2] https://bugs.launchpad.net/ubuntu-gnome/+bug/1193993

@mcornella
Copy link
Member

@fearphage any news?

@mcornella
Copy link
Member

Hey @fearphage, here's what I put in my zshrc to fix:

# Open new tab in current directory
[[ -f /etc/profile.d/vte.sh ]] && . /etc/profile.d/vte.sh

It looks though as this will be fixed in Ubuntu 15.04, it couldn't make it into 14.10 unfortunately.

What's sure is that this is not oh-my-zsh's fault. Please close this issue

@fearphage
Copy link
Author

Thanks for the time and effort. I apologize for the delayed response. Yes, that fixed it.

@abhisheksoni27
Copy link

I am using Ubuntu 17.04 and this problem is still there.

@XeniaSiskaki
Copy link

Issue is still there in Ubuntu 18.04 LTS

@fearphage
Copy link
Author

The solution is above.

@XeniaSiskaki
Copy link

None of these worked for me

@fearphage
Copy link
Author

I've been using that solution for 4 years now and I'm also on Ubuntu 18.04 currently. Have you tried moving that line earlier or later in your .zshrc? Also keep in mind that you have to make the change, source the updated file, and then open a new tab for it to take effect.

@mcornella
Copy link
Member

Are there any vte files in /etc/profile.d?

@XeniaSiskaki
Copy link

XeniaSiskaki commented Sep 7, 2018

@mcornella

-rw-r--r-- 1 root root 1.9K Apr 10 19:58 vte-2.91.sh
lrwxrwxrwx 1 root root   26 Aug 31 16:19 vte.sh -> /etc/profile.d/vte-2.91.sh

@fearphage The only thing I didn't try was moving the line. I put it in the end
EDIT Tried that also, no change

@mcornella
Copy link
Member

You seem to have the file, I assume you're using gnome-terminal? If so, maybe there's a bug in there? What are the contents of /etc/profile.d/vte.sh?

@XeniaSiskaki
Copy link

I'm sorry for the noise. It is working indeed. I had a cd at the end of my .zshrc which was overriding the current directory I guess

@mcornella
Copy link
Member

No worries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants