Skip to content

Commit

Permalink
Fish shell (#80)
Browse files Browse the repository at this point in the history
* init

* feat: add picture

* feat: add picture

* feat: add picture

* feat: add gpg configuration draft

* feat: fish chapter init

* feat: fish chapter typos

* feat: NVM chapter typos

* feat: typos & conclusion

* feat: typos

* feat: typos

* feat: version & comment in GH workflow

* fix: typos

* feat:  puoblish now

---------

Co-authored-by: Alexandre Touret <alexandre-touret@users.noreply.github.com>
  • Loading branch information
alexandre-touret and alexandre-touret committed Jul 21, 2023
1 parent a8b6c50 commit 344d875
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Expand Up @@ -25,7 +25,7 @@ jobs:
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' # Authorize the deployment for the main branch only
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
114 changes: 114 additions & 0 deletions content/posts/fish-shell.en.md
@@ -0,0 +1,114 @@
---
title: Moving on to Fish shell (and beyond)
date: 2023-07-21 08:00:00
images: ["/assets/images/2023/07/jakub-kapusnak-vLQzopDRSNI-unsplash.webp"]
featuredImagePreview: /assets/images/2023/07/jakub-kapusnak-vLQzopDRSNI-unsplash.webp
featuredImage: /assets/images/2023/07/jakub-kapusnak-vLQzopDRSNI-unsplash.webp
og_image: /assets/images/2023/07/jakub-kapusnak-vLQzopDRSNI-unsplash.webp
draft: false
tags:
- shell
- GNU/Linux
---

While chatting with one of [my WL colleague](https://twitter.com/foxlegend), I stumbled upon [Fish shell](https://fishshell.com/).
I immediately liked its autocompletion and extensibility mechanisms.
After many years using [BASH](https://www.gnu.org/software/bash/) and [ZSH](https://zsh.sourceforge.io/), I therefore decided to move on to this new [shell](https://en.wikipedia.org/wiki/Unix_shell).

Unlike the others, it's not [POSIX-compatible](https://fishshell.com/docs/current/fish_for_bash_users.html#fish-for-bash-users).

Furthermore, to get (_at least_) the same functionalities as [OhMyZsh](https://github.com/ohmyzsh/ohmyzsh), I chose to install [StarShip](https://starship.rs/).

I will then describe how I moved on and updated my existing tools such as [SdkMan](https://sdkman.io/).

## FISH Installation

{{< admonition info "OS" true >}}
I applied these commands on both [Ubuntu20](http://ubuntu.com/)/[WSL2](https://learn.microsoft.com/fr-fr/windows/wsl/install) and [Linux Mint](https://linuxmint.com/).
{{< /admonition >}}

To install it, run this command:

```jshelllanguage
sudo apt install fish
```

You must also use a font available on the [NerdFonts website](https://www.nerdfonts.com/font-downloads).
By the way, you can also use the fonts available through your package manager.

For instance, I chose using [JetBrains Mono](https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/JetBrainsMono.zip)

After downloading it, you can reload your font cache running this command:

```jshelllanguage
fc-cache -fv
```
## StarShip installation

I ran this command:
```jshelllanguage
curl -sS https://starship.rs/install.sh | sh
```

{{< admonition info "How to update StarShip" true >}}
To update StarShip, you must use the same command.
{{< /admonition >}}

I also added the following command at the end of ``~/.config/fish/config.fish``:

```shell
starship init fish | source
```
Due to some WSL2 incompatibilities, I also chose to use [the plain text presets](https://starship.rs/presets/plain-text.html) running this command:

```jshelllanguage
starship preset plain-text-symbols -o ~/.config/starship.toml
```

## SDKMAN update
At this stage, SdkMan didn't work at all. To put it alive again, I had to install [Fisher](https://github.com/jorgebucaran/fisher) and a [SdkMan for fish plugin](https://github.com/reitzig/sdkman-for-fish).

### Fisher install
Run this command:
```jshelllanguage
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
```
### SdkMan for fish plugin
Run this command:
```jshelllanguage
fisher install reitzig/sdkman-for-fish@v2.0.0
```
### Run SdkMan
Run this command:

```jshelllanguage
sdk ug
```
Say yes and restart a shell.
Now it should work.

## NVM
I had the same issue with [NVM](https://github.com/nvm-sh/nvm).

I then installed another plugin with Fisher:

```jshelllanguage
fisher install jorgebucaran/nvm.fish
```

## GnuPG
I use [GnuPG for signing my GIT commits](https://blog.touret.info/2019/08/09/verifier-les-commit-git-avec-gpg/).
Installing Fisher broke my setup.

I then added this new configuration file ``$HOME/.config/fish/conf.d/config_gpgagent.fish`` with the following content:

```jshelllanguage
set -gx GPG_TTY /dev/pts/0
```
To activate it, restart your shell (again).

## Conclusion
I can now use FISH for my daily job.
As I said first, this article is only a reminder for my next setups (aka when I will broke my GNU/Linux boxes and try to restore them).

Hope it will help you!
Binary file not shown.

0 comments on commit 344d875

Please sign in to comment.