diff options
author | 2005-09-21 09:42:00 +1000 | |
---|---|---|
committer | 2005-09-21 09:42:00 +1000 | |
commit | e3ce01d6855c9330b1cd2dec19eff1139676c7db (patch) | |
tree | d982476194567eb2544a84fc12bfba1033995ccc /init | |
parent | 3a60fc52061961ad98614c19e3e12a0e251e3777 (diff) |
Key binding functions
darcs-hash:20050920234200-ac50b-3895a97cb024368258cd1562bdcc9fda2c84f521.gz
Diffstat (limited to 'init')
-rw-r--r-- | init/fish_function.fish | 47 | ||||
-rw-r--r-- | init/fish_inputrc | 11 |
2 files changed, 33 insertions, 25 deletions
diff --git a/init/fish_function.fish b/init/fish_function.fish index 8c218a30..d73af23c 100644 --- a/init/fish_function.fish +++ b/init/fish_function.fish @@ -289,21 +289,6 @@ function vared -d "Edit variable value" end # -# This function deletes a character from the commandline if it is -# non-empty, and exits the shell otherwise. Implementing this -# functionality has been a longstanding request from various -# fish-users. -# - -function __fish_delete_or_exit -d "Exit the shell if the commandline is empty, delete a character otherwise" - if test (commandline) - commandline -f delete-char - else - exit - end -end - -# # This function is bound to Alt-L, it is used to list the contents of # the directory under the cursor # @@ -672,3 +657,35 @@ function type -d "Print the type of a command" return $status end + +function prevd-or-backward-word --key-binding + if test -z (commandline) + prevd + else + commandline -f backward-word + end +end + +function nextd-or-forward-word --key-binding + if test -z (commandline) + nextd + else + commandline -f forward-word + end +end + +# +# This function deletes a character from the commandline if it is +# non-empty, and exits the shell otherwise. Implementing this +# functionality has been a longstanding request from various +# fish-users. +# + +function delete-or-exit --key-binding -d "Exit the shell if the commandline is empty, delete a character otherwise" + if test (commandline) + commandline -f delete-char + else + exit + end +end + diff --git a/init/fish_inputrc b/init/fish_inputrc index 70996919..f252ca31 100644 --- a/init/fish_inputrc +++ b/init/fish_inputrc @@ -16,17 +16,8 @@ $if fish "\M-d": kill-word "\C-w": backward-kill-word "\M-k": dump-functions - "\C-d": __fish_delete_or_exit "\M-d": if test -z (commandline); dirh; else; commandline -f kill-word; end - - "\e\eOD": if test -z (commandline); prevd; else; commandline -f backward-word; end - "\e\eOC": if test -z (commandline); nextd; else; commandline -f forward-word; end - - "\eO3D": if test -z (commandline); prevd; else; commandline -f backward-word; end - "\eO3C": if test -z (commandline); nextd; else; commandline -f forward-word; end - - "\e[3D": if test -z (commandline); prevd; else; commandline -f backward-word; end - "\e[3C": if test -z (commandline); nextd; else; commandline -f forward-word; end + "\C-d": delete-or-exit $endif |