diff --git a/bin/altaria/default b/bin/altaria/default index c1fdbfa..78ce745 100755 --- a/bin/altaria/default +++ b/bin/altaria/default @@ -1,8 +1,29 @@ #!/bin/zsh source ${0:a:h}/xorg.zsh +USE_SMOL=false +xrandr -q | grep $XRANDR_OUTPUT__smol | grep -v 'disconnected' && { + xrandr -q | grep $XRANDR_OUTPUT__smol | grep -qv primary && { + USE_SMOL=true + } +} + +XRANDR_ARGS=() +case $USE_SMOL in + true ) + XRANDR_ARGS+=( + ${XRANDR_ARGS__smol__1080p[@]} --pos 0x0 --primary + ) + ;; + false ) + XRANDR_ARGS+=( + ${XRANDR_ARGS__office__4k[@]} --pos 0x0 --primary + ${XRANDR_ARGS__livingroom__4k[@]} --pos 0x0 + ) + ;; +esac + XRANDR_SET \ --screen-blank disable \ - ${XRANDR_ARGS__office__4k[@]} --pos 0x0 --primary \ - ${XRANDR_ARGS__livingroom__4k[@]} --pos 0x0 \ + ${XRANDR_ARGS[@]} \ ; diff --git a/bin/altaria/smol-game b/bin/altaria/smol-game index 3c5db40..91adfb9 100755 --- a/bin/altaria/smol-game +++ b/bin/altaria/smol-game @@ -2,9 +2,8 @@ source ${0:a:h}/xorg.zsh XRANDR_SET \ - --compositing disable \ + --compositing enable \ --screen-blank disable \ - --background captain-falcon.jpg \ --sound-effect gamedock \ ${XRANDR_ARGS__smol__1080p[@]} --pos 0x0 --primary \ ; diff --git a/bin/i3-utils b/bin/i3-utils index 7627b9c..c56ba56 100755 --- a/bin/i3-utils +++ b/bin/i3-utils @@ -1,26 +1,24 @@ #!/bin/zsh -source "$HOME/.config/wryn/env.zsh" case $1 in + ( next | previous | play-pause ) playerctl $1 ;; + ( fastforward ) playerctl position 5+ ;; + ( rewind ) playerctl position 5- ;; - #next ) scwrypts desktop media -- next ;; - #prev ) scwrypts desktop media -- prev ;; - #play ) scwrypts desktop media -- play ;; + ( volumedown ) scwrypts -n desktop pulseaudio -- sink down ;; + ( volumeup ) scwrypts -n desktop pulseaudio -- sink up ;; + ( volumemute ) scwrypts -n desktop pulseaudio -- sink mute ;; + ( micmute ) scwrypts -n desktop pulseaudio -- source mute ;; - volumeup ) scwrypts desktop pulseaudio -- sink up ;; - volumedown ) scwrypts desktop pulseaudio -- sink down ;; - volumemute ) scwrypts desktop pulseaudio -- sink mute ;; - micmute ) scwrypts desktop pulseaudio -- source mute ;; + ( backlightup ) scwrypts -n desktop backlight -- up ;; + ( backlightdown ) scwrypts -n desktop backlight -- down ;; - backlightup ) scwrypts desktop backlight -- up ;; - backlightdown ) scwrypts desktop backlight -- down ;; + ( lock ) scwrypts -n desktop lock i3 -- ;; - lock ) scwrypts desktop lock i3 -- ;; + ( bgrandomize ) scwrypts desktop set i3 background -- random ;; - bgrandomize ) scwrypts desktop set i3 background -- random ;; + ( logout ) scwrypts desktop i3 logout -- ;; - logout ) scwrypts desktop i3 logout -- ;; - - launch ) + ( launch ) local PROGRAM local ARGS=() case $2 in @@ -40,7 +38,7 @@ case $1 in scwrypts i3 launch or show -- $PROGRAM ${ARGS[@]} ;; - screenshot ) + ( screenshot ) command -v deepin-screen-recorder || notify-send "I3 UTILS" "no screenshot application available" deepin-screen-recorder DEEPIN_CONFIG="$HOME/.config/deepin/deepin-screen-recorder/deepin-screen-recorder.conf" diff --git a/bin/scwrypts b/bin/scwrypts deleted file mode 100755 index 368d4cc..0000000 --- a/bin/scwrypts +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/zsh -__X="$SCWRYPTS_ENV" -source $HOME/.config/wryn/env.zsh - -SCWRYPTS_ENV="$__X" "$DOTWRYN/zsh/plugins/scwrypts/scwrypts" $@ diff --git a/bin/umbreon/scwrypts b/bin/umbreon/scwrypts new file mode 120000 index 0000000..a1b734c --- /dev/null +++ b/bin/umbreon/scwrypts @@ -0,0 +1 @@ +../../zsh/plugins/scwrypts/scwrypts \ No newline at end of file diff --git a/colorschemes/spring-sunset.yaml b/colorschemes/spring-sunset.yaml index 42c8955..15319aa 100644 --- a/colorschemes/spring-sunset.yaml +++ b/colorschemes/spring-sunset.yaml @@ -5,6 +5,22 @@ foreground: .material.secondary.50 alacritty: transparency: 0.85 +i3: + focused: + border: .material.primary.500 + indicator: .material.primary.700 + text: .material.foreground.primary.500 + + inactive: + border: .material.secondary.400 + indicator: .material.secondary.500 + text: .material.foreground.secondary.400 + + unfocused: + border: .material.secondary.800 + indicator: .material.secondary.900 + text: .material.foreground.secondary.800 + ansi: blue: regular: '#5ab5e0' diff --git a/config/dotwryn.env.vim b/config/dotwryn.env.vim deleted file mode 100644 index f1517a0..0000000 --- a/config/dotwryn.env.vim +++ /dev/null @@ -1,14 +0,0 @@ -" -- RC Resources ----------------------------------------------- {{{ -if empty($DOTWRYN) - let $DOTWRYN=expand("$HOME/.wryn") -endif -let $WRYNVIMPATH=expand("$DOTWRYN/vim") -let $WRYNVIMRC=expand("$WRYNVIMPATH/rc.vim") -" }}} - -" -- Leader bindings -------------------------------------------- {{{ -let mapleader = "\\" - -nmap -let maplocalleader = "\" -" }}} diff --git a/config/dotwryn.env.zsh b/config/dotwryn.env.zsh index 0bde055..b020f8b 100644 --- a/config/dotwryn.env.zsh +++ b/config/dotwryn.env.zsh @@ -1,72 +1,21 @@ ##################################################################### -### Path References ################################################# +### default .wryn configuration settings ############################ ##################################################################### +# installation path for this repository export DOTWRYN="$HOME/.wryn" -export SOURCE_PACKAGES="$HOME/.local/share/source-packages" -RELOAD_ZSH_UTILS() { - local SCWRYPTS_ROOT="$(scwrypts --root 2>/dev/null)" - : \ - && [ $SCWRYPTS_ROOT ] \ - && [ -d "$SCWRYPTS_ROOT" ] \ - && source "$(scwrypts --root)/zsh/lib/utils/utils.module.zsh" \ - && export DOTWRYN_UTILS_LOADED=1 \ - ; -} -[ $DOTWRYN_UTILS_LOADED ] || RELOAD_ZSH_UTILS - -##################################################################### -### Application Settings ############################################ -##################################################################### - -export PREFERRED_EDITOR=(vim vi) - -RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config" +# order of editor preference +export PREFERRED_EDITORS=(vim vi nano) +# prompt generator settings PS1_BRANCH_SYMBOL='' PS1_INDICATOR_SYMBOL='☕' PS1_SEPARATOR='::' PS1_USER='%m' +# run at each zsh login WELCOME () { + [[ $TERM =~ tmux ]] && return 0 { figlet 'Welcome, beautiful'; cowsay -p 'damn u sexy'; } | lolcat } - -##################################################################### -### External Plugins / Settings ##################################### -##################################################################### - -# fzf -EXTERNAL_PLUGINS+=( - '/usr/share/fzf/key-bindings.zsh' - '/usr/share/fzf/completion.zsh' -) - -export FZF_DEFAULT_OPTS='--reverse --ansi --height 50% --bind=ctrl-c:cancel' -export FZF_DEFAULT_COMMAND='rg --files' - -# fzf-tab -EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/fzf-tab/fzf-tab.plugin.zsh") - -zstyle ':fzf-tab:*' accept-line enter -zstyle ':fzf-tab:*' fzf-bindings 'space:accept' ';:toggle' -zstyle ':fzf-tab:*' continuous-trigger '/' - -# scwrypts -EXTERNAL_PLUGINS+=("$(scwrypts --root 2>/dev/null)/scwrypts.plugin.zsh") - -for e in \ - "local.$(hostnamectl --static).secret" \ - "local.$(hostnamectl --static)" \ - "local" -do export SCWRYPTS_ENV="$e"; [ -f "$HOME/.config/scwrypts/environments/scwrypts/$e" ] && break; done - -# z -EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/z/z.sh") - -# code-activator -EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/code-activator/activator.plugin.zsh") - -# ssh -EXTERNAL_PLUGINS+=("$DOTWRYN/zsh/plugins/ssh/ssh.plugin.zsh") diff --git a/config/i3.conf b/config/i3.conf index 090e5b7..bcfdd7e 100644 --- a/config/i3.conf +++ b/config/i3.conf @@ -10,44 +10,44 @@ font pango:Monaspace Argon, pango:Noto Color Emoji, pango:Symbols Nerd Font 16 ## Custom Utility ############################################################## ################################################################################ -set $UTILS /home/w0ryn/.config/i3/utils +set $UTILS exec --no-startup-id /home/w0ryn/.config/i3/utils # Audio -bindsym XF86AudioRewind exec --no-startup-id $UTILS prev -bindsym XF86AudioPrev exec --no-startup-id $UTILS prev -bindsym XF86AudioForward exec --no-startup-id $UTILS next -bindsym XF86AudioNext exec --no-startup-id $UTILS next -bindsym XF86AudioPlay exec --no-startup-id $UTILS play -bindsym XF86AudioRaiseVolume exec --no-startup-id $UTILS volumeup -bindsym XF86AudioLowerVolume exec --no-startup-id $UTILS volumedown -bindsym XF86AudioMute exec --no-startup-id $UTILS volumemute -bindsym XF86AudioMicMute exec --no-startup-id $UTILS micmute +bindsym XF86AudioRewind $UTILS previous +bindsym XF86AudioPrev $UTILS previous +bindsym XF86AudioForward $UTILS next +bindsym XF86AudioNext $UTILS next +bindsym XF86AudioPlay $UTILS play-pause +bindsym XF86AudioRaiseVolume $UTILS volumeup +bindsym XF86AudioLowerVolume $UTILS volumedown +bindsym XF86AudioMute $UTILS volumemute +bindsym XF86AudioMicMute $UTILS micmute # Screen brightness -bindsym XF86MonBrightnessUp exec --no-startup-id $UTILS backlightup -bindsym XF86MonBrightnessDown exec --no-startup-id $UTILS backlightdown +bindsym XF86MonBrightnessUp $UTILS backlightup +bindsym XF86MonBrightnessDown $UTILS backlightdown # Quick applications -bindsym $mod+Shift+m exec --no-startup-id $UTILS launch messages -bindsym $mod+Shift+d exec --no-startup-id $UTILS launch discord -bindsym $mod+c exec --no-startup-id $UTILS launch voice -bindsym $mod+m exec --no-startup-id $UTILS launch ytmusic -bindsym $mod+Shift+s exec --no-startup-id $UTILS launch spotify -bindsym $mod+a exec --no-startup-id $UTILS launch pavuctrl -bindsym $mod+Shift+p exec --no-startup-id $UTILS launch scrcpy -bindsym $mod+Shift+o exec --no-startup-id $UTILS launch obs +bindsym $mod+Shift+m $UTILS launch messages +bindsym $mod+Shift+d $UTILS launch discord +bindsym $mod+c $UTILS launch voice +bindsym $mod+m $UTILS launch ytmusic +bindsym $mod+Shift+s $UTILS launch spotify +bindsym $mod+a $UTILS launch pavuctrl +bindsym $mod+Shift+p $UTILS launch scrcpy +bindsym $mod+Shift+o $UTILS launch obs # Terminal bindsym $mod+Return exec --no-startup-id i3-sensible-terminal # Other -bindsym $mod+p exec --no-startup-id $UTILS bgrandomize +bindsym $mod+p $UTILS bgrandomize -bindsym $mod+Shift+minus exec --no-startup-id $UTILS lock +bindsym $mod+Shift+minus $UTILS lock bindsym $mod+space exec --no-startup-id dmenu_run -c -l 5 -fn 'DejaVuSansMono Nerd Font-25' -bindsym $mod+backslash exec --no-startup-id $UTILS screenshot +bindsym $mod+backslash $UTILS screenshot ################################################################################ ## Window Management and Navigation ############################################ @@ -126,6 +126,20 @@ bindsym $mod+Shift+x [class=$GAMES_CLIENT_CLASSES] scratchpad show set $TERMINAL_EMULATOR_CLASSES ^(Alacritty)$ bindsym $mod+x [class=$TERMINAL_EMULATOR_CLASSES] scratchpad show +# floating window / notification compatibility +for_window [window_role="About"] floating enable +for_window [window_role="Organizer"] floating enable +for_window [window_role="Preferences"] floating enable +for_window [window_role="bubble"] floating enable +for_window [window_role="page-info"] floating enable +for_window [window_role="pop-up"] floating enable +for_window [window_role="task_dialog"] floating enable +for_window [window_role="toolbox"] floating enable +for_window [window_role="webconsole"] floating enable +for_window [window_type="dialog"] floating enable +for_window [window_type="menu"] floating enable +for_window [class="[xX]fce4-notifyd"] border pixel 0 + ################################################################################ ## i3 Settings ################################################################# ################################################################################ @@ -141,8 +155,6 @@ for_window [class="^.*"] border pixel 4 gaps inner 0 gaps outer 0 -# prevent borders on xfce4-notifyd -for_window [class="[xX]fce4-notifyd"] border pixel 0 bindsym $mod+z gaps outer current plus 2; gaps inner current plus 2; bindsym $mod+shift+z gaps outer current minus 2; gaps inner current minus 2; diff --git a/config/i3.config.yaml b/config/i3.config.yaml index 9f0c7d8..449bd8e 100644 --- a/config/i3.config.yaml +++ b/config/i3.config.yaml @@ -8,18 +8,18 @@ font: FontAwesome application-launcher: >- - dmenu_run -c -l 5 -fn 'DejaVuSansMono Nerd Font-25' + "rofi -theme $DOTWRYN/config/rofi.theme.rasi -modes drun,run -show run" + +# application-launcher: >- +# dmenu_run -c -l 5 -fn 'DejaVuSansMono Nerd Font-25' gaps: inner: 0 outer: 0 -i3configs: - - |- - # for use after any command which should refresh the statusbar - set $refresh_statusbar killall -SIGUSR1 i3status - bar { - status_command i3status - } - # - exec_always --no-startup-id $DOTWRYN/bin/polybar & - - exec --no-startup-id i3-msg workspace 1 +statusbar: + # supported values are 'polybar' and 'i3status' + type: polybar + +# a list of i3conifg excerpts that should be appended to the generated config +i3configs: [] diff --git a/config/scwrypts/dotfiles.zsh b/config/scwrypts/dotfiles.zsh index 53fb4fa..f22ec6f 100644 --- a/config/scwrypts/dotfiles.zsh +++ b/config/scwrypts/dotfiles.zsh @@ -14,7 +14,6 @@ $DOTWRYN/bin/i3-utils i3/utils $DOTWRYN/colorschemes/active/kitty.conf kitty/theme.conf $DOTWRYN/colorschemes/active/alacritty.toml alacritty/theme.toml $DOTWRYN/colorschemes/active/alacritty.yaml alacritty/theme.yml -$DOTWRYN/colorschemes/active/getty.sh wryn/tty-colorscheme $DOTWRYN/config/alacritty.toml alacritty/alacritty.toml $DOTWRYN/config/alacritty.default.toml alacritty/default.toml $DOTWRYN/config/alacritty.yaml alacritty/alacritty.yml diff --git a/config/scwrypts/environments/scwrypts/local.altaria b/config/scwrypts/environments/scwrypts/local.altaria index 12d9b43..038a9fb 100644 --- a/config/scwrypts/environments/scwrypts/local.altaria +++ b/config/scwrypts/environments/scwrypts/local.altaria @@ -36,14 +36,13 @@ export LINEAR__API_TOKEN= # s3 bucket name and filesystem targets for media backups export MEDIA_SYNC__S3_BUCKET=yage # from local export MEDIA_SYNC__TARGETS=( - .local/share/dolphin-emu - .porn - Games/roms - Games/wrynscape + Pictures Documents Media - Pictures - Archives/recordings + .local/.porn + Games/roms + .local/share/dolphin-emu + Games/archives ) # redis connection credentials diff --git a/config/xinitrc.common b/config/xinitrc.common index 80e6593..5c48114 100644 --- a/config/xinitrc.common +++ b/config/xinitrc.common @@ -1,10 +1,24 @@ #!/bin/zsh -export PATH="$DOTWRYN/bin/$(hostnamectl --static):$PATH" +for PREFERRED_TERMINAL in \ + alacritty \ + kitty \ + ; +do + command -v $PREFERRED_TERMINAL &/dev/null 2>&1 \ - && export TERMINAL=$(which kitty) +for PREFERRED_BROWSER in \ + google-chrome-stable \ + google-chrome \ + ; +do + command -v $PREFERRED_BROWSER & >/dev/null \ + && export BROWSER="$(which $PREFERRED_BROWSER)" \ + && break +done -command -v alacritty >/dev/null 2>&1 \ - && export TERMINAL=$(which alacritty) +for XINITRC in $(find /etc/X11/xinit/xinitrc.d); do source "$XINITRC"; done -for SCRIPT in $(find /etc/x11/xinit/xinitrc.d); do source $SCRIPT; done +unset PREFERRED_TERMINAL PREFERRED_BROWSER XINITRC diff --git a/config/xinitrc.i3 b/config/xinitrc.i3 index a061bbc..fd19fc6 100644 --- a/config/xinitrc.i3 +++ b/config/xinitrc.i3 @@ -1,23 +1,18 @@ #!/bin/zsh -source "$HOME/.config/wryn/env.zsh" +source "$HOME/.zshrc" &>/dev/null source "$DOTWRYN/config/xinitrc.common" -command -v dex && dex -a - -for FILE in $(find /etc/X11/xinit/xinitrc.d/ -type f) +for BACKGROUND_APPLICATION in \ + apps \ + /usr/lib/xfce-polkit/xfce-polkit \ + /usr/lib/xfce4/notifyd/xfce4-notifyd \ + "$DOTWRYN/bin/xorg-activate-default" \ + ; do - source "$FILE" + command -v $BACKGROUND_APPLCATION \ + && exec $BACKGROUND_APPLICATION & done -unset FILE -[ -f /usr/lib/xfce-polkit/xfce-polkit ] \ - && exec /usr/lib/xfce-polkit/xfce-polkit & - -[ -f /usr/lib/xfce4/notifyd/xfce4-notifyd ] \ - && exec /usr/lib/xfce4/notifyd/xfce4-notifyd & - -$DOTWRYN/bin/xorg-activate-default & - -cd export DESKTOP_SESSION=i3wm -exec i3 + +cd; exec i3 diff --git a/scwrypts/dotwryn/lib/desktop/colorscheme/getty.module.zsh b/scwrypts/dotwryn/lib/desktop/colorscheme/getty.module.zsh index c380888..021e1c2 100644 --- a/scwrypts/dotwryn/lib/desktop/colorscheme/getty.module.zsh +++ b/scwrypts/dotwryn/lib/desktop/colorscheme/getty.module.zsh @@ -32,5 +32,5 @@ return 0 } _SET_THEME__getty() { - ln -sf "$_COLORSCHEME_FILE__getty" "$HOME/.config/wryn/tty-colorscheme" + return 0 # theme is referenced explicitly after generation } diff --git a/scwrypts/dotwryn/lib/desktop/xorg/i3.module.zsh b/scwrypts/dotwryn/lib/desktop/xorg/i3.module.zsh index 89d3613..82b0005 100644 --- a/scwrypts/dotwryn/lib/desktop/xorg/i3.module.zsh +++ b/scwrypts/dotwryn/lib/desktop/xorg/i3.module.zsh @@ -66,6 +66,17 @@ I3__GENERATE_CUSTOM_CONFIG() { echo "# - i3 config base : $DOTWRYN/config/i3.conf" echo "# - custom values : $CONFIG_DEFAULT_FILE" echo "# - override values : $CONFIG_OVERRIDE_FILE" + + case $(GET .statusbar.type) in + i3status ) + echo 'set $refresh_statusbar killall -SIGUSR1 i3status' + echo 'bar { status_command i3status }' + ;; + polybar ) + echo "exec_always --no-startup-id $DOTWRYN/bin/polybar &" + echo "exec --no-startup-id i3-msg workspace 1" + ;; + esac } > "$I3_CONFIG.temp" \ && sed " /Legacy Defaults/,\$d @@ -85,25 +96,25 @@ I3__GENERATE_CUSTOM_CONFIG() { s/^\(# color settings\).*$/\1 (theme '$(basename $(readlink -f "$DOTWRYN/colorschemes/active/main.conf") | sed 's/\.conf//')')/ - s/\(^set \$FOCUSED_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.secondary.500 .ansi.green.bright)/ - s/\(^set \$FOCUSED_INDICATOR.*#\).*/\1$(COLOR .material.secondary.700 .ansi.green.regular)/ - s/\(^set \$FOCUSED_TEXT.*#\).*/\1$(COLOR .material.foreground.secondary.500 .foreground)/ + s/\(^set \$FOCUSED_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .i3.focused.border .material.secondary.500 .ansi.green.bright)/ + s/\(^set \$FOCUSED_INDICATOR.*#\).*/\1$(COLOR .i3.focused.indicator .material.secondary.700 .ansi.green.regular)/ + s/\(^set \$FOCUSED_TEXT.*#\).*/\1$(COLOR .i3.focused.text .material.foreground.secondary.500 .foreground)/ - s/\(^set \$INACTIVE_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.primary.500 .ansi.blue.bright)/ - s/\(^set \$INACTIVE_INDICATOR.*#\).*/\1$(COLOR .material.primary.600 .ansi.blue.regular)/ - s/\(^set \$INACTIVE_TEXT.*#\).*/\1$(COLOR .material.foreground.primary.500 .foreground)/ + s/\(^set \$INACTIVE_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .i3.inactive.border .material.primary.500 .ansi.blue.bright)/ + s/\(^set \$INACTIVE_INDICATOR.*#\).*/\1$(COLOR .i3.inactive.indicator .material.primary.600 .ansi.blue.regular)/ + s/\(^set \$INACTIVE_TEXT.*#\).*/\1$(COLOR .i3.inactive.text .material.foreground.primary.500 .foreground)/ - s/\(^set \$UNFOCUSED_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.primary.700 .ansi.yellow.bright)/ - s/\(^set \$UNFOCUSED_INDICATOR.*#\).*/\1$(COLOR .material.primary.900 .ansi.yellow.regular)/ - s/\(^set \$UNFOCUSED_TEXT.*#\).*/\1$(COLOR .material.foreground.primary.700 .foreground)/ + s/\(^set \$UNFOCUSED_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .i3.unfocused.border .material.primary.700 .ansi.yellow.bright)/ + s/\(^set \$UNFOCUSED_INDICATOR.*#\).*/\1$(COLOR .i3.unfocused.indicator .material.primary.900 .ansi.yellow.regular)/ + s/\(^set \$UNFOCUSED_TEXT.*#\).*/\1$(COLOR .i3.unfocused.text .material.foreground.primary.700 .foreground)/ - s/\(^set \$URGENT_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.error.500 .ansi.red.bright)/ - s/\(^set \$URGENT_INDICATOR.*#\).*/\1$(COLOR .material.error.700 .ansi.red.regular)/ - s/\(^set \$URGENT_TEXT.*#\).*/\1$(COLOR .material.foreground.error.500 .foreground)/ + s/\(^set \$URGENT_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .i3.urgent.border .material.error.500 .ansi.red.bright)/ + s/\(^set \$URGENT_INDICATOR.*#\).*/\1$(COLOR .i3.urgent.indicator .material.error.700 .ansi.red.regular)/ + s/\(^set \$URGENT_TEXT.*#\).*/\1$(COLOR .i3.urgent.text .material.foreground.error.500 .foreground)/ - s/\(^set \$PLACEHOLDER_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .material.primary.300 .ansi.cyan.bright)/ - s/\(^set \$PLACEHOLDER_INDICATOR.*#\).*/\1$(COLOR .material.primary.100 .ansi.cyan.regular)/ - s/\(^set \$PLACEHOLDER_TEXT.*#\).*/\1$(COLOR .material.foreground.primary.300 .foreground)/ + s/\(^set \$PLACEHOLDER_\(BORDER\|BACKGROUND\|CHILD_BORDER\).*#\).*/\1$(COLOR .i3.placeholder.border .material.primary.300 .ansi.cyan.bright)/ + s/\(^set \$PLACEHOLDER_INDICATOR.*#\).*/\1$(COLOR .i3.placeholder.indicator .material.primary.100 .ansi.cyan.regular)/ + s/\(^set \$PLACEHOLDER_TEXT.*#\).*/\1$(COLOR .i3.placeholder.text .material.foreground.primary.300 .foreground)/ " "$DOTWRYN/config/i3.conf" > "$I3_CONFIG.temp2" \ && grep "^font " "$I3_CONFIG.temp2" >> "$I3_CONFIG.temp" \ && grep "^set " "$I3_CONFIG.temp2" >> "$I3_CONFIG.temp" \ diff --git a/setup/config.zsh b/setup/config.zsh index 8bd787f..9ff8fe6 100644 --- a/setup/config.zsh +++ b/setup/config.zsh @@ -33,8 +33,7 @@ CONFIG__SET_DEFAULT_SHELL() { ##################################################################### CONFIG__VIM() { - CONFIG__ENV vim || return 1 - CONFIG__RC vim || return 2 + CONFIG__RC vim || return 1 STATUS 'starting vim setup' SCWRYPTS --name system/vim/vundle/install --group scwrypts --type zsh || return 1 @@ -61,7 +60,6 @@ CONFIG__ENV() { STATUS "setting up $1 configuration ($LOCAL_CONFIG)" case $1 in - vim ) COMMENT='"' ;; zsh ) COMMENT='#' ;; esac @@ -96,4 +94,3 @@ CONFIG__RC() { || FAIL 1 "failed to configure ${TYPE}rc" \ ; } - diff --git a/setup/os-dependencies/arch.txt b/setup/os-dependencies/arch.txt index 75998d9..327a71e 100644 --- a/setup/os-dependencies/arch.txt +++ b/setup/os-dependencies/arch.txt @@ -1,9 +1,13 @@ +1password +1password-cli alacritty +arch-install-scripts aws-cli-v2 base-devel bat cmake cowsay +feh figlet fprintd fzf @@ -13,20 +17,42 @@ google-chrome htop i3-wm i3lock-color -i3status jdk-openjdk jq lolcat +lxappearance monaspace-font mono ncurses +neofetch nodejs +noto-fonts-emoji npm +ntp +obs-studio +openssh pam-fprint-grosshack +picom +playerctl +polybar python +python-pip +python-pylint +python-rtmidi +python-virtualenv ripgrep +rofi +rustup +sudo tmux unipicker +vi vim vim-runtime +which +xclip +xdotool yamllint +zip +zsh +zsh-completions diff --git a/setup/os-dependencies/generic.txt b/setup/os-dependencies/generic.txt index 0edb363..0d18ab9 100644 --- a/setup/os-dependencies/generic.txt +++ b/setup/os-dependencies/generic.txt @@ -5,6 +5,7 @@ figlet fzf go java +jq lolcat ncurses node @@ -13,3 +14,4 @@ python3 rg tmux xbuild +yq diff --git a/vim/rc.d/00.plugin-vundle.vim b/vim/rc.d/00.plugin-vundle.vim new file mode 100644 index 0000000..63c25be --- /dev/null +++ b/vim/rc.d/00.plugin-vundle.vim @@ -0,0 +1,25 @@ +if !isdirectory(expand("$HOME/.vim/bundle/Vundle.vim")) | let g:plugins_ok = 0 | finish | endif +" ------------------------------------------------------------------- + +set nocompatible +filetype off + +set rtp+=~/.vim/bundle/Vundle.vim + +call vundle#begin() + Plugin 'VundleVim/Vundle.vim' " 00.plugin-vundle.vim + Plugin 'valloric/youcompleteme' " 01.plugin-youcompleteme.vim + Plugin 'w0rp/ale' " 02.plugin-ale.vim + Plugin 'scrooloose/nerdtree' " 03.plugin-nerdtree.vim + Plugin 'tpope/vim-surround' " 04.plugin-vim-surround.vim + Plugin 'tpope/vim-fugitive' " 05.plugin-vim-fugitive.vim + Plugin 'jeffkreeftmeijer/vim-dim' " 07.plugin-vim-dim.vim + Plugin 'chrisbra/unicode.vim' " 08.plugin-unicode.vim + Plugin 'rrethy/vim-hexokinase' " 09.plugin-vim-hexokinase.vim + Plugin 'fatih/vim-go' " 10.plugin-vim-go.vim + Plugin 'rust-lang/rust.vim' " 11.plugin-rust.vim +" --------------------------------------------------------------------- +call vundle#end() + +filetype plugin indent on +let g:plugins_ok = 1 diff --git a/vim/rc.d/01.plugin-youcompleteme.vim b/vim/rc.d/01.plugin-youcompleteme.vim new file mode 100644 index 0000000..f99c341 --- /dev/null +++ b/vim/rc.d/01.plugin-youcompleteme.vim @@ -0,0 +1,29 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + +let g:ycm_autoclose_preview_window_after_insertion = 1 +let g:ycm_goto_buffer_command = 'new-tab' +let g:ycm_auto_hover = '' + +let g:preferred_rust_root = trim(system("rustup toolchain list -v | grep default | sed 's|[^/]*||'")) + +if isdirectory(g:preferred_rust_root) + let g:ycm_rust_toolchain_root = g:preferred_rust_root +endif + +function! ToggleYCM() + if g:ycm_auto_trigger + let g:ycm_auto_trigger = 0 + echohl DiffDelete | echo "YouCompleteMe autocompletion disabled" | echohl None + else + let g:ycm_auto_trigger = 1 + echohl DiffAdd | echo "YouCompleteMe autocompletion enabled" | echohl None + endif +endfunction + +nnoremap :call ToggleYCM() +nnoremap gd :YcmCompleter GoToDefinition + +augroup ycm_hover + autocmd FileType rust,typescript,javascript,python nnoremap ? (YCMHover) +augroup end diff --git a/vim/rc.d/02.plugin-ale.vim b/vim/rc.d/02.plugin-ale.vim new file mode 100644 index 0000000..6578621 --- /dev/null +++ b/vim/rc.d/02.plugin-ale.vim @@ -0,0 +1,26 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + +let g:ale_linters = { +\ 'cs' : ['OmniSharp'], +\ 'python' : ['pylint'], +\ 'go' : ['golint'], +\ 'rust' : ['analyzer'], +\} + +let g:ale_fixers = { +\ 'javascript': ['prettier'], +\ 'typescript': ['prettier'], +\ 'rust': ['rustfmt'], +\} + +let g:ale_lint_on_text_changed = 0 +let g:ale_lint_on_insert_leave = 0 +let g:ale_lint_on_save = 1 +let g:ale_sign_column_always = 1 + +nnoremap at (ale_toggle_buffer) +nnoremap ae (ale_next) +nnoremap ad :YcmDiags " requires 01.plugin-youcompleteme.vim +nnoremap ar (ale_previous) +nnoremap f (ale_fix) diff --git a/vim/rc.d/03.plugin-nerdtree.vim b/vim/rc.d/03.plugin-nerdtree.vim new file mode 100644 index 0000000..91943aa --- /dev/null +++ b/vim/rc.d/03.plugin-nerdtree.vim @@ -0,0 +1,5 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + +nnoremap :NERDTreeToggle % +let g:NERDTreeNodeDelimiter = "\u00a0" " -- fixes ^G character diff --git a/vim/rc.d/04.plugin-vim-surround.vim b/vim/rc.d/04.plugin-vim-surround.vim new file mode 100644 index 0000000..b638f97 --- /dev/null +++ b/vim/rc.d/04.plugin-vim-surround.vim @@ -0,0 +1,3 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + diff --git a/vim/rc.d/05.plugin-vim-fugitive.vim b/vim/rc.d/05.plugin-vim-fugitive.vim new file mode 100644 index 0000000..9d87bcd --- /dev/null +++ b/vim/rc.d/05.plugin-vim-fugitive.vim @@ -0,0 +1,9 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + +" I'm not really convinced this is a useful plugin for me; keeping it +" around for a bit longer to see if I find some fantastic way I work +" well with it since it is very popular :) + +" \g git fugitive shortcuts +nnoremap gb :Git blame diff --git a/vim/rc.d/07.plugin-vim-dim.vim b/vim/rc.d/07.plugin-vim-dim.vim new file mode 100644 index 0000000..b638f97 --- /dev/null +++ b/vim/rc.d/07.plugin-vim-dim.vim @@ -0,0 +1,3 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + diff --git a/vim/rc.d/08.plugin-unicode.vim b/vim/rc.d/08.plugin-unicode.vim new file mode 100644 index 0000000..084facf --- /dev/null +++ b/vim/rc.d/08.plugin-unicode.vim @@ -0,0 +1,4 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + +imap (UnicodeFuzzy) diff --git a/vim/rc.d/09.plugin-vim-hexokinase.vim b/vim/rc.d/09.plugin-vim-hexokinase.vim new file mode 100644 index 0000000..e436173 --- /dev/null +++ b/vim/rc.d/09.plugin-vim-hexokinase.vim @@ -0,0 +1,4 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + +let g:Hexokinase_highlighters = ['foregroundfull'] diff --git a/vim/rc.d/10.plugin-vim-go.vim b/vim/rc.d/10.plugin-vim-go.vim new file mode 100644 index 0000000..92a2637 --- /dev/null +++ b/vim/rc.d/10.plugin-vim-go.vim @@ -0,0 +1,8 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + +let g:go_imports_autosave = 0 +let g:go_def_mapping_enabled = 0 +let g:go_fmt_fail_silently = 1 +let g:go_def_reuse_buffer = 1 +let g:go_textobj_enabled = 0 diff --git a/vim/rc.d/11.plugin-rust.vim b/vim/rc.d/11.plugin-rust.vim new file mode 100644 index 0000000..b638f97 --- /dev/null +++ b/vim/rc.d/11.plugin-rust.vim @@ -0,0 +1,3 @@ +if g:plugins_ok != 1 | finish | endif +" ------------------------------------------------------------------- + diff --git a/vim/options.vim b/vim/rc.d/20.options.vim similarity index 82% rename from vim/options.vim rename to vim/rc.d/20.options.vim index a61941b..bd9d4b1 100644 --- a/vim/options.vim +++ b/vim/rc.d/20.options.vim @@ -8,4 +8,4 @@ set timeoutlen=200 set showmatch matchtime=0 set backspace=indent,eol,start -set spellfile=$WRYNVIMPATH/en.utf-8.add spelllang=en +set spellfile=$DOTWRYN/vim/en.utf-8.add spelllang=en diff --git a/vim/rc.d/30.utility.vim b/vim/rc.d/30.utility.vim new file mode 100644 index 0000000..d14819f --- /dev/null +++ b/vim/rc.d/30.utility.vim @@ -0,0 +1,7 @@ +function EnsureTmuxSession() + call system("tmux new -ds " . g:escapeTmuxSession . " -c $HOME >/dev/null 2>&1") +endfunction + +function FindGitRoot() + return finddir('.git/..', expand('%:p:h').';') +endfunction diff --git a/vim/execute.vim b/vim/rc.d/31.utility-execute.vim similarity index 74% rename from vim/execute.vim rename to vim/rc.d/31.utility-execute.vim index 4274d82..12cd9a3 100644 --- a/vim/execute.vim +++ b/vim/rc.d/31.utility-execute.vim @@ -1,18 +1,13 @@ +" +" escape-to-shell execution wrapper with great functionality +" and an OK-to-bad API (EXTREMELY helpful) +" + let escapeTmuxSession = "vim-exec" let escapeTmuxPaneID = g:escapeTmuxSession . ":0.0" let escapeCommandOutputs = ['tmux', 'split-pane-vertical', 'split-pane-horizontal'] -function ExecuteScwrypt(scwrypt = '', args = '', output = '', syntax = 'bash') - let b:scwryptsPrevArgs = a:args - call ExecuteCommand('scwrypts -n ' . a:scwrypt . ' -- ' . a:args, a:output, 'shell', a:syntax) - echom 'scwrypts -n ' . a:scwrypt . '--' . a:args -endfunction - -function ExecuteScwryptInteractive(scwrypt = '', args = '', output = '', syntax = 'bash') - call ExecuteScwrypt(a:scwrypt, a:args . input('scwrypts ' . a:scwrypt . '--' . a:args), a:output, a:syntax) -endfunction - function ExecuteCommand(args = '', output = '', flavor = 'shell', syntax = 'bash') let output = a:output if output == '' @@ -83,11 +78,3 @@ function GetPrefferredCommandOutput() return 'shell-escape' endfunction - -function EnsureTmuxSession() - call system("tmux new -ds " . g:escapeTmuxSession . " -c $HOME >/dev/null 2>&1") -endfunction - -function FindGitRoot() - return finddir('.git/..', expand('%:p:h').';') -endfunction diff --git a/vim/rc.d/32.utility-scwrypts.vim b/vim/rc.d/32.utility-scwrypts.vim new file mode 100644 index 0000000..bb1ff80 --- /dev/null +++ b/vim/rc.d/32.utility-scwrypts.vim @@ -0,0 +1,13 @@ +" +" 31.utility-execute.vim wrapper for scwrypts-specific execution +" + +function ExecuteScwrypt(scwrypt = '', args = '', output = '', syntax = 'bash') + let b:scwryptsPrevArgs = a:args + call ExecuteCommand('scwrypts -n ' . a:scwrypt . ' -- ' . a:args, a:output, 'shell', a:syntax) + echom 'scwrypts -n ' . a:scwrypt . '--' . a:args +endfunction + +function ExecuteScwryptInteractive(scwrypt = '', args = '', output = '', syntax = 'bash') + call ExecuteScwrypt(a:scwrypt, a:args . input('scwrypts ' . a:scwrypt . '--' . a:args), a:output, a:syntax) +endfunction diff --git a/vim/rc.d/34.utility-quick-repl.vim b/vim/rc.d/34.utility-quick-repl.vim new file mode 100644 index 0000000..63bff49 --- /dev/null +++ b/vim/rc.d/34.utility-quick-repl.vim @@ -0,0 +1,59 @@ +" +" quickly open a REPL with r +" +" tries to guess based on configuration + filetype what repl to use, +" otherwise asks the user to provide the required REPL command +" for the current buffer +" +" always uses the last used REPL type unless specified otherwise +" in the :call arguments +" + +let g:quickrepl_commands_by_filetype = { + \ 'python': 'bpython', + \ 'zsh': 'zsh', + \ 'bash': 'bash', + \ 'typescript': 'node', + \ 'javascript': 'node', + \} + +let g:quickrepl_output_format_default = 'split-pane-horizontal' +let g:quickrepl_output_format_overrides_by_repl_command = { + \ 'bpython': 'split-pane-vertical', + \ 'node': 'split-pane-vertical', + \ 'zsh': 'split-pane-vertical', + \} + +let g:quickrepl_repl_command_args_by_repl_command= { + \ 'zsh': '-l', + \} + +function QuickREPL(repl = '') + let l:repl = a:repl + + if ( l:repl == '' ) + let l:repl = get(b:, 'quick_repl', '') + endif + + if ( l:repl == '' ) + let l:repl = get(g:quickrepl_commands_by_filetype, &filetype, '') + endif + + if ( l:repl == '' ) + let l:repl = input('input a repl command : ') | redraw + endif + + if ( l:repl == '' ) + echohl DiffDelete | echo "no command supplied; canceled REPL execution" | echohl None + return + endif + + let b:quick_repl = l:repl + + let l:output = get(g:quickrepl_output_format_overrides_by_repl_command, l:repl, g:quickrepl_output_format_default) + let l:repl_args = get(g:quickrepl_repl_command_args, l:repl, '') + + call ExecuteCommand(l:repl . ' ' . l:repl_args, l:output) +endfunction + +nnoremap r :call QuickREPL() diff --git a/vim/rc.d/35.utility-quick-command.vim b/vim/rc.d/35.utility-quick-command.vim new file mode 100644 index 0000000..9b4dca1 --- /dev/null +++ b/vim/rc.d/35.utility-quick-command.vim @@ -0,0 +1,43 @@ +" +" quickly run a custom command with t +" +" this is a safer version of what used to be my 'quicktest' +" bindings; sometimes I don't have the time to create a proper +" language/technology-specific testing utility, and would +" rather run a quick SHELL command at the touch of a button +" +" this safer, upgrade to the previous bindings (listed below) +" requires buffer-level specificity and does not allow quick +" commands to bleed between vim sessions and buffers; this +" has saved me from some accidental push-to-main-with-admin-power +" situations which arose from the previous bindings +" +" previously: +" +" " \t = run last quicktest +" " t)ype new quicktest +" " e)dit last quicktest +" nnoremap t q:?^echom 'quicktest' +" nnoremap tt q:oechom 'quicktest' \| call ExecuteCommand('')F'i +" nnoremap te q:?^echom 'quicktest' +" + +let g:quick_command_output_format = 'split-pane-horizontal' + +function QuickCommand() + let l:quick_command = get(b:, 'quick_command', '') + if ( l:quick_command == '' ) + let l:quick_command = input('input quick command : ') | redraw + endif + + if ( l:quick_command == '' ) + echohl DiffDelete | echo "no command supplied; canceled execution" | echohl None + return + endif + + let b:quick_command = l:quick_command + + call ExecuteCommand(l:quick_command, g:quick_command_output_format) +endfunction + +nnoremap t :call QuickCommand() diff --git a/vim/utility.vim b/vim/rc.d/39.utility-misc.vim similarity index 52% rename from vim/utility.vim rename to vim/rc.d/39.utility-misc.vim index 5ce4749..0e3d618 100644 --- a/vim/utility.vim +++ b/vim/rc.d/39.utility-misc.vim @@ -1,7 +1,10 @@ + function Sudowrite() execute 'w !sudo tee "%"' endfunction +nnoremap w :call Sudowrite() + function MakeFileExecutable(sudo = 0) if a:sudo execute '! sudo chmod +x "%"' @@ -9,3 +12,6 @@ function MakeFileExecutable(sudo = 0) execute '! chmod +x "%"' endif endfunction + +nnoremap x :call MakeFileExecutable(0) +nnoremap xx :call MakeFileExecutable(1) diff --git a/vim/formatting.vim b/vim/rc.d/41.file-formatting.vim similarity index 100% rename from vim/formatting.vim rename to vim/rc.d/41.file-formatting.vim diff --git a/vim/file-execute.vim b/vim/rc.d/42.file-execute.vim similarity index 76% rename from vim/file-execute.vim rename to vim/rc.d/42.file-execute.vim index 39406a6..78d962b 100644 --- a/vim/file-execute.vim +++ b/vim/rc.d/42.file-execute.vim @@ -40,6 +40,15 @@ augroup file_specific_commands autocmd FileType yaml let b:executeBuild = 'call ExecuteScwrypt(b:scwryptBuild, b:scwryptArgs, "split-pane-vertical", "yaml")' autocmd FileType yaml let b:executeTest = 'call ExecuteScwrypt(b:scwryptDefault, b:scwryptArgs, "split-pane-vertical", "yaml")' + autocmd FileType rust let b:executeDefault = "call ExecuteCommand('zsh -c \"cd %:p:h; cargo run --quiet\"', 'split-pane-horizontal')" + autocmd BufRead,BufNewFile */Cargo.toml let b:executeDefault = "call ExecuteCommand('zsh -c \"cd %:p:h; cargo run --quiet\"', 'split-pane-horizontal')" + autocmd FileType rust let b:executeInteractive = "call ExecuteCommand('zsh -c \"cd %:p:h; cargo run --quiet -- ' . input('cargo run -- ') . '\"', 'split-pane-horizontal')" + autocmd BufRead,BufNewFile */Cargo.toml let b:executeInteractive = "call ExecuteCommand('zsh -c \"cd %:p:h; cargo run --quiet -- ' . input('cargo run -- ') . '\"', 'split-pane-horizontal')" + autocmd FileType rust let b:executeBuild = "call ExecuteCommand('zsh -c \"cd %:p:h; cargo build\"', 'split-pane-horizontal')" + autocmd BufRead,BufNewFile */Cargo.toml let b:executeBuild = "call ExecuteCommand('zsh -c \"cd %:p:h; cargo build\"', 'split-pane-horizontal')" + autocmd FileType rust let b:executeTest = "call ExecuteCommand('zsh -c \"cd %:p:h; cargo test\"', 'split-pane-horizontal')" + autocmd BufRead,BufNewFile */Cargo.toml let b:executeTest = "call ExecuteCommand('zsh -c \"cd %:p:h; cargo test\"', 'split-pane-horizontal')" + " --- OVERRIDES ---------------------------- " autocmd FileType *.scwrypts let b:scwryptsType = "" diff --git a/vim/rc.d/70.bindings.vim b/vim/rc.d/70.bindings.vim new file mode 100644 index 0000000..4218f8b --- /dev/null +++ b/vim/rc.d/70.bindings.vim @@ -0,0 +1,8 @@ +" backslash for Leader and backspace for LocalLeader +nmap +let mapleader = "\\" +let maplocalleader = "\" + +" (e)dit / (s)ource (v)imrc +nnoremap ev :tabedit $VIMRC +nnoremap sv :source $VIMRC diff --git a/vim/navigation.vim b/vim/rc.d/71.bindings-navigation.vim similarity index 100% rename from vim/navigation.vim rename to vim/rc.d/71.bindings-navigation.vim diff --git a/vim/color.vim b/vim/rc.d/80.color.vim similarity index 100% rename from vim/color.vim rename to vim/rc.d/80.color.vim diff --git a/vim/override/rentdynamics.vim b/vim/rc.d/90.override-rentdynamics.vim similarity index 100% rename from vim/override/rentdynamics.vim rename to vim/rc.d/90.override-rentdynamics.vim diff --git a/vim/override/directus.vim b/vim/rc.d/91.override-directus.vim similarity index 100% rename from vim/override/directus.vim rename to vim/rc.d/91.override-directus.vim diff --git a/vim/rc.vim b/vim/rc.vim index 9c9d8de..a899e83 100644 --- a/vim/rc.vim +++ b/vim/rc.vim @@ -1,22 +1,15 @@ -source $HOME/.config/wryn/env.vim - -if isdirectory(expand("$HOME/.vim/bundle/Vundle.vim")) - source $WRYNVIMPATH/vundle.vim +if empty($DOTWRYN) + let $DOTWRYN=expand("$HOME/.wryn") endif -source $WRYNVIMPATH/options.vim -source $WRYNVIMPATH/execute.vim -source $WRYNVIMPATH/formatting.vim -source $WRYNVIMPATH/file-execute.vim -source $WRYNVIMPATH/navigation.vim -source $WRYNVIMPATH/color.vim -source $WRYNVIMPATH/utility.vim +let $VIMRC=expand("$DOTWRYN/vim/rc.vim") +for vimrcfile in split(trim(system("find " . expand("$DOTWRYN/vim/rc.d") . " -type f | sort -u")), '\n') + execute 'source ' . vimrcfile +endfor -source $WRYNVIMPATH/override/rentdynamics.vim -source $WRYNVIMPATH/override/directus.vim - -" --------------------------------------------------------------------- -" {{{ +" ------------------------------------------------------------------- +" --- generic bindings (easy reference) ----------------------------- +" ------------------------------------------------------------------- " to execute macro on q nnoremap @q @@ -27,48 +20,22 @@ nnoremap q q: " \s previous selection command nnoremap s :'<,'> -" \m to set buffer to modifiable -nnoremap m :set modifiable - -" (e)dit / (s)ource vimrc -nnoremap ev :tabedit $WRYNVIMRC -nnoremap sv :source $MYVIMRC - -" Q to replace current line/selection with bash execution +" Q to replace current line(s) with shell execution vnoremap Q !$SHELL nnoremap Q !!$SHELL +" \j like J, but append current line to the line below +nnoremap j ddpkJ + " move the current line down/up one nnoremap - :move +1 nnoremap _ :move -2 -" \j like J, but append current line to the line below -nnoremap j ddpkJ - " \d insert formatted date below nnoremap d :let @d = system("date '+%A, %B %-d, %Y'")od -" \g git fugitive shortcuts -nnoremap gb :Git blame - -" \r = open last REPL (p)ython (n)odejs (c)lisp -nnoremap r q:?^echom 'quickrepl' -nnoremap rp q:oechom 'quickrepl' \| call ExecuteCommand('bpython', 'split-pane-vertical') -nnoremap rn q:oechom 'quickrepl' \| call ExecuteCommand('node', 'split-pane-vertical') -nnoremap rc q:oechom 'quickrepl' \| call ExecuteCommand('clisp', 'split-pane-horizontal') -nnoremap rs q:oechom 'quickrepl' \| call ExecuteCommand('zsh -l', 'split-pane-vertical') - -" \t = run last quicktest -" t)ype new quicktest -" e)dit last quicktest -nnoremap t q:?^echom 'quicktest' -nnoremap tt q:oechom 'quicktest' \| call ExecuteCommand('')F'i -nnoremap te q:?^echom 'quicktest' - -" ./utility.vim -nnoremap w :call Sudowrite() -nnoremap x :call MakeFileExecutable(0) -nnoremap xx :call MakeFileExecutable(1) +" \m to set buffer to modifiable +nnoremap m :set modifiable " (c)opy / (p)aste from xclip " TODO: learn how to compile vim with x11 compatibility and delete @@ -79,13 +46,12 @@ nnoremap sc :'<,'>w !xclip " enable/disable true color nnoremap :set invtermguicolors -" --- available / rarely used bindings (personal reference) --- +" ------------------------------------------------------------------- +" --- available / rarely used bindings (personal reference) --------- +" ------------------------------------------------------------------- " nnoremap " nnoremap " nnoremap " nnoremap z " nnoremap ^ - -" }}} -" --------------------------------------------------------------------- diff --git a/vim/vundle.vim b/vim/vundle.vim deleted file mode 100644 index 001d22e..0000000 --- a/vim/vundle.vim +++ /dev/null @@ -1,86 +0,0 @@ -set nocompatible -filetype off - -set rtp+=~/.vim/bundle/Vundle.vim -call vundle#begin() - -Plugin 'VundleVim/Vundle.vim' -" --- installed plugins ----------------------------------------------- -" {{{ - Plugin 'fatih/vim-go' - Plugin 'jeffkreeftmeijer/vim-dim' - Plugin 'rrethy/vim-hexokinase' - Plugin 'scrooloose/nerdtree' - Plugin 'tpope/vim-fugitive' - Plugin 'tpope/vim-surround' - Plugin 'valloric/youcompleteme' - Plugin 'w0rp/ale' - Plugin 'chrisbra/unicode.vim' -" }}} -" --------------------------------------------------------------------- -call vundle#end() -filetype plugin indent on - -" --- plugin configuration -------------------------------------------- -" {{{ - -" fatih/vim-go -let g:go_imports_autosave = 0 -let g:go_def_mapping_enabled = 0 -let g:go_fmt_fail_silently = 1 -let g:go_def_reuse_buffer = 1 -let g:go_textobj_enabled = 0 - - -" rrethy/vim-hexokinase -let g:Hexokinase_highlighters = ['foregroundfull'] - -" scrooloose/nerdtree -nnoremap :NERDTreeToggle % -let g:NERDTreeNodeDelimiter = "\u00a0" " -- fixes ^G character - - -" Valloric/YouCompleteMe -function! ToggleYCM() - if g:ycm_auto_trigger - let g:ycm_auto_trigger = 0 - echohl DiffDelete | echo "YouCompleteMe autocompletion disabled" | echohl None - else - let g:ycm_auto_trigger = 1 - echohl DiffAdd | echo "YouCompleteMe autocompletion enabled" | echohl None - endif -endfunction - -let g:ycm_autoclose_preview_window_after_insertion = 1 -let g:ycm_goto_buffer_command = 'new-tab' - -nnoremap :call ToggleYCM() -nnoremap gd :YcmCompleter GoToDefinition - - -" w0ryn/ale -let g:ale_linters = { -\ 'cs' : ['OmniSharp'], -\ 'python' : ['pylint'], -\ 'go' : ['golint'] -\} - -let g:ale_fixers = { -\ 'javascript': ['prettier'], -\ 'typescript': ['prettier'] -\} - -let g:ale_lint_on_text_changed = 0 -let g:ale_lint_on_insert_leave = 0 -let g:ale_lint_on_save = 1 -let g:ale_sign_column_always = 1 - -nmap at (ale_toggle_buffer) -nmap ae (ale_next) -nmap ar (ale_previous) -nmap f (ale_fix) - -imap (UnicodeFuzzy) - -" }}} -" --------------------------------------------------------------------- diff --git a/zsh/alias b/zsh/alias index ee768e7..483edf5 100644 --- a/zsh/alias +++ b/zsh/alias @@ -1,5 +1,7 @@ #!/bin/zsh ##################################################################### +### basic alias ##################################################### +##################################################################### alias pd='pushd' alias qd='popd' @@ -8,10 +10,23 @@ alias lsd='dirs' alias pdo='pwd | xclip' # [p]aste [d]irectory [o]n clipboard alias cdo='cd $(xclip -o)' # [c]hange to [d]irectory [o]n clipboard -alias restart='clear; source ~/.zshrc' +##################################################################### +### default command override ######################################## +##################################################################### -alias fix='vim $(git diff --name-only | uniq) -p' +alias ls='ls --color=auto --group-directories-first' +command -v bat >/dev/null 2>&1 \ + && alias cat='bat --style="plain"' + +command -v startplasma-x11 >/dev/null 2>&1 \ + && alias startk="startx '$DOTWRYN/config/xinitrc.kde'" + +command -v i3 >/dev/null 2>&1 \ + && alias starti="startx '$DOTWRYN/config/xinitrc.i3'" + +##################################################################### +### fancy alias (not technically an "alias" but makes sense here) ### ##################################################################### w() { # fancy(?) version of "alias w='watch -tcn1 '" @@ -37,20 +52,57 @@ w() { # fancy(?) version of "alias w='watch -tcn1 '" watch ${WATCH_ARGS[@]} "zsh -c 'source ~/.zshrc >/dev/null 2>&1; $(while read e; do printf 'export '; printf '%q ' "$e"; echo; done < <(env) | grep '='); echo \" $@\n---------------------------------------------------- \$(date +%H:%m:%S)\"; $@'" } -##################################################################### +erg() { # [e]dit files with [r]ip[g]rep matches + $EDITOR $(rg --color=never --files-with-matches $@) +} -command -v bat >/dev/null 2>&1 \ - && alias cat='bat --style="plain"' +fix() { # [fix] merge conflicts + local PREFIX="$(git rev-parse --show-toplevel)" + [ $PREFIX ] || return 128 -command -v startplasma-x11 >/dev/null 2>&1 \ - && alias startk="startx '$DOTWRYN/config/xinitrc.kde'" + local FILE FILES=() + for FILE in $(git diff --name-only 2>/dev/null | sort -u) + do + echo "diff detected in $(basename -- $(dirname -- "$FILE"))/$(basename -- "$FILE")" >&2 + FILES+=("$PREFIX/$FILE") + done -command -v i3 >/dev/null 2>&1 \ - && alias starti="startx '$DOTWRYN/config/xinitrc.i3'" - -##################################################################### - -alias erg='EDIT_RIPGREP_FILE_MATCHES' -EDIT_RIPGREP_FILE_MATCHES() { $EDITOR $(rg --color=never -l $@); } + [[ ${#FILES[@]} -eq 0 ]] && { + echo "no merge conflicts detected" + return 0 + } + + $EDITOR ${FILES[@]} +} + +restart() { # reload zshrc with some bonus options + local _S EXECUTION_MODE=quiet + while [[ $# -gt 0 ]] + do + _S=1 + case $1 in + ( -h | --help ) which restart; return 0 ;; + ( -v | --verbose ) EXECUTION_MODE=verbose ;; + ( -l | --login ) EXECUTION_MODE=login ;; + esac + shift $_S + done + + case $EXECUTION_MODE in + login ) + echo "--- fresh start c: ---" >&2 + zsh -l + echo "--- fresh end :c ---" >&2 + ;; + verbose ) + source "$HOME/.zshrc" + ;; + quiet ) + clear + source "$HOME/.zshrc" 2>/dev/null + ;; + esac +} ##################################################################### +return 0 diff --git a/zsh/colors b/zsh/colors deleted file mode 100644 index 99e159e..0000000 --- a/zsh/colors +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/zsh -##################################################################### - -alias ls='ls --color=auto --group-directories-first' - -[ -f "$HOME/.config/wryn/tty-colorscheme" ] \ - && source "$HOME/.config/wryn/tty-colorscheme" - -##################################################################### diff --git a/zsh/rc b/zsh/rc index a8e641c..8f4c44d 100644 --- a/zsh/rc +++ b/zsh/rc @@ -1,51 +1,9 @@ #!/bin/zsh -source "$HOME/.config/wryn/env.zsh" -##################################################################### -INTERNAL_PLUGINS=( - "$DOTWRYN/zsh/config" # must load first - $(find "$DOTWRYN/zsh" -mindepth 1 -maxdepth 1 -type f \ - | grep -v '/rc$' \ - | grep -v '/config$' \ - | grep -v '/\.[^/]\+$' \ - ) -) - -SET_PREFERRED_EDITOR() { - # load preference from environment - [[ ${#PREFERRED_EDITOR[@]} -eq 0 ]] && { - echo 'unable to find $PREFERRED_EDITOR environment variable' +for RC_FILE in $(find "${0:a:h}/rc.d/" -type f | sort) +do + source "$RC_FILE" || { + echo "something went wrong in '$RC_FILE'; aborting dotwryn load" return 1 } - - [[ $EDITOR == "${PREFERRED_EDITOR[-1]}" ]] \ - && [[ $VISUAL == "${PREFERENCE[-1]}" ]] \ - && return 0 - - local AVAILABLE_EDITOR=$EDITOR - - for program in $PREFERRED_EDITOR - do - which $program >/dev/null 2>&1 \ - && AVAILABLE_EDITOR="$program" \ - && break - done - - export EDITOR="$AVAILABLE_EDITOR" - export VISUAL="$AVAILABLE_EDITOR" -} - -##################################################################### -for p in $INTERNAL_PLUGINS; do source $p; done -for p in $EXTERNAL_PLUGINS; do [ -f $p ] && source $p; done -SET_PREFERRED_EDITOR -WELCOME - -echo $PATH | grep -q "^\\(.*:\\|\\)$HOME/.local/bin\\(:.*\\|\\)$" \ - || export PATH="$HOME/.local/bin:$PATH" -##################################################################### - -[[ $TERM =~ alacritty ]] \ - && [[ $(tmux -L omni.socket list-clients | wc -l) -eq 0 ]] \ - && scwrypts tmux omni - -true +done +return 0 diff --git a/zsh/rc.d/00.config.zsh b/zsh/rc.d/00.config.zsh new file mode 100644 index 0000000..d99378d --- /dev/null +++ b/zsh/rc.d/00.config.zsh @@ -0,0 +1,5 @@ +: \ + && source "$HOME/.config/wryn/env.zsh" \ + && [ "$DOTWRYN" ] \ + && [ -d "$DOTWRYN" ] \ + ; diff --git a/zsh/config b/zsh/rc.d/01.config-zsh.zsh similarity index 74% rename from zsh/config rename to zsh/rc.d/01.config-zsh.zsh index 8aa035a..39ad04d 100644 --- a/zsh/config +++ b/zsh/rc.d/01.config-zsh.zsh @@ -1,32 +1,29 @@ -#!/bin/zsh ##################################################################### -HISTFILE=~/.histfile -HISTSIZE=1000 -SAVEHIST=1000 +HISTFILE=~/.local/zsh.history +HISTSIZE=10000 +SAVEHIST=10000 setopt appendhistory autocd beep notify HIST_IGNORE_SPACE unsetopt nomatch bindkey -v - bindkey '^R' history-incremental-search-backward +# ESC,v to use $EDITOR to modify the current command autoload edit-command-line zle -N edit-command-line bindkey -M vicmd v edit-command-line -##################################################################### - +# zsh auto/tab-completion engine zmodload -i zsh/complist +autoload -Uz compinit +compinit + zstyle ':completion:*' completer _complete _ignored _approximate zstyle ':completion:*' max-errors 1 zstyle ':completion:*' menu select bindkey -M menuselect '^M' .accept-line -autoload -Uz compinit -compinit - ##################################################################### - -which kitty >/dev/null && kitty + complete setup zsh | source /dev/stdin +return 0 diff --git a/zsh/rc.d/09.config-misc.zsh b/zsh/rc.d/09.config-misc.zsh new file mode 100644 index 0000000..b1d0adc --- /dev/null +++ b/zsh/rc.d/09.config-misc.zsh @@ -0,0 +1,19 @@ +##################################################################### + +# I hate the default "$HOME/go" go path; hide it away +[ $GOPATH ] \ + || export GOPATH="$HOME/.local/go" + +# not sure if this is needed anymore since I've moved to alacritty, +# but leaving this here since it was obnoxious to find +which kitty &>/dev/null \ + && kitty + complete setup zsh | source /dev/stdin + +# many tmux workflows like to interact with the X-server; however, +# the tmux sessions frequently start before the X-session +[[ $TERM =~ tmux ]] && [ ! $DISPLAY ] && export DISPLAY=:0 + +#RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/config" + +##################################################################### +return 0 diff --git a/zsh/rc.d/10.plugins.zsh b/zsh/rc.d/10.plugins.zsh new file mode 100644 index 0000000..8992666 --- /dev/null +++ b/zsh/rc.d/10.plugins.zsh @@ -0,0 +1,11 @@ +##################################################################### + +ZSH_PLUGINS+=( + "$DOTWRYN/colorschemes/active/getty.sh" + "$DOTWRYN/zsh/plugins/code-activator/activator.plugin.zsh" + "$DOTWRYN/zsh/plugins/z/z.sh" + "$DOTWRYN/zsh/alias" +) + +##################################################################### +return 0 diff --git a/zsh/rc.d/11.plugins-fzf.zsh b/zsh/rc.d/11.plugins-fzf.zsh new file mode 100644 index 0000000..3857e4a --- /dev/null +++ b/zsh/rc.d/11.plugins-fzf.zsh @@ -0,0 +1,17 @@ +##################################################################### + +ZSH_PLUGINS+=( + '/usr/share/fzf/key-bindings.zsh' + '/usr/share/fzf/completion.zsh' + "$DOTWRYN/zsh/plugins/fzf-tab/fzf-tab.plugin.zsh" +) + +export FZF_DEFAULT_OPTS='--reverse --ansi --height 50% --bind=ctrl-c:cancel' +export FZF_DEFAULT_COMMAND='rg --files' + +zstyle ':fzf-tab:*' accept-line enter +zstyle ':fzf-tab:*' fzf-bindings 'space:accept' ';:toggle' +zstyle ':fzf-tab:*' continuous-trigger '/' + +##################################################################### +return 0 diff --git a/zsh/rc.d/15.plugins-scwrypts.zsh b/zsh/rc.d/15.plugins-scwrypts.zsh new file mode 100644 index 0000000..182a752 --- /dev/null +++ b/zsh/rc.d/15.plugins-scwrypts.zsh @@ -0,0 +1,24 @@ +##################################################################### + +ZSH_PLUGINS+=( + "$(scwrypts --root 2>/dev/null)/scwrypts.plugin.zsh" + ) + +() { # default environment name lookup + local ENVIRONMENT_NAME HOSTNAME="$(hostnamectl --static)" + + for ENVIRONMENT_NAME in \ + "local.${HOSTNAME}.secret" \ + "local.${HOSTNAME}" \ + "local" \ + "dev" \ + ; + do + [ -f "$HOME/.config/scwrypts/environments/scwrypts/$ENVIRONMENT_NAME" ] \ + && export SCWRYPTS_ENV="$ENVIRONMENT_NAME" \ + && break + done +} + +##################################################################### +return 0 diff --git a/zsh/rc.d/19.plugins-local.zsh b/zsh/rc.d/19.plugins-local.zsh new file mode 100644 index 0000000..97a94ae --- /dev/null +++ b/zsh/rc.d/19.plugins-local.zsh @@ -0,0 +1,3 @@ +ZSH_PLUGINS+=($( + find "$HOME/.local/zsh" -type f 2>/dev/null + )) diff --git a/zsh/rc.d/20.setup-path.zsh b/zsh/rc.d/20.setup-path.zsh new file mode 100644 index 0000000..b7a2d46 --- /dev/null +++ b/zsh/rc.d/20.setup-path.zsh @@ -0,0 +1,19 @@ +() { # create path entries + local PATH_ENTRY + for PATH_ENTRY in \ + "$HOME/.local/bin" \ + "$(go env GOPATH 2>/dev/null)/bin" \ + "$HOME/.$(hostnamectl --static)" \ + ; + do + echo "$PATH" | sed 's/:/\n/g' | grep -q "^$PATH_ENTRY$" \ + && continue # avoid duplicate PATH entries + + mkdir -p "$PATH_ENTRY" 2>/dev/null \ + || continue # avoid invalid PATH entries + + export PATH="$PATH_ENTRY:$PATH" + done + + return 0 +} diff --git a/zsh/rc.d/25.setup-editor.zsh b/zsh/rc.d/25.setup-editor.zsh new file mode 100644 index 0000000..fecc856 --- /dev/null +++ b/zsh/rc.d/25.setup-editor.zsh @@ -0,0 +1,16 @@ +() { # set EDITOR/VISUAL variables + [[ ${#PREFERRED_EDITORS[@]} -eq 0 ]] && { + echo 'unable to find $PREFERRED_EDITORS environment variable' + return 1 + } + + local PROGRAM PROGRAM_EXECUTABLE + for PROGRAM in ${PREFERRED_EDITORS[@]} + do + PROGRAM_EXECUTABLE="$(which $PROGRAM 2>/dev/null)" + [ -f "$PROGRAM_EXECUTABLE" ] \ + && export EDITOR="$PROGRAM_EXECUTABLE" \ + && export VISUAL="$PROGRAM_EXECUTABLE" \ + && break + done +} diff --git a/zsh/rc.d/26.setup-unipicker.zsh b/zsh/rc.d/26.setup-unipicker.zsh new file mode 100644 index 0000000..f2be447 --- /dev/null +++ b/zsh/rc.d/26.setup-unipicker.zsh @@ -0,0 +1,13 @@ +command -v unipicker &>/dev/null || return 0 +##################################################################### + +__ZSH_SHORTCUT__UNIPICKER() { + LBUFFER+="$(unipicker)" + zle reset-prompt +} + +zle -N unipicker __ZSH_SHORTCUT__UNIPICKER +bindkey  unipicker + +##################################################################### +return 0 diff --git a/zsh/rc.d/40.import-plugins.zsh b/zsh/rc.d/40.import-plugins.zsh new file mode 100644 index 0000000..a3a8937 --- /dev/null +++ b/zsh/rc.d/40.import-plugins.zsh @@ -0,0 +1,10 @@ +() { + local PLUGIN + + for PLUGIN in ${ZSH_PLUGINS[@]} + do + [ -f "$PLUGIN" ] && source "$PLUGIN" + done + + return 0 +} diff --git a/zsh/completion b/zsh/rc.d/70.completion.zsh similarity index 95% rename from zsh/completion rename to zsh/rc.d/70.completion.zsh index 9ed8d22..be4e75a 100644 --- a/zsh/completion +++ b/zsh/rc.d/70.completion.zsh @@ -1,4 +1,3 @@ -#!/bin/zsh ##################################################################### command -v op >/dev/null 2>&1 && { @@ -12,4 +11,4 @@ command -v flux >/dev/null 2>&1 && { } ##################################################################### -true +return 0 diff --git a/zsh/ps1 b/zsh/rc.d/91.ps1.zsh similarity index 84% rename from zsh/ps1 rename to zsh/rc.d/91.ps1.zsh index 7034350..f8a32c6 100644 --- a/zsh/ps1 +++ b/zsh/rc.d/91.ps1.zsh @@ -1,4 +1,4 @@ -#!/bin/zsh +##################################################################### PS1__GET_DIRECTORY() { local _DIRECTORY="%B%F{yellow}%6~" @@ -26,7 +26,7 @@ PS1__GET_GIT_BRANCH() { echo $_GIT_BRANCH } -GENERATE_PS1() { +PS1__GENERATE() { local _INDICATOR="%B%(?.%F{green}.%F{red}) $PS1_INDICATOR_SYMBOL" local _USER="%B%F{magenta}$PS1_USER" local _SEPARATOR="%b%F{red}$PS1_SEPARATOR" @@ -39,4 +39,7 @@ GENERATE_PS1() { } setopt PROMPT_SUBST -export PS1="$(GENERATE_PS1)" +export PS1="$(PS1__GENERATE)" + +##################################################################### +return 0 diff --git a/zsh/rc.d/99.welcome.zsh b/zsh/rc.d/99.welcome.zsh new file mode 100644 index 0000000..63f78d5 --- /dev/null +++ b/zsh/rc.d/99.welcome.zsh @@ -0,0 +1,12 @@ +case $TERM in + *kitty* | *alacritty* ) + # when using desktop terminal emulators, automatically launch tmux/omni + # if no active omni client can be found + : \ + && [[ $(tmux -L omni.socket list-clients 2>/dev/null | wc -l) -eq 0 ]] \ + && scwrypts tmux omni \ + || WELCOME \ + ; + ;; + * ) WELCOME ;; +esac diff --git a/zsh/unipicker b/zsh/unipicker deleted file mode 100644 index ee03d83..0000000 --- a/zsh/unipicker +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/zsh -command -v unipicker >/dev/null 2>&1 || return 0 - -__ZSH_SHORTCUT__UNIPICKER() { - LBUFFER+="$(unipicker)" - zle reset-prompt -} - -zle -N unipicker __ZSH_SHORTCUT__UNIPICKER -bindkey  unipicker