diff --git a/shell_integration/bash b/shell_integration/bash index e9ddd0c..f3391ff 100644 --- a/shell_integration/bash +++ b/shell_integration/bash @@ -461,7 +461,7 @@ function iterm2_end_osc { function iterm2_print_state_data() { local _iterm2_hostname="${iterm2_hostname}" if [ -z "${iterm2_hostname:-}" ]; then - _iterm2_hostname=$(hostname -f 2>/dev/null) + _iterm2_hostname=$(uname -n 2>/dev/null) fi iterm2_begin_osc printf "1337;RemoteHost=%s@%s" "$USER" "$_iterm2_hostname" @@ -516,15 +516,11 @@ function iterm2_print_version_number() { } -# If hostname -f is slow on your system, set iterm2_hostname before sourcing this script. -# On macOS we run `hostname -f` every time because it is fast. +# If uname -n is slow on your system, set iterm2_hostname before sourcing this script. +# On macOS we run `uname -n` every time because it is fast. if [ -z "${iterm2_hostname:-}" ]; then if [ "$(uname)" != "Darwin" ]; then - iterm2_hostname=$(hostname -f 2>/dev/null) - # some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option - if [ $? -ne 0 ]; then - iterm2_hostname=$(hostname) - fi + iterm2_hostname=$(uname -n 2>/dev/null) fi fi diff --git a/shell_integration/fish b/shell_integration/fish index 6e66191..84a6b08 100644 --- a/shell_integration/fish +++ b/shell_integration/fish @@ -48,7 +48,7 @@ if begin; status --is-interactive; and not functions -q -- iterm2_status; and [ function iterm2_write_remotehost_currentdir_uservars if not set -q -g iterm2_hostname - printf "\033]1337;RemoteHost=%s@%s\007\033]1337;CurrentDir=%s\007" $USER (hostname -f 2>/dev/null) $PWD + printf "\033]1337;RemoteHost=%s@%s\007\033]1337;CurrentDir=%s\007" $USER (uname -n 2>/dev/null) $PWD else printf "\033]1337;RemoteHost=%s@%s\007\033]1337;CurrentDir=%s\007" $USER $iterm2_hostname $PWD end @@ -108,16 +108,12 @@ if begin; status --is-interactive; and not functions -q -- iterm2_status; and [ end end - # If hostname -f is slow for you, set iterm2_hostname before sourcing this script + # If uname -n is slow for you, set iterm2_hostname before sourcing this script if not set -q -g iterm2_hostname - # hostname -f is fast on macOS so don't cache it. This lets us get an updated version when + # uname -n is fast on macOS so don't cache it. This lets us get an updated version when # it changes, such as if you attach to a VPN. if [ (uname) != Darwin ] - set -g iterm2_hostname (hostname -f 2>/dev/null) - # some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option - if test $status -ne 0 - set -g iterm2_hostname (hostname) - end + set -g iterm2_hostname (uname -n 2>/dev/null) end end diff --git a/shell_integration/source/bash.0 b/shell_integration/source/bash.0 index 4c432f8..cf06c4b 100644 --- a/shell_integration/source/bash.0 +++ b/shell_integration/source/bash.0 @@ -17,7 +17,7 @@ # -- BEGIN ITERM2 CUSTOMIZATIONS -- -if [[ "$ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX""$TERM" != screen && "$ITERM_SHELL_INTEGRATION_INSTALLED" = "" && "$-" == *i* && "$TERM" != linux && "$TERM" != dumb ]]; then +if [[ "$ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX""$TERM" != screen && "$ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX""$TERM" != tmux-256color && "$ITERM_SHELL_INTEGRATION_INSTALLED" = "" && "$-" == *i* && "$TERM" != linux && "$TERM" != dumb ]]; then if shopt extdebug | grep on > /dev/null; then echo "iTerm2 Shell Integration not installed." diff --git a/shell_integration/source/bash.1 b/shell_integration/source/bash.1 index 0d80b77..209366d 100644 --- a/shell_integration/source/bash.1 +++ b/shell_integration/source/bash.1 @@ -24,7 +24,7 @@ function iterm2_end_osc { function iterm2_print_state_data() { local _iterm2_hostname="${iterm2_hostname}" if [ -z "${iterm2_hostname:-}" ]; then - _iterm2_hostname=$(hostname -f 2>/dev/null) + _iterm2_hostname=$(uname -n 2>/dev/null) fi iterm2_begin_osc printf "1337;RemoteHost=%s@%s" "$USER" "$_iterm2_hostname" @@ -74,16 +74,16 @@ function iterm2_prompt_suffix() { function iterm2_print_version_number() { iterm2_begin_osc - printf "1337;ShellIntegrationVersion=17;shell=bash" + printf "1337;ShellIntegrationVersion=18;shell=bash" iterm2_end_osc } -# If hostname -f is slow on your system, set iterm2_hostname before sourcing this script. -# On macOS we run `hostname -f` every time because it is fast. +# If uname -n is slow on your system, set iterm2_hostname before sourcing this script. +# On macOS we run `uname -n` every time because it is fast. if [ -z "${iterm2_hostname:-}" ]; then if [ "$(uname)" != "Darwin" ]; then - iterm2_hostname=$(hostname -f 2>/dev/null) + iterm2_hostname=$(uname -n 2>/dev/null) # some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option if [ $? -ne 0 ]; then iterm2_hostname=$(hostname) diff --git a/shell_integration/tcsh b/shell_integration/tcsh index 450d5d8..4b8c689 100755 --- a/shell_integration/tcsh +++ b/shell_integration/tcsh @@ -35,20 +35,16 @@ if ( ! ($?iterm2_shell_integration_installed)) then alias _iterm2_end_prompt 'printf "\007"' # Define aliases for printing the current hostname - # If hostname -f is slow to run on your system, set iterm2_hostname before sourcing this script. + # If uname -n is slow to run on your system, set iterm2_hostname before sourcing this script. if ( ! ($?iterm2_hostname)) then # hostname is fast on macOS so don't cache it. This lets us have an up to date value if it # changes because you connect to a VPN, for example. if ( `uname` != Darwin ) then - set iterm2_hostname=`hostname -f |& cat || false` - # some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option - if ( $status != 0 ) then - set iterm2_hostname=`hostname` - endif + set iterm2_hostname=`uname -n |& cat || false` endif endif if ( ! ($?iterm2_hostname)) then - alias _iterm2_print_remote_host 'printf "1337;RemoteHost=%s@%s" "$USER" `hostname -f`' + alias _iterm2_print_remote_host 'printf "1337;RemoteHost=%s@%s" "$USER" `uname -n`' else alias _iterm2_print_remote_host 'printf "1337;RemoteHost=%s@%s" "$USER" "$iterm2_hostname"' endif diff --git a/shell_integration/zsh b/shell_integration/zsh index 7871ddd..d172776 100755 --- a/shell_integration/zsh +++ b/shell_integration/zsh @@ -44,7 +44,7 @@ if [[ -o interactive ]]; then iterm2_print_state_data() { local _iterm2_hostname="${iterm2_hostname-}" if [ -z "${iterm2_hostname:-}" ]; then - _iterm2_hostname=$(hostname -f 2>/dev/null) + _iterm2_hostname=$(uname -n 2>/dev/null) fi printf "\033]1337;RemoteHost=%s@%s\007" "$USER" "${_iterm2_hostname-}" printf "\033]1337;CurrentDir=%s\007" "$PWD" @@ -152,17 +152,13 @@ if [[ -o interactive ]]; then iterm2_before_cmd_executes } - # If hostname -f is slow on your system set iterm2_hostname prior to + # If uname -n is slow on your system set iterm2_hostname prior to # sourcing this script. We know it is fast on macOS so we don't cache # it. That lets us handle the hostname changing like when you attach # to a VPN. if [ -z "${iterm2_hostname-}" ]; then if [ "$(uname)" != "Darwin" ]; then - iterm2_hostname=`hostname -f 2>/dev/null` - # Some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option. - if [ $? -ne 0 ]; then - iterm2_hostname=`hostname` - fi + iterm2_hostname=`uname -n 2>/dev/null` fi fi diff --git a/utilities/it2ssh b/utilities/it2ssh old mode 100644 new mode 100755