Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: configuration files #511

Open
tbodt opened this issue Jun 19, 2019 · 7 comments
Open

Feature request: configuration files #511

tbodt opened this issue Jun 19, 2019 · 7 comments

Comments

@tbodt
Copy link
Contributor

tbodt commented Jun 19, 2019

Having to configure exa using a shell alias is less than convenient. ripgrep allows you to set a RIPGREP_CONFIG_PATH environment variable to point to a file that contains a list of default options, one per line (https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file). I think exa should do this too.

@bkuhlmann
Copy link

I would like this too. One suggestion would be to adhere to the XDG specification so our Dotfiles don't get so cluttered. With XDG, we could have this instead: ~/.config/exa/configuration.yml. 🎉

NOTE: Doesn't have to be a YAML configuration but can be any configuration format that makes sense.

@ariasuni
Copy link
Collaborator

ariasuni commented Apr 3, 2021

Here’s a suggested, hypothetical config file, inspired by ui_styles.rs/default_theme.rs:

~/.config/exa/exa.toml
# The [colors] table has all that’s possible to configure with EXA_COLORS
# and filekinds too, in a much more readable way!!

[colors.ui]
punctuation = "black bold"
# date = ""
# inode = ""
# blocks = ""
# header = ""
# link_path = ""
# control_char = ""
# broken_path = ""

[colors.filetypes]
# file = ""
# directory = ""
# executable = ""
# pipe = ""
# socket = ""
# block_device = ""
# char_device = ""
# symlink = ""
# broken_symlink = ""

[colors.filekinds]
temp = "white"
# build = "yellow bold"
image = "purple"
video = "purple bold"
music = "cyan"
lossless = "cyan bold"
crypto = "green bold"
document = "green"
# compressed = "red"
compiled = "yellow"

[colors.perms]
# ur = ""
# uw = ""
# ux_file = ""
# ux_other = ""
# gr = ""
# gw = ""
# gx = ""
# or = ""
# ow = ""
# ox = ""
# special_user_file = ""
# special_other = ""
# extended_attribute = ""

[colors.sizes]
# the two first are default, and overridden by the more specific variants.
# nums = ""
# units = ""
num-byte = "green"
num-kilo = "green bold"
num-mega = "yellow"
num-giga = "red"
num-huge = "purple"
unit-byte = "green"
unit-kilo = "green bold"
unit-mega = "yellow"
unit-giga = "red"
unit-huge = "purple"
# major = ""
# minor = ""

[colors.users]
# user-you = ""
# user-other = ""
# group-yours = ""
# group-other = ""

[colors.links]
# normal = ""
# multi = ""

[colors.git]
# new = ""
# modified = ""
# deleted = ""
# renamed = ""
# changed = ""

## The [[ and ]] signals that colors.custom is an array of table.
[[colors.custom]]
patterns = ["*.md", "*.rst"]
style = "yellow bold"

[[colors.custom]]
patterns = [".py"]
style = "red underline"


## Everything else that was controlled by environment variables.
[options]
# columns =
strict = true
# grid_rows
# icon_spacing

I’m not sure about some names (I’m totally not sure what’s special_user_file and special_other, and if the same distinction between ux_file and ux_other).

But mostly I think it’s an interesting draft. Any thoughts?

@fredericrous
Copy link

nice draft ariasuni. where would the file extension icon fit into this config? maybe colors.custom could be replaced by something like [[file_extension]]? Also, how would you define filekinds like the group of extensions behind image? in a separate config file? I would suggest not to put too much effort into color definitions per file extension. These can already be defined by LS_COLORS and there already is an excellent tool that handles configuring these with config files: Vivid. See config file examples for vivid here: https://github.com/sharkdp/vivid/blob/master/themes/jellybeans.yml and there https://github.com/sharkdp/vivid/blob/master/config/filetypes.yml

@ariasuni
Copy link
Collaborator

ariasuni commented May 4, 2021

Well a great first step would be to be able to have a configuration file at all.

More advanced features, like colors based on file glob/pattern and custom file icons mapping, should probably be handled separately afterwards — e.g. to discuss if things like vivid are the way we want to handle colors.

@edent
Copy link

edent commented Mar 20, 2023

Is there currently any way to do this? I always run

exa -l -s modified --no-permissions --icons --no-user

Is there a way to set those defaults so I just need to type exa?

@zhengpd
Copy link

zhengpd commented Mar 27, 2023

It could be a config file supporting simple options at first step, and after that extend to complex options/features.

@zhengpd
Copy link

zhengpd commented Mar 27, 2023

My workaround before official conf file (with zsh & exa installed by homebrew on macos):

  1. create ~/.bin/exa (~/.bin/ should be placed before /opt/homebrew/bin in PATH)
#!/usr/bin/env zsh

args=($@)

opts_file=$HOME/.exarc
[[ -f $opts_file ]] || touch $opts_file

opts=(${(@f)$(<$opts_file)})

/opt/homebrew/bin/exa $opts $args
  1. create ~/.exarc with desired exa options
--sort=Name
--git
--time-style=long-iso

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants