diff --git a/.doom.d/autoload.el b/.doom.d/autoload.el index a1bf3ca8..bd1c7a27 100644 --- a/.doom.d/autoload.el +++ b/.doom.d/autoload.el @@ -624,7 +624,7 @@ _b_ranch _j_next _k_prev _h_up ;;;###autoload (defun +cljr--log-spy (prefix-info log-type arg) (let* ((log-spy-str (cond - ((eq log-type :js-console) "js/console.log") + ((eq log-type :squint) "log/spy") ((eq log-type :log!) "log/spy!") (t "log/spy"))) (log-spy-str (if prefix-info @@ -666,8 +666,8 @@ _b_ranch _j_next _k_prev _h_up (defun +spy (arg) (interactive "P") (when (and lispy-mode (memq major-mode '(clojure-mode clojurescript-mode clojurec-mode))) - (let* ((squint? (seq-find (-partial 'string= "squint.edn") (projectile-dir-files (doom-project-root)))) - (has-as-log? (or squint? (ignore-errors (save-excursion (re-search-backward ":as log\\]"))))) + (let* ((has-as-log? (ignore-errors (save-excursion (re-search-backward ":as log\\]")))) + (squint? (seq-find (-partial 'string= "squint.edn") (projectile-dir-files (doom-project-root)))) (telemere? (+cljr-project-has-dep? "com.taoensso/telemere")) (glogi? (+cljr-project-has-dep? "lambdaisland/glogi")) (timbre? (+cljr-project-has-dep? "timbre")) @@ -676,12 +676,17 @@ _b_ranch _j_next _k_prev _h_up (f (apply-partially '+cljr--log-spy pedestal? (cond - (squint? :js-console) + (squint? :squint) ((and telemere? (not glogi?)) :log!) (t :log))))) (cond (has-as-log? (funcall f arg)) + (squint? + (save-excursion + (cljr--insert-in-ns ":require") + (insert "[\"@/spy\":as log]")) + (funcall f arg)) (glogi? (save-excursion (cljr--insert-in-ns ":require") diff --git a/.doom.d/better-default.el b/.doom.d/better-default.el index bb737d1d..5633a4f3 100644 --- a/.doom.d/better-default.el +++ b/.doom.d/better-default.el @@ -149,12 +149,16 @@ (apply orig-fn (not arg) project-p)) +;;; +word-wrap +(setq! +word-wrap-fill-style 'soft) +(pushnew! +word-wrap-disabled-modes 'minibuffer-mode) + (+global-word-wrap-mode +1) -(defadvice! ++word-wrap--enable-global-mode (orig-fn) - :around #'+word-wrap--enable-global-mode - (unless (derived-mode-p 'prog-mode) - (funcall orig-fn))) +;; (defadvice! ++word-wrap--enable-global-mode (orig-fn) +;; :around #'+word-wrap--enable-global-mode +;; (unless (derived-mode-p 'prog-mode) +;; (funcall orig-fn))) (set-popup-rules! '(("^\\*[Hh]elp" :slot 2 :side right :vslot -8 :size 0.35 :select t :quit current) @@ -950,3 +954,6 @@ If `DEVICE-NAME' is provided, it will be used instead of prompting the user." ;; and `buffer-terminator-interval'.) ;; (kill-buffer-property . inactive) (return . :keep)))) + +;; quote “ +;; quote ” diff --git a/.doom.d/map.el b/.doom.d/map.el index 8248419b..e54cb57b 100644 --- a/.doom.d/map.el +++ b/.doom.d/map.el @@ -648,10 +648,12 @@ (:map cider-inspector-mode-map :n "s" 'yq-s-map :n "X" #'cider-inspector-set-page-size - :n "C-j" #'cider-inspector-next-inspectable-object - :n "C-k" #'cider-inspector-previous-inspectable-object :n "gj" #'cider-inspector-next-page - :n "gk" #'cider-inspector-prev-page) + :n "gk" #'cider-inspector-prev-page + :g "C-j" #'cider-inspector-next-inspectable-object + :g "C-k" #'cider-inspector-previous-inspectable-object + :n "C-j" #'cider-inspector-next-inspectable-object + :n "C-k" #'cider-inspector-previous-inspectable-object) (:map cider-repl-mode-map (:localleader "sp" (cmd! diff --git a/modules/yqrashawn/home-manager/cli/functions.sh b/modules/yqrashawn/home-manager/cli/functions.sh index a3b0fafd..b019cb1e 100644 --- a/modules/yqrashawn/home-manager/cli/functions.sh +++ b/modules/yqrashawn/home-manager/cli/functions.sh @@ -65,4 +65,11 @@ _dopy_completion() { return 0 } -complete -o default -F _dopy_completion sysdo +# Check if the script is running in Zsh +if [ -n "$ZSH_VERSION" ]; then + # Use compdef for Zsh + compdef _dopy_completion sysdo +elif [ -n "$BASH_VERSION" ]; then + # Use complete for Bash + complete -o default -F _dopy_completion sysdo +fi diff --git a/modules/yqrashawn/home-manager/dotfiles/aerospace.toml b/modules/yqrashawn/home-manager/dotfiles/aerospace.toml index 7fe441a9..97921ae2 100644 --- a/modules/yqrashawn/home-manager/dotfiles/aerospace.toml +++ b/modules/yqrashawn/home-manager/dotfiles/aerospace.toml @@ -27,8 +27,8 @@ default-root-container-orientation = 'auto' # See https://nikitabobko.github.io/AeroSpace/guide#on-focus-changed-callbacks # See https://nikitabobko.github.io/AeroSpace/commands#move-mouse # Fallback value (if you omit the key): on-focused-monitor-changed = [] -# on-focused-monitor-changed = ['move-mouse monitor-lazy-center'] -on-focused-monitor-changed = [] +on-focused-monitor-changed = ['move-mouse window-lazy-center'] +# on-focused-monitor-changed = [] # You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag # Useful if you don't use this macOS feature, but accidentally hit cmd-h or cmd-alt-h key @@ -74,7 +74,10 @@ if.app-id = 'ai.perplexity.mac' run = [ 'move-node-to-workspace B' ] [[on-window-detected]] if.app-id = 'com.openai.chat' -run = [ 'move-node-to-workspace B' ] +run = [ 'layout floating', 'move-node-to-workspace B' ] +[[on-window-detected]] +if.app-id = 'ai.perplexity.mac' +run = [ 'layout floating', 'move-node-to-workspace B' ] ### coding workspace [[on-window-detected]] diff --git a/modules/yqrashawn/home-manager/dotfiles/karabiner.edn b/modules/yqrashawn/home-manager/dotfiles/karabiner.edn index fe989ce8..bc906d9a 100644 --- a/modules/yqrashawn/home-manager/dotfiles/karabiner.edn +++ b/modules/yqrashawn/home-manager/dotfiles/karabiner.edn @@ -26,22 +26,24 @@ "PATH=/run/current-system/sw/bin:/opt/homebrew/bin:/usr/local/bin:$PATH %s" :yabai "PATH=/run/current-system/sw/bin:/opt/homebrew/bin:/usr/local/bin:$PATH yabai -m %s" + :ae + "PATH=/run/current-system/sw/bin:/opt/homebrew/bin:/usr/local/bin:$PATH ~/.nixpkgs/modules/yqrashawn/home-manager/dotfiles/local-bins/aerofocus %s" :aero "PATH=/run/current-system/sw/bin:/opt/homebrew/bin:/usr/local/bin:$PATH aerospace %s" :km "osascript -e 'tell application \"Keyboard Maestro Engine\" to do script \"%s\"'" :kb-maestro "osascript -e 'tell application \"Keyboard Maestro Engine\" to do script \"%s\"'" - :open "open \"%s\"" - :opena "open -a \"%s\"" - :curl "/run/current-system/sw/bin/curl -s \"%s\"" + :open "open \"%s\"" + :opena "open -a \"%s\"" + :curl "/run/current-system/sw/bin/curl -s \"%s\"" ;; :hsl ;; "PATH=/run/current-system/sw/bin:/opt/homebrew/bin:/usr/local/bin:$PATH hs -A -n -q -t 0.1 -c 'hs.application.launchOrFocus(\"%s\")'" :hsl "/opt/homebrew/bin/hs -A -n -q -t 0.01 -c 'hs.application.launchOrFocus(\"%s\")'" - :kitten "/Applications/kitty.app/Contents/MacOS/kitten @ --to unix:/tmp/tkitty %s" - :kitten-splits-layout "/Applications/kitty.app/Contents/MacOS/kitten @ --to unix:/tmp/tkitty goto-layout --match=state:active splits && /Applications/kitty.app/Contents/MacOS/kitten @ --to unix:/tmp/tkitty %s" - :kitten-focus-window "/Applications/kitty.app/Contents/MacOS/kitten @ --to unix:/tmp/tkitty focus-window --match %s" + :kitten "/Applications/kitty.app/Contents/MacOS/kitten @ --to unix:/tmp/tkitty %s" + :kitten-splits-layout "/Applications/kitty.app/Contents/MacOS/kitten @ --to unix:/tmp/tkitty goto-layout --match=state:active splits && /Applications/kitty.app/Contents/MacOS/kitten @ --to unix:/tmp/tkitty %s" + :kitten-focus-window "/Applications/kitty.app/Contents/MacOS/kitten @ --to unix:/tmp/tkitty focus-window --match %s" :show "osascript -e 'set appName to \"%s\"\nset startIt to false\ntell application \"System Events\"\n if not (exists process appName) then\n set startIt to true\n else\n set frontmost of process appName to true\n end if\nend tell\nif startIt then\n tell application appName to activate\nend if'\n" :show-in-firefox @@ -50,7 +52,7 @@ "PATH=/run/current-system/sw/bin:/opt/homebrew/bin:/usr/local/bin:$PATH hs -A -n -q -t 0.1 -c 'hs.application.launchOrFocus(\"Firefox Developer Edition\")'; bash ~/Dropbox/sync/scripts/switch-tab '%s'" :togg "PATH=/run/current-system/sw/bin:/opt/homebrew/bin:/usr/local/bin:$PATH hs -A -n -q -t 0.1 -c '\nlocal appName = \"%s\";\nlocal x = hs.application.find(appName);\nif x and x:isFrontmost() then\n x:hide();\nelse\n hs.application.launchOrFocus(appName);\nend'" - :yfocus "sh ~/.config/yabai/focus-window %s" + :yfocus "sh ~/.config/yabai/focus-window %s" :toggle "osascript -e 'set appName to \"%s\"\nset startIt to false\ntell application \"System Events\"\n if not (exists process appName) then\n set startIt to true\n else if frontmost of process appName then\n set visible of process appName to false\n else\n set frontmost of process appName to true\n end if\nend tell\nif startIt then\n tell application appName to activate\nend if'" :type @@ -81,16 +83,16 @@ :emacs-bufmove-mode {:key :f :condi :emacs-windmove-mode} :period-mode {:key :period :afterup {:set ["period-comma-mode" 0]} - :condi [:!emacs-s-mode :!tmux-windmove-mode + :condi [:!emacs-s-mode :!tmux-windmove-mode :!kitty-windmove-mode :!k2-mode]} :comma-mode {:key :comma - :condi [:!emacs-s-mode :!tmux-windmove-mode]} + :condi [:!emacs-s-mode :!tmux-windmove-mode :!kitty-windmove-mode]} :tmux-windmove-mode {:key :q :condi [:Terminals :!comma-mode :!period-mode]} :kitty-windmove-mode {:key :q :condi [:kitty :!comma-mode :!period-mode]} :kitty-windresize-mode {:key :c :condi :kitty-windmove-mode} :warp-windmove-mode {:key :q :condi [:Warp :!comma-mode :!period-mode]} :tmux-windresize-mode {:key :c :condi :tmux-windmove-mode} - :k2-mode {:key :2 :condi [:!tab-mode :!tmux-windmove-mode]}} + :k2-mode {:key :2 :condi [:!tab-mode :!tmux-windmove-mode :!kitty-windmove-mode]}} :simlayers {:test-mode {:key :9} :contexts-f-mode {:key :f :condi :!Games} @@ -136,10 +138,10 @@ ;; [:!Tm :!Sreturn_or_enter] ;; [:!Creturn_or_enter :return_or_enter]]} {:des "chatgpt" - :rules [[:f23 :!OS8] + :rules [;; [:f23 :!OS8] ;; [:f23 :!CT8] ;; [:f23 :f18] - ]} + [:f23 [:hsl "/Applications/ChatGPT.app"]]]} {:des "unstuck emacs" :rules [[:!CTg ["/bin/kill -s USR2 $(pgrep Emacs)" "/bin/kill -s USR1 $(pgrep Emacs)"]]]} @@ -440,10 +442,11 @@ ;; [:j [:sh "open -a kitty --args -o allow_remote_control=yes --single-instance"]] ;; [:j [:op "/Applications/Rio.app"]] ;; [:k :same_wind_app :Emacs] - [:k [:hsl "/Applications/Emacs.app"]] + ;; [:k [:hsl "/Applications/Emacs.app"]] + [:k [:op "/Applications/Emacs.app"]] [:u [:!CTcomma]] - [:quote [:hsl "Perplexity"]] + [:quote [:op "/Applications/Perplexity"]] [:t [:show-in-firefox-dev "http://localhost:61942/api/local-server/pext/switch-tab?url=https://app.todoist.com/&create-when-missing=1&pin=1&idx=6"]] [:n [:show-in-firefox-dev "http://localhost:61942/api/local-server/pext/switch-tab?url=https://www.notion.so/&create-when-missing=1&pin=1&idx=3"]] [:9 [:show-in-firefox-dev "http://localhost:61942/api/local-server/pext/switch-tab?url=https://discord.com/&create-when-missing=1&pin=1&idx=1"]] @@ -453,19 +456,20 @@ [:comma :same_wind_app :Safari] [:l [:op "/Applications/Firefox Developer Edition.app"] :!Firefoxes] [:l :same_wind_app :Firefoxes] - [:return_or_enter [:togg "/Applications/ChatGPT.app"]] + [:return_or_enter [:op "/System/Applications/iPhone Mirroring.app"]] + ;; [:return_or_enter :!OS8] [:m [:op "/System/Applications/Mail.app"]] [:v [:op "/Applications/WeChat.app"]] [:q [:op "/Applications/Karabiner-Elements.app"]] [:f [:op "/System/Library/CoreServices/Finder.app"]] [:y :!!x] ; Dash [:6 :!!z] - ;; [:r [:hsl "Orion"]] + ;; [:r [:op "/Applications/Orion"]] ;; [:hyphen [:togg "RapidApi"]] ;; [:equal_sign [:togg "Textual"]] [:period [:togg "Surge Dashboard"] :Surge] [:period [:togg "Surge"]] - [:8 [:hsl "Karabiner-EventViewer"]] + [:8 [:op "/Applications/Karabiner-EventViewer"]] ;; [:c [:togg "Visual Studio Code"]] [:c [:togg "Zed"]] [:e [:w :e]]]} @@ -608,6 +612,7 @@ :kitty-windmove-mode [:return_or_enter :!Ct] [:m [:!CS8 :m]] + [:comma [:!CS8 :comma]] [:hyphen [:kitten "load-config"]] [:open_bracket [[:hsl "/Applications/Emacs.app"] diff --git a/modules/yqrashawn/home-manager/dotfiles/kitty-map.conf b/modules/yqrashawn/home-manager/dotfiles/kitty-map.conf index 993c69f5..8b6d2d3d 100644 --- a/modules/yqrashawn/home-manager/dotfiles/kitty-map.conf +++ b/modules/yqrashawn/home-manager/dotfiles/kitty-map.conf @@ -4,6 +4,7 @@ map cmd+shift+8>up neighboring_window up map cmd+shift+8>down neighboring_window down map cmd+shift+8>m toggle_layout stack +map cmd+shift+8>, set_tab_title map cmd+shift+8>h show_scrollback map cmd+shift+8>g show_last_command_output map cmd+shift+8>e open_url_with_hints diff --git a/modules/yqrashawn/home-manager/dotfiles/kitty-startup-session.conf b/modules/yqrashawn/home-manager/dotfiles/kitty-startup-session.conf index 8e063670..14646aeb 100644 --- a/modules/yqrashawn/home-manager/dotfiles/kitty-startup-session.conf +++ b/modules/yqrashawn/home-manager/dotfiles/kitty-startup-session.conf @@ -1,5 +1,8 @@ -new_tab nix -cd ~/.nixpkgs +new_tab ssh +launch ssh mini +launch ssh mini -launch zsh -new_tab misc \ No newline at end of file +new_tab misc + +new_tab pext +cd ~/workspace/home/pext diff --git a/modules/yqrashawn/home-manager/dotfiles/local-bins/aerofocus b/modules/yqrashawn/home-manager/dotfiles/local-bins/aerofocus new file mode 100755 index 00000000..bc98247b --- /dev/null +++ b/modules/yqrashawn/home-manager/dotfiles/local-bins/aerofocus @@ -0,0 +1,36 @@ +#!/usr/bin/env sh + +# Check if an application name is provided as an argument +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +# Assign the first argument to a variable +app_name="$1" + +# Input data +data=$(aerospace list-windows --all --json) +current_window_id=$(aerospace list-windows --focused --json | jq 'first | .["window-id"]') + +# Extract the window ID for the specified application +# window_id=$(echo "$data" | awk -F '|' -v app="$app_name" '$2 ~ app {gsub(/ /, "", $1); print $1}') + +# # Check if a window ID was found +# if [ -n "$window_id" ]; then +# echo $window_id +# # aerospace focus --window-id "$window_id" +# else +# exit 1 +# fi + +window_id=$(echo "$data" | jq --arg app "Emacs" --arg current_window_id $current_window_id ' + map(select(.["app-name"] == $app and .["window-title"] != "" and .["window-id"] != $current_window_id)) | last | .["window-id"] +') + + +if [ "$window_id" -gt 0 ]; then + aerospace focus --window-id "$window_id" +else + exit 0 +fi