Skip to content

Instantly share code, notes, and snippets.

@vhbui02
Last active May 3, 2023 14:24
Show Gist options
  • Save vhbui02/1305747a1123378ae0bf390ac048101d to your computer and use it in GitHub Desktop.
Save vhbui02/1305747a1123378ae0bf390ac048101d to your computer and use it in GitHub Desktop.
[.dotfiles note] Some things I've to deal with later #dotfiles

Adding custom auto-loading function directory

set -Up fish_function_path ~/.dotfiles/fish/functions

Notes: the dir is realpath format, which means NO TRAILING SLASH

Two method to maintain these custom-autoloading function directory

Method 1: funced and funcsave directly to these directory

  • Edit and save custom auto-loading function via funced

Presume that you have custom auto-loading function directory in fish_function_path

Simply:funced <func_name>, then funcsave -d <directory> <func_name> (little weird that funced doesn't have -d option, but funcsave does)

  • Edit and save custom auto-loading function via custom editor

notepad++ ~/.dotfiles/fish/functions/<func-name>.fish

funcsave -d ~/.dotfiles/fish/functions <func-name>

Method 2: symlinking to these function

Write symlinking command inside bootstraping.fish

Naming convention

It's true that people tend to mirror the .dotfiles directory as a $HOME directory, but I think that's not good. Files inside .dotfiles can remove the . in front of it to make seperation directory. If you do that:

  • If I say .ssh, you know it's the symbolic linked directory in $HOME
  • If I say ssh (no dot), you know it's the real directory resides in .dotfiles

Some more conventions to represent their roles

  • <name>.backup: backup the original file called <name>
  • <name>.dotfiles
  • <name>.symlink
  • <name>: Shell script, no dot, no file extension. Or simply text files
  • conf.d: directory for Fish functions that will load at startup.
  • functions: directory for Fish function that will be lazy-loaded.

or use <name>.dotfiles to indicate its usage is from a dotfiles repository.

Dotfiles repositories usually have a naming convention where the files are prefixed with a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment