Skip to content

Upgrade your fish_greeting experience with greetings that only show up under certain contexts.

Notifications You must be signed in to change notification settings

eth-p/fish-contextual-greeting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Contextual Greetings for Fish Shell

Upgrade your fish_greeting experience with greetings that only show up under certain contexts.

Install

With fisher:

fisher add eth-p/fish-contextual-greeting

Greetings

Currently, fish-contextual-greeting supports the following greeting contexts:

greeting_for_ssh: When connected through a SSH client.
function greeting_for_ssh
	if contextual_greeting --is-toplevel  # only show if it's not a nested shell
		echo "Hello, $SSH_CLIENT!"
	end
end
greeting_for_ide: When using an IDE terminal.
function greeting_for_ide
	echo "You appear to be using an IDE terminal."
end
greeting_for_tmux: When inside a tmux pane.
function greeting_for_tmux
	tmux list-windows
end

The user's fish_greeting will also be called after the other contextual greetings..

Configuration

Greetings can be configured with variables:

Variable Default Description
contextualgreeting_order 'ssh' 'ide' 'tmux' 'fish' The order in which prefixes are printed.
contextualgreeting_prefix 'greeting_for_' The prefix for greeting functions.
contextualgreeting_redraw false Redraw the greeting if the terminal is resized.

Advanced Features

Event Listener

You can add an event listener for the contextual_greeting event to optionally disable greetings under certain circumstances:

function disable_ide_message_for_tmux --on-event contextual_greeting
	set -l current_context $argv[1]
	if contains "tmux" (contextual_greeting contexts) && test $current_context = "ide" 
		contextual_greeting skip
	end
end

About

Upgrade your fish_greeting experience with greetings that only show up under certain contexts.

Topics

Resources

Stars

Watchers

Forks

Languages