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.
- Host: GitHub
- URL: https://github.com/eth-p/fish-contextual-greeting
- Owner: eth-p
- Created: 2022-09-13T17:49:33.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-27T21:09:41.000Z (over 3 years ago)
- Last Synced: 2025-04-03T11:13:03.074Z (about 1 year ago)
- Topics: fish-plugin, fish-shell, fisher, fisherman
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```