diff options
author | Fabian Homborg <FHomborg@gmail.com> | 2016-05-24 13:17:03 +0200 |
---|---|---|
committer | Fabian Homborg <FHomborg@gmail.com> | 2016-05-25 16:10:16 +0200 |
commit | 7d1f45e25f8f7c0bdf0af7d96a60b148b8f54dd3 (patch) | |
tree | 9e41e9ab5613f1ce7f991e96a8902901f531cadf | |
parent | 1bad956633860ff6ea5c0ce709e7e1947b05517f (diff) |
Add clipboard helper functions and bind them
\cy copies, \cv pastes.
-rw-r--r-- | share/functions/fish_clipboard_copy.fish | 7 | ||||
-rw-r--r-- | share/functions/fish_clipboard_paste.fish | 7 | ||||
-rw-r--r-- | share/functions/fish_default_key_bindings.fish | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/share/functions/fish_clipboard_copy.fish b/share/functions/fish_clipboard_copy.fish new file mode 100644 index 00000000..a65efc04 --- /dev/null +++ b/share/functions/fish_clipboard_copy.fish @@ -0,0 +1,7 @@ +function fish_clipboard_copy + if type -q pbcopy + commandline | pbcopy + else if type -q xsel + commandline | xsel --clipboard + end +end diff --git a/share/functions/fish_clipboard_paste.fish b/share/functions/fish_clipboard_paste.fish new file mode 100644 index 00000000..bec43c88 --- /dev/null +++ b/share/functions/fish_clipboard_paste.fish @@ -0,0 +1,7 @@ +function fish_clipboard_paste + if type -q pbpaste + commandline -i (pbpaste) + else if type -q xsel + commandline -i (xsel --clipboard) + end +end diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index e5491321..41b252f9 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -18,7 +18,8 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis bind $argv \r execute bind $argv \ck kill-line - bind $argv \cy yank + bind $argv \cy fish_clipboard_copy + bind $argv \cv fish_clipboard_paste bind $argv \t complete bind $argv \e\n "commandline -i \n" |