Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fish shell; import config into main config

Tags:

fish

My ~/.config/fish/config.fish is getting gigantic.

What is the idiomatic way to write another file and "source" it from inside this file so my main config isn't so huge?

Can I make like a ~/.config/fish/config-work.fish and add source ~/.config/fish/config-work.fish into my main config?

like image 360
Tommy Avatar asked Feb 12 '18 15:02

Tommy


People also ask

Where do I put the config fish?

The configuration file runs at every login and is located at ~/. config/fish/config. fish . Adding commands or functions to the file will execute/define them when opening a terminal, similar to .

How do you put a path in fish shell?

It does this by adding the components either to $fish_user_paths or directly to $PATH (if the --path switch is given). It is (by default) safe to use fish_add_path in config. fish, or it can be used once, interactively, and the paths will stay in future because of universal variables.

How do I customize my fish shell prompt?

Prompt Tab The "prompt" tab displays the contents of the current fish shell prompt. It allows selection from 17 predefined prompts. To change the prompt, select one and press "Prompt Set!".

Does fish run bashrc?

bashrc to conform to the subset of code that is valid in both bash and fish . Yes, fish is not bash-compatible, so reading . bashrc will typically not work.


2 Answers

Since version 2.3.0, fish automatically reads ~/.config/fish/conf.d/*.fish on startup, so you can also just use those.

Or you can manually source files.

like image 83
faho Avatar answered Dec 02 '22 21:12

faho


One strategy I use is to segregate functionality based on what machine I'm using.
In my ~/.config/fish/config.fish I have:

set host_config ~/.config/fish/config.(hostname).fish
test -r $host_config; and source $host_config
like image 38
glenn jackman Avatar answered Dec 02 '22 21:12

glenn jackman