From ad63831b8f14e8a9ec894802542746dc47c226d8 Mon Sep 17 00:00:00 2001 From: JP Viljoen Date: Sat, 29 Nov 2014 17:44:25 +0200 Subject: [PATCH 1/4] [ssh plugin] 256-colour helper stuff --- plugins/ssh/README.md | 20 ++++++++++++++++++++ plugins/ssh/ssh.fish | 12 ++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 plugins/ssh/README.md create mode 100644 plugins/ssh/ssh.fish diff --git a/plugins/ssh/README.md b/plugins/ssh/README.md new file mode 100644 index 0000000..018a651 --- /dev/null +++ b/plugins/ssh/README.md @@ -0,0 +1,20 @@ +## ssh conservative $TERM value helper plugin + +Due to inconsistency of 256 color terminal support across +terminal applications, it may be desirable to force the +$TERM value to it's -256color variant. + +For example, this is often accomplished in tmux by means +of adding the following to a tmux.conf file: + + set -g default-terminal "screen-256color" + +Unfortunately, remote hosts accessed via ssh may not have +the requisite terminfo files, and may not even allow the +user to supply them, as is often the case with network +equipment and other appliances accessible via ssh. + +This helper strips the -256color suffix and exports a +regular 'screen' or 'xterm' $TERM value when setting up +a ssh connection. + diff --git a/plugins/ssh/ssh.fish b/plugins/ssh/ssh.fish new file mode 100644 index 0000000..e39a9e3 --- /dev/null +++ b/plugins/ssh/ssh.fish @@ -0,0 +1,12 @@ +function ssh --description 'OpenSSH SSH client (remote login program) with a conservative $TERM value' + switch $TERM + case screen-256color + set -l -x TERM screen + command ssh $argv + case xterm-256color + set -l -x TERM xterm + command ssh $argv + case '*' + command ssh $argv + end +end From c761f9442ce9b96b283e36600579250cfe41c906 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 29 Nov 2014 23:10:55 +0100 Subject: [PATCH 2/4] Added documentation link for ssh helper plugin and further cleanup --- plugins/README.markdown | 1 + plugins/ssh/README.md | 10 +++++----- plugins/ssh/ssh.fish | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/README.markdown b/plugins/README.markdown index 2dd4e98..b815c98 100644 --- a/plugins/README.markdown +++ b/plugins/README.markdown @@ -31,6 +31,7 @@ * __rbenv__ – [rbenv](https://github.com/sstephenson/rbenv) Ruby environment/version manager. * __replace__ – A port of [replace](https://github.com/thoughtbot/dotfiles/blob/master/bin/replace). * __rvm__ – [RVM](http://rvm.io) Ruby version manager. +* __ssh__ – ssh conservative $TERM value helper. * __sublime__ – Creates `subl` command line shortcut to launch [Sublime Text editor](http://sublimetext.com/). * __tmux__ – Plugin to start tmux with support for 256 colours. * __vi-mode__ – Basic vi key bindings emulation for fish. diff --git a/plugins/ssh/README.md b/plugins/ssh/README.md index 018a651..0631649 100644 --- a/plugins/ssh/README.md +++ b/plugins/ssh/README.md @@ -1,20 +1,20 @@ -## ssh conservative $TERM value helper plugin +## ssh conservative $TERM value helper Due to inconsistency of 256 color terminal support across -terminal applications, it may be desirable to force the +terminal applications, it may be desirable to force the $TERM value to it's -256color variant. For example, this is often accomplished in tmux by means -of adding the following to a tmux.conf file: +of adding the following to a tmux.conf file: set -g default-terminal "screen-256color" -Unfortunately, remote hosts accessed via ssh may not have +Unfortunately, remote hosts accessed via ssh may not have the requisite terminfo files, and may not even allow the user to supply them, as is often the case with network equipment and other appliances accessible via ssh. -This helper strips the -256color suffix and exports a +This helper strips the -256color suffix and exports a regular 'screen' or 'xterm' $TERM value when setting up a ssh connection. diff --git a/plugins/ssh/ssh.fish b/plugins/ssh/ssh.fish index e39a9e3..14e3edd 100644 --- a/plugins/ssh/ssh.fish +++ b/plugins/ssh/ssh.fish @@ -1,12 +1,12 @@ function ssh --description 'OpenSSH SSH client (remote login program) with a conservative $TERM value' switch $TERM - case screen-256color - set -l -x TERM screen + case screen-256color + set -lx TERM screen command ssh $argv case xterm-256color - set -l -x TERM xterm + set -lx TERM xterm command ssh $argv - case '*' + case '*' command ssh $argv end end From bafb64147ca2a668b40a54ba79c7ae1aa5198ee0 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 29 Nov 2014 23:23:54 +0100 Subject: [PATCH 3/4] Eliminate superficial whitespaces in ssh plugin --- plugins/ssh/README.md | 10 +++++----- plugins/ssh/ssh.fish | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/ssh/README.md b/plugins/ssh/README.md index 0631649..1ed25f2 100644 --- a/plugins/ssh/README.md +++ b/plugins/ssh/README.md @@ -1,20 +1,20 @@ -## ssh conservative $TERM value helper +## ssh conservative $TERM value helper Due to inconsistency of 256 color terminal support across -terminal applications, it may be desirable to force the +terminal applications, it may be desirable to force the $TERM value to it's -256color variant. For example, this is often accomplished in tmux by means -of adding the following to a tmux.conf file: +of adding the following to a tmux.conf file: set -g default-terminal "screen-256color" -Unfortunately, remote hosts accessed via ssh may not have +Unfortunately, remote hosts accessed via ssh may not have the requisite terminfo files, and may not even allow the user to supply them, as is often the case with network equipment and other appliances accessible via ssh. -This helper strips the -256color suffix and exports a +This helper strips the -256color suffix and exports a regular 'screen' or 'xterm' $TERM value when setting up a ssh connection. diff --git a/plugins/ssh/ssh.fish b/plugins/ssh/ssh.fish index 14e3edd..bf6f19c 100644 --- a/plugins/ssh/ssh.fish +++ b/plugins/ssh/ssh.fish @@ -1,12 +1,12 @@ function ssh --description 'OpenSSH SSH client (remote login program) with a conservative $TERM value' switch $TERM - case screen-256color + case screen-256color set -lx TERM screen command ssh $argv case xterm-256color set -lx TERM xterm command ssh $argv - case '*' + case '*' command ssh $argv end end From 1a18186ccadc74e93283b83331ad5a131ac6c347 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sun, 30 Nov 2014 09:42:32 +0100 Subject: [PATCH 4/4] changed code indent to 2 spaces for consistency --- plugins/ssh/ssh.fish | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/ssh/ssh.fish b/plugins/ssh/ssh.fish index bf6f19c..00d1963 100644 --- a/plugins/ssh/ssh.fish +++ b/plugins/ssh/ssh.fish @@ -1,12 +1,12 @@ function ssh --description 'OpenSSH SSH client (remote login program) with a conservative $TERM value' switch $TERM case screen-256color - set -lx TERM screen - command ssh $argv + set -lx TERM screen + command ssh $argv case xterm-256color - set -lx TERM xterm - command ssh $argv + set -lx TERM xterm + command ssh $argv case '*' command ssh $argv - end + end end