Skip to content

Commit

Permalink
Move less configs and data to XDG dirs
Browse files Browse the repository at this point in the history
Addresses #17
 - Defines `LESSKEY` environment variable pointing to `XDG_CONFIG_HOME`
 - Defines `LESSHISTFILE` environment variable pointing to
   `XDG_DATA_HOME`

Notes:
 - `less` as of version 600 should support XDG out-of-the-box and thus
   this environment setup could be later deprecated
 - Additionally, `less` should pick the history file from
   `XDG_STATE_HOME` as well - this env var is currently undefined tho

After reloading shell make sure to create appropriate directories and
move/rename existing files.
  • Loading branch information
matyama committed Apr 9, 2022
1 parent 29ef4e4 commit 3d53a13
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,21 @@ export LESS_TERMCAP_so=$'\e[38;5;246m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\e[0m' # end underline
export LESS_TERMCAP_us=$'\e[04;38;5;146m' # begin underline

# make less better
# Make less better
# X = leave content on-screen
# F = quit automatically if less than one screenfull
# R = raw terminal characters (fixes git diff)
# see http://jugglingbits.wordpress.com/2010/03/24/a-better-less-playing-nice-with-git/
export LESS="-F -X -R"

# Set configuration files for less
# - TODO: XDG should be fully supported when version 600 lands
# - TODO: Try `XDG_STATE_HOME` instead of `XDG_DATA_HOME` as it should be more
# appropriate for `lesshst` and should be supported by less as well.
# Unfortunately, currently `XDG_STATE_HOME` is not set.
export LESSKEY=${XDG_CONFIG_HOME}/less/lesskey
export LESSHISTFILE=${XDG_DATA_HOME}/less/lesshst

# To customize prompt, run `p10k configure` or edit `POWERLEVEL9K_CONFIG_FILE`
[[ ! -f "${POWERLEVEL9K_CONFIG_FILE}" ]] || \
source "${POWERLEVEL9K_CONFIG_FILE}"
Expand Down

0 comments on commit 3d53a13

Please sign in to comment.