An open API service indexing awesome lists of open source software.

https://github.com/eth-p/fish-contextual-greeting

Upgrade your fish_greeting experience with greetings that only show up under certain contexts.
https://github.com/eth-p/fish-contextual-greeting

fish-plugin fish-shell fisher fisherman

Last synced: 11 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# Contextual Greetings for Fish Shell

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

## Install

With [fisher](https://github.com/jorgebucaran/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.

```fish
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.

```fish
function greeting_for_ide
echo "You appear to be using an IDE terminal."
end
```

greeting_for_tmux: When inside a tmux pane.

```fish
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:

```fish
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
```