From 2a5ad20f279f2583699081b3a289b3d1050866c9 Mon Sep 17 00:00:00 2001 From: Patrick Fong Date: Wed, 2 Jun 2021 19:12:26 -0700 Subject: [PATCH] rename install to configure --- conf.d/fzf.fish | 2 +- ...eymap_help.fish => _fzf_configure_keymap_help.fish} | 6 +++--- ...f_install_keymap.fish => fzf_configure_keymap.fish} | 10 +++++----- functions/fzf_conflictless_mnemonic_keymap.fish | 2 +- functions/fzf_simple_mnemonic_keymap.fish | 2 +- .../can_override_keymap.fish | 0 tests/configure_keymap/fails_if_pos_args.fish | 2 ++ .../fails_if_unknown_opt.fish | 2 +- .../installs_for_insert_mode.fish | 0 .../installs_specified_bindings.fish | 2 +- tests/configure_keymap/supports_partial_keymap.fish | 2 ++ .../uninstalls_previous_keymap.fish | 2 +- tests/install_keymap/fails_if_pos_args.fish | 2 -- tests/install_keymap/supports_partial_keymap.fish | 2 -- 14 files changed, 18 insertions(+), 18 deletions(-) rename functions/{_fzf_install_keymap_help.fish => _fzf_configure_keymap_help.fish} (83%) rename functions/{fzf_install_keymap.fish => fzf_configure_keymap.fish} (83%) rename tests/{install_keymap => configure_keymap}/can_override_keymap.fish (100%) create mode 100644 tests/configure_keymap/fails_if_pos_args.fish rename tests/{install_keymap => configure_keymap}/fails_if_unknown_opt.fish (53%) rename tests/{install_keymap => configure_keymap}/installs_for_insert_mode.fish (100%) rename tests/{install_keymap => configure_keymap}/installs_specified_bindings.fish (88%) create mode 100644 tests/configure_keymap/supports_partial_keymap.fish rename tests/{install_keymap => configure_keymap}/uninstalls_previous_keymap.fish (76%) delete mode 100644 tests/install_keymap/fails_if_pos_args.fish delete mode 100644 tests/install_keymap/supports_partial_keymap.fish diff --git a/conf.d/fzf.fish b/conf.d/fzf.fish index 7d089f6c..d97b6dd3 100644 --- a/conf.d/fzf.fish +++ b/conf.d/fzf.fish @@ -26,7 +26,7 @@ function _fzf_uninstall --on-event fzf_uninstall set --erase _fzf_search_vars_command functions --erase _fzf_uninstall _fzf_migration_message - functions --erase _fzf_uninstall_keymap fzf_install_keymap fzf_conflictless_mnemonic_keymap fzf_simple_mnemonic_keymap + functions --erase _fzf_uninstall_keymap fzf_configure_keymap fzf_conflictless_mnemonic_keymap fzf_simple_mnemonic_keymap set_color --italics cyan echo "fzf.fish uninstalled" diff --git a/functions/_fzf_install_keymap_help.fish b/functions/_fzf_configure_keymap_help.fish similarity index 83% rename from functions/_fzf_install_keymap_help.fish rename to functions/_fzf_configure_keymap_help.fish index 78244fe2..35b566af 100644 --- a/functions/_fzf_install_keymap_help.fish +++ b/functions/_fzf_configure_keymap_help.fish @@ -1,7 +1,7 @@ -function _fzf_install_keymap_help - echo 'fzf_install_keymap - installs a set of key bindings for fzf.fish.' +function _fzf_configure_keymap_help + echo 'fzf_configure_keymap - change the key bindings for fzf.fish.' echo 'Usage:' - echo ' fzf_install_keymap --searchable_entity=key_sequence...' + echo ' fzf_configure_keymap --searchable_entity=key_sequence...' echo 'Description:' echo ' Key bindings must be specified as long options where the option name is an entity searchable by fzf.fish and the option value is a key sequence. Try fish_key_reader to generate key sequences.' echo ' You do not have to specify key bindings for all entities. However, you must specify at least one.' diff --git a/functions/fzf_install_keymap.fish b/functions/fzf_configure_keymap.fish similarity index 83% rename from functions/fzf_install_keymap.fish rename to functions/fzf_configure_keymap.fish index e8f48e68..e3f16e8a 100644 --- a/functions/fzf_install_keymap.fish +++ b/functions/fzf_configure_keymap.fish @@ -1,19 +1,19 @@ -# Supports overriding bindings set by pre-configured keymaps with appended user-specified bindings +# Supports overriding keymaps with appended user-specified bindings # Always installs bindings for insert mode since for simplicity and b/c it has almost no side-effect # https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1 -function fzf_install_keymap --description "Install a set of key bindings for fzf.fish's functions using the specified key sequences." +function fzf_configure_keymap keymap --description "Change the key bindings for fzf.fish's functions to the specified key sequences." if test (count $argv) -eq 0 - _fzf_install_keymap_help + _fzf_configure_keymap_help return end set options_spec h/help directory= git_log= git_status= history= variables= argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null if test $status -ne 0 - _fzf_install_keymap_help + _fzf_configure_keymap_help return 22 else if set --query _flag_h - _fzf_install_keymap_help + _fzf_configure_keymap_help return end diff --git a/functions/fzf_conflictless_mnemonic_keymap.fish b/functions/fzf_conflictless_mnemonic_keymap.fish index 2881087c..f8e57306 100644 --- a/functions/fzf_conflictless_mnemonic_keymap.fish +++ b/functions/fzf_conflictless_mnemonic_keymap.fish @@ -1,6 +1,6 @@ function fzf_conflictless_mnemonic_keymap --description "Install key bindings that are mnemonic and unlikely to override existing key bindings." # \e = alt, \c = control - fzf_install_keymap \ + fzf_configure_keymap \ --directory=\e\cf \ --git_log=\e\cl \ --git_status=\cs \ diff --git a/functions/fzf_simple_mnemonic_keymap.fish b/functions/fzf_simple_mnemonic_keymap.fish index 83b1cfa4..4694e44e 100644 --- a/functions/fzf_simple_mnemonic_keymap.fish +++ b/functions/fzf_simple_mnemonic_keymap.fish @@ -1,6 +1,6 @@ function fzf_simple_mnemonic_keymap --description "Install key bindings that are simple and mnemonic but may override existing key bindings." # \c = control - fzf_install_keymap \ + fzf_configure_keymap \ --directory=\cf \ --git_log=\cl \ --git_status=\cs \ diff --git a/tests/install_keymap/can_override_keymap.fish b/tests/configure_keymap/can_override_keymap.fish similarity index 100% rename from tests/install_keymap/can_override_keymap.fish rename to tests/configure_keymap/can_override_keymap.fish diff --git a/tests/configure_keymap/fails_if_pos_args.fish b/tests/configure_keymap/fails_if_pos_args.fish new file mode 100644 index 00000000..4ac1d9e3 --- /dev/null +++ b/tests/configure_keymap/fails_if_pos_args.fish @@ -0,0 +1,2 @@ +fzf_configure_keymap --directory=\co positional_argument 2>/dev/null +@test "fails if provided positional argument" $status -ne 0 diff --git a/tests/install_keymap/fails_if_unknown_opt.fish b/tests/configure_keymap/fails_if_unknown_opt.fish similarity index 53% rename from tests/install_keymap/fails_if_unknown_opt.fish rename to tests/configure_keymap/fails_if_unknown_opt.fish index a8091c43..5ac7acf3 100644 --- a/tests/install_keymap/fails_if_unknown_opt.fish +++ b/tests/configure_keymap/fails_if_unknown_opt.fish @@ -1,2 +1,2 @@ -fzf_install_keymap --unknown=\cq 2>/dev/null +fzf_configure_keymap --unknown=\cq 2>/dev/null @test "fails if passed unknown option" $status -ne 0 diff --git a/tests/install_keymap/installs_for_insert_mode.fish b/tests/configure_keymap/installs_for_insert_mode.fish similarity index 100% rename from tests/install_keymap/installs_for_insert_mode.fish rename to tests/configure_keymap/installs_for_insert_mode.fish diff --git a/tests/install_keymap/installs_specified_bindings.fish b/tests/configure_keymap/installs_specified_bindings.fish similarity index 88% rename from tests/install_keymap/installs_specified_bindings.fish rename to tests/configure_keymap/installs_specified_bindings.fish index 4db18899..ec3c1b11 100644 --- a/tests/install_keymap/installs_specified_bindings.fish +++ b/tests/configure_keymap/installs_specified_bindings.fish @@ -2,7 +2,7 @@ function binding_contains_func --argument-names sequence function_name string match --entire $function_name (bind $sequence) >/dev/null end -fzf_install_keymap --directory=\ca --git_log=\cb --git_status=\cc --history=\cd --variables=\ce +fzf_configure_keymap --directory=\ca --git_log=\cb --git_status=\cc --history=\cd --variables=\ce @test "installs the specified binding for directory" (binding_contains_func \ca __fzf_search_current_dir) $status -eq 0 @test "installs the specified binding for git log" (binding_contains_func \cb __fzf_search_git_log) $status -eq 0 diff --git a/tests/configure_keymap/supports_partial_keymap.fish b/tests/configure_keymap/supports_partial_keymap.fish new file mode 100644 index 00000000..ced5a9e5 --- /dev/null +++ b/tests/configure_keymap/supports_partial_keymap.fish @@ -0,0 +1,2 @@ +fzf_configure_keymap --directory=\co && test -z (bind | string match --entire __fzf_search_history) +@test "allows not installing key bindings for all entities" $status -eq 0 diff --git a/tests/install_keymap/uninstalls_previous_keymap.fish b/tests/configure_keymap/uninstalls_previous_keymap.fish similarity index 76% rename from tests/install_keymap/uninstalls_previous_keymap.fish rename to tests/configure_keymap/uninstalls_previous_keymap.fish index be7b7925..e184818c 100644 --- a/tests/install_keymap/uninstalls_previous_keymap.fish +++ b/tests/configure_keymap/uninstalls_previous_keymap.fish @@ -1,3 +1,3 @@ -fzf_install_keymap --directory=\e\cp +fzf_configure_keymap --directory=\e\cp fzf_simple_mnemonic_keymap @test "new keymap should completely overwrite previous keymap" (bind \e\cp 2>/dev/null) $status -ne 0 diff --git a/tests/install_keymap/fails_if_pos_args.fish b/tests/install_keymap/fails_if_pos_args.fish deleted file mode 100644 index f6de3ec8..00000000 --- a/tests/install_keymap/fails_if_pos_args.fish +++ /dev/null @@ -1,2 +0,0 @@ -fzf_install_keymap --directory=\co positional_argument 2>/dev/null -@test "fails if provided positional argument" $status -ne 0 diff --git a/tests/install_keymap/supports_partial_keymap.fish b/tests/install_keymap/supports_partial_keymap.fish deleted file mode 100644 index 20795f91..00000000 --- a/tests/install_keymap/supports_partial_keymap.fish +++ /dev/null @@ -1,2 +0,0 @@ -fzf_install_keymap --directory=\co && test -z (bind | string match --entire __fzf_search_history) -@test "allows not installing key bindings for all entities" $status -eq 0