diff options
author | Roger Gonzalez <roger@rogs.me> | 2023-03-18 16:40:57 -0300 |
---|---|---|
committer | Roger Gonzalez <roger@rogs.me> | 2023-03-18 16:40:57 -0300 |
commit | 8600374371f91843064441113f4023cda1730877 (patch) | |
tree | bb4677ec186dd5c323f1f010207076b7df285606 /.config/fish/functions/_fzf_extract_var_info.fish | |
parent | c95dd49df12f4f8dc13cf3bdc4dad70a060bd5eb (diff) |
General fish fixes and updates
Diffstat (limited to '.config/fish/functions/_fzf_extract_var_info.fish')
-rw-r--r-- | .config/fish/functions/_fzf_extract_var_info.fish | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/.config/fish/functions/_fzf_extract_var_info.fish b/.config/fish/functions/_fzf_extract_var_info.fish new file mode 100644 index 00000000..dd4e9523 --- /dev/null +++ b/.config/fish/functions/_fzf_extract_var_info.fish @@ -0,0 +1,15 @@ +# helper function for _fzf_search_variables +function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output." + # Extract only the lines about the variable, all of which begin with either + # $variable_name: ...or... $variable_name[ + string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output | + + # Strip the variable name prefix, including ": " for scope info lines + string replace --regex "^\\\$$variable_name(?:: )?" '' | + + # Distill the lines of values, replacing... + # [1]: |value| + # ...with... + # [1] value + string replace --regex ": \|(.*)\|" ' $1' +end |