Giter Site home page Giter Site logo

termtitle's Introduction

termtitle

Sets a custom terminal title.

Settings

The default terminal title format is %n@%m: %~, which corresponds to username@host: /path/to/working/directory.

You can set your format using prompt expansion escape sequences. The following example sets the format to show the current directory name:

zstyle ':zim:termtitle' format '%1~'

Apple Terminal does not support the above, but a working directory escape sequence which is sent instead.

By default, the terminal title is updated before each prompt. The hooks to be used can be customized with the zstyle below. For example, to have the title updated when a command is about to be executed and also before each prompt:

zstyle ':zim:termtitle' hooks 'preexec' 'precmd'

A custom title format can be set for each separate hook using the following syntax:

zstyle ':zim:termtitle:<hook>' format '<format>'

For example, to set the titles to show the command name typed by the user while the command is being executed and then the current directory name after the command ended (i.e. before each prompt):

zstyle ':zim:termtitle' hooks 'preexec' 'precmd'
zstyle ':zim:termtitle:preexec' format '${${(A)=1}[1]}'
zstyle ':zim:termtitle:precmd'  format '%1~'

Add the zstyles to your ~/.zshrc. Make sure you add them before where the module is initialized.

termtitle's People

Contributors

ad1217 avatar csraghunandan avatar ericbn avatar mat813 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

termtitle's Issues

Dynamically change the terminal title when a command is being ran

Hello everyone.

I wish to update my term title to hide personal information such as the user and hostname. To do so I added this my zim config:

zstyle ':zim:termtitle' format '%~'

It works well. But when I run a command, I get something like (example running nvim):

user@host: nvim

I guess something else takes precedence and updates the title with another format, but I don't know what. Maybe the default zsh config ? (that's the part I'm confused about)

I tried to add the hooks line:

zstyle ':zim:termtitle' hooks 'precmd' 'preexec'

and it, indeed, shows the current directory, even when I run a command.

However, I would like the title to show the current command in place of the working directory when I run a command. Is there a way to do that with termtitle ?

Thank you for your attention !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.