Monday, November 17, 2025

Re: :sort in .tsv file

On 2025-11-17 21:54, Vim Users wrote:
> the /pattern/ feature of sort doesn't work if the recognized filetype
> is .tsv (which gives alternate colours for successive fields).
>
> Is there a workaround, apart from copying it to a plain file and
> working on it there?

I'm not sure if you have some plugin interfering, but when I open a TSV
file with the following contents:

$ cat test.tsv
h1 h2 h3 h4 h5
d c b a 1
c d a b 30
b a d c 4
a b c d 200

I can issue the following commands to sort by the various columns:

:2,$sort " sort by the first column
:2,$sor /[^^I]*^I/ " sort by the second column
:2,$sor /\([^^I]*^I\)\{2}/ " sort by third column
:2,$sor /\([^^I]*^I\)\{3}/ " sort by the fourth column
:2,$sor n /\([^^I]*^I\)\{4}/ " sort numerically by the fifth column

So I'm uncertain what you're seeing or how you're sorting that differs.

-tim
--





--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/aRuwJ25oNYdDa9at%40thechases.com.

No comments: