Skip to content

Place current_working_dir in Tab title #5890

Closed Answered by idr4n
idr4n asked this question in Q&A
Discussion options

You must be logged in to vote

Actually, I have resolved this for me using the shell integration instead, that is, setting the window title via the shell. In my case, using fish, I accomplished what I wanted (and more, e.g., adding the git branch as well), with the following:

function fish_title
    # Get shortened path without the full home path
    # basename (prompt_pwd)

    # Get current working directory
    set -l wd (prompt_pwd)

    # Try to get git branch
    set -l git_branch (command git rev-parse --abbrev-ref HEAD 2>/dev/null)

    if test -n "$git_branch"
        echo "$wd ($git_branch)"
    else
        echo $wd
    end
end

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@habahabahaba
Comment options

@estin
Comment options

@habahabahaba
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by idr4n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants