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

How can I shorten the prompt? #159

Open
sunilw opened this issue Sep 2, 2021 · 2 comments
Open

How can I shorten the prompt? #159

sunilw opened this issue Sep 2, 2021 · 2 comments

Comments

@sunilw
Copy link

sunilw commented Sep 2, 2021

I know this question has been asked and answered a lot.
But I simply haven't been able to successfully do this:

By default the prompt shows the entire path of the current directory.
I'd just like to show the current directory instead of the whole path.

If that isn't possible, I'll settle for removing everything except the user and host.

@marcflavius
Copy link

unfortunately the theme doesn't offer a lot of customisation. a work around can be done by replacing the function:

 prompt_dir() {
   prompt_segment blue $CURRENT_FG ' %~ '
 }

by

 prompt_dir() {
   prompt_segment blue $CURRENT_FG ' %CD% '
 }

in (User)/.oh-my-zsh/themes/agnoster.zsh-theme

@realamirhe
Copy link

You can fine more info about configuration customization in this comment

prompt_dir() {
  prompt_segment blue $CURRENT_FG '%C' # get last directory in CWD

  # Or get last 2 directories in CWD (e.g. /dir-one/dir-two)
  prompt_segment blue $CURRENT_FG '%2C' 
  prompt_segment blue $CURRENT_FG '%2~'

}

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

3 participants