From ad0c8cfb83739508a9e0650ec490ab133b0fc2a6 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 13 Mar 2019 12:15:45 +0100 Subject: [PATCH] fish_clipboard_paste: Don't add histignore spaces If we're at the beginning of the commandline, we trim leading whitespace so we don't trigger histignore. Since that's the main issue of problems with histignore: Closes #4327. --- share/functions/fish_clipboard_paste.fish | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/functions/fish_clipboard_paste.fish b/share/functions/fish_clipboard_paste.fish index e56ff6b16..105ca1226 100644 --- a/share/functions/fish_clipboard_paste.fish +++ b/share/functions/fish_clipboard_paste.fish @@ -28,6 +28,11 @@ function fish_clipboard_paste if __fish_commandline_is_singlequoted set data (string replace -ra "(['\\\])" '\\\\\\\$1' -- $data) end + if not string length -q -- (commandline -c) + # If we're at the beginning of the first line, trim whitespace from the start, + # so we don't trigger ignoring history. + set data (string trim -l -- $data) + end if test -n "$data" commandline -i -- $data end