I have hyper.js 3.0.2 terminal on mac (10.14.3).
My goal is to change the tab title like https://www.npmjs.com/package/hyperterm-title.
But it not working.
Please begin following what is written in the "Usage" section of their GitHub's Readme:
To test this out, you can tell the shell to suggest a different title:
function title() { echo -e "\033]0;${1:?please specify a title}\007" ; }
title "My Title"
And then, to persist this function, add it to end of your shell profile file (.bash_profile in case of Bash, .zprofile in case of ZSH).
Related
I have iTerm Build 3.3.9 installed. I have configured oh-my-zsh with following plugins & themes
ZSH_THEME="powerlevel10k/powerlevel10k"
ZSH_DISABLE_COMPFIX="true"
plugins=(aws git colored-man-pages colorize github virtualenv pip python osx zsh-syntax-highlighting zsh-completions zsh-autosuggestions django npm zsh-interactive-cd zsh-navigation-tools)
Now there are 2 issues that i am trying to solve
See the , I have written the command uptil aws cognito-i and remaining is appearing as autosuggestion. the problem is that with my setup (probably theme but i have tried multiple themes) i am unable to distinguish between the command that i have typed and the command is being suggested. normally suggested command should appear a little dimmer but its the same color/opacity as the one that i have written. how to fix this
The second issue is that whenever i run a command with aws cli (also with aws-nuke, the response is opened with a new vi type window, i.e., the commands get removed and i see blank window with each line starting with ~ and at the end of the window it says END. Why is it happening and how to fix this as well
To fix the first issue try moving zsh-syntax-highlighting to the very end of plugins. From zsh-syntax-highlighting FAQ:
Why must zsh-syntax-highlighting.zsh be sourced at the end of the .zshrc file?
zsh-syntax-highlighting.zsh wraps ZLE widgets. It must be sourced
after all custom widgets have been created (i.e., after all zle -N
calls and after running compinit). Widgets created later will work,
but will not update the syntax highlighting.
To fix the second issue add the following at the end of ~/.zshrc:
# Use `less` as pager in Zsh.
READNULLCMD=less
# Use `less` as pager in external commands.
export PAGER=less
# This affects every invocation of `less`.
#
# -i case-insensitive search unless search string contains uppercase letters
# -R color
# -F exit if there is less than one page of content
# -X keep content on screen after exit
# -M show more info at the bottom prompt line
# -x4 tabs are 4 instead of 8
export LESS=-iRFXMx4
When using iTerm2, every time I open it or open a new window, a 1 automatically appears in the input field and in the "last login" string above it. In the last login string, it appears before "Last login" when I first open iTerm, but appears as 1% on a new line when I open a new window.
I use the latest iTerm (3.3.7), as well as oh-my-zsh. I don't have anything defined as a command to run at the start of a session in iTerm's preferences. Up until this last update, I was able to keep the dreaded "1" from appearing by adding prompt_context () { } to my .zshrc file — but even that doesn't seem to help anymore. That said, if I completely delete the .zshrc file, the problem still persists.
Here's my current .zshrc file (minus a bunch of auto-generated, commented out lines):
ZSHING_PLUGINS=(
"https://gitlab.com/zakariaGatter/zshing"
)
# source zshing plugin
source $HOME/.zshing/zshing/zshing.zsh
# Path to your oh-my-zsh installation.
export ZSH="/Users/dc/.oh-my-zsh"
ZSH_THEME=powerlevel10k/powerlevel10k
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"POWERLEVEL9K_MODE='nerdfont-complete'
source ~/powerlevel9k/powerlevel9k.zsh-theme
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
git-flow-completion
zsh-syntax-highlighting
zsh-autosuggestions
)
source $ZSH/oh-my-zsh.sh
# User configuration
export EDITOR="/usr/local/bin/atom --wait"
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE_COUN=4
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
POWERLEVEL9K_DISABLE_PROMPT=true
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="▶ "
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=""
alias ls='ls -G'
# redefine prompt_context for hiding user#hostname
prompt_context () { }
eval $(thefuck --alias)
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
Here's an image of what happens when I open iTerm2 (I tried to add clear as a command to run at the start of a session to mitigate the problem via general config, but it just ended up sending 1clear instead, so that's why the autocomplete shows what it does):
https://i.gyazo.com/4c6cf3826a2da40d5a8fe225b7d030c7.png
Here's an image of what happens when I open a new iTerm2 window from an existing session: https://i.gyazo.com/06c3ce5727afe053e4f9ec2cd07c26f0.png
Here's an image of my profile's general config — I originally just put the clear in the "send text at start" option:
https://i.gyazo.com/1c3d407686047ddf1fddd957b209bef4.png
Thanks in advance to anyone who takes the time to help!
I'm not quite sure why this worked, but this fixed it:
Go to iTerm2 > Preferences > Profiles > Window
Under the "Settings for New Windows" section, change the "Space" setting from the dropdown to "Current Space"
Having just installed VScode I have noticed as it uses Bash by default on OSX, with the shell's default prompt of bash-3.2$; consequently, I cannot see the current working directory. It means having to type 'pwd' and 'ls' quite frequently which is obvious quite tedious.
I have tried changing the default shell in the settings to
"terminal.integrated.shell.osx": "/Applications/Utilities/Terminal.app"
or
"terminal.integrated.shell.osx": "/Applications/iTerm.app"
This doesn't seem to work, have I made a mistake here?
I would also like to know if I am limited to bash, can I configure it to display the working directory instead of simply bash-3.2$ ?
See this screenshot of how the VSCode integrated terminal looks by default
Thanks in advance!
I use Ubuntu, and only add the following lines to the end of ~/.bashrc:
if [ "$TERM_PROGRAM" = "vscode" ]; then
PS1='\$ '
fi
Try it and let me know if it works on your OS.
You can set your prompt to contain the current working directory by defining PS1 as follows:
PS1="\w $"
The $ is just some visual sugar. There all manner of things you can have your prompt display. Put the definition in your ~/.bashrc or ~/.profile for it to be set when you login.
Check out the Controlling the Prompt section of the GNU Bash manual for details.
If you are not accustomed to editing your bash init files you can do it with Visual Studio Code by going to View->Command Palette and execute the following command (one-time only):
Install 'Code' command in path
Then open the integrated terminal and type the following:
code ~/.bashrc
Then add the PS1 definition to the bottom of that file.
I want to change the tab title in iTerm2 if a specific command is run. Specifically, when the runserver command from django is run, I would like the tab to show 'runserver' in the title.
I've been experimenting with bash escape codes, but I can't find something to do this. I have seen trap brought up in similar questions, but I can't find great documentation on how to do something like what I want.
iTerm2 also has 'triggers' in preferences that checks for regex matches, but I can't get the 'command' portion to execute. I.e. catching the string 'Starting development server at' via regex and running the command echo test does not do anything.
Open 'Preference' (⌘+,)
Select 'Appearance' Tab
Select 'Show current job name' in field 'Windows & Tab Titles'
Base on iTerm 2.9
Is there way to set terminator (Version: 0.95ppa1) title of tabs to a different string via bash command-line (CLI)?
I plan to use this feature with AutoKey and I can open multiple machines at same time and set title to Name of the machine its connected to.
ORIG=$PS1
TITLE="\e]2;\"This is just crazy enough to work\"\a"
PS1=${ORIG}${TITLE}
Resets title to
"This is just crazy enough to work"
This should apply to all xterm-style terminal emulators.
From the Terminator man pages,
Ctrl+Alt+W
Rename window title.
Ctrl+Alt+A
Rename tab title.
Ctrl+Alt+X
Rename terminal title.
You can also launch a new instance with
$ terminator --title [title]
Add follwing in your .bashrc file by editing it using vim ~/.bashrc and use set_title to rename your tab:
set_title()
{
ORIG=$PS1
TITLE="\e]2;$*\a"
PS1=${ORIG}${TITLE}
}
run source ~/.bashrc command after editing your .bashrc file
Ex.: set_title newtab will rename your current tab to newtab
working Properly in Gnome3.14 terminal and terminator 0.97
On Terminator 1.91-6 double click terminal title enables edition
PS1 does not need to be set. Credit for this function goes to geirha on freenode #bash
set_title() { printf '\e]2;%s\a' "$*"; }
This seems to work for me. I'm using BASH on Crunchbang (Debian derived)
$ echo -en '\e]0;echo works too\a'
With Terminator 0.96 and GNU bash 4.2.25 the printf suggestion above worked for me, but I had to tweak it slightly to make it into a function that would just work for me in a new Terminator tab. I added this to the end of my ~/.bashrc file:
set_title() { printf "\e]2;$*\a"; }
The key was placing the \a at the end of the quoted string. Then when opening a new tab in Terminator I can use this like so:
set_title "My new tab title"
Apologies to those who already stated the essentials of this answer, but since I found that I had to make slight changes to get it to work for me, this my also benefit someone else.
Try add PROMPT_COMMAND='echo -en "\033]0; $("pwd") \a"' in your .bashrc
For terminator 0.98 (Ubuntu 16.04 MATE), right clicking the title enables renaming it.
Right click on terminator and choose preferences from the drop-down menu. Choose profiles tab and enable "show title bar" option. It works!!
Tip: You can actually rename each terminator window!!