From 6a32e673b638e38c53dee04eb35a5942b0e24c1c Mon Sep 17 00:00:00 2001 From: sev Date: Tue, 18 Jul 2023 18:02:45 -0500 Subject: [PATCH] replace modeline with editorconfig; small fixes also delete termux colors, unused --- .editorconfig | 16 +++++++++ base/.zshenv | 36 ++++++++----------- bin/ykman-oath-reload | 1 - etc/fontconfig/fonts.conf | 3 -- etc/vim/.vimrc | 2 +- etc/zsh/.zlogin | 3 +- etc/zsh/.zlogout | 7 ++-- etc/zsh/.zprofile | 33 ++++++++--------- etc/zsh/.zshrc | 4 +-- etc/zsh/functions/Prompts/prompt_arrows_setup | 3 +- install.sh | 2 -- termux/colors.properties | 27 -------------- 12 files changed, 54 insertions(+), 83 deletions(-) create mode 100644 .editorconfig delete mode 100644 termux/colors.properties diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e734683 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +charset = utf-8 + +max_line_length = 79 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +tab_width = 8 +indent_style = space +indent_size = 4 + +[/etc/fontconfig/fonts.conf] +indent_size = 2 diff --git a/base/.zshenv b/base/.zshenv index 462fefd..90ec4ca 100644 --- a/base/.zshenv +++ b/base/.zshenv @@ -1,3 +1,5 @@ +[[ -v _sev_home ]] || export _sev_home=$HOME + export ZDOTDIR=${XDG_CONFIG_HOME:-~/.config}/zsh ### load site-specific @@ -14,26 +16,16 @@ if [[ -o interactive && $#terminfo -eq 0 ]] { unset _oldterm } -if [[ -o login ]] { - ### cd on login shell for convenience - # NOTE: we do this here and not in .zprofile since we occasionally might - # re-source .zprofile, and it's easier to just put the logic here... - cd ~ -} else { - if [[ ! -v _sev_first_display && ( -v DISPLAY || -v WAYLAND_DISPLAY ) ]] { - ### update gpgagent to use graphical pinentry - # XXX: will be sourced by every new child shell if zsh is not used to - # start the graphical session and the _sev_first_disaply var isn't - # exported; for example, this happens with sway without a display - # manager or launcher in front of it - export _sev_first_display= - _sev_refresh_gpgagent= source ${ZDOTDIR:-~}/.zprofile - } elif [[ $SHLVL == 1 ]] { - ### early zprofile sourcing for first shell even if not a login shell - # NOTE: ensure profile is loaded for toplevel shells; should hopefully be 1 - # under some Xorg or cron implementations, which is where this would be most useful - source ${ZDOTDIR:-~}/.zprofile - } +# NOTE: see .zprofile comment for rationale on sourcing +if [[ ! -v _sev_first_display && ( -v DISPLAY || -v WAYLAND_DISPLAY ) ]] { + ### update gpgagent to use graphical pinentry + # XXX: will be sourced by every new child shell if zsh is not used to + # start the graphical session and the _sev_first_display var isn't + # exported; for example, this previously happened with sway without a + # display manager or launcher in front of it + export _sev_first_display= + _sev_refresh_gpgagent= source ${ZDOTDIR:-~}/.zprofile +} elif [[ ! -o login && $SHLVL == 1 ]] { + ### early zprofile sourcing for first shell even if not a login shell + source ${ZDOTDIR:-~}/.zprofile } - -# vim: et sts=4 sw=4 ts=8 tw=79 diff --git a/bin/ykman-oath-reload b/bin/ykman-oath-reload index 0d6d709..d33914a 100755 --- a/bin/ykman-oath-reload +++ b/bin/ykman-oath-reload @@ -14,4 +14,3 @@ for x in $(ykman list --serials); do ykman -d $x oath accounts uri -fp $p $y done done -# vim: sts=4 sw=4 et diff --git a/etc/fontconfig/fonts.conf b/etc/fontconfig/fonts.conf index 972f7e4..593a6e2 100644 --- a/etc/fontconfig/fonts.conf +++ b/etc/fontconfig/fonts.conf @@ -50,6 +50,3 @@ - - diff --git a/etc/vim/.vimrc b/etc/vim/.vimrc index 3c96a4f..bad9f6a 100644 --- a/etc/vim/.vimrc +++ b/etc/vim/.vimrc @@ -47,4 +47,4 @@ highlight WhiteSpaceMol ctermfg=Black match WhiteSpaceMol / / 2match WhiteSpaceBol /\(^ \+\)\|\( \+$\)/ -" vim: set et fenc=utf-8 ft=vim sts=4 sw=4 ts=8 tw=79 : +let g:EditorConfig_enable_for_new_buf = 1 diff --git a/etc/zsh/.zlogin b/etc/zsh/.zlogin index 471fc29..612209e 100644 --- a/etc/zsh/.zlogin +++ b/etc/zsh/.zlogin @@ -3,4 +3,5 @@ ### load site-specific if [[ -f ${ZDOTDIR:-~}/.zlogin.local ]] { source ${ZDOTDIR:-~}/.zlogin.local } -# vim: et sts=4 sw=4 ts=8 tw=79 +### cd for convenience +[[ -o login ]] && cd ${_sev_home:-~} diff --git a/etc/zsh/.zlogout b/etc/zsh/.zlogout index 1ede4c5..cac7939 100644 --- a/etc/zsh/.zlogout +++ b/etc/zsh/.zlogout @@ -5,9 +5,10 @@ # but it should be cleared out on next session launch _sev_zcleanup ## unset vars that use our tmp since above will remove them -unset XDG_CACHE_HOME XDG_RUNTIME_DIR +[[ XDG_CACHE_HOME = $_sev_tmp/.xdg.cache ]] && unset XDG_CACHE_DIR +[[ XDG_RUNTIME_DIR = $TMPDIR/.xdg.runtime ]] && unset XDG_RUNTIME_DIR ## clean up any remaining sockets from gpg forwarding -[[ -v _GNUPG_SOCK_DEST_BASE ]] && rm -f $_GNUPG_SOCK_DEST_BASE*(N=) +[[ -v _GNUPG_SOCK_DEST_BASE ]] && rm -f $_GNUPG_SOCK_DEST_BASE*(=N) if [[ -o interactive ]] { echo logout @@ -16,5 +17,3 @@ if [[ -o interactive ]] { ### load site-specific if [[ -f ${ZDOTDIR:-~}/.zlogout.local ]] { source ${ZDOTDIR:-~}/.zlogout.local } - -# vim: et sts=4 sw=4 ts=8 tw=79 diff --git a/etc/zsh/.zprofile b/etc/zsh/.zprofile index 777e0fa..3bad054 100644 --- a/etc/zsh/.zprofile +++ b/etc/zsh/.zprofile @@ -11,12 +11,7 @@ # properly configured for any child processes. # * some desktop environments/graphical terminal emulators will start new # terminal windows with login shells, which runs .zprofile every time and -# leads to noticably slow startup times. -# * switching users without wiping the environment will result in paths and -# variables intended for the old user being used for the new user. while -# this may be considered an edge-case that should not be supported, there -# are legitimate reasons to want to do this, and in any case the shell -# should not choke or cause unexpected problems should it happen anyway. +# leads to noticably slow startup times if we have not already ran it. ### cleanup # XXX: only call after relevant vars have been set up, defined early so that @@ -115,7 +110,7 @@ if [[ ! -v _sev_setup_path || -o login ]] { # XXX: perms are not specified for XDG dirs except runtime, but I think 760 # makes the most sense. shouldn't break anything since no one else should # be poking around in our dir. -[[ -e ~/.local ]] || mkdir -m760 ~/.local +[[ -e ${_sev_home:-~}/.local ]] || mkdir -m760 ${_sev_home:-~}/.local ### tmp # NOTE: specs say that POSIX tmp and XDG runtime directories should exist @@ -125,7 +120,7 @@ if [[ ! -v _sev_setup_path || -o login ]] { # toplevel session (i.e. SHLVL=1). this should placate most applications, # though it is not expressly spec compliant. if [[ ! -v _sev_tmp ]] { - _sev_tmp=~/.local/tmp + _sev_tmp=${_sev_home:-~}/.local/tmp # NOTE: race condition/remove in use files [[ -h $_sev_tmp ]] && unlink $_sev_tmp 2>/dev/null t=${TMPDIR:-${TEMP:-${TMP:-/tmp}}}/.home-$LOGNAME @@ -211,15 +206,19 @@ if [[ ! -v _sev_setup_xdg ]] { } } - # make runtime dir in our session-specific tmpdir - export XDG_RUNTIME_DIR=$TMPDIR/.xdg.runtime - # same as in tmpdir creation, ensure dir doesn't exist - if [[ -h $XDG_RUNTIME_DIR ]] { - unlink $XDG_RUNTIME_DIR 2>/dev/null - } elif [[ -e $XDG_RUNTIME_DIR ]] { - rm -rf $XDG_RUNTIME_DIR 2>/dev/null + if [[ -v XDG_RUNTIME_DIR ]] { + export XDG_RUNTIME_DIR + } else { + # make runtime dir in our session-specific tmpdir + export XDG_RUNTIME_DIR=$TMPDIR/.xdg.runtime + # same as in tmpdir creation, ensure dir doesn't exist + if [[ -h $XDG_RUNTIME_DIR ]] { + unlink $XDG_RUNTIME_DIR 2>/dev/null + } elif [[ -e $XDG_RUNTIME_DIR ]] { + rm -rf $XDG_RUNTIME_DIR 2>/dev/null + } + mkdir -m700 $XDG_RUNTIME_DIR 2>/dev/null } - mkdir -m700 $XDG_RUNTIME_DIR 2>/dev/null # source user dirs after other vars [[ -e $XDG_CONFIG_HOME/user-dirs.dirs ]] && @@ -431,5 +430,3 @@ unfunction _gpg_socketpath ### load site-specific if [[ -f ${ZDOTDIR:-~}/.zprofile.local ]] { source ${ZDOTDIR:-~}/.zprofile.local } - -# vim: et sts=4 sw=4 ts=8 tw=79 diff --git a/etc/zsh/.zshrc b/etc/zsh/.zshrc index 5ca4858..dd7d2dd 100644 --- a/etc/zsh/.zshrc +++ b/etc/zsh/.zshrc @@ -25,7 +25,7 @@ export SAVEHIST=1000 ## python export PYTHONSTARTUP=${XDG_CONFIG_HOME:-~/.config}/pythonrc ## vim -export VIMINIT='execute "source" ($XDG_CONFIG_HOME??($HOME."/.config"))."/vim/.vimrc"' +export VIMINIT='let$MYVIMRC=($XDG_CONFIG_HOME??($HOME."/.config"))."/vim/.vimrc"|execute"source"$MYVIMRC' ## wayland/sway # XXX: only do this if we're actually in wayland, but without a start script export XDG_SESSION_TYPE=wayland @@ -315,5 +315,3 @@ prompt arrows ### load site-specific if [[ -f ${ZDOTDIR:-~}/.zshrc.local ]] { source ${ZDOTDIR:-~}/.zshrc.local } - -# vim: et sts=4 sw=4 ts=8 tw=79 diff --git a/etc/zsh/functions/Prompts/prompt_arrows_setup b/etc/zsh/functions/Prompts/prompt_arrows_setup index 64590b2..0e08413 100644 --- a/etc/zsh/functions/Prompts/prompt_arrows_setup +++ b/etc/zsh/functions/Prompts/prompt_arrows_setup @@ -1,3 +1,5 @@ +#!/bin/zsh + prompt_arrows_help() { cat << EOF prompt arrows @@ -108,4 +110,3 @@ function prompt_arrows_preview { } prompt_arrows_setup "$@" -# vim: set et fenc=utf-8 ft=zsh sts=4 sw=4 ts=8 tw=0 : diff --git a/install.sh b/install.sh index b33d374..27b88c5 100755 --- a/install.sh +++ b/install.sh @@ -132,5 +132,3 @@ if [ $(uname -o) = 'Android' ]; then find termux -mindepth 1 -maxdepth 1 | while read -r x; do l ".$x"; done l '.termux/font.ttf' "$share/fonts/Dina-ttf/Dina.ttf" fi - -# vim: sts=4 sw=4 et diff --git a/termux/colors.properties b/termux/colors.properties deleted file mode 100644 index 2b596e5..0000000 --- a/termux/colors.properties +++ /dev/null @@ -1,27 +0,0 @@ -background = #010812 -foreground = #798699 -cursor = #6408a4 -# black/grey -color0 = #191c21 -color8 = #3b434e -# red -color1 = #d51d0a -color9 = #f4321e -# green -color2 = #5dd50a -color10 = #75f41e -# yellow -color3 = #d5820a -color11 = #f49d1e -# blue -color4 = #0a5dd5 -color12 = #1e75f4 -# magenta -color5 = #820ad5 -color13 = #9d1ef4 -# cyan -color6 = #0ac2d5 -color14 = #1ee0f4 -# light grey/white -color7 = #bcc2cc -color15 = #e8ebee -- 2.47.0