(post-update): From Bash to Fish: fishing after 15 years

Add alias files in conf.d, add completions section
This commit is contained in:
Eduard Tolosa 2025-02-28 19:48:24 +00:00
parent 3360ce2f16
commit adb444cee0

View file

@ -52,7 +52,7 @@ paru -S oh-my-posh-bin
## Configuration ## Configuration
The Fish configuration is stored in `~/.config/fish/`. The main configuration file is `~/.config/fish/config.fish`. You can also have a `~/.config/fish/functions/` directory to store your functions, and a `~/.config/fish/completions/` directory to store your completions. There's also a `~/.config/fish/conf.d/` directory to store your drop-in configuration files. The Fish configuration is stored in `~/.config/fish/`. The main configuration file is `~/.config/fish/config.fish`. You can also have a `~/.config/fish/functions/` directory to store your functions, and a `~/.config/fish/completions/` directory to store your completions. There's also a `~/.config/fish/conf.d/` directory to store your drop-in configuration files which gets sourced when Fish starts.
### Main configuration file ### Main configuration file
@ -73,15 +73,6 @@ set -x DOTNET_CLI_TELEMETRY_OPTOUT 1
set -x PATH $PATH \ set -x PATH $PATH \
$HOME/.local/bin $HOME/.local/bin
# Source aliases (if files exist)
if test -f ~/.config/fish/aliases/aliases.fish
source ~/.config/fish/aliases/aliases.fish
end
if test -f ~/.config/fish/aliases/private-aliases.fish
source ~/.config/fish/aliases/private-aliases.fish
end
# Run only in interactive sessions # Run only in interactive sessions
if status is-interactive if status is-interactive
# Initialize Oh My Posh # Initialize Oh My Posh
@ -146,6 +137,31 @@ end
``` ```
{% endraw %} {% endraw %}
### Aliases
Aliases use a slightly different syntax in Fish. Here's an example of a few aliases that I use:
{% raw %}
```sh
# Use `eza` instead of `ls`
alias ls "eza"
# Upload Gists
alias gist "gh gist create"
# Some ls aliases
alias ll 'eza -l'
alias la 'eza -la'
alias l 'eza -hF'
```
{% endraw %}
So, just migrate your aliases and put the resulting file(s) in `~/.config/fish/conf.d/`.
### Completions
Fish automatically searches through any directories in the list variable `$fish_complete_path`, and any completions defined are automatically loaded when needed. Most software already have Fish completions, but if you need to create your own, see the [official documentation](https://fishshell.com/docs/current/completions.html).
### Plugins ### Plugins
Fish has a nice plugin system, you can use [Fisher](https://github.com/jorgebucaran/fisher) to manage your plugins. It's very easy to use, and you can install plugins with a single command. Here's a list of some plugins that I use: Fish has a nice plugin system, you can use [Fisher](https://github.com/jorgebucaran/fisher) to manage your plugins. It's very easy to use, and you can install plugins with a single command. Here's a list of some plugins that I use: