Make it look like exa
This commit is contained in:
parent
8e4f32e9b9
commit
eeb493442b
|
@ -22,14 +22,86 @@ $env.config.filesize = {
|
|||
# ls aliases
|
||||
alias _ls = ls
|
||||
|
||||
def _ls_format_mode [mode: string] {
|
||||
let chars = echo $mode | split chars
|
||||
|
||||
let r1 = (if (echo $chars | get 0) == "r" {
|
||||
[(ansi yellow_bold), "r", (ansi reset)]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
let w1 = (if (echo $chars | get 1) == "w" {
|
||||
[(ansi red_bold), "w", (ansi reset)]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
let x1 = (if (echo $chars | get 2) == "x" {
|
||||
[(ansi green_bold), "x", (ansi reset)]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
let r2 = (if (echo $chars | get 3) == "r" {
|
||||
[(ansi yellow), "r", (ansi reset)]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
let w2 = (if (echo $chars | get 4) == "w" {
|
||||
[(ansi red), "w"]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
let x2 = (if (echo $chars | get 5) == "x" {
|
||||
[(ansi green), "x"]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
let r3 = (if (echo $chars | get 6) == "r" {
|
||||
[(ansi yellow), "r", (ansi reset)]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
let w3 = (if (echo $chars | get 7) == "w" {
|
||||
[(ansi red), "w"]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
let x3 = (if (echo $chars | get 8) == "x" {
|
||||
[(ansi green), "x"]
|
||||
} else {
|
||||
[(ansi grey), "-"]
|
||||
} | str join)
|
||||
|
||||
[
|
||||
$r1
|
||||
$w1
|
||||
$x1
|
||||
$r2
|
||||
$w2
|
||||
$x2
|
||||
$r3
|
||||
$w3
|
||||
$x3
|
||||
] | str join
|
||||
}
|
||||
|
||||
def l [dir?: string] {
|
||||
_ls (if $dir == null { "" } else { $dir })
|
||||
| sort-by type name -i | grid -c
|
||||
| sort-by type name -i
|
||||
| grid -c
|
||||
}
|
||||
|
||||
def ls [dir?: string] {
|
||||
_ls (if $dir == null { "" } else { $dir })
|
||||
| sort-by type name -i | grid -c
|
||||
| sort-by type name -i
|
||||
| grid -c
|
||||
}
|
||||
|
||||
def la [dir?: string] {
|
||||
|
@ -40,8 +112,9 @@ def la [dir?: string] {
|
|||
|
||||
def ll [dir?: string] {
|
||||
_ls -l (if $dir == null { "" } else { $dir })
|
||||
| each {|x| return (echo $x | update mode (_ls_format_mode $x.mode))}
|
||||
| sort-by type name -i
|
||||
| select name type target user size modified
|
||||
| select mode name target user size modified
|
||||
}
|
||||
|
||||
# cool df
|
||||
|
|
|
@ -175,6 +175,51 @@ $env.NU_PLUGIN_DIRS = [
|
|||
($nu.default-config-dir | path join 'plugins') # add <nushell-config-dir>/plugins
|
||||
]
|
||||
|
||||
# LS_COLORS so that ls mimics the colors of exa
|
||||
$env.LS_COLORS = ([
|
||||
# File types
|
||||
"ex=1;32" # Executables
|
||||
"di=1;34" # Directories
|
||||
"ln=36" # Links
|
||||
"or=31" # Orphan
|
||||
|
||||
# Media types
|
||||
"*.pdf=32" # PDF files
|
||||
|
||||
# Images
|
||||
"*.webp=35" # Webp image
|
||||
"*.png=35" # PNG image
|
||||
"*.jpg=35" # JPG image
|
||||
|
||||
# Music
|
||||
"*.ogg=36" # OGG sound
|
||||
"*.mp3=36" # MP3 sound
|
||||
|
||||
# Videos
|
||||
"*.mp4=1;35" # MP4 video
|
||||
"*.avi=1;35" # AVI video
|
||||
"*.webm=1;35" # WebM video
|
||||
|
||||
# Bold yellow: source code
|
||||
"*.c=1;33" # C source
|
||||
"*.h=1;33" # C header
|
||||
"*.cpp=1;33" # C++ source
|
||||
"*.hpp=1;33" # C++ header
|
||||
"*.inl=1;33" # C++ include
|
||||
"*.cxx=1;33" # C++ include
|
||||
"*.py=1;33" # Python
|
||||
"*.js=1;33" # JavaScript
|
||||
"*.ts=1;33" # TypeScript
|
||||
"*.rs=1;33" # Rust
|
||||
"*.elm=1;33" # Elm
|
||||
|
||||
# Build / doc files
|
||||
"*Makefile=1;4;33" # Makefile
|
||||
"*Dockerfile=1;4;33" # Dockerfile
|
||||
"*.md=1;4;33" # Markdown
|
||||
"*.toml=1;4;33" # Toml
|
||||
] | str join ":")
|
||||
|
||||
# French by default
|
||||
$env.LANG = fr_FR.UTF-8
|
||||
|
||||
|
|
Loading…
Reference in New Issue