Files
cshenv/tcshrc.lscolors
adam e3732c0d19 Merge branch 'master' of gitea.nerdland.org:adam/cshenv into master
* 'master' of gitea.nerdland.org:adam/cshenv:
  Fix substitution on older TCSH.
2026-07-30 02:35:37 -04:00

116 lines
3.1 KiB
Tcsh

#######################################
# CSHENV Colors for gnu compatible LS #
#######################################
#### Old form
set cshenv_computed_ls_colors='pi=40;33:do=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35'
set cshenv_c_source="italic ansi:2"
set cshenv_c_header="italic ansi:3"
set cshenv_archive="ansi:9 doubleunder"
set cshenv_image="bold ansi:5"
set cshenv_ls_colors=\
( \
.sh=ansi:9,underline,ul:ext:7 \
no=reset # Normal \
fi=reset # File? \
ex=under,ul:ext:1,ansi:1,italic # Executable \
ln=bold,ansi:13 # Link \
so=bold,ansi:5,italic # Socket \
di=ext:4,bold # Directory \
bd=bg:ext:14,fg:ext:0,bold # Block Device \
cd=bg:ext:11,fg:ext:0,italic # Character Device \
or=blink,bg:ext:1,fg:ext:15,bold,strike,doubleunder,ul:ext:0 # Broken symlink\
\
.a=ansi:1 \
.asm=ansi:1 \
.bin=ansi:5 \
.sec=ansi:6 \
.ko=ansi:1 \
.deb=italic,underline,ansi:11 \
.rp=italic,underline,ansi:11 \
)
set cshenv_source_files=( c cpp cc cxx C )
set cshenv_header_files=( h hpp hh hxx H )
set cshenv_archive_files=( tar tgz tbz arj taz lzh zip z Z gz bz2 zst lz4 )
set cshenv_image_files=( jpg png gif bmp ppm tga xbm xpm tif png webm )
set _last=""
set _computed=""
foreach kind ( ${cshenv_source_files} )
set hl="${cshenv_c_source}"
#if ( ${kind} != c ) then
#set hl="${hl} underline"
#endif
if( "${_last}" != "${hl}" ) then
set _computed="`__build_sgr_code no-csi ${hl}`"
endif
set cshenv_computed_ls_colors="${cshenv_computed_ls_colors}:*.${kind}=${_computed}"
set _last="${hl}"
end
set _last=""
set _computed=""
foreach kind ( ${cshenv_header_files} )
set hl="${cshenv_c_header}"
#if ( ${kind} != h ) then
#set hl="${hl} underline"
#endif
if( "${_last}" != "${hl}" ) then
set _computed="`__build_sgr_code no-csi ${hl}`"
endif
set cshenv_computed_ls_colors="${cshenv_computed_ls_colors}:*.${kind}=${_computed}"
set _last="${hl}"
end
set _last=""
set _computed=""
foreach kind ( ${cshenv_archive_files} )
set hl="${cshenv_archive}"
if( "${_last}" != "${hl}" ) then
set _computed="`__build_sgr_code no-csi ${hl}`"
endif
set cshenv_computed_ls_colors="${cshenv_computed_ls_colors}:*.${kind}=${_computed}"
set _last="${hl}"
end
set _last=""
set _computed=""
foreach kind ( ${cshenv_image_files} )
set hl="${cshenv_image}"
if( "${_last}" != "${hl}" ) then
set _computed="`__build_sgr_code no-csi ${hl}`"
endif
set cshenv_computed_ls_colors="${cshenv_computed_ls_colors}:*.${kind}=${_computed}"
set _last="${hl}"
end
foreach color ( ${cshenv_ls_colors} )
_debug "${color}"
set split=( ${color:as/=/ /} )
set match="${split[1]:s/./*./}"
set args="${split[2]}"
#_debug "Split: ${split}"
#_debug "First: ${split[1]}"
_debug "Match: ${match}"
_debug "Match: ${match:as/./*----------/:as/----------/./}"
_debug "Args: ${args}"
_debug "${args:as/,/ /}"
if ( $?CSHENV_DEBUG ) then
_debug __build_sgr_code no-csi "${args:as/,/ /}"
endif
set codes="`__build_sgr_code no-csi ${args:as/,/ /}`"
set cshenv_computed_ls_colors="${cshenv_computed_ls_colors}:${match}=${codes}"
end
setenv LS_COLORS "${cshenv_computed_ls_colors}"
###########################
# vim: ft=tcsh
###########################