Cached ls colors generation for some "groups"
This commit is contained in:
+40
-13
@@ -2,6 +2,10 @@
|
||||
# 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"
|
||||
@@ -35,36 +39,57 @@ 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"
|
||||
#if ( ${kind} != c ) then
|
||||
#set hl="${hl} underline"
|
||||
#endif
|
||||
if( "${_last}" != "${hl}" ) then
|
||||
set _computed="`__build_sgr_code no-csi ${hl}`"
|
||||
endif
|
||||
set cshenv_ls_colors=( ${cshenv_ls_colors} .${kind}=${hl:as/ /,/} )
|
||||
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"
|
||||
#if ( ${kind} != h ) then
|
||||
#set hl="${hl} underline"
|
||||
#endif
|
||||
if( "${_last}" != "${hl}" ) then
|
||||
set _computed="`__build_sgr_code no-csi ${hl}`"
|
||||
endif
|
||||
set cshenv_ls_colors=( ${cshenv_ls_colors} .${kind}=${hl:as/ /,/} )
|
||||
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}"
|
||||
set cshenv_ls_colors=( ${cshenv_ls_colors} .${kind}=${hl:as/ /,/} )
|
||||
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}"
|
||||
set cshenv_ls_colors=( ${cshenv_ls_colors} .${kind}=${hl:as/ /,/} )
|
||||
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
|
||||
|
||||
|
||||
#### Old form
|
||||
setenv LS_COLORS 'pi=40;33:do=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35'
|
||||
|
||||
foreach color ( ${cshenv_ls_colors} )
|
||||
_debug "${color}"
|
||||
set split=( ${color:as/=/ /} )
|
||||
@@ -79,10 +104,12 @@ foreach color ( ${cshenv_ls_colors} )
|
||||
if ( $?CSHENV_DEBUG ) then
|
||||
_debug __build_sgr_code no-csi "${args:as/,/ /}"
|
||||
endif
|
||||
set codes=`__build_sgr_code no-csi ${args:as/,/ /}`
|
||||
setenv LS_COLORS "${LS_COLORS}:${match}=${codes}"
|
||||
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
|
||||
###########################
|
||||
|
||||
Reference in New Issue
Block a user