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
Should we strip the last trailing delimiter by default? It means breaking backward compatibility, but you can replicate the old behavior using templates.
# Please keep the last comma!echo foo,bar,baz | fzf --delimiter , --with-nth '{2},{1},'# bar,foo,
However, when rearranging markdown table columns, keeping the last delimiter is desirable because it contains whitespaces for alignment, and you can't replicate the previous behavior using templates.
Thanks for clearing this up. For me using the template {1} instead is an acceptable solution, and I agree with you it may do more harm if we break backwards compatibility, even if it was a better default. So maybe it's best to keep it as it is right now.
The only ugly thing is now that --with-nth and --accept-nth behave differently without templates.
vimpostor
added a commit
to vimpostor/vim-clue
that referenced
this issue
Feb 23, 2025
The delimiter wasn't strictly visible before, because back in
00022ad we deliberately chose "\t" to
workaround the weird default in fzf, however it's still unnecessary to
include that whitespace in the popup.
Nowadays [0] we can simply use templates (i.e. "{1}" instead of "1") to
avoid adding the delimiter.
The concern raised in 983e744 (which
would be fixable by using the new --accept-nth option [1]) has become
invalid since 46d41c3, because now we
actually need both fields, so keeping the delimiter is important for
destructuring the fields from the response.
[0] junegunn/fzf#4274
[1] junegunn/fzf#1323
The only ugly thing is now that --with-nth and --accept-nth behave differently without templates.
Fair enough. The inconsistency can surprise the users. My thought was there are cases, albeit niche, where it's desirable to keep the last delimiter when using --with-nth (e.g. the table example above), but no one would want it in the context of --accept-nth.
#1323 (comment)
Currently,
--with-nth
keeps the last trailing delimiter.This behavior is usually not desirable, but now you can work around it by using a template.
Note
When you use a template, the trailing delimiter is stripped from each expression, giving you more control over the output.
Should we strip the last trailing delimiter by default? It means breaking backward compatibility, but you can replicate the old behavior using templates.
However, when rearranging markdown table columns, keeping the last delimiter is desirable because it contains whitespaces for alignment, and you can't replicate the previous behavior using templates.
The text was updated successfully, but these errors were encountered: