Function: f-short

f-short is a for abbreviate-file-name, defined in files.el.gz.

Signature

(f-short FILENAME)

Documentation

Return a version of FILENAME shortened using directory-abbrev-alist.

This also substitutes "~" for the user's home directory (unless the home directory is a root directory) and removes automounter prefixes
(see the variable automount-dir-prefix).

When this function is first called, it caches the user's home directory as a regexp in abbreviated-home-dir, and reuses it afterwards (so long as the home directory does not change; if you want to permanently change your home directory after having started Emacs, set abbreviated-home-dir to nil so it will be recalculated).

Other relevant functions are documented in the f group.

Shortdoc

;; f
(f-short "/Users/foo/Code/on/macOS")
    => ~/Code/on/macOS
  (f-short "/home/foo/Code/on/linux")
    => ~/Code/on/linux
  (f-short "/path/to/Code/bar")
    => "/path/to/Code/bar"

Aliases

viper-abbreviate-file-name (obsolete since 27.1) f-abbrev f-short