Skip to content

tahmidul612/fish-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Setup Fish Shell

Fish is a smart & user-friendly command line shell for Linux, macOS, and the rest of the family. Unlike other shells, which disable certain features by default to save system resources, Fish enables all features by default—finally, a command line shell for the 90s!

A curation of plugins, prompts, and other treasures for the friendly interactive shell. This page is not an official Fish project. We do not to advertise for profit. Want to have your project featured here? Send us a pull request.

Official Resources

Community Resources


Install Fish

Ubuntu

sudo apt-add-repository ppa:fish-shell/release-4
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install fish
chsh -s $(which fish)
fish_add_path -m ~/.local/bin

Arch

sudo pacman -S fish
chsh -s $(which fish)
fish_add_path -m ~/.local/bin

Fonts

Nerd-Fonts - Iconic font aggregator, collection, & patcher

Install FiraCode

git clone --filter=blob:none --sparse https://github.com/ryanoasis/nerd-fonts
cd nerd-fonts
git sparse-checkout add patched-fonts/FiraCode
./install.sh FiraCode

Plugins

Fisher - Manage functions, completions, bindings, and snippets from the CLI

curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher

fzf - Ef-🐟-ient key bindings for junegunn/fzf. (Alternative)

Install dependencies

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
  • fd

    Ubuntu

    sudo apt install fd-find
    ln -s $(which fdfind) ~/.local/bin/fd

    Arch

    paru -S cachyos-extra-v3/fd
  • bat

    Ubuntu

    sudo apt install bat
    ln -s /usr/bin/batcat ~/.local/bin/bat

    Arch

    paru -S cachyos-extra-v3/bat

Finally install fzf with Fisher

fisher install PatrickF1/fzf.fish

Sponge - Clean command history from typos automatically

fisher install meaningful-ooo/sponge

⛔ Purge only on exit

Sometimes you want to ignore sponge_delay variable and access the whole history of the current session. In such cases you can instruct Sponge to purge entries only on shell exit with sponge_purge_only_on_exit variable:

set sponge_purge_only_on_exit true

Autopair - Auto-complete matching pairs in the Fish command-line. (Alternative)

fisher install jorgebucaran/autopair.fish

Getopts - CLI options parser (alternative to the argparse builtin)

fisher install jorgebucaran/getopts.fish

Install pyenv:

curl -fsSL https://pyenv.run | bash

Configure fish shell to use pyenv:

set -Ux PYENV_ROOT $HOME/.pyenv
test -d $PYENV_ROOT/bin; and fish_add_path $PYENV_ROOT/bin

Install a pyenv fisher plugin to setup completions and shell integration:

fisher install amir20/fish-pyenv 

Prompts

Tide - A modern prompt manager for Fish

fisher install IlanCosman/tide@v6

Extra Modifications

Multiplexer (Byobu)

https://alexsavio.github.io/how-to-byobu.html

  • Install byobu

    Ubuntu

    sudo apt install byobu

    Arch

    sudo pacman -S byobu
  • Start byobu on login

    byobu-enable
  • Enable mouse in byobu

    • Create/open ~/.byobu/profile.tmux and add the following lines

      source $BYOBU_PREFIX/share/byobu/profiles/tmux
      
      ## Make mouse useful, tmux > 2.1 include select, resize pane/window and console wheel scroll
      set -g mouse on
      
      ## Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access
      set -s escape-time 50

      rodricels/.tmux.conf

Custom Fish Keybindings

  • Delete next word with Ctrl + Delete and previous word with Ctrl + Backspace

    • Open ~/.config/fish/functions/fish_user_key_bindings.fish and add the following lines within the function

      bind \x7f backward-delete-char  # Normal Backspace deletes characters
      bind \b backward-kill-word      # Ctrl+Backspace deletes words
      
      bind \e\[3\;5~ kill-word  # Bind Ctrl+Delete to delete the next word

    [!NOTE] Termius on iOS registers both backspace and ctrl + backspace with the same keycode ^H. So, you may want to skip the backspace keybindings.

    You can check what your terminal gets on a keypress by entering cat and pressing the key you want to check.

Keychain (ssh-agent)

https://superuser.com/a/1727657

  • Install keychain:

    Ubuntu

    sudo apt install keychain

    Arch

    sudo pacman -S keychain
  • Add these lines to ~/.config/fish/conf.d/keychain.fish:

    if status is-login
        and status is-interactive
        # To add a key, set -Ua SSH_KEYS_TO_AUTOLOAD keypath
        # To remove a key, set -U --erase SSH_KEYS_TO_AUTOLOAD[index_of_key]
        keychain --eval $SSH_KEYS_TO_AUTOLOAD | source
    
    end

    [!TIP] SSH_KEYS_TO_AUTOLOAD is an array of key paths to be loaded by keychain. You can add or remove keys from the array as needed.

    Add multiple keys to SSH_KEYS_TO_AUTOLOAD array

    set -Ua SSH_KEYS_TO_AUTOLOAD ~/.ssh/{key1,key1.pub,key2,key2.pub}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors