Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: support escaping of displayed elements #3493

Open
3 tasks done
calestyo opened this issue Oct 26, 2023 · 0 comments
Open
3 tasks done

feature request: support escaping of displayed elements #3493

calestyo opened this issue Oct 26, 2023 · 0 comments

Comments

@calestyo
Copy link
Contributor

  • I have read through the manual page (man fzf)
  • I have the latest version of fzf
  • I have searched through the existing issues

Feature Request

Hey.

I with --read0 one can read NUL-delimited items (which is great) and right now they're even displayed in a fancy way.

Assuming e.g. a directory with the following subdirectories:

$ ls -1
'a'$'\n''b'
'c'$'\t''d'
'e'$'\r''f'
'g h'
'i'$'\n''j'
'k'$'\n\n'
strange-files
--foo
'\n'
𑙣𑙤𑙦

Executing:

$ find . -mindepth 1 -maxdepth 1 -type d -print0 | fzf --read0

gives:

 ./k␊␊              
  ./strange-files   
  ./i␊j             
> ./e␍f             
  ./c     d         
  ./g h             
  ./\n              
  ./𑙣𑙤𑙦          
  ./a␊b             
  ./--foo           
  10/10 ────────────
>                   

Notice the unicode replacement characters like (U+240A SYMBOL FOR LINE FEED) that are used.

While this looks indeed nice and is probably a good default for most cases, it would IMO be even nicer if one could specify a quotation style, similar to ls--quoting-style=-option, but specifically for displaying/searching purposes.

So that the output would be given like this:

  𑙣𑙤𑙦             
  '\n'               
  --foo              
  strange-files      
> 'k'$'\n\n'         
  'i'$'\n''j'        
  'g h'              
  'e'$'\r''f'        
  'c'$'\t''d'        
  'a'$'\n''b'        
  10/10 ──────────   
>                    

The idea is, that this would be really only for display (and searching) purposes, i.e. when selecting e.g '\n' it would still return a literal newline.

One benefit of this might be, that the elements are easier to read (e.g. is quite small on a terminal). Another, that one can search for those characters (typing e.g. is not so easy via the keyboard).

Cheers,
Chris.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant