diff options
Diffstat (limited to '')
| -rw-r--r-- | pkgs/by-name/fi/fish-mk-maps/.envrc | 21 | ||||
| -rw-r--r-- | pkgs/by-name/fi/fish-mk-maps/.gitignore | 16 | ||||
| -rw-r--r-- | pkgs/by-name/fi/fish-mk-maps/default.nix | 445 | ||||
| -rwxr-xr-x | pkgs/by-name/fi/fish-mk-maps/fish_maps.sh | 405 | ||||
| -rwxr-xr-x | pkgs/by-name/fi/fish-mk-maps/fish_test.sh | 31 | ||||
| -rw-r--r-- | pkgs/by-name/fi/fish-mk-maps/package.unstable.nix (renamed from pkgs/by-name/mp/mpdpopm/package.nix) | 0 | ||||
| -rw-r--r-- | pkgs/by-name/fi/fish-mk-maps/src/main.rs | 362 | ||||
| -rwxr-xr-x | pkgs/by-name/fi/fish-mk-maps/update.sh | 14 | ||||
| -rw-r--r-- | pkgs/by-name/fi/fish-patched/package.unstable.nix (renamed from pkgs/by-name/fi/fish-patched/package.nix) | 0 |
9 files changed, 1294 insertions, 0 deletions
diff --git a/pkgs/by-name/fi/fish-mk-maps/.envrc b/pkgs/by-name/fi/fish-mk-maps/.envrc new file mode 100644 index 00000000..0001f149 --- /dev/null +++ b/pkgs/by-name/fi/fish-mk-maps/.envrc @@ -0,0 +1,21 @@ +#!/usr/bin/env sh + +# Mpdpopm - A mpd rating tracker +# +# Copyright (C) 2026 Benedikt Peetz, Michael Herstine <sp1ff@pobox.com> <benedikt.peetz@b-peetz.de, sp1ff@pobox.com> +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Mpdpopm. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/agpl.txt>. + +source_env_if_exists ./.nenvrc + +PATH_add ./scripts +PATH_add ./target/debug/ +PATH_add ./target/release/ + +if on_git_branch; then + echo && git status --short --branch +fi diff --git a/pkgs/by-name/fi/fish-mk-maps/.gitignore b/pkgs/by-name/fi/fish-mk-maps/.gitignore new file mode 100644 index 00000000..c80d7eef --- /dev/null +++ b/pkgs/by-name/fi/fish-mk-maps/.gitignore @@ -0,0 +1,16 @@ +# Mpdpopm - A mpd rating tracker +# +# Copyright (C) 2026 Benedikt Peetz, Michael Herstine <sp1ff@pobox.com> <benedikt.peetz@b-peetz.de, sp1ff@pobox.com> +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Mpdpopm. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/agpl.txt>. + +# build +/target +/result + +# dev env +.direnv diff --git a/pkgs/by-name/fi/fish-mk-maps/default.nix b/pkgs/by-name/fi/fish-mk-maps/default.nix new file mode 100644 index 00000000..566d0398 --- /dev/null +++ b/pkgs/by-name/fi/fish-mk-maps/default.nix @@ -0,0 +1,445 @@ +{ + "operator" = { + "escape" = { cmd = "fish_vi_operator_cancel"; sets_mode_to = "default";}; + "F" = { cmd = ""; sets_mode_to = "F";}; + "d" = { cmd = "fish_vi_exec_motion --linewise"; sets_mode_to = "default";}; + "e" = { cmd = "fish_vi_exec_motion forward-word-end"; sets_mode_to = "default";}; + "j" = { cmd = "fish_vi_exec_motion down-line"; sets_mode_to = "default";}; + "k" = { cmd = "fish_vi_exec_motion up-line"; sets_mode_to = "default";}; + "7" = { cmd = "fish_vi_arg_digit 7"; sets_mode_to = "default";}; + "h" = { cmd = "fish_vi_exec_motion backward-char"; sets_mode_to = "default";}; + "B" = { cmd = "fish_vi_exec_motion backward-bigword"; sets_mode_to = "default";}; + "9" = { cmd = "fish_vi_arg_digit 9"; sets_mode_to = "default";}; + "5" = { cmd = "fish_vi_arg_digit 5"; sets_mode_to = "default";}; + "E" = { cmd = "fish_vi_exec_motion forward-bigword-end"; sets_mode_to = "default";}; + "~" = { cmd = "fish_vi_exec_motion --linewise"; sets_mode_to = "default";}; + "4" = { cmd = "fish_vi_arg_digit 4"; sets_mode_to = "default";}; + "comma" = { cmd = "fish_vi_exec_motion repeat-jump-reverse"; sets_mode_to = "default";}; + "^" = { cmd = "fish_vi_exec_motion beginning-of-line"; sets_mode_to = "default";}; + "ctrl-[" = { cmd = "fish_vi_operator_cancel"; sets_mode_to = "default";}; + ";" = { cmd = "fish_vi_exec_motion repeat-jump"; sets_mode_to = "default";}; + "c" = { cmd = "fish_vi_exec_motion --linewise"; sets_mode_to = "default";}; + "T" = { cmd = ""; sets_mode_to = "T";}; + "t" = { cmd = ""; sets_mode_to = "t";}; + "2" = { cmd = "fish_vi_arg_digit 2"; sets_mode_to = "default";}; + "W" = { cmd = "fish_vi_exec_motion forward-bigword-vi"; sets_mode_to = "default";}; + "$" = { cmd = "fish_vi_exec_motion end-of-line"; sets_mode_to = "default";}; + "0" = { cmd = "fish_vi_exec_motion beginning-of-line"; sets_mode_to = "default";}; + "8" = { cmd = "fish_vi_arg_digit 8"; sets_mode_to = "default";}; + "g" = { + "E" = { cmd = "fish_vi_exec_motion backward-bigword-end"; sets_mode_to = "default";}; + "e" = { cmd = "fish_vi_exec_motion backward-word-end"; sets_mode_to = "default";}; + }; + "w" = { cmd = "fish_vi_exec_motion forward-word-vi"; sets_mode_to = "default";}; + "b" = { cmd = "fish_vi_exec_motion backward-word"; sets_mode_to = "default";}; + "6" = { cmd = "fish_vi_arg_digit 6"; sets_mode_to = "default";}; + "y" = { cmd = "fish_vi_exec_motion --linewise"; sets_mode_to = "default";}; + "l" = { cmd = "fish_vi_exec_motion forward-char"; sets_mode_to = "default";}; + "1" = { cmd = "fish_vi_arg_digit 1"; sets_mode_to = "default";}; + "f" = { cmd = ""; sets_mode_to = "f";}; + "3" = { cmd = "fish_vi_arg_digit 3"; sets_mode_to = "default";}; + }; + "T" = { + "" = { cmd = "get-key fish_vi_exec_motion commandline --backward-jump-till=$fish_key set -eg fish_key"; sets_mode_to = "default";}; + }; + "f" = { + "" = { cmd = "get-key fish_vi_exec_motion commandline --forward-jump=$fish_key set -eg fish_key"; sets_mode_to = "default";}; + }; + "insert" = { + "alt-up" = { cmd = "history-token-search-backward"; sets_mode_to = "default";}; + "alt-v" = { cmd = "edit_command_buffer"; sets_mode_to = "default";}; + "pageup" = { cmd = "beginning-of-history"; sets_mode_to = "default";}; + ">" = { cmd = "self-insert expand-abbr"; sets_mode_to = "default";}; + "left" = { cmd = "backward-char"; sets_mode_to = "default";}; + "\e\[1\;9C" = { cmd = "nextd-or-forward-word"; sets_mode_to = "default";}; + "ctrl-k" = { cmd = "kill-line"; sets_mode_to = "default";}; + "&" = { cmd = "self-insert expand-abbr"; sets_mode_to = "default";}; + "shift-delete" = { cmd = "history-delete or backward-delete-char"; sets_mode_to = "default";}; + "alt-l" = { cmd = "__fish_list_current_token"; sets_mode_to = "default";}; + "shift-tab" = { cmd = "complete-and-search"; sets_mode_to = "default";}; + "space" = { cmd = "self-insert expand-abbr"; sets_mode_to = "default";}; + "up" = { cmd = "up-or-search"; sets_mode_to = "default";}; + "alt-#" = { cmd = "__fish_toggle_comment_commandline"; sets_mode_to = "default";}; + "tab" = { cmd = "complete"; sets_mode_to = "default";}; + "alt-h" = { cmd = "__fish_man_page"; sets_mode_to = "default";}; + "\e\[1\;9A" = { cmd = "history-token-search-backward"; sets_mode_to = "default";}; + "ctrl-u" = { cmd = "backward-kill-line"; sets_mode_to = "default";}; + "shift-backspace" = { cmd = "backward-delete-char"; sets_mode_to = "default";}; + "alt-enter" = { cmd = "commandline -i \\n (commandline --search-field >/dev/null && echo --search-field) expand-abbr"; sets_mode_to = "default";}; + "ctrl-w" = { cmd = "backward-kill-path-component"; sets_mode_to = "default";}; + "ctrl-right" = { cmd = "forward-token"; sets_mode_to = "default";}; + "pagedown" = { cmd = "end-of-history"; sets_mode_to = "default";}; + "alt-down" = { cmd = "history-token-search-forward"; sets_mode_to = "default";}; + "down" = { cmd = "down-or-search"; sets_mode_to = "default";}; + "ctrl-n" = { cmd = "accept-autosuggestion"; sets_mode_to = "default";}; + "enter" = { cmd = "execute"; sets_mode_to = "default";}; + "ctrl-m" = { cmd = "execute"; sets_mode_to = "default";}; + "shift-space" = { cmd = "commandline -i " " (commandline --search-field >/dev/null && echo --search-field) expand-abbr"; sets_mode_to = "default";}; + "ctrl-s" = { cmd = "pager-toggle-search"; sets_mode_to = "default";}; + "ctrl-i" = { cmd = "complete"; sets_mode_to = "default";}; + "shift-right" = { cmd = "forward-bigword"; sets_mode_to = "default";}; + "end" = { cmd = "end-of-line"; sets_mode_to = "default";}; + ")" = { cmd = "self-insert expand-abbr"; sets_mode_to = "default";}; + "ctrl-x" = { cmd = "fish_clipboard_copy"; sets_mode_to = "default";}; + "\e\[1\;9D" = { cmd = "prevd-or-backward-word"; sets_mode_to = "default";}; + "alt-e" = { cmd = "edit_command_buffer"; sets_mode_to = "default";}; + "alt-p" = { cmd = "__fish_paginate"; sets_mode_to = "default";}; + "f1" = { cmd = "__fish_man_page"; sets_mode_to = "default";}; + "shift-left" = { cmd = "backward-bigword"; sets_mode_to = "default";}; + "ctrl-l" = { cmd = "status test-terminal-feature scroll-content-up && commandline -f scrollback-push clear-screen"; sets_mode_to = "default";}; + "alt-y" = { cmd = "yank-pop"; sets_mode_to = "default";}; + "<" = { cmd = "self-insert expand-abbr"; sets_mode_to = "default";}; + "alt-w" = { cmd = "__fish_whatis_current_token"; sets_mode_to = "default";}; + "right" = { cmd = "forward-char"; sets_mode_to = "default";}; + "shift-enter" = { cmd = "commandline -i \\n (commandline --search-field >/dev/null && echo --search-field) expand-abbr"; sets_mode_to = "default";}; + "\e\[1\;9B" = { cmd = "history-token-search-forward"; sets_mode_to = "default";}; + "escape" = { cmd = "\n\ \ \ \ \ \ \ \ if\ commandline\ -P\n\ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ cancel\n\ \ \ \ \ \ \ \ else\n\ \ \ \ \ \ \ \ \ \ \ \ set\ fish_bind_mode\ default\n\ \ \ \ \ \ \ \ \ \ \ \ if\ test\ \(count\ \(commandline\ --cut-at-cursor\ \|\ tail\ -c2\)\)\ !=\ 2\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ backward-char\n\ \ \ \ \ \ \ \ \ \ \ \ end\n\ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ repaint-mode\n\ \ \ \ \ \ \ \ end\n\ \ \ bind --preset -M insert ctrl-\[ \n\ \ \ \ \ \ \ \ if\ commandline\ -P\n\ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ cancel\n\ \ \ \ \ \ \ \ else\n\ \ \ \ \ \ \ \ \ \ \ \ set\ fish_bind_mode\ default\n\ \ \ \ \ \ \ \ \ \ \ \ if\ test\ \(count\ \(commandline\ --cut-at-cursor\ \|\ tail\ -c2\)\)\ !=\ 2\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ backward-char\n\ \ \ \ \ \ \ \ \ \ \ \ end\n\ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ repaint-mode\n\ \ \ \ \ \ \ \ end\n\ \ "; sets_mode_to = "default";}; + "|" = { cmd = "self-insert expand-abbr"; sets_mode_to = "default";}; + "alt-b" = { cmd = "prevd-or-backward-word"; sets_mode_to = "default";}; + "ctrl-enter" = { cmd = "execute"; sets_mode_to = "default";}; + "alt-f" = { cmd = "nextd-or-forward-word"; sets_mode_to = "default";}; + "alt-s" = { cmd = "for cmd in sudo doas please run0; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end"; sets_mode_to = "default";}; + "ctrl-space" = { cmd = "test -n "$(commandline)" && commandline -i " " (commandline --search-field >/dev/null && echo --search-field)"; sets_mode_to = "default";}; + "ctrl-left" = { cmd = "backward-token"; sets_mode_to = "default";}; + "ctrl-y" = { cmd = "yank"; sets_mode_to = "default";}; + "alt-." = { cmd = "history-token-search-backward"; sets_mode_to = "default";}; + "ctrl-j" = { cmd = "execute"; sets_mode_to = "default";}; + "alt-left" = { cmd = "prevd-or-backward-word"; sets_mode_to = "default";}; + "ctrl-h" = { cmd = "backward-delete-char"; sets_mode_to = "default";}; + "alt-o" = { cmd = "__fish_preview_current_file"; sets_mode_to = "default";}; + "delete" = { cmd = "delete-char"; sets_mode_to = "default";}; + "" = { cmd = "self-insert"; sets_mode_to = "default";}; + "ctrl-d" = { cmd = "delete-or-exit"; sets_mode_to = "default";}; + "alt-d" = { cmd = "if test "$(commandline; printf .)" = \\n.; __fish_echo dirh; else; commandline -f kill-word; end"; sets_mode_to = "default";}; + "alt-right" = { cmd = "nextd-or-forward-word"; sets_mode_to = "default";}; + "ctrl-v" = { cmd = "fish_clipboard_paste"; sets_mode_to = "default";}; + "home" = { cmd = "beginning-of-line"; sets_mode_to = "default";}; + ";" = { cmd = "self-insert expand-abbr"; sets_mode_to = "default";}; + "backspace" = { cmd = "backward-delete-char"; sets_mode_to = "default";}; + "ctrl-c" = { cmd = "clear-commandline"; sets_mode_to = "default";}; + }; + "default" = { + "ctrl-y" = { cmd = "yank"; }; + "x" = { cmd = "__fish_vi_delete_char"; }; + "down" = { cmd = "down-or-search"; }; + "ctrl-left" = { cmd = "backward-token"; }; + "D" = { cmd = "kill-line"; }; + "j" = { cmd = "fish_vi_run_count down-or-search"; }; + "f" = { cmd = "forward-jump"; }; + "alt-v" = { cmd = "edit_command_buffer"; }; + "ctrl-a" = { cmd = "fish_vi_inc"; }; + "s" = { cmd = "delete-char repaint-mode"; sets_mode_to = "insert";}; + "%" = { cmd = "jump-to-matching-bracket"; }; + "k" = { cmd = "fish_vi_run_count up-or-search"; }; + ";" = { cmd = "repeat-jump"; }; + "\e\[1\;9C" = { cmd = "nextd-or-forward-word"; }; + "ctrl-u" = { cmd = "backward-kill-line"; }; + "ctrl-x" = { cmd = "fish_vi_dec"; }; + "P" = { cmd = "yank"; }; + ":" = { + "q" = { cmd = "exit"; }; + }; + "5" = { cmd = "fish_vi_arg_digit 5"; }; + "ctrl-r" = { cmd = "redo"; }; + "alt-#" = { cmd = "__fish_toggle_comment_commandline"; }; + "up" = { cmd = "up-or-search"; }; + "S" = { cmd = "kill-inner-line repaint-mode"; sets_mode_to = "insert";}; + "ctrl-j" = { cmd = "execute"; sets_mode_to = "insert";}; + "e" = { cmd = "fish_vi_run_count forward-word-end"; }; + "]" = { cmd = "history-token-search-forward"; }; + "delete" = { cmd = "delete-char"; }; + "b" = { cmd = "fish_vi_run_count backward-word"; }; + "alt-d" = { cmd = "if test "$(commandline; printf .)" = \\n.; __fish_echo dirh; else; commandline -f kill-word; end"; }; + "alt-l" = { cmd = "__fish_list_current_token"; }; + "alt-f" = { cmd = "nextd-or-forward-word"; }; + "right" = { cmd = "forward-char"; }; + "alt-s" = { cmd = "for cmd in sudo doas please run0; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end"; }; + "r" = { cmd = "repaint-mode"; sets_mode_to = "replaceone";}; + "enter" = { cmd = "execute"; sets_mode_to = "insert";}; + "alt-w" = { cmd = "__fish_whatis_current_token"; }; + "\e\[1\;9D" = { cmd = "prevd-or-backward-word"; }; + "f1" = { cmd = "__fish_man_page"; }; + """ = { + "+" = { + "P" = { cmd = "fish_clipboard_paste"; }; + "y" = { + "y" = { cmd = "fish_clipboard_copy"; }; + }; + "p" = { cmd = "set -g fish_cursor_end_mode exclusive forward-char set -g fish_cursor_end_mode inclusive fish_clipboard_paste"; }; + "Y" = { cmd = "fish_clipboard_copy"; }; + }; + "*" = { + "p" = { cmd = "set -g fish_cursor_end_mode exclusive forward-char set -g fish_cursor_end_mode inclusive fish_clipboard_paste"; }; + "P" = { cmd = "fish_clipboard_paste"; }; + "Y" = { cmd = "fish_clipboard_copy"; }; + "y" = { + "y" = { cmd = "fish_clipboard_copy"; }; + }; + }; + }; + "ctrl-l" = { cmd = "status test-terminal-feature scroll-content-up && commandline -f scrollback-push clear-screen"; }; + "t" = { cmd = "forward-jump-till"; }; + "ctrl-v" = { cmd = "fish_clipboard_paste"; }; + "~" = { cmd = "togglecase-char forward-single-char"; }; + "i" = { cmd = "repaint-mode"; sets_mode_to = "insert";}; + "9" = { cmd = "fish_vi_arg_digit 9"; }; + "4" = { cmd = "fish_vi_arg_digit 4"; }; + "ctrl-h" = { cmd = "backward-char"; }; + "backspace" = { cmd = "backward-char"; }; + "l" = { cmd = "fish_vi_run_count forward-char"; }; + "end" = { cmd = "end-of-line"; }; + "T" = { cmd = "backward-jump-till"; }; + "/" = { cmd = "history-pager repaint-mode"; sets_mode_to = "insert";}; + "8" = { cmd = "fish_vi_arg_digit 8"; }; + "alt-p" = { cmd = "__fish_paginate"; }; + "alt-up" = { cmd = "history-token-search-backward"; }; + "ctrl-m" = { cmd = "execute"; sets_mode_to = "insert";}; + "\e\[1\;9A" = { cmd = "history-token-search-backward"; }; + "alt-h" = { cmd = "__fish_man_page"; }; + "alt-left" = { cmd = "prevd-or-backward-word"; }; + "tab" = { cmd = "complete"; }; + "a" = { cmd = "set fish_cursor_end_mode exclusive forward-single-char repaint-mode"; sets_mode_to = "insert";}; + "R" = { cmd = "repaint-mode"; sets_mode_to = "replace";}; + "K" = { cmd = "man (commandline -t) 2>/dev/null; or echo -n \\a"; }; + "G" = { cmd = "end-of-buffer"; }; + "ctrl-d" = { cmd = "delete-or-exit"; }; + "[" = { cmd = "history-token-search-backward"; }; + "left" = { cmd = "backward-char"; }; + "o" = { cmd = "set fish_cursor_end_mode exclusive insert-line-under repaint-mode"; sets_mode_to = "insert";}; + "W" = { cmd = "fish_vi_run_count forward-bigword-vi"; }; + "w" = { cmd = "fish_vi_run_count forward-word-vi"; }; + "6" = { cmd = "fish_vi_arg_digit 6"; }; + "comma" = { cmd = "repeat-jump-reverse"; }; + "0" = { cmd = "if test -n "$__fish_vi_count"; fish_vi_arg_digit 0; else; commandline -f beginning-of-line; end"; }; + "pageup" = { cmd = "beginning-of-history"; }; + "ctrl-w" = { cmd = "backward-kill-path-component"; }; + "alt-down" = { cmd = "history-token-search-forward"; }; + "alt-b" = { cmd = "prevd-or-backward-word"; }; + "alt-right" = { cmd = "nextd-or-forward-word"; }; + "alt-y" = { cmd = "yank-pop"; }; + "ctrl-[" = { cmd = "set -g __fish_vi_count"; }; + "ctrl-i" = { cmd = "complete"; }; + "^" = { cmd = "beginning-of-line"; }; + "home" = { cmd = "beginning-of-line"; }; + "ctrl-s" = { cmd = "pager-toggle-search"; }; + "d" = { + "$" = { cmd = "kill-line"; }; + "a" = { + "w" = { cmd = "kill-a-word"; }; + "b" = { cmd = "jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection end-selection"; }; + "W" = { cmd = "kill-a-bigword"; }; + }; + "i" = { + "w" = { cmd = "kill-inner-word"; }; + "W" = { cmd = "kill-inner-bigword"; }; + "b" = { cmd = "jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection end-selection"; }; + }; + "comma" = { cmd = "begin-selection repeat-jump-reverse kill-selection end-selection"; }; + ";" = { cmd = "begin-selection repeat-jump kill-selection end-selection"; }; + "0" = { cmd = "backward-kill-line"; }; + "^" = { cmd = "backward-kill-line"; }; + }; + "1" = { cmd = "fish_vi_arg_digit 1"; }; + "F" = { cmd = "backward-jump"; }; + "Y" = { cmd = "kill-whole-line yank"; }; + "E" = { cmd = "fish_vi_run_count forward-bigword-end"; }; + "shift-left" = { cmd = "backward-bigword"; }; + "escape" = { cmd = "set -g __fish_vi_count"; }; + "alt-e" = { cmd = "edit_command_buffer"; }; + "3" = { cmd = "fish_vi_arg_digit 3"; }; + "J" = { cmd = "end-of-line delete-char"; }; + "u" = { cmd = "undo"; }; + "c" = { + "^" = { cmd = "backward-kill-line repaint-mode"; sets_mode_to = "insert";}; + "i" = { + "w" = { cmd = "kill-inner-word repaint-mode"; sets_mode_to = "insert";}; + "W" = { cmd = "kill-inner-bigword repaint-mode"; sets_mode_to = "insert";}; + "b" = { cmd = "jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection end-selection"; sets_mode_to = "insert";}; + }; + "a" = { + "W" = { cmd = "kill-a-bigword repaint-mode"; sets_mode_to = "insert";}; + "w" = { cmd = "kill-a-word repaint-mode"; sets_mode_to = "insert";}; + "b" = { cmd = "jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection end-selection"; sets_mode_to = "insert";}; + }; + "$" = { cmd = "kill-line repaint-mode"; sets_mode_to = "insert";}; + "0" = { cmd = "backward-kill-line repaint-mode"; sets_mode_to = "insert";}; + }; + "_" = { cmd = "beginning-of-line"; }; + "pagedown" = { cmd = "end-of-history"; }; + "\e\[1\;9B" = { cmd = "history-token-search-forward"; }; + "A" = { cmd = "set fish_cursor_end_mode exclusive end-of-line repaint-mode"; sets_mode_to = "insert";}; + "shift-tab" = { cmd = "complete-and-search"; }; + "I" = { cmd = "beginning-of-line repaint-mode"; sets_mode_to = "insert";}; + "$" = { cmd = "end-of-line"; }; + "X" = { cmd = "__fish_vi_backward_delete_char"; }; + "B" = { cmd = "fish_vi_run_count backward-bigword"; }; + "shift-delete" = { cmd = "history-delete or backward-delete-char"; }; + "y" = { + "0" = { cmd = "backward-kill-line yank"; }; + "i" = { + "W" = { cmd = "kill-inner-bigword yank"; }; + "w" = { cmd = "kill-inner-word yank"; }; + "b" = { cmd = "jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket fish_vi_yank_selection end-selection"; }; + }; + "a" = { + "W" = { cmd = "kill-a-bigword yank"; }; + "b" = { cmd = "jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket fish_vi_yank_selection end-selection"; }; + "w" = { cmd = "kill-a-word yank"; }; + }; + "^" = { cmd = "backward-kill-line yank"; }; + "$" = { cmd = "kill-line yank"; }; + }; + "p" = { cmd = "set -g fish_cursor_end_mode exclusive forward-char set -g fish_cursor_end_mode inclusive yank"; }; + "shift-right" = { cmd = "forward-bigword"; }; + "#" = { cmd = "__fish_toggle_comment_commandline"; }; + "v" = { cmd = "begin-selection repaint-mode"; sets_mode_to = "visual";}; + "O" = { cmd = "set fish_cursor_end_mode exclusive insert-line-over repaint-mode"; sets_mode_to = "insert";}; + "2" = { cmd = "fish_vi_arg_digit 2"; }; + "ctrl-k" = { cmd = "kill-line"; }; + "g" = { + "g" = { cmd = "beginning-of-buffer"; }; + "^" = { cmd = "beginning-of-line"; }; + "~" = { cmd = "fish_vi_start_operator swap-case"; }; + "u" = { cmd = "downcase-word"; }; + "U" = { cmd = "upcase-word"; }; + "$" = { cmd = "end-of-line"; }; + "E" = { cmd = "fish_vi_run_count backward-bigword-end"; }; + "p" = { cmd = "yank-pop"; }; + "e" = { cmd = "fish_vi_run_count backward-word-end"; }; + }; + "alt-." = { cmd = "history-token-search-backward"; }; + "7" = { cmd = "fish_vi_arg_digit 7"; }; + "C" = { cmd = "kill-line repaint-mode"; sets_mode_to = "insert";}; + "ctrl-right" = { cmd = "forward-token"; }; + "ctrl-c" = { cmd = "clear-commandline repaint-mode"; sets_mode_to = "insert";}; + "h" = { cmd = "fish_vi_run_count backward-char"; }; + "alt-o" = { cmd = "__fish_preview_current_file"; }; + }; + "visual" = { + "alt-down" = { cmd = "history-token-search-forward"; sets_mode_to = "default";}; + "ctrl-c" = { cmd = "end-selection repaint-mode"; sets_mode_to = "default";}; + "alt-h" = { cmd = "__fish_man_page"; sets_mode_to = "default";}; + "l" = { cmd = "forward-char"; sets_mode_to = "default";}; + "T" = { cmd = "backward-jump-till"; sets_mode_to = "default";}; + "e" = { cmd = "forward-word-end"; sets_mode_to = "default";}; + "right" = { cmd = "forward-char"; sets_mode_to = "default";}; + "t" = { cmd = "forward-jump-till"; sets_mode_to = "default";}; + "s" = { cmd = "kill-selection end-selection repaint-mode"; sets_mode_to = "insert";}; + "alt-#" = { cmd = "__fish_toggle_comment_commandline"; sets_mode_to = "default";}; + "_" = { cmd = "beginning-of-line"; sets_mode_to = "default";}; + "%" = { cmd = "jump-to-matching-bracket"; sets_mode_to = "default";}; + "ctrl-s" = { cmd = "pager-toggle-search"; sets_mode_to = "default";}; + "ctrl-w" = { cmd = "backward-kill-path-component"; sets_mode_to = "default";}; + "alt-o" = { cmd = "__fish_preview_current_file"; sets_mode_to = "default";}; + "left" = { cmd = "backward-char"; sets_mode_to = "default";}; + "shift-left" = { cmd = "backward-bigword"; sets_mode_to = "default";}; + "alt-p" = { cmd = "__fish_paginate"; sets_mode_to = "default";}; + "F" = { cmd = "backward-jump"; sets_mode_to = "default";}; + "ctrl-left" = { cmd = "backward-token"; sets_mode_to = "default";}; + "b" = { cmd = "backward-word"; sets_mode_to = "default";}; + "f1" = { cmd = "__fish_man_page"; sets_mode_to = "default";}; + "shift-delete" = { cmd = "history-delete or backward-delete-char"; sets_mode_to = "default";}; + """ = { + "+" = { + "y" = { cmd = "fish_clipboard_copy; commandline -f end-selection repaint-mode"; sets_mode_to = "default";}; + }; + "*" = { + "y" = { cmd = "fish_clipboard_copy; commandline -f end-selection repaint-mode"; sets_mode_to = "default";}; + }; + }; + "shift-tab" = { cmd = "complete-and-search"; sets_mode_to = "default";}; + "alt-b" = { cmd = "prevd-or-backward-word"; sets_mode_to = "default";}; + "#" = { cmd = "__fish_toggle_comment_commandline"; sets_mode_to = "default";}; + "~" = { cmd = "togglecase-selection end-selection repaint-mode"; sets_mode_to = "default";}; + "y" = { cmd = "fish_vi_yank_selection end-selection repaint-mode"; sets_mode_to = "default";}; + "f" = { cmd = "forward-jump"; sets_mode_to = "default";}; + "x" = { cmd = "kill-selection end-selection repaint-mode"; sets_mode_to = "default";}; + "alt-y" = { cmd = "yank-pop"; sets_mode_to = "default";}; + "$" = { cmd = "end-of-line"; sets_mode_to = "default";}; + ";" = { cmd = "repeat-jump"; sets_mode_to = "default";}; + "W" = { cmd = "forward-bigword-vi"; sets_mode_to = "default";}; + "w" = { cmd = "forward-word-vi"; sets_mode_to = "default";}; + "j" = { cmd = "down-line"; sets_mode_to = "default";}; + "k" = { cmd = "up-line"; sets_mode_to = "default";}; + "end" = { cmd = "end-of-line"; sets_mode_to = "default";}; + "down" = { cmd = "down-or-search"; sets_mode_to = "default";}; + "alt-up" = { cmd = "history-token-search-backward"; sets_mode_to = "default";}; + "i" = { cmd = "end-selection repaint-mode"; sets_mode_to = "insert";}; + "g" = { + "^" = { cmd = "beginning-of-line"; sets_mode_to = "default";}; + "e" = { cmd = "backward-word-end"; sets_mode_to = "default";}; + "u" = { cmd = "downcase-selection end-selection repaint-mode"; sets_mode_to = "default";}; + "$" = { cmd = "end-of-line"; sets_mode_to = "default";}; + "U" = { cmd = "upcase-selection end-selection repaint-mode"; sets_mode_to = "default";}; + "E" = { cmd = "backward-bigword-end"; sets_mode_to = "default";}; + }; + "I" = { cmd = "end-selection beginning-of-line repaint-mode"; sets_mode_to = "insert";}; + "alt-." = { cmd = "history-token-search-backward"; sets_mode_to = "default";}; + "home" = { cmd = "beginning-of-line"; sets_mode_to = "default";}; + "alt-l" = { cmd = "__fish_list_current_token"; sets_mode_to = "default";}; + "ctrl-x" = { cmd = "fish_clipboard_copy"; sets_mode_to = "default";}; + "alt-s" = { cmd = "for cmd in sudo doas please run0; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end"; sets_mode_to = "default";}; + "o" = { cmd = "swap-selection-start-stop repaint-mode"; sets_mode_to = "default";}; + "ctrl-[" = { cmd = "end-selection repaint-mode"; sets_mode_to = "default";}; + "X" = { cmd = "kill-whole-line end-selection repaint-mode"; sets_mode_to = "default";}; + "\e\[1\;9B" = { cmd = "history-token-search-forward"; sets_mode_to = "default";}; + "pageup" = { cmd = "beginning-of-history"; sets_mode_to = "default";}; + "ctrl-l" = { cmd = "status test-terminal-feature scroll-content-up && commandline -f scrollback-push clear-screen"; sets_mode_to = "default";}; + "up" = { cmd = "up-or-search"; sets_mode_to = "default";}; + "ctrl-u" = { cmd = "backward-kill-line"; sets_mode_to = "default";}; + "h" = { cmd = "backward-char"; sets_mode_to = "default";}; + "alt-right" = { cmd = "nextd-or-forward-word"; sets_mode_to = "default";}; + "ctrl-y" = { cmd = "yank"; sets_mode_to = "default";}; + "v" = { cmd = "end-selection repaint-mode"; sets_mode_to = "default";}; + "\e\[1\;9D" = { cmd = "prevd-or-backward-word"; sets_mode_to = "default";}; + "\e\[1\;9C" = { cmd = "nextd-or-forward-word"; sets_mode_to = "default";}; + "0" = { cmd = "beginning-of-line"; sets_mode_to = "default";}; + "ctrl-k" = { cmd = "kill-line"; sets_mode_to = "default";}; + "alt-v" = { cmd = "edit_command_buffer"; sets_mode_to = "default";}; + "ctrl-v" = { cmd = "fish_clipboard_paste"; sets_mode_to = "default";}; + "ctrl-i" = { cmd = "complete"; sets_mode_to = "default";}; + "d" = { cmd = "kill-selection end-selection backward-char repaint-mode"; sets_mode_to = "default";}; + "^" = { cmd = "beginning-of-line"; sets_mode_to = "default";}; + "alt-f" = { cmd = "nextd-or-forward-word"; sets_mode_to = "default";}; + "ctrl-right" = { cmd = "forward-token"; sets_mode_to = "default";}; + "alt-w" = { cmd = "__fish_whatis_current_token"; sets_mode_to = "default";}; + "\e\[1\;9A" = { cmd = "history-token-search-backward"; sets_mode_to = "default";}; + "shift-right" = { cmd = "forward-bigword"; sets_mode_to = "default";}; + "E" = { cmd = "forward-bigword-end"; sets_mode_to = "default";}; + "tab" = { cmd = "complete"; sets_mode_to = "default";}; + "B" = { cmd = "backward-bigword"; sets_mode_to = "default";}; + "alt-e" = { cmd = "edit_command_buffer"; sets_mode_to = "default";}; + "alt-d" = { cmd = "if test "$(commandline; printf .)" = \\n.; __fish_echo dirh; else; commandline -f kill-word; end"; sets_mode_to = "default";}; + "pagedown" = { cmd = "end-of-history"; sets_mode_to = "default";}; + "c" = { cmd = "kill-selection end-selection repaint-mode"; sets_mode_to = "insert";}; + "alt-left" = { cmd = "prevd-or-backward-word"; sets_mode_to = "default";}; + "comma" = { cmd = "repeat-jump-reverse"; sets_mode_to = "default";}; + "ctrl-d" = { cmd = "delete-or-exit"; sets_mode_to = "default";}; + "escape" = { cmd = "end-selection repaint-mode"; sets_mode_to = "default";}; + }; + "F" = { + "" = { cmd = "get-key fish_vi_exec_motion commandline --backward-jump=$fish_key set -eg fish_key"; sets_mode_to = "default";}; + }; + "t" = { + "" = { cmd = "get-key fish_vi_exec_motion commandline --forward-jump-till=$fish_key set -eg fish_key"; sets_mode_to = "default";}; + }; + "replace" = { + "escape" = { cmd = "cancel repaint-mode"; sets_mode_to = "default";}; + "#" = { cmd = "__fish_toggle_comment_commandline"; sets_mode_to = "default";}; + "ctrl-m" = { cmd = "execute repaint-mode"; sets_mode_to = "insert";}; + "shift-backspace" = { cmd = "backward-char"; sets_mode_to = "default";}; + "ctrl-[" = { cmd = "cancel repaint-mode"; sets_mode_to = "default";}; + "enter" = { cmd = "execute repaint-mode"; sets_mode_to = "insert";}; + "" = { cmd = "delete-char self-insert"; sets_mode_to = "default";}; + "backspace" = { cmd = "backward-char"; sets_mode_to = "default";}; + "ctrl-j" = { cmd = "execute repaint-mode"; sets_mode_to = "insert";}; + }; + "replaceone" = { + "escape" = { cmd = "cancel repaint-mode"; sets_mode_to = "default";}; + "" = { cmd = "set -g fish_cursor_end_mode exclusive delete-char self-insert backward-char repaint-mode set -g fish_cursor_end_mode inclusive"; sets_mode_to = "default";}; + "ctrl-j" = { cmd = "set -g fish_cursor_end_mode exclusive commandline -f delete-char; commandline -i \\n; commandline -f backward-char repaint-mode set -g fish_cursor_end_mode inclusive"; sets_mode_to = "default";}; + "enter" = { cmd = "set -g fish_cursor_end_mode exclusive commandline -f delete-char; commandline -i \\n; commandline -f backward-char repaint-mode set -g fish_cursor_end_mode inclusive"; sets_mode_to = "default";}; + "ctrl-[" = { cmd = "cancel repaint-mode"; sets_mode_to = "default";}; + "ctrl-m" = { cmd = "set -g fish_cursor_end_mode exclusive commandline -f delete-char; commandline -i \\n; commandline -f backward-char repaint-mode set -g fish_cursor_end_mode inclusive"; sets_mode_to = "default";}; + }; +} diff --git a/pkgs/by-name/fi/fish-mk-maps/fish_maps.sh b/pkgs/by-name/fi/fish-mk-maps/fish_maps.sh new file mode 100755 index 00000000..61824c7d --- /dev/null +++ b/pkgs/by-name/fi/fish-mk-maps/fish_maps.sh @@ -0,0 +1,405 @@ +#! /usr/bin/env sh + +set -e + +cargo build +./target/debug/bind-server > ./default.nix & +sleep 1 + +# bind --preset y,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump fish_vi_yank_selection end-selection +# bind --preset y,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump fish_vi_yank_selection end-selection +# bind --preset d,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection +# bind --preset d,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection +# bind --preset d 'fish_vi_start_operator delete' +# bind --preset c 'fish_vi_start_operator change' +# bind --preset y 'fish_vi_start_operator yank' +# bind --preset -m insert c,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode +# bind --preset -m insert c,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode + +bind --preset -M insert ctrl-y yank +bind --preset -M insert alt-y yank-pop +bind --preset -M insert right forward-char +bind --preset -M insert left backward-char +bind --preset -M insert ctrl-right forward-token +bind --preset -M insert ctrl-left backward-token +bind --preset -M insert pageup beginning-of-history +bind --preset -M insert pagedown end-of-history +bind --preset -M insert ctrl-x fish_clipboard_copy +bind --preset -M insert ctrl-v fish_clipboard_paste +bind --preset -M insert escape "\n\ \ \ \ \ \ \ \ if\ commandline\ -P\n\ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ cancel\n\ \ \ \ \ \ \ \ else\n\ \ \ \ \ \ \ \ \ \ \ \ set\ fish_bind_mode\ default\n\ \ \ \ \ \ \ \ \ \ \ \ if\ test\ \(count\ \(commandline\ --cut-at-cursor\ \|\ tail\ -c2\)\)\ !=\ 2\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ backward-char\n\ \ \ \ \ \ \ \ \ \ \ \ end\n\ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ repaint-mode\n\ \ \ \ \ \ \ \ end\n\ \ " +bind --preset -M insert ctrl-\[ "\n\ \ \ \ \ \ \ \ if\ commandline\ -P\n\ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ cancel\n\ \ \ \ \ \ \ \ else\n\ \ \ \ \ \ \ \ \ \ \ \ set\ fish_bind_mode\ default\n\ \ \ \ \ \ \ \ \ \ \ \ if\ test\ \(count\ \(commandline\ --cut-at-cursor\ \|\ tail\ -c2\)\)\ !=\ 2\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ backward-char\n\ \ \ \ \ \ \ \ \ \ \ \ end\n\ \ \ \ \ \ \ \ \ \ \ \ commandline\ -f\ repaint-mode\n\ \ \ \ \ \ \ \ end\n\ \ " +bind --preset -M insert tab complete +bind --preset -M insert ctrl-i complete +bind --preset -M insert ctrl-s pager-toggle-search +bind --preset -M insert shift-tab complete-and-search +bind --preset -M insert shift-delete history-delete or backward-delete-char +bind --preset -M insert down down-or-search +bind --preset -M insert up up-or-search +bind --preset -M insert shift-right forward-bigword +bind --preset -M insert shift-left backward-bigword +bind --preset -M insert alt-b prevd-or-backward-word +bind --preset -M insert alt-f nextd-or-forward-word +bind --preset -M insert alt-right nextd-or-forward-word +bind --preset -M insert "\e\[1\;9C" nextd-or-forward-word +bind --preset -M insert alt-left prevd-or-backward-word +bind --preset -M insert "\e\[1\;9D" prevd-or-backward-word +bind --preset -M insert alt-up history-token-search-backward +bind --preset -M insert alt-down history-token-search-forward +bind --preset -M insert "\e\[1\;9A" history-token-search-backward +bind --preset -M insert "\e\[1\;9B" history-token-search-forward +bind --preset -M insert alt-. history-token-search-backward +bind --preset -M insert alt-l __fish_list_current_token +bind --preset -M insert alt-o __fish_preview_current_file +bind --preset -M insert alt-w __fish_whatis_current_token +bind --preset -M insert ctrl-l 'status test-terminal-feature scroll-content-up && commandline -f scrollback-push' clear-screen +bind --preset -M insert ctrl-c clear-commandline +bind --preset -M insert ctrl-u backward-kill-line +bind --preset -M insert ctrl-k kill-line +bind --preset -M insert ctrl-w backward-kill-path-component +bind --preset -M insert end end-of-line +bind --preset -M insert home beginning-of-line +bind --preset -M insert alt-d 'if test "$(commandline; printf .)" = \\n.; __fish_echo dirh; else; commandline -f kill-word; end' +bind --preset -M insert ctrl-d delete-or-exit +bind --preset -M insert alt-s 'for cmd in sudo doas please run0; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end' +bind --preset -M insert f1 __fish_man_page +bind --preset -M insert alt-h __fish_man_page +bind --preset -M insert alt-p __fish_paginate +bind --preset -M insert alt-# __fish_toggle_comment_commandline +bind --preset -M insert alt-e edit_command_buffer +bind --preset -M insert alt-v edit_command_buffer +bind --preset -M insert '' self-insert +bind --preset -M insert space self-insert expand-abbr +bind --preset -M insert \; self-insert expand-abbr +bind --preset -M insert \| self-insert expand-abbr +bind --preset -M insert \& self-insert expand-abbr +bind --preset -M insert \> self-insert expand-abbr +bind --preset -M insert \< self-insert expand-abbr +bind --preset -M insert shift-enter 'commandline -i \\n (commandline --search-field >/dev/null && echo --search-field)' expand-abbr +bind --preset -M insert alt-enter 'commandline -i \\n (commandline --search-field >/dev/null && echo --search-field)' expand-abbr +bind --preset -M insert \) self-insert expand-abbr +bind --preset -M insert ctrl-space 'test -n "$(commandline)" && commandline -i " " (commandline --search-field >/dev/null && echo --search-field)' +bind --preset -M insert shift-space 'commandline -i " " (commandline --search-field >/dev/null && echo --search-field)' expand-abbr +bind --preset -M insert enter execute +bind --preset -M insert ctrl-j execute +bind --preset -M insert ctrl-m execute +bind --preset -M insert ctrl-enter execute +bind --preset ctrl-y yank +bind --preset alt-y yank-pop +bind --preset right forward-char +bind --preset left backward-char +bind --preset ctrl-right forward-token +bind --preset ctrl-left backward-token +bind --preset pageup beginning-of-history +bind --preset pagedown end-of-history +bind --preset ctrl-x fish_vi_dec +bind --preset ctrl-v fish_clipboard_paste +bind --preset escape 'set -g __fish_vi_count' +bind --preset ctrl-\[ 'set -g __fish_vi_count' +bind --preset tab complete +bind --preset ctrl-i complete +bind --preset ctrl-s pager-toggle-search +bind --preset shift-tab complete-and-search +bind --preset shift-delete history-delete or backward-delete-char +bind --preset down down-or-search +bind --preset up up-or-search +bind --preset shift-right forward-bigword +bind --preset shift-left backward-bigword +bind --preset alt-b prevd-or-backward-word +bind --preset alt-f nextd-or-forward-word +bind --preset alt-right nextd-or-forward-word +bind --preset "\e\[1\;9C" nextd-or-forward-word +bind --preset alt-left prevd-or-backward-word +bind --preset "\e\[1\;9D" prevd-or-backward-word +bind --preset alt-up history-token-search-backward +bind --preset alt-down history-token-search-forward +bind --preset "\e\[1\;9A" history-token-search-backward +bind --preset "\e\[1\;9B" history-token-search-forward +bind --preset alt-. history-token-search-backward +bind --preset alt-l __fish_list_current_token +bind --preset alt-o __fish_preview_current_file +bind --preset alt-w __fish_whatis_current_token +bind --preset ctrl-l 'status test-terminal-feature scroll-content-up && commandline -f scrollback-push' clear-screen +bind --preset -m insert ctrl-c clear-commandline repaint-mode +bind --preset ctrl-u backward-kill-line +bind --preset ctrl-k kill-line +bind --preset ctrl-w backward-kill-path-component +bind --preset end end-of-line +bind --preset home beginning-of-line +bind --preset alt-d 'if test "$(commandline; printf .)" = \\n.; __fish_echo dirh; else; commandline -f kill-word; end' +bind --preset ctrl-d delete-or-exit +bind --preset alt-s 'for cmd in sudo doas please run0; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end' +bind --preset f1 __fish_man_page +bind --preset alt-h __fish_man_page +bind --preset alt-p __fish_paginate +bind --preset alt-# __fish_toggle_comment_commandline +bind --preset alt-e edit_command_buffer +bind --preset alt-v edit_command_buffer +bind --preset -M visual ctrl-y yank +bind --preset -M visual alt-y yank-pop +bind --preset -M visual right forward-char +bind --preset -M visual left backward-char +bind --preset -M visual ctrl-right forward-token +bind --preset -M visual ctrl-left backward-token +bind --preset -M visual pageup beginning-of-history +bind --preset -M visual pagedown end-of-history +bind --preset -M visual ctrl-x fish_clipboard_copy +bind --preset -M visual ctrl-v fish_clipboard_paste +bind --preset -M visual -m default escape end-selection repaint-mode +bind --preset -M visual -m default ctrl-\[ end-selection repaint-mode +bind --preset -M visual tab complete +bind --preset -M visual ctrl-i complete +bind --preset -M visual ctrl-s pager-toggle-search +bind --preset -M visual shift-tab complete-and-search +bind --preset -M visual shift-delete history-delete or backward-delete-char +bind --preset -M visual down down-or-search +bind --preset -M visual up up-or-search +bind --preset -M visual shift-right forward-bigword +bind --preset -M visual shift-left backward-bigword +bind --preset -M visual alt-b prevd-or-backward-word +bind --preset -M visual alt-f nextd-or-forward-word +bind --preset -M visual alt-right nextd-or-forward-word +bind --preset -M visual "\e\[1\;9C" nextd-or-forward-word +bind --preset -M visual alt-left prevd-or-backward-word +bind --preset -M visual "\e\[1\;9D" prevd-or-backward-word +bind --preset -M visual alt-up history-token-search-backward +bind --preset -M visual alt-down history-token-search-forward +bind --preset -M visual "\e\[1\;9A" history-token-search-backward +bind --preset -M visual "\e\[1\;9B" history-token-search-forward +bind --preset -M visual alt-. history-token-search-backward +bind --preset -M visual alt-l __fish_list_current_token +bind --preset -M visual alt-o __fish_preview_current_file +bind --preset -M visual alt-w __fish_whatis_current_token +bind --preset -M visual ctrl-l 'status test-terminal-feature scroll-content-up && commandline -f scrollback-push' clear-screen +bind --preset -M visual -m default ctrl-c end-selection repaint-mode +bind --preset -M visual ctrl-u backward-kill-line +bind --preset -M visual ctrl-k kill-line +bind --preset -M visual ctrl-w backward-kill-path-component +bind --preset -M visual end end-of-line +bind --preset -M visual home beginning-of-line +bind --preset -M visual alt-d 'if test "$(commandline; printf .)" = \\n.; __fish_echo dirh; else; commandline -f kill-word; end' +bind --preset -M visual ctrl-d delete-or-exit +bind --preset -M visual alt-s 'for cmd in sudo doas please run0; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end' +bind --preset -M visual f1 __fish_man_page +bind --preset -M visual alt-h __fish_man_page +bind --preset -M visual alt-p __fish_paginate +bind --preset -M visual alt-# __fish_toggle_comment_commandline +bind --preset -M visual alt-e edit_command_buffer +bind --preset -M visual alt-v edit_command_buffer +bind --preset :,q exit +bind --preset 1 'fish_vi_arg_digit 1' +bind --preset 2 'fish_vi_arg_digit 2' +bind --preset 3 'fish_vi_arg_digit 3' +bind --preset 4 'fish_vi_arg_digit 4' +bind --preset 5 'fish_vi_arg_digit 5' +bind --preset 6 'fish_vi_arg_digit 6' +bind --preset 7 'fish_vi_arg_digit 7' +bind --preset 8 'fish_vi_arg_digit 8' +bind --preset 9 'fish_vi_arg_digit 9' +bind --preset 0 'if test -n "$__fish_vi_count"; fish_vi_arg_digit 0; else; commandline -f beginning-of-line; end' +bind --preset h 'fish_vi_run_count backward-char' +bind --preset l 'fish_vi_run_count forward-char' +bind --preset k 'fish_vi_run_count up-or-search' +bind --preset j 'fish_vi_run_count down-or-search' +bind --preset b 'fish_vi_run_count backward-word' +bind --preset B 'fish_vi_run_count backward-bigword' +bind --preset g,e 'fish_vi_run_count backward-word-end' +bind --preset g,E 'fish_vi_run_count backward-bigword-end' +bind --preset w 'fish_vi_run_count forward-word-vi' +bind --preset W 'fish_vi_run_count forward-bigword-vi' +bind --preset e 'fish_vi_run_count forward-word-end' +bind --preset E 'fish_vi_run_count forward-bigword-end' +bind --preset x __fish_vi_delete_char +bind --preset X __fish_vi_backward_delete_char +bind --preset -m insert enter execute +bind --preset -m insert ctrl-j execute +bind --preset -m insert ctrl-m execute +bind --preset -m insert o 'set fish_cursor_end_mode exclusive' insert-line-under repaint-mode +bind --preset -m insert O 'set fish_cursor_end_mode exclusive' insert-line-over repaint-mode +bind --preset -m insert i repaint-mode +bind --preset -m insert I beginning-of-line repaint-mode +bind --preset -m insert a 'set fish_cursor_end_mode exclusive' forward-single-char repaint-mode +bind --preset -m insert A 'set fish_cursor_end_mode exclusive' end-of-line repaint-mode +bind --preset -m visual v begin-selection repaint-mode +bind --preset g,g beginning-of-buffer +bind --preset G end-of-buffer +bind --preset \$ end-of-line +bind --preset g,\$ end-of-line +bind --preset ^ beginning-of-line +bind --preset g,^ beginning-of-line +bind --preset _ beginning-of-line +bind --preset u undo +bind --preset ctrl-r redo +bind --preset \[ history-token-search-backward +bind --preset \] history-token-search-forward +bind --preset -m insert / history-pager repaint-mode +bind --preset -M insert ctrl-n accept-autosuggestion +bind --preset -M insert delete delete-char +bind --preset delete delete-char +bind --preset -M insert backspace backward-delete-char +bind --preset -M insert shift-backspace backward-delete-char +bind --preset backspace backward-char +bind --preset -M insert ctrl-h backward-delete-char +bind --preset ctrl-h backward-char +bind --preset g,\~ 'fish_vi_start_operator swap-case' +bind --preset -M operator escape fish_vi_operator_cancel +bind --preset -M operator ctrl-\[ fish_vi_operator_cancel +bind --preset -M operator 1 'fish_vi_arg_digit 1' +bind --preset -M operator 2 'fish_vi_arg_digit 2' +bind --preset -M operator 3 'fish_vi_arg_digit 3' +bind --preset -M operator 4 'fish_vi_arg_digit 4' +bind --preset -M operator 5 'fish_vi_arg_digit 5' +bind --preset -M operator 6 'fish_vi_arg_digit 6' +bind --preset -M operator 7 'fish_vi_arg_digit 7' +bind --preset -M operator 8 'fish_vi_arg_digit 8' +bind --preset -M operator 9 'fish_vi_arg_digit 9' +bind --preset -M operator 0 'fish_vi_exec_motion beginning-of-line' +bind --preset -M operator h 'fish_vi_exec_motion backward-char' +bind --preset -M operator l 'fish_vi_exec_motion forward-char' +bind --preset -M operator k 'fish_vi_exec_motion up-line' +bind --preset -M operator j 'fish_vi_exec_motion down-line' +bind --preset -M operator b 'fish_vi_exec_motion backward-word' +bind --preset -M operator B 'fish_vi_exec_motion backward-bigword' +bind --preset -M operator g,e 'fish_vi_exec_motion backward-word-end' +bind --preset -M operator g,E 'fish_vi_exec_motion backward-bigword-end' +bind --preset -M operator w 'fish_vi_exec_motion forward-word-vi' +bind --preset -M operator W 'fish_vi_exec_motion forward-bigword-vi' +bind --preset -M operator e 'fish_vi_exec_motion forward-word-end' +bind --preset -M operator E 'fish_vi_exec_motion forward-bigword-end' +bind --preset -M operator ^ 'fish_vi_exec_motion beginning-of-line' +bind --preset -M operator \$ 'fish_vi_exec_motion end-of-line' +bind --preset -M operator -m f f '' +bind --preset -M operator -m F F '' +bind --preset -M operator -m t t '' +bind --preset -M operator -m T T '' +bind --preset -M f '' get-key 'fish_vi_exec_motion commandline --forward-jump=$fish_key' 'set -eg fish_key' +bind --preset -M F '' get-key 'fish_vi_exec_motion commandline --backward-jump=$fish_key' 'set -eg fish_key' +bind --preset -M t '' get-key 'fish_vi_exec_motion commandline --forward-jump-till=$fish_key' 'set -eg fish_key' +bind --preset -M T '' get-key 'fish_vi_exec_motion commandline --backward-jump-till=$fish_key' 'set -eg fish_key' +bind --preset -M operator \; 'fish_vi_exec_motion repeat-jump' +bind --preset -M operator comma 'fish_vi_exec_motion repeat-jump-reverse' +bind --preset -M operator d 'fish_vi_exec_motion --linewise' +bind --preset -M operator c 'fish_vi_exec_motion --linewise' +bind --preset -M operator y 'fish_vi_exec_motion --linewise' +bind --preset -M operator \~ 'fish_vi_exec_motion --linewise' +bind --preset D kill-line +bind --preset d,\$ kill-line +bind --preset d,^ backward-kill-line +bind --preset d,0 backward-kill-line +bind --preset d,i,w kill-inner-word +bind --preset d,i,W kill-inner-bigword +bind --preset d,a,w kill-a-word +bind --preset d,a,W kill-a-bigword +bind --preset d,i,b jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection end-selection +bind --preset d,a,b jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection end-selection +bind --preset d,\; begin-selection repeat-jump kill-selection end-selection +bind --preset d,comma begin-selection repeat-jump-reverse kill-selection end-selection +bind --preset -m insert s delete-char repaint-mode +bind --preset -m insert S kill-inner-line repaint-mode +bind --preset -m insert C kill-line repaint-mode +bind --preset -m insert c,\$ kill-line repaint-mode +bind --preset -m insert c,^ backward-kill-line repaint-mode +bind --preset -m insert c,0 backward-kill-line repaint-mode +bind --preset -m insert c,i,w kill-inner-word repaint-mode +bind --preset -m insert c,i,W kill-inner-bigword repaint-mode +bind --preset -m insert c,a,w kill-a-word repaint-mode +bind --preset -m insert c,a,W kill-a-bigword repaint-mode +bind --preset -m insert c,i,b jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket kill-selection end-selection +bind --preset -m insert c,a,b jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket kill-selection end-selection +bind --preset \~ togglecase-char forward-single-char +bind --preset g,u downcase-word +bind --preset g,U upcase-word +bind --preset J end-of-line delete-char +bind --preset K 'man (commandline -t) 2>/dev/null; or echo -n \\a' +bind --preset \",\*,y,y fish_clipboard_copy +bind --preset \",\*,Y fish_clipboard_copy +bind --preset \",+,y,y fish_clipboard_copy +bind --preset \",+,Y fish_clipboard_copy +bind --preset Y kill-whole-line yank +bind --preset y,\$ kill-line yank +bind --preset y,^ backward-kill-line yank +bind --preset y,0 backward-kill-line yank +bind --preset y,i,w kill-inner-word yank +bind --preset y,i,W kill-inner-bigword yank +bind --preset y,a,w kill-a-word yank +bind --preset y,a,W kill-a-bigword yank +bind --preset y,i,b jump-till-matching-bracket and jump-till-matching-bracket and begin-selection jump-till-matching-bracket fish_vi_yank_selection end-selection +bind --preset y,a,b jump-to-matching-bracket and jump-to-matching-bracket and begin-selection jump-to-matching-bracket fish_vi_yank_selection end-selection +bind --preset % jump-to-matching-bracket +bind --preset f forward-jump +bind --preset F backward-jump +bind --preset t forward-jump-till +bind --preset T backward-jump-till +bind --preset \; repeat-jump +bind --preset comma repeat-jump-reverse +bind --preset p 'set -g fish_cursor_end_mode exclusive' forward-char 'set -g fish_cursor_end_mode inclusive' yank +bind --preset P yank +bind --preset g,p yank-pop +bind --preset \",\*,p 'set -g fish_cursor_end_mode exclusive' forward-char 'set -g fish_cursor_end_mode inclusive' fish_clipboard_paste +bind --preset \",\*,P fish_clipboard_paste +bind --preset \",+,p 'set -g fish_cursor_end_mode exclusive' forward-char 'set -g fish_cursor_end_mode inclusive' fish_clipboard_paste +bind --preset \",+,P fish_clipboard_paste +bind --preset -m replace_one r repaint-mode +bind --preset -M replace_one -m default '' 'set -g fish_cursor_end_mode exclusive' delete-char self-insert backward-char repaint-mode 'set -g fish_cursor_end_mode inclusive' +bind --preset -M replace_one -m default enter 'set -g fish_cursor_end_mode exclusive' 'commandline -f delete-char; commandline -i \\n; commandline -f backward-char' repaint-mode 'set -g fish_cursor_end_mode inclusive' +bind --preset -M replace_one -m default ctrl-j 'set -g fish_cursor_end_mode exclusive' 'commandline -f delete-char; commandline -i \\n; commandline -f backward-char' repaint-mode 'set -g fish_cursor_end_mode inclusive' +bind --preset -M replace_one -m default ctrl-m 'set -g fish_cursor_end_mode exclusive' 'commandline -f delete-char; commandline -i \\n; commandline -f backward-char' repaint-mode 'set -g fish_cursor_end_mode inclusive' +bind --preset -M replace_one -m default escape cancel repaint-mode +bind --preset -M replace_one -m default ctrl-\[ cancel repaint-mode +bind --preset -m replace R repaint-mode +bind --preset -M replace '' delete-char self-insert +bind --preset -M replace -m insert enter execute repaint-mode +bind --preset -M replace -m insert ctrl-j execute repaint-mode +bind --preset -M replace -m insert ctrl-m execute repaint-mode +bind --preset -M replace -m default escape cancel repaint-mode +bind --preset -M replace -m default ctrl-\[ cancel repaint-mode +bind --preset -M replace backspace backward-char +bind --preset -M replace shift-backspace backward-char +bind --preset ctrl-a fish_vi_inc +bind --preset -M visual h backward-char +bind --preset -M visual l forward-char +bind --preset -M visual k up-line +bind --preset -M visual j down-line +bind --preset -M visual b backward-word +bind --preset -M visual B backward-bigword +bind --preset -M visual g,e backward-word-end +bind --preset -M visual g,E backward-bigword-end +bind --preset -M visual w forward-word-vi +bind --preset -M visual W forward-bigword-vi +bind --preset -M visual e forward-word-end +bind --preset -M visual E forward-bigword-end +bind --preset -M visual o swap-selection-start-stop repaint-mode +bind --preset -M visual % jump-to-matching-bracket +bind --preset -M visual f forward-jump +bind --preset -M visual t forward-jump-till +bind --preset -M visual F backward-jump +bind --preset -M visual T backward-jump-till +bind --preset -M visual \; repeat-jump +bind --preset -M visual comma repeat-jump-reverse +bind --preset -M visual \$ end-of-line +bind --preset -M visual g,\$ end-of-line +bind --preset -M visual ^ beginning-of-line +bind --preset -M visual 0 beginning-of-line +bind --preset -M visual g,^ beginning-of-line +bind --preset -M visual _ beginning-of-line +bind --preset -M visual -m default v end-selection repaint-mode +bind --preset -M visual -m insert i end-selection repaint-mode +bind --preset -M visual -m insert I end-selection beginning-of-line repaint-mode +bind --preset -M visual -m insert c kill-selection end-selection repaint-mode +bind --preset -M visual -m insert s kill-selection end-selection repaint-mode +bind --preset -M visual -m default d kill-selection end-selection backward-char repaint-mode +bind --preset -M visual -m default x kill-selection end-selection repaint-mode +bind --preset -M visual -m default X kill-whole-line end-selection repaint-mode +bind --preset -M visual -m default y fish_vi_yank_selection end-selection repaint-mode +bind --preset -M visual -m default \",\*,y 'fish_clipboard_copy; commandline -f end-selection repaint-mode' +bind --preset -M visual -m default \",+,y 'fish_clipboard_copy; commandline -f end-selection repaint-mode' +bind --preset -M visual -m default \~ togglecase-selection end-selection repaint-mode +bind --preset -M visual -m default g,u downcase-selection end-selection repaint-mode +bind --preset -M visual -m default g,U upcase-selection end-selection repaint-mode +bind --preset \# __fish_toggle_comment_commandline +bind --preset -M visual \# __fish_toggle_comment_commandline +bind --preset -M replace \# __fish_toggle_comment_commandline + +bind-end + +wait +cat ./default.nix diff --git a/pkgs/by-name/fi/fish-mk-maps/fish_test.sh b/pkgs/by-name/fi/fish-mk-maps/fish_test.sh new file mode 100755 index 00000000..3c6077b5 --- /dev/null +++ b/pkgs/by-name/fi/fish-mk-maps/fish_test.sh @@ -0,0 +1,31 @@ +#! /usr/bin/env sh + +set -e + +cargo build +./target/debug/bind-server > ./default.nix & +sleep 1 + +# bind --preset y,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump fish_vi_yank_selection end-selection +# bind --preset y,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump fish_vi_yank_selection end-selection +# bind --preset d,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection +# bind --preset d,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection +# bind --preset d 'fish_vi_start_operator delete' +# bind --preset c 'fish_vi_start_operator change' +# bind --preset y 'fish_vi_start_operator yank' +# bind --preset -m insert c,i backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode +# bind --preset -m insert c,a backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode + +# bind --preset -M insert a,b,c,a yank +# bind --preset -M insert a,b,c,b yank +# bind --preset -M insert a,b,c,c yank +bind --preset a,b,y,y fish_clipboard_copy +bind --preset a,b,Y fish_clipboard_copy +bind --preset a,c,y,y fish_clipboard_copy +bind --preset a,c,Y fish_clipboard_copy + +bind-end + +wait +cat ./default.nix +nix eval -f default.nix diff --git a/pkgs/by-name/mp/mpdpopm/package.nix b/pkgs/by-name/fi/fish-mk-maps/package.unstable.nix index 7048f41e..7048f41e 100644 --- a/pkgs/by-name/mp/mpdpopm/package.nix +++ b/pkgs/by-name/fi/fish-mk-maps/package.unstable.nix diff --git a/pkgs/by-name/fi/fish-mk-maps/src/main.rs b/pkgs/by-name/fi/fish-mk-maps/src/main.rs new file mode 100644 index 00000000..57d221db --- /dev/null +++ b/pkgs/by-name/fi/fish-mk-maps/src/main.rs @@ -0,0 +1,362 @@ +use std::{ + collections::HashMap, + env::args, + fs, + io::{Read, Write}, + mem, + os::unix::net::{UnixListener, UnixStream}, + path::PathBuf, + process, + str::FromStr, +}; + +use anyhow::{Context, bail}; +use clap::Parser; +use keymaps::map_tree::Trie; +use serde::{Deserialize, Serialize}; + +macro_rules! is_open { + ($is_open:ident, @set_element $value:ident[$idx:expr]) => {{ + if let Some(value) = $value.get($idx - 1) && $value.len() > $idx { + if let Some(io) = &mut $is_open { + io.truncate($idx); + io.push(value.clone()); + println!("{}\"{}\" = {{", " ".repeat($idx + 1), value); + + eprintln!("Setting io element {} to '{}' (io: '{}')", $idx, value, io.join(",")); + } else if $idx == 1 { + $is_open = Some(vec![value.clone()]); + println!(" \"{}\" = {{", value); + + eprintln!("Initializing io with element '{}'", value); + } else { + unreachable!() + } + } + }}; + ($is_open:ident, @query $value:ident [..$till:expr]) => {{ + if $value.len() <= $till { + false + } else { + if let Some(io) = &$is_open { + let mut output = true; + for (idx, val) in $value.iter().take($till).enumerate() { + output = output && io.get(idx).map(|got| got == val).unwrap_or(false); + } + if output { + eprintln!("Query for '{}' (io: '{}') matched at element {}", $value.join(","), io.join(","), $till); + } + output + } else { + false + } + } + }}; + ($is_open:ident, @close $num:expr) => {{ + if let Some(io) = &mut $is_open { + eprintln!("Performing close for {} elements (io: '{}') ..", $num, io.join(",")); + for idx in (0..io.len()).rev().take($num) { + io.pop(); + eprintln!(" Emitting close at element {} (io now: '{}')", idx + 1, io.join(",")); + println!("{}}};", " ".repeat(idx + 2)); + } + } else { + unreachable!() + } + }}; + ($is_open:ident, @close_till $value:ident $num:expr) => {{ + if let Some(io) = $is_open.clone() { + is_open!($is_open, @close io.len() - $num) + } else { + } + }}; + ($is_open:ident, @close_all) => {{ + if let Some(io) = $is_open.clone() { + is_open!($is_open, @close io.len()); + } else { + } + }}; +} + +fn print_key(key: Vec<String>, node: Mapping) { + print!( + "{}\"{}\" = {{ cmd = \"{}\"; ", + " ".repeat(key.len() + 1), + key.last().expect("That's the len"), + node.command.join(" "), + ); + if let Some(sets_mode_to) = node.sets_mode_to { + println!("sets_mode_to = \"{}\";}};", sets_mode_to); + } else { + println!("}};"); + } +} + +#[derive(clap::Parser, Debug)] +#[clap(rename_all = "snake_case")] +pub(crate) struct Cli { + #[arg(long)] + preset: bool, + + #[arg(short = 'M', default_value = "default")] + mode: MapMode, + + #[arg(short = 'm', default_value = "default")] + sets_mode_to: MapMode, + + key: String, + + command: Vec<String>, +} + +#[derive( + Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord, Hash, Clone, Copy, Debug, Default, +)] +#[expect(non_camel_case_types)] +enum MapMode { + #[default] + Default, + Insert, + Operator, + ReplaceOne, + Replace, + Visual, + f, + F, + t, + T, +} + +impl std::fmt::Display for MapMode { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + MapMode::Default => f.write_str("default")?, + MapMode::Insert => f.write_str("insert")?, + MapMode::Operator => f.write_str("operator")?, + MapMode::ReplaceOne => f.write_str("replace_one")?, + MapMode::Replace => f.write_str("replace")?, + MapMode::Visual => f.write_str("visual")?, + MapMode::f => f.write_str("f")?, + MapMode::F => f.write_str("F")?, + MapMode::t => f.write_str("t")?, + MapMode::T => f.write_str("T")?, + } + Ok(()) + } +} + +impl FromStr for MapMode { + type Err = anyhow::Error; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + let me = match s { + "operator" => Self::Operator, + "insert" => Self::Insert, + "replace_one" => Self::ReplaceOne, + "replace" => Self::Replace, + "visual" => Self::Visual, + "default" => Self::Default, + "f" => Self::f, + "F" => Self::F, + "t" => Self::t, + "T" => Self::T, + other => bail!("Mapping mode '{other}' not yet supported"), + }; + Ok(me) + } +} + +enum Message { + NewBinding(usize), + End(usize), +} +type Key = String; +#[derive(Debug, Deserialize, Serialize)] +struct Binding { + key: Vec<Key>, + command: Vec<String>, + sets_mode_to: Option<MapMode>, + mode: MapMode, +} + +struct MapStore { + map: HashMap<MapMode, Trie<Key, Mapping>>, +} + +#[derive(Clone, PartialEq, PartialOrd, Debug)] +struct Mapping { + command: Vec<String>, + sets_mode_to: Option<MapMode>, +} + +fn main() -> anyhow::Result<()> { + let communication_socket: PathBuf = PathBuf::from("/tmp/fish_map_store.socket"); + + match PathBuf::from(args().next().unwrap()) + .file_name() + .unwrap() + .to_str() + .unwrap() + { + "bind-end" => { + let mut stream = UnixStream::connect(communication_socket)?; + let message_raw: [u8; size_of::<Message>()] = + unsafe { mem::transmute(Message::End(0)) }; + + stream.write_all(&message_raw)?; + stream.flush()?; + } + "bind" => { + let args = Cli::parse(); + assert!(args.preset); + + let binding = Binding { + key: args.key.split(',').map(|s| s.to_string()).collect(), + command: args.command, + sets_mode_to: if args.mode != args.sets_mode_to { + Some(args.sets_mode_to) + } else { + None + }, + mode: args.mode, + }; + let binding_msg = serde_json::to_string(&binding)?; + + let mut stream = UnixStream::connect(communication_socket)?; + + let length = binding_msg.len(); + + let message_raw: [u8; size_of::<Message>()] = + unsafe { mem::transmute(Message::NewBinding(length)) }; + + stream.write_all(&message_raw)?; + stream.write_all(binding_msg.as_bytes())?; + stream.flush()?; + drop(stream); + } + "bind-server" => bind_server_main(communication_socket)?, + other => { + eprintln!("Personality '{other}' not supported."); + process::exit(2); + } + } + + // let mappings = store.map.entry(args.mode).or_insert(Vec::default()); + // mappings.push(mapping); + // + // { + // let mut file = fs::OpenOptions::new() + // .create(true) + // .truncate(true) + // .append(false) + // .write(true) + // .open(storage_file)?; + // + // file.write_all(serde_json::to_string(&store)?.as_bytes())?; + // } + // + // { + // eprintln!("Added {}", args.key); + // } + + Ok(()) +} + +fn bind_server_main(communication_socket: PathBuf) -> anyhow::Result<()> { + if communication_socket.exists() { + fs::remove_file(&communication_socket)?; + } + + let mut store = MapStore { + map: HashMap::new(), + }; + + let listener = UnixListener::bind(communication_socket)?; + + for stream in listener.incoming() { + match stream { + Ok(mut stream) => { + let mut next_message_raw = [0; size_of::<Message>()]; + stream.read_exact(&mut next_message_raw)?; + let next_message: Message = unsafe { mem::transmute(next_message_raw) }; + + match next_message { + Message::NewBinding(length) => { + let mut binding_str = String::new(); + stream.read_to_string(&mut binding_str)?; + + let binding: Binding = serde_json::from_str(&binding_str[..length]) + .with_context(|| { + format!("Failed to parse '{binding_str:?}' as json") + })?; + + let trie = store.map.entry(binding.mode).or_default(); + trie.insert( + &binding.key, + Mapping { + command: binding.command, + sets_mode_to: binding.sets_mode_to, + }, + )?; + } + Message::End(_pointless_value) => { + println!("{{"); + for (mode, trie) in store.map { + println!(" \"{mode}\" = {{"); + { + let mut io: Option<Vec<String>> = None; + for (key, node) in trie.iter() { + if is_open!(io, @query key[..4]) { + is_open!(io, @close_till key 4); + print_key(key, node); + } else if is_open!(io, @query key[..3]) { + is_open!(io, @close_till key 3); + is_open!(io, @set_element key[4]); + print_key(key, node); + } else if is_open!(io, @query key[..2]) { + is_open!(io, @close_till key 2); + is_open!(io, @set_element key[3]); + is_open!(io, @set_element key[4]); + print_key(key, node); + } else if is_open!(io, @query key[..1]) { + is_open!(io, @close_till key 1); + is_open!(io, @set_element key[2]); + is_open!(io, @set_element key[3]); + is_open!(io, @set_element key[4]); + print_key(key, node); + } else { + { + eprint!("No query matched: '{}'", key.join(",")); + if let Some(io) = &io { + eprintln!(" (io: '{}')", io.join(",")); + } else { + eprintln!(" (io empty)"); + } + } + + is_open!(io, @close_all); + is_open!(io, @set_element key[1]); + is_open!(io, @set_element key[2]); + is_open!(io, @set_element key[3]); + is_open!(io, @set_element key[4]); + print_key(key, node); + } + } + is_open!(io, @close_all); + } + println!(" }};"); + } + println!("}}"); + + break; + } + } + } + Err(_) => { + /* connection failed */ + break; + } + } + } + Ok(()) +} diff --git a/pkgs/by-name/fi/fish-mk-maps/update.sh b/pkgs/by-name/fi/fish-mk-maps/update.sh new file mode 100755 index 00000000..5aedf3b3 --- /dev/null +++ b/pkgs/by-name/fi/fish-mk-maps/update.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +# Mpdpopm - A mpd rating tracker +# +# Copyright (C) 2026 Benedikt Peetz, Michael Herstine <sp1ff@pobox.com> <benedikt.peetz@b-peetz.de, sp1ff@pobox.com> +# SPDX-License-Identifier: AGPL-3.0-or-later +# +# This file is part of Mpdpopm. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/agpl.txt>. + +[ "$1" = "upgrade" ] && cargo upgrade --incompatible allow --pinned allow --recursive true +cargo update --recursive diff --git a/pkgs/by-name/fi/fish-patched/package.nix b/pkgs/by-name/fi/fish-patched/package.unstable.nix index cb45af99..cb45af99 100644 --- a/pkgs/by-name/fi/fish-patched/package.nix +++ b/pkgs/by-name/fi/fish-patched/package.unstable.nix |
