You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[fish] Fix whitespace/regex characters in command line
This is a rewrite of __fzf_parse_commandline function, that fixes the
following issues, when CTRL-T/ALT-C is used and current command line
token contains:
- Escaped newlines (\n): This never worked correctly, but after 282884a,
the string would split, and the script would enter an infinite loop
while trying to set $dir.
- Escaped bell (\a, \cg), backspace (\b), form feed (\v, \cl), carriage
return (\r), vertical tab (\v, \ck): walker-root would not set
correctly for existing directories containing any of those characters.
- Regular expression special characters (^, +, ? etc): $dir would not be
be stripped from $fzf_query if it contained any of those characters.
The lowest supported fish version is v3.1b. For optimal operation, the
function uses more recent commands when supported by the running
version. Specifically, for versions equal or newer than:
- v3.2.0: Sets variables using PCRE2 capture groups of `string match
--regex` when needing to preserve any trailing newlines and
simultaneously omit the extra newline that is appended by `string
collect -N`.
- v3.5.0: Uses the builtin path command for path normalization, dirname
extraction and existing directories check.
- v4.0.0: Uses the --tokens-expanded option of commandline, for
expansion and dealing with unbalanced quotes and incomplete escape
sequences. It also uses the regex style of string-escape, to prepare
variable contents for regex operations. This is not used in older
versions, because they don't escape newlines.
Copy file name to clipboardExpand all lines: shell/key-bindings.fish
+66-38
Original file line number
Diff line number
Diff line change
@@ -42,45 +42,73 @@ function fzf_key_bindings
42
42
end
43
43
44
44
function __fzf_parse_commandline -d'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix'
0 commit comments