Merge branch 'master' of gitea.nerdland.org:adam/cshenv into master

* 'master' of gitea.nerdland.org:adam/cshenv:
  Support for machine suffixes.
  Fix spurious "h " in canonicalization list.
  The new filetype plugin burned me.
  Clean up a lot how the ssh search is generated and maintained.
  Remove the need for the adamformat symlink.
  Tag syntax for C++
  Directory stack size shouldn't use a PID.
  Battery colour shouldn't be literals!
  A bit of style cleanup.
  Update adam format for more recent `uncrustify`.
  A lot more automation for ssh.
  Add a bit of ssh universal configuration.
  Fix the way that git gets linked.
This commit is contained in:
2025-03-14 00:59:16 -04:00
13 changed files with 94 additions and 14 deletions

View File

@ -26,8 +26,8 @@ indent_relative_single_line_comments=true
indent_col1_comment=true
indent_access_spec_body=true
indent_paren_nl=false
indent_comma_paren=false
indent_bool_paren=false
indent_comma_paren=0
indent_bool_paren=0
indent_first_bool_expr=false
indent_square_nl=false
indent_preserve_sql=false
@ -47,7 +47,7 @@ align_on_operator=false
align_mix_var_proto=false
align_single_line_func=false
align_single_line_brace=false
align_nl_cont=false
align_nl_cont=0
align_left_shift=true
align_oc_decl_colon=false
nl_collapse_empty_body=true
@ -81,7 +81,7 @@ ls_func_split_full=false
nl_after_multiline_comment=false
eat_blanks_after_open_brace=true
eat_blanks_before_close_brace=true
mod_full_brace_if_chain=false
mod_full_brace_if_chain=0
mod_pawn_semicolon=false
mod_full_paren_if_bool=false
mod_remove_extra_semicolon=false

1
ssh/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
ssh-search-domains

8
ssh/epilogue Normal file
View File

@ -0,0 +1,8 @@
Host gitea gitea.* github.com gitlab.com *.github.com *.gitlab.com
User git
Host *
IdentityFile ~/.ssh/id_%L${CSHENV_MACHINE_SUFFIX}-%h
# vim: ft=sshconfig

18
ssh/gen-search.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
rm -f ~/.ssh/search
if [ -e ${CSHENV_DIR}/ssh/ssh-search-domains ]
then
domains=`grep "^search" /etc/resolv.conf | cut -c 8- - | cat - ${CSHENV_DIR}/ssh/ssh-search-domains | xargs`
else
domains=`grep "^search" /etc/resolv.conf | cut -c 8- - | xargs`
fi
if [ -z "${domains}" ] ; then exit 1; fi
printf "Host *\n\tCanonicalDomains ${domains}\n\tCanonicalizeHostname yes\n# v" > ~/.ssh/search
printf "im:ft=sshconfig" >> ~/.ssh/search
exit 0
# vim: ft=bash

9
ssh/prologue Normal file
View File

@ -0,0 +1,9 @@
# This scans your resolver and then custom-creates a config file
# for your current resolver situation.
#
# That config uses Canonicalization to emulate what your local resolver
# does in these circumstances.
Match exec "~/cshenv/ssh/gen-search.sh"
Include ~/.ssh/search
# vim: ft=sshconfig

View File

@ -3,7 +3,17 @@
# Yeah, my CSHENV Install script is written in Bourne shell. This is because
# CSH isn't a great scripting language, but it is a nice interactive shell.
export CSHENV_LOCATION="~/cshenv"
export REALPATH=`realpath $0`
export INSTALLER_LOCATION=`dirname ${REALPATH}`
export CSHENV_LOCATION=`dirname ${INSTALLER_LOCATION}`
export RELATIVE_CSHENV_LOCATION=`realpath --relative-to=${HOME} ${CSHENV_LOCATION}`
if [ -v CSHENV_DEBUG_INSTALLER ]
then
echo $CSHENV_LOCATION
echo $RELATIVE_CSHENV_LOCATION
exit
fi
echo "Checking for ~/.login"
if [ ! -e ~/.login ]
@ -36,8 +46,10 @@ then
fi
echo "Installing vim setup"
ln -s `echo ${CSHENV_LOCATION}`/vim ~/.vim
ln -s ~/.vim/vimrc ~/.vimrc
pushd ~ >& /dev/null
ln -s `echo ${RELATIVE_CSHENV_LOCATION}`/vim .vim
ln -s .vim/vimrc .vimrc
popd >& /dev/null
if [ -e ~/.gitconfig ]
then
@ -60,3 +72,6 @@ echo " signingKey = \"`hostname` Git\"" >> ~/.gitconfig
echo "" >> ~/.gitconfig
echo "[commit]" >> ~/.gitconfig
echo " gpgSign = true" >> ~/.gitconfig
echo "Do not forget to add the following line at the top of your ssh config:"
echo "Include ${CSHENV_LOCATION}/ssh/config"

2
tcshrc
View File

@ -9,6 +9,8 @@ endif
set path=( ${CSHENV_DIR}/bin ${path} )
setenv CSHENV_MACHINE_SUFFIX
# Figure out what kind of tcsh we are running.
if( $?tcsh ) then

View File

@ -150,6 +150,7 @@ endif
if( $?CSHENV_DEBUG ) echo "Dynamic color loading processed..."
if( ${prompt_hcolor} != 0 ) then
set last_color = ${reference_colors[${prompt_hcolor}]}
endif
@ -167,7 +168,6 @@ set medium_battery_level = 50
set strong_battery_level = 75
while( ${prompt_hcolor} == 0 )
if( $?CSHENV_DEBUG ) then
echo colorshuffle
@ -243,9 +243,9 @@ if( $?CSHENV_SHOW_BATTERY_LEVEL ) then
else if( ${battery_level} < ${low_battery_level} ) then
set battery_color=${red}
else if( ${battery_level} < ${weak_battery_level} ) then
set battery_color=${yellow}
set battery_color=${csi}33m
else if( ${battery_level} < ${medium_battery_level} ) then
set battery_color=${bright_yellow}
set battery_color=${csi}93m
else if( ${battery_level} < ${strong_battery_level} ) then
set battery_color=${green}
else
@ -342,6 +342,7 @@ if( ! $?CSHENV_DISABLE_PROMPT_NESTING ) then
endif
endif
endif
if( ! $?CSHENV_DISABLE_PROMPT_USER ) then
set user_prompt_view="${user_color_seq}${user_prompt}%{${sgr_reset}%}"
if( ! $?CSHENV_DISABLE_PROMPT_HOST ) then
@ -355,6 +356,7 @@ if( ! $?CSHENV_DISABLE_PROMPT_HOST ) then
endif
set host_prompt_view="${host_color_seq}${host_prompt}%{${text_color_seq}%}${host_prompt_tail}"
endif
if( ! $?CSHENV_DISABLE_PROMPT_GIT ) then
set git_prompt_view="${git_prompt}"
endif
@ -362,7 +364,8 @@ if( ! $?CSHENV_DISABLE_PROMPT_PATH ) then
set path_prompt_view="%{${path_color_seq}%}${path_prompt}%{${sgr_reset}%}"
endif
if( ! $?CSHENV_DISABLE_PROMPT_DIRS ) then
set dirs_prompt=`dirs -v | wc -l`
set dir_list=`dirs`
set dirs_prompt="${#dir_list}"
if( ${dirs_prompt} > 1 ) then
set dirs_prompt_view=" {%{${dirs_color_seq}%}${dirs_prompt}%{${sgr_reset}%}}"
endif

View File

@ -38,6 +38,8 @@ syn match cxxCriticalNames "\<Critical[A-Z][A-Za-z0-9_]*Error\>"
syn match cxxCriticalNames "\<[A-Z][A-Za-z0-9_]*CriticalError\>"
syn match cxxViolationNames "\<[A-Z][A-Za-z0-9_]*Violation\>"
syn match cxxTagName "\<[a-zA-Z_][A-Za-z0-9_]*_tag\>"
syn match cxxCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*\(<\)\@="
@ -279,5 +281,7 @@ if version >= 508 || !exists("did_cxx_syntax_inits")
HiLink cxxStlDangerousFunction Dangerous
HiLink cxxTagName Tag
delcommand HiLink
endif

View File

@ -82,6 +82,8 @@ hi FoldColumn ctermbg=darkgrey ctermfg=white
hi cIf0 ctermfg=gray term=none start=<esc>[38;2;100;100;100m stop=<esc>[0m
"hi diffOnly ctermfg=red cterm=bold
hi Tag ctermfg=darkblue
" End of ron above.
"set t_Co=8

View File

@ -1,8 +1,8 @@
"ADAM David Alan Martin's updated vimrc
"source ~/.vim/default.vim
let g:netrw_special_syntax=1
set nofoldenable
source ~/.vim/vimrc.disablejunk
syntax on
"The adam color scheme has both syntax colors and adam colorscheme now.

18
vim/vimrc.disablejunk Normal file
View File

@ -0,0 +1,18 @@
" Here's a bunch of junk that Vim has turned on over
" the years, by default, that I've had to fight
" with configuration to get these not to load.
"
" If I ever want these back on, one day, I'll know where
" to find them.
let g:netrw_special_syntax=1
set nofoldenable
let g:did_load_ftplugin = 1
let b:did_ftplugin = 1
let g:did_ftplugin = 1
" This never seems to be respected anymore...
set noloadplugins

View File

@ -13,5 +13,5 @@ map <Ins> :cp
map <Del> :cn
"map _ :1,$!/opt/local/bin/clang-format-mp-3.9 -style=file
:1,$!/opt/local/bin/uncrustify -q -lCPP -c ~/adamformat/adam.format.cfg
:1,$!/opt/local/bin/uncrustify -q -lCPP -c ~/adamformat/adam.format.cfg
map _ :1,$!uncrustify -q -lCPP -c ~/cshenv/adamformat/adam.format.cfg