From 84e3ed64b13d998cc68017575e10c0e2c4e4c705 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 15:22:13 -0500 Subject: [PATCH 01/13] Fix the way that git gets linked. --- startup_hooks/install.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/startup_hooks/install.sh b/startup_hooks/install.sh index 2867e6a..64a7942 100755 --- a/startup_hooks/install.sh +++ b/startup_hooks/install.sh @@ -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 From 8c304b51264bed4319a55826837f09c38cad2ac5 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 15:22:26 -0500 Subject: [PATCH 02/13] Add a bit of ssh universal configuration. This is intended to work with the `ssh-mgmt` scripts. Maybe its better to move this there? Maybe not? --- ssh/config | 14 ++++++++++++++ startup_hooks/install.sh | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 ssh/config diff --git a/ssh/config b/ssh/config new file mode 100644 index 0000000..fe3085f --- /dev/null +++ b/ssh/config @@ -0,0 +1,14 @@ +CanonicalizeMaxDots 5 +CanonicalizeHostname yes +CanonicalDomains nerdland.org + +Host gitea.* github.com + User git + +Host *.nerdland.org *.nerdland.it.cx + AddressFamily inet6 + +Host * + IdentityFile ~/.ssh/id_%L-%h + +# vim: ft=sshconfig diff --git a/startup_hooks/install.sh b/startup_hooks/install.sh index 64a7942..d5e8fa5 100755 --- a/startup_hooks/install.sh +++ b/startup_hooks/install.sh @@ -72,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" From f31647d198b0440e1e8a480d74a98795bf3dcd1d Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 23:11:04 -0500 Subject: [PATCH 03/13] A lot more automation for ssh. (And I probably broke something, but we'll see!) --- ssh/config | 14 -------------- ssh/epilogue | 8 ++++++++ ssh/prologue | 12 ++++++++++++ 3 files changed, 20 insertions(+), 14 deletions(-) delete mode 100644 ssh/config create mode 100644 ssh/epilogue create mode 100644 ssh/prologue diff --git a/ssh/config b/ssh/config deleted file mode 100644 index fe3085f..0000000 --- a/ssh/config +++ /dev/null @@ -1,14 +0,0 @@ -CanonicalizeMaxDots 5 -CanonicalizeHostname yes -CanonicalDomains nerdland.org - -Host gitea.* github.com - User git - -Host *.nerdland.org *.nerdland.it.cx - AddressFamily inet6 - -Host * - IdentityFile ~/.ssh/id_%L-%h - -# vim: ft=sshconfig diff --git a/ssh/epilogue b/ssh/epilogue new file mode 100644 index 0000000..8001630 --- /dev/null +++ b/ssh/epilogue @@ -0,0 +1,8 @@ +Host gitea.* github.com gitlab.com *.github.com *.gitlab.com + User git + + +Host * + IdentityFile ~/.ssh/id_%L-%h + +# vim: ft=sshconfig diff --git a/ssh/prologue b/ssh/prologue new file mode 100644 index 0000000..72afa6d --- /dev/null +++ b/ssh/prologue @@ -0,0 +1,12 @@ +# 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 'rm -f ~/ssh/search | false' + +Match exec 'grep "^search" /etc/resolv.conf ' exec 'grep search /etc/resolv.conf | awk \'{print "Host *\n\tCanonicalDomains "$2"\n\tCanonicalizeHostname yes\n# v""im:ft=sshconfig"}\' > ~/.ssh/search' + + Include ~/.ssh/search + +# vim: ft=sshconfig From 997e208300dbda6db3d84c726b47c862d18046ee Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 23:11:31 -0500 Subject: [PATCH 04/13] Update adam format for more recent `uncrustify`. --- adamformat/adam.format.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/adamformat/adam.format.cfg b/adamformat/adam.format.cfg index b8ccbfb..fa689aa 100644 --- a/adamformat/adam.format.cfg +++ b/adamformat/adam.format.cfg @@ -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 From 67f4542811deaca499b645c3081184f4634c4d8b Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 23:12:50 -0500 Subject: [PATCH 05/13] A bit of style cleanup. --- tcshrc.prompt.final | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final index da6b5c9..6ac69bb 100644 --- a/tcshrc.prompt.final +++ b/tcshrc.prompt.final @@ -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 @@ -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 From fe472e09cbf3702215cf5b5debf1ead25ec94bca Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 23:12:59 -0500 Subject: [PATCH 06/13] Battery colour shouldn't be literals! --- tcshrc.prompt.final | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final index 6ac69bb..30a4c62 100644 --- a/tcshrc.prompt.final +++ b/tcshrc.prompt.final @@ -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 From 88bb192ca35675f9a5a450aa5b0438a878129211 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 23:13:16 -0500 Subject: [PATCH 07/13] Directory stack size shouldn't use a PID. Use in-shell array size counting. --- tcshrc.prompt.final | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final index 30a4c62..8191a6b 100644 --- a/tcshrc.prompt.final +++ b/tcshrc.prompt.final @@ -364,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 From 60607dbce7834f3c47b274ff2e0735a8fd12806a Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 23:14:27 -0500 Subject: [PATCH 08/13] Tag syntax for C++ --- vim/after/syntax/cpp.vim | 4 ++++ vim/colors/adam.vim | 2 ++ 2 files changed, 6 insertions(+) diff --git a/vim/after/syntax/cpp.vim b/vim/after/syntax/cpp.vim index 8122074..8eb95e2 100644 --- a/vim/after/syntax/cpp.vim +++ b/vim/after/syntax/cpp.vim @@ -38,6 +38,8 @@ syn match cxxCriticalNames "\" 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 diff --git a/vim/colors/adam.vim b/vim/colors/adam.vim index f69630f..91a2a75 100644 --- a/vim/colors/adam.vim +++ b/vim/colors/adam.vim @@ -82,6 +82,8 @@ hi FoldColumn ctermbg=darkgrey ctermfg=white hi cIf0 ctermfg=gray term=none start=[38;2;100;100;100m stop=[0m "hi diffOnly ctermfg=red cterm=bold +hi Tag ctermfg=darkblue + " End of ron above. "set t_Co=8 From 2e677b63254d12d9de9986fbc84a40d9766178c6 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 7 Mar 2025 23:14:43 -0500 Subject: [PATCH 09/13] Remove the need for the adamformat symlink. --- vim/vimrc.keymaps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc.keymaps b/vim/vimrc.keymaps index ad9939f..d3ef5f8 100644 --- a/vim/vimrc.keymaps +++ b/vim/vimrc.keymaps @@ -13,5 +13,5 @@ map :cp map :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 -map _ :1,$!uncrustify -q -lCPP -c ~/adamformat/adam.format.cfg +map _ :1,$!uncrustify -q -lCPP -c ~/cshenv/adamformat/adam.format.cfg map \ :1,$!clang-format-devel -style=file From a1dd3bd43cd56b077b206c3716c252e1628c1133 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Mon, 10 Mar 2025 15:23:10 -0400 Subject: [PATCH 10/13] Clean up a lot how the ssh search is generated and maintained. --- ssh/.gitignore | 1 + ssh/gen-search.sh | 19 +++++++++++++++++++ ssh/prologue | 5 +---- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 ssh/.gitignore create mode 100755 ssh/gen-search.sh diff --git a/ssh/.gitignore b/ssh/.gitignore new file mode 100644 index 0000000..98b4fd5 --- /dev/null +++ b/ssh/.gitignore @@ -0,0 +1 @@ +ssh-search-domains diff --git a/ssh/gen-search.sh b/ssh/gen-search.sh new file mode 100755 index 0000000..8a66c2c --- /dev/null +++ b/ssh/gen-search.sh @@ -0,0 +1,19 @@ +#!/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 6- - | cat - ${CSHENV_DIR}/ssh/ssh-search-domains | xargs` +else + domains=`grep "^search" /etc/resolv.conf | cut -c 6- - | xargs` +fi + +if [ -z "${domains}" ] ; then exit 1; fi +echo ${domains} + +printf "Host *\n\tCanonicalDomains ${domains}\n\tCanonicalizeHostname yes\n# v" > ~/.ssh/search +printf "im:ft=sshconfig" >> ~/.ssh/search + +exit 0 + + # vim: ft=bash diff --git a/ssh/prologue b/ssh/prologue index 72afa6d..0dac0ad 100644 --- a/ssh/prologue +++ b/ssh/prologue @@ -3,10 +3,7 @@ # # That config uses Canonicalization to emulate what your local resolver # does in these circumstances. -Match exec 'rm -f ~/ssh/search | false' - -Match exec 'grep "^search" /etc/resolv.conf ' exec 'grep search /etc/resolv.conf | awk \'{print "Host *\n\tCanonicalDomains "$2"\n\tCanonicalizeHostname yes\n# v""im:ft=sshconfig"}\' > ~/.ssh/search' - +Match exec "~/cshenv/ssh/gen-search.sh" Include ~/.ssh/search # vim: ft=sshconfig From 192c8b1abde862bd7469234155688afaf845a698 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Mon, 10 Mar 2025 16:14:05 -0400 Subject: [PATCH 11/13] The new filetype plugin burned me. --- vim/vimrc | 4 ++-- vim/vimrc.disablejunk | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 vim/vimrc.disablejunk diff --git a/vim/vimrc b/vim/vimrc index 19b60a4..a1b62f2 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -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. diff --git a/vim/vimrc.disablejunk b/vim/vimrc.disablejunk new file mode 100644 index 0000000..8188871 --- /dev/null +++ b/vim/vimrc.disablejunk @@ -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 + From 035cb2520938b839f3443b1697b41d34cf823991 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Tue, 11 Mar 2025 14:04:57 -0400 Subject: [PATCH 12/13] Fix spurious "h " in canonicalization list. --- ssh/gen-search.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ssh/gen-search.sh b/ssh/gen-search.sh index 8a66c2c..a65b93f 100755 --- a/ssh/gen-search.sh +++ b/ssh/gen-search.sh @@ -3,13 +3,12 @@ rm -f ~/.ssh/search if [ -e ${CSHENV_DIR}/ssh/ssh-search-domains ] then - domains=`grep "^search" /etc/resolv.conf | cut -c 6- - | cat - ${CSHENV_DIR}/ssh/ssh-search-domains | xargs` + 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 6- - | xargs` + domains=`grep "^search" /etc/resolv.conf | cut -c 8- - | xargs` fi if [ -z "${domains}" ] ; then exit 1; fi -echo ${domains} printf "Host *\n\tCanonicalDomains ${domains}\n\tCanonicalizeHostname yes\n# v" > ~/.ssh/search printf "im:ft=sshconfig" >> ~/.ssh/search From 2015c6f6c2df56a9b534e4278cbfbed976be1ea8 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Tue, 11 Mar 2025 16:21:05 -0400 Subject: [PATCH 13/13] Support for machine suffixes. I put the outer hostname as a suffix on VMs. --- ssh/epilogue | 4 ++-- tcshrc | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ssh/epilogue b/ssh/epilogue index 8001630..d630445 100644 --- a/ssh/epilogue +++ b/ssh/epilogue @@ -1,8 +1,8 @@ -Host gitea.* github.com gitlab.com *.github.com *.gitlab.com +Host gitea gitea.* github.com gitlab.com *.github.com *.gitlab.com User git Host * - IdentityFile ~/.ssh/id_%L-%h + IdentityFile ~/.ssh/id_%L${CSHENV_MACHINE_SUFFIX}-%h # vim: ft=sshconfig diff --git a/tcshrc b/tcshrc index 9be9074..457b67e 100644 --- a/tcshrc +++ b/tcshrc @@ -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