diff options
| author | Mike Vink <ivi@vinkies.net> | 2025-09-10 17:41:37 +0200 |
|---|---|---|
| committer | Mike Vink <ivi@vinkies.net> | 2025-09-10 17:41:37 +0200 |
| commit | bafbb701cb2b01a62933e039946266779159f5a4 (patch) | |
| tree | fdcbbbae788844753e8adae512ee3958da991a9b | |
| parent | b220fc1dd52298a3acc98f157c333e8ee44dcecb (diff) | |
update kak config
| -rw-r--r-- | .config/emacs/init.el | 209 | ||||
| -rw-r--r-- | .config/kak/kakrc | 130 | ||||
| -rw-r--r-- | .config/shell/aliasrc | 3 | ||||
| -rw-r--r-- | .config/zsh/rc | 9 | ||||
| -rwxr-xr-x | .local/bin/shortcuts | 31 |
5 files changed, 236 insertions, 146 deletions
diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 52de580..5faff8a 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -3,9 +3,6 @@ (require 'package) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) -(defun seq-keep (function sequence) - "Apply FUNCTION to SEQUENCE and return the list of all the non-nil results." - (delq nil (seq-map function sequence))) (defvar rc/package-contents-refreshed nil) @@ -19,30 +16,108 @@ (rc/package-refresh-contents-once) (package-install package))) + (defun rc/require (&rest packages) (dolist (package packages) (rc/require-one-package package))) (defun rc/require-theme (theme) - (let ((theme-package (->> theme - (symbol-name) - (funcall (-flip #'concat) "-theme") - (intern)))) + (let ((theme-package (intern (concat (symbol-name theme) "-theme")))) (rc/require theme-package) (load-theme theme t))) - -(rc/require 'dash) -(require 'dash) -(rc/require 'dash-functional) -(require 'dash-functional) - (defun rc/get-default-font () (cond ((eq system-type 'windows-nt) "Consolas-13") (t "mono-13"))) (add-to-list 'default-frame-alist `(font . ,(rc/get-default-font))) -(rc/require 'ansi-color) + +(defun meow-setup () + (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) + (meow-motion-define-key + '("j" . meow-next) + '("k" . meow-prev) + '("<escape>" . ignore)) + (meow-leader-define-key + ;; Use SPC (0-9) for digit arguments. + '("1" . meow-digit-argument) + '("2" . meow-digit-argument) + '("3" . meow-digit-argument) + '("4" . meow-digit-argument) + '("5" . meow-digit-argument) + '("6" . meow-digit-argument) + '("7" . meow-digit-argument) + '("8" . meow-digit-argument) + '("9" . meow-digit-argument) + '("0" . meow-digit-argument) + '("/" . meow-keypad-describe-key) + '("?" . meow-cheatsheet)) + (meow-normal-define-key + '("0" . meow-expand-0) + '("9" . meow-expand-9) + '("8" . meow-expand-8) + '("7" . meow-expand-7) + '("6" . meow-expand-6) + '("5" . meow-expand-5) + '("4" . meow-expand-4) + '("3" . meow-expand-3) + '("2" . meow-expand-2) + '("1" . meow-expand-1) + '("-" . negative-argument) + '(";" . meow-reverse) + '("," . meow-inner-of-thing) + '("." . meow-bounds-of-thing) + '("[" . meow-beginning-of-thing) + '("]" . meow-end-of-thing) + '("a" . meow-append) + '("A" . meow-open-below) + '("b" . meow-back-word) + '("B" . meow-back-symbol) + '("c" . meow-change) + '("d" . meow-delete) + '("D" . meow-backward-delete) + '("e" . meow-next-word) + '("E" . meow-next-symbol) + '("f" . meow-find) + '("g" . meow-cancel-selection) + '("G" . meow-grab) + '("h" . meow-left) + '("H" . meow-left-expand) + '("i" . meow-insert) + '("I" . meow-open-above) + '("j" . meow-next) + '("J" . meow-next-expand) + '("k" . meow-prev) + '("K" . meow-prev-expand) + '("l" . meow-right) + '("L" . meow-right-expand) + '("m" . meow-join) + '("n" . meow-search) + '("o" . meow-block) + '("O" . meow-to-block) + '("p" . meow-yank) + '("q" . meow-quit) + '("Q" . meow-goto-line) + '("r" . meow-replace) + '("R" . meow-swap-grab) + '("s" . meow-kill) + '("t" . meow-till) + '("u" . meow-undo) + '("U" . meow-undo-in-selection) + '("v" . meow-visit) + '("w" . meow-mark-word) + '("W" . meow-mark-symbol) + '("x" . meow-line) + '("X" . meow-goto-line) + '("y" . meow-save) + '("Y" . meow-sync-grab) + '("z" . meow-pop-selection) + '("'" . repeat) + '("<escape>" . ignore))) +(rc/require 'meow) +(require 'meow) +(meow-setup) +(meow-global-mode 1) (rc/require 'ido 'ido-completing-read+ 'smex 'corfu) (ido-mode t) @@ -60,6 +135,7 @@ (scroll-bar-mode 0) (column-number-mode 1) (show-paren-mode 1) +(setq split-width-threshold 9999) (setq-default inhibit-splash-screen t make-backup-files nil @@ -68,41 +144,15 @@ compilation-scroll-output t visible-bell (equal system-type 'windows-nt)) -(setq-default c-basic-offset 4 - c-default-style '((java-mode . "java") - (awk-mode . "awk") - (other . "bsd"))) -(setq split-width-threshold 9999) - -(defun rc/duplicate-line () - "Duplicate current line" - (interactive) - (let ((column (- (point) (point-at-bol))) - (line (let ((s (thing-at-point 'line t))) - (if s (string-remove-suffix "\n" s) "")))) - (move-end-of-line 1) - (newline) - (insert line) - (move-beginning-of-line 1) - (forward-char column))) - (global-set-key (kbd "M-J") 'text-scale-decrease) (global-set-key (kbd "M-K") 'text-scale-increase) -(global-set-key (kbd "M-c") 'rc/duplicate-line) -(global-set-key (kbd "C-c p") 'find-file-at-point) (global-display-line-numbers-mode) (setq next-line-add-newlines t) (setq display-line-numbers-type 'relative) -(rc/require 'direnv 'editorconfig 'multiple-cursors) +(rc/require 'direnv 'editorconfig) (editorconfig-mode 1) -(electric-pair-mode) -(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) -(global-set-key (kbd "C->") 'mc/mark-next-like-this) -(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) -(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) -(global-set-key (kbd "C-.") 'mc/mark-all-in-region) (rc/require 'cl-lib 'magit) (setq magit-auto-revert-mode nil) @@ -115,52 +165,12 @@ (setq-default dired-dwim-target t) (setq dired-listing-switches "-alh") -;; stolen from: https://emacs.stackexchange.com/questions/24698/ansi-escape-sequences-in-compilation-mode -(rc/require 'ansi-color) -(defun endless/colorize-compilation () - "Colorize from `compilation-filter-start' to `point'." - (let ((inhibit-read-only t)) - (ansi-color-apply-on-region - compilation-filter-start (point)))) -(add-hook 'compilation-filter-hook - #'endless/colorize-compilation) - -(setq TeX-auto-save t) -(setq TeX-parse-self t) -(setq-default TeX-master nil) - (setq completion-auto-select 'second-tab) (setq completions-format 'one-column) (setq completions-max-height 20) (define-key completion-in-region-mode-map (kbd "M-p") #'minibuffer-previous-completion) (define-key completion-in-region-mode-map (kbd "M-n") #'minibuffer-next-completion) -;; (rc/require 'consult 'vertico 'orderless) -;; (setq completion-in-region-function #'completion--) - - -(rc/require - 'nix-mode - 'go-mode - 'auctex - 'yaml-pro - 'rust-mode) - - -(require 'lsp-mode) -(add-hook 'rust-mode-hook #'lsp-deferred) -(add-hook 'go-mode-hook #'lsp-deferred) -(defun lsp-go-install-save-hooks () - (add-hook 'before-save-hook #'lsp-format-buffer t t) - (add-hook 'before-save-hook #'lsp-organize-imports t t)) -(add-hook 'go-mode-hook #'lsp-go-install-save-hooks) -(lsp-register-custom-settings - '(("gopls.hints.assignVariableTypes" t t) - ("gopls.hints.compositeLiteralFields" t t) - ("gopls.hints.compositeLiteralTypes" t t) - ("gopls.hints.constantValues" t t) - ("gopls.hints.functionTypeParameters" t t) - ("gopls.hints.parameterNames" t t) - ("gopls.hints.rangeVariableTypes" t t))) + (rc/require-theme 'gruber-darker) (custom-set-variables @@ -170,12 +180,39 @@ ;; If there is more than one, they won't work right. '(custom-enabled-themes '(gruber-darker)) '(custom-safe-themes - '("ba4ab079778624e2eadbdc5d9345e6ada531dc3febeb24d257e6d31d5ed02577" "a9dc7790550dcdb88a23d9f81cc0333490529a20e160a8599a6ceaf1104192b5" "5f128efd37c6a87cd4ad8e8b7f2afaba425425524a68133ac0efd87291d05874" "5b9a45080feaedc7820894ebbfe4f8251e13b66654ac4394cb416fef9fdca789" "9013233028d9798f901e5e8efb31841c24c12444d3b6e92580080505d56fd392" "6adeb971e4d5fe32bee0d5b1302bc0dfd70d4b42bad61e1c346599a6dc9569b5" "8d3ef5ff6273f2a552152c7febc40eabca26bae05bd12bc85062e2dc224cde9a" "75b2a02e1e0313742f548d43003fcdc45106553af7283fb5fad74359e07fe0e2" "b9761a2e568bee658e0ff723dd620d844172943eb5ec4053e2b199c59e0bcc22" "9d29a302302cce971d988eb51bd17c1d2be6cd68305710446f658958c0640f68" "f053f92735d6d238461da8512b9c071a5ce3b9d972501f7a5e6682a90bf29725" "dc8285f7f4d86c0aebf1ea4b448842a6868553eded6f71d1de52f3dcbc960039" "38c0c668d8ac3841cb9608522ca116067177c92feeabc6f002a27249976d7434" "162201cf5b5899938cfaec99c8cb35a2f1bf0775fc9ccbf5e63130a1ea217213" "ff24d14f5f7d355f47d53fd016565ed128bf3af30eb7ce8cae307ee4fe7f3fd0" "da75eceab6bea9298e04ce5b4b07349f8c02da305734f7c0c8c6af7b5eaa9738" "e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2" "631c52620e2953e744f2b56d102eae503017047fb43d65ce028e88ef5846ea3b" "88f7ee5594021c60a4a6a1c275614103de8c1435d6d08cc58882f920e0cec65e" "dfb1c8b5bfa040b042b4ef660d0aab48ef2e89ee719a1f24a4629a0c5ed769e8" "e13beeb34b932f309fb2c360a04a460821ca99fe58f69e65557d6c1b10ba18c7" default)) + '("ba4ab079778624e2eadbdc5d9345e6ada531dc3febeb24d257e6d31d5ed02577" + "a9dc7790550dcdb88a23d9f81cc0333490529a20e160a8599a6ceaf1104192b5" + "5f128efd37c6a87cd4ad8e8b7f2afaba425425524a68133ac0efd87291d05874" + "5b9a45080feaedc7820894ebbfe4f8251e13b66654ac4394cb416fef9fdca789" + "9013233028d9798f901e5e8efb31841c24c12444d3b6e92580080505d56fd392" + "6adeb971e4d5fe32bee0d5b1302bc0dfd70d4b42bad61e1c346599a6dc9569b5" + "8d3ef5ff6273f2a552152c7febc40eabca26bae05bd12bc85062e2dc224cde9a" + "75b2a02e1e0313742f548d43003fcdc45106553af7283fb5fad74359e07fe0e2" + "b9761a2e568bee658e0ff723dd620d844172943eb5ec4053e2b199c59e0bcc22" + "9d29a302302cce971d988eb51bd17c1d2be6cd68305710446f658958c0640f68" + "f053f92735d6d238461da8512b9c071a5ce3b9d972501f7a5e6682a90bf29725" + "dc8285f7f4d86c0aebf1ea4b448842a6868553eded6f71d1de52f3dcbc960039" + "38c0c668d8ac3841cb9608522ca116067177c92feeabc6f002a27249976d7434" + "162201cf5b5899938cfaec99c8cb35a2f1bf0775fc9ccbf5e63130a1ea217213" + "ff24d14f5f7d355f47d53fd016565ed128bf3af30eb7ce8cae307ee4fe7f3fd0" + "da75eceab6bea9298e04ce5b4b07349f8c02da305734f7c0c8c6af7b5eaa9738" + "e3daa8f18440301f3e54f2093fe15f4fe951986a8628e98dcd781efbec7a46f2" + "631c52620e2953e744f2b56d102eae503017047fb43d65ce028e88ef5846ea3b" + "88f7ee5594021c60a4a6a1c275614103de8c1435d6d08cc58882f920e0cec65e" + "dfb1c8b5bfa040b042b4ef660d0aab48ef2e89ee719a1f24a4629a0c5ed769e8" + "e13beeb34b932f309fb2c360a04a460821ca99fe58f69e65557d6c1b10ba18c7" + default)) '(package-selected-packages - '(doom-themes corfu yaml-pro smex rust-mode nix-mode multiple-cursors magit lsp-ui ido-completing-read+ gruber-darker-theme go-mode editorconfig direnv dash-functional auctex))) -(custom-set-faces) + '(auctex corfu direnv doom-themes editorconfig go-mode + gruber-darker-theme ido-completing-read+ lsp-ui magit meow + multiple-cursors nix-mode rust-mode smex yaml-pro))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - diff --git a/.config/kak/kakrc b/.config/kak/kakrc index 762d0e2..bf4c08d 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -1,6 +1,27 @@ -colorscheme gruber-darker -add-highlighter global/ number-lines -relative +colorscheme gruvbox-dark +set-option global makecmd 'make -j8' +set-option global grepcmd 'rg --vimgrep --hidden' +add-highlighter global/ show-matching -previous +set-face global CurSearch +u +set-face global CurWord +b +hook global WinCreate ^[^*]+$ %{ add-highlighter window/ number-lines -hlcursor -relative } + +# Enable editor config +# ──────────────────── +hook global BufOpenFile .* %{ editorconfig-load } +hook global BufNewFile .* %{ editorconfig-load } + +hook global BufSetOption indentwidth=[1-9] %{ + hook buffer InsertChar \t %{ try %{ + execute-keys -draft "h<a-h><a-k>\A\h+\z<ret><a-;>;%opt{indentwidth}@" + }} + hook buffer InsertDelete ' ' %{ try %{ + execute-keys -draft 'h<a-h><a-k>\A\h+\z<ret>i<space><esc><lt>' + }} +} +# Workaround to not use tmux, but dtach and window manager +# ──────────────────── hook -once global KakBegin .* %{ require-module connect require-module dtach-repl @@ -35,27 +56,69 @@ hook -once global KakBegin .* %{ alias global repl-send-text dtach-send-text } -set-option global toolsclient t -set-option global jumpclient j -set-option global docsclient d +# Ide / connect +# ──────────────────── +set-option global toolsclient tools +set-option global jumpclient main +set-option global docsclient docs +define-command ide -params 0..1 %{ + try %{ rename-session %arg{1} } + + rename-client main + new rename-client tools + new rename-client docs +} set-option global ui_options terminal_assistant=cat +map global normal '#' :comment-line<ret> -map -docstring "Jump to next grep match" global goto n <esc>:grep-next-match<ret> -map -docstring "Jump to previous grep match" global goto p <esc>:grep-previous-match<ret> -map -docstring "Jump to next make error" global goto ] <esc>:make-next-error<ret> -map -docstring "Jump to previous make error" global goto [ <esc>:make-previous-error<ret> +define-command -override -params 1 shell-bookmark %{ + execute-keys %sh{ + printf "%s" "<esc>:cd " + d=$(printenv "${@}") + printf "%s" "$d<ret>" + printf "%s" "<esc>:info %[cd'd into ${d}]<ret>" + } +} +map global user C "<esc>:shell-bookmark " +define-command -override relative-edit %{ + execute-keys %sh{ + printf "%s" "<esc>:e $(realpath --relative-to "$PWD" "${kak_buffile%/*}")/" + } +} +map global user e "<esc>:relative-edit<ret>" +define-command -override relative-cd %{ + execute-keys %sh{ + d=$(realpath --relative-to "$PWD" "${kak_buffile%/*}") + printf "%s" "<esc>:cd $d/" + } +} +map global user c "<esc>:relative-cd<ret>" +map global user f "<esc>:> yazi<ret>" +define-command find -params 1 %{ edit %arg{1} } +complete-command -menu find shell-script-candidates %{ fd --type=f --hidden --exclude='.git**' } + +# Goto jump next grep, lint, compile +# ──────────────────── +hook global -always BufOpenFifo '\*grep\*' %{ + map global normal <minus> ': grep-next-match<ret>' + map global normal = ': grep-previous-match<ret>' +} +hook global -always BufOpenFifo '\*make\*' %{ + map global normal <minus> ': make-next-match<ret>' + map global normal = ': make-previous-match<ret>' +} +map global user -docstring 'next lint error' n ':lint-next-error<ret>' +map global normal <c-p> :lint<ret> +# System clipboard +# ──────────────────── hook global RegisterModified '"' %{ nop %sh{ export kak_client_pid="$kak_client_pid" printf %s "$kak_main_reg_dquote" | vis-clipboard --copy }} -hook global WinCreate ^[^*]+$ %{ - editorconfig-load - map global insert <tab> '<a-;><a-gt>' - map global insert <s-tab> '<a-;><a-lt>' -} - +# Filetype specific hooks +# ─────────────────────── define-command -override -docstring %{ Format the contents of the buffer, but also write it. } format-but-write %{ @@ -63,26 +126,28 @@ define-command -override -docstring %{ write } -hook global BufSetOption filetype=python %{ +hook global WinSetOption filetype=python %{ set-option buffer formatcmd 'ruff format -' hook buffer -group format BufWritePost .* format-but-write } -hook global BufSetOption filetype=terraform %{ +hook global WinSetOption filetype=terraform %{ set-option buffer formatcmd 'terraform fmt -' hook buffer -group format BufWritePost .* format-but-write } -hook global BufSetOption filetype=go %{ +hook global WinSetOption filetype=go %{ set-option buffer formatcmd 'gofumpt | goimports' set-option global make_error_pattern '^\s*([^:\n]+):(\d+):?(?:(\d+):)? ?([^\n]+)?' hook buffer -group format BufWritePost .* format-but-write } -hook global BufSetOption filetype=sh %{ - set-option window lintcmd "shellcheck -fgcc -Cnever" +hook global WinSetOption filetype=sh %{ + set-option buffer lintcmd "shellcheck -fgcc -Cnever" } +# Buffers +# ─────────────────────── define-command delete-buffers-matching -params 1..2 %{ evaluate-commands %sh{ cmd=delete-buffer @@ -109,33 +174,8 @@ define-command delete-buffers-matching -params 1..2 %{ map global user b ':enter-buffers-mode<ret>' -docstring 'buffers…' map global user B ':enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)…' -# Suggested aliases - alias global bd delete-buffer alias global bf buffer-first alias global bl buffer-last alias global bo buffer-only alias global bo! buffer-only-force -define-command -override -params 1 C %{ - execute-keys %sh{ - printf "%s" "<esc>:cd " - d=$(printenv "${@}") - printf "%s" "$d<ret>" - printf "%s" "<esc>:info %[cd'd into ${d}]<ret>" - } -} -map global user C "<esc>:C " -define-command -override el %{ - execute-keys %sh{ - printf "%s" "<esc>:e $(realpath --relative-to "$PWD" "${kak_buffile%/*}")/" - } -} -map global user e "<esc>:el<ret>" -define-command -override cdl %{ - execute-keys %sh{ - d=$(realpath --relative-to "$PWD" "${kak_buffile%/*}") - printf "%s" "<esc>:cd $d/" - } -} -map global user c "<esc>:cdl<ret>" -map global user f "<esc>:> lf<ret>" diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 85755da..c9725ff 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -44,7 +44,8 @@ alias \ xi="xbps-install" \ xr="xbps-remove -R" \ xq="xbps-query" \ - z="zathura" + z="zathura" \ + fzl="fuzzy-links" alias \ ref="shortcuts >/dev/null; . ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; . ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" \ diff --git a/.config/zsh/rc b/.config/zsh/rc index bdeb327..7ae93e2 100644 --- a/.config/zsh/rc +++ b/.config/zsh/rc @@ -86,4 +86,11 @@ lfcd () { [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" && c fi } -bindkey -s '^o' '^ulfcd\n' +bindkey -s '^o' 'y\n' + +autoload -z edit-command-line +my-edit-command-line() { + EDITOR=kak edit-command-line +} +zle -N my-edit-command-line +bindkey '^X^E' my-edit-command-line diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts index 692e95d..b756754 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -9,6 +9,7 @@ shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" shell_env_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc" +yazi_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/yazi/shortcutrc" vim_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/nvim/shortcuts.vim" qute_shortcuts="/dev/null" fish_shortcuts="/dev/null" @@ -21,9 +22,12 @@ printf "alias " > "$shell_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. eval "echo \"$(cat "$bmdirs"; for i in "$bmdirs_dir"/*; do cat $i; done)\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); - printf(\"%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; - printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" ; - printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ; }" + printf(\"%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; + printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" ; + printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ; + printf(\"{ on = [\42C\42,\",\$1) > \"$yazi_shortcuts\" ; + for(i = 0; ++i <= length(\$1);) printf(\"\42%s\42,\", substr(\$0, i, 1)) > \"$yazi_shortcuts\" ; + printf(\"\42<Enter>\42], run = \42cd %s\42 },\\\\\n\",\$2) > \"$yazi_shortcuts\" ; }" # " printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; # printf(\"abbr %s \42cd %s; and ls -A\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ; # printf(\"map g%s :cd %s<CR>\nmap t%s <tab>:cd %s<CR><tab>\nmap M%s <tab>:cd %s<CR><tab>:mo<CR>\nmap Y%s <tab>:cd %s<CR><tab>:co<CR> \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ; @@ -31,13 +35,14 @@ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); # printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" " -# Format the `files` file in the correct syntax and sent it to both configs. -# eval "echo \"$(cat "$bmfiles")\"" | \ -# awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); -# printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; -# printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" }" -# " printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; -# printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ; -# printf(\"map %s :e %s<CR> \n\",\$1,\$2) >> \"$vifm_shortcuts\" ; -# printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ; -# printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }" +sed '/^append_keymap.*\[$/,/^\]$/ { +/^append_keymap.*\[[[:space:]]*/b +/^\]$/b +/.*/d +}' ~/.config/yazi/keymap.toml | sed '/^append_keymap.*\[$/,/^\]$/ { +/^append_keymap.*\[[[:space:]]*/b +/^\]$/c\ +'"$(cat ~/.config/yazi/shortcutrc)"' +] +}' > ~/.config/yazi/keymap.toml.sed +mv ~/.config/yazi/keymap.toml.sed ~/.config/yazi/keymap.toml |
