Thanks to all who replied to my thread!
On Sun, 20 Dec 2020 at 17:30, Tim Chase <vim@tim.thechases.com> wrote:
>
> On 2020-12-20 11:09, A. Wik wrote:
> > Browsing a directory listing, sometimes I hit lines like these:
> > ./spool/exim/input/1FM8sl-00004n-Ix-H
> > ./spool/exim/input/1FM8sn-00004u-OF-D
> > ./spool/exim/input/1E9dsQ-00004f-MO-D
> > [... thousands of similar lines ...]
> >
> > How can I use "/" to find the next line not matching the above
> > pattern? I've tried the following (and several variations):
> > /\(.*exim.input\)\@<!.*
>
> you can use which only finds the start of the line:
>
> /^\%(.*exim.input\)\@!
>
> or if you want to match the entire line, you can use:
>
> /^\%(\%(exim.input\)\@!.\)*$/
>
> That breaks down to
>
> ^ from the start of the line
> \%(…\)* zero or more of these things
> \%(exim.match\)\@! at each of these places, this can't match
> . accept a character here
> $ all the way to the end of the line
> (no partial line matches, or it would find
> ".spool/exim/inpu" (because "exim.input" doesn't yet
> match)
Can you clarify the function of the dot? It appears that without it,
it finds only empty lines. With it, it finds any line not matching
"exim.input", including empty lines.
-aw
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/CALPW7mQjfOSkRpMzOWB0Na2SO5E33E5XAqQ2zwGOQn3e%2BMYzCQ%40mail.gmail.com.
Monday, October 11, 2021
Sunday, October 10, 2021
Re: Sort lines, then tag, then unsort
Julius Hamilton said on Tue, 14 Sep 2021 13:57:34 +0200
>I would like to sort lines in a text document and then tag them, and
>then revert the file to its original order.
>
>First of all, is there a way to tag a line, so that lines with a given
>tag can be quickly referred to, but the tag is not in the actual text?
>
>Secondly, I noticed with my sort command ":sort \^[A-Z].*[^\.]$\ r"
>(sort all lines beginning with a capital letter and not ending in a
>period) it sends the matches in alphabetical order to the bottom of
>the file. Is there a way to specify a second-order sort by which all
>the matches are sub-sorted, rather than the default alphabetical? And,
>is there a way to send them to the top of the document rather than the
>bottom?
I think you're using the wrong tool. Also, you haven't said why you
need Vim tags on lines. If I'm not mistaken, there are only a limited
number of tags, and if you have that few lines, you're better off doing
this all manually.
Anyway, the tool I'd use is AWK. Not one liners, but real AWK programs.
My first step would be to put every about 3 underscores followed by
the line number at the end of every line, but add one million to
the line number so all line numbers have the same length. This is
trivial in AWK. Now you have a record of the original sort order.
Next, I'd perform whatever kind of two stage or branched sorting you
need to do, once again with AWK.
Next, do whatever you need to do in order to simulate Vim tags. Because
you haven't told us what the tags are used for, I can't comment further.
Next, do whatever you need to do with those simulated tags.
Finally, within Vim, move the ending line numbers to the front of each
line, and re-sort again, to put it in the original order. Finally, use
Vim to get rid of those line numbers.
SteveT
Steve Litt
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20211010042520.5103b5c2%40mydesk.domain.cxm.
>I would like to sort lines in a text document and then tag them, and
>then revert the file to its original order.
>
>First of all, is there a way to tag a line, so that lines with a given
>tag can be quickly referred to, but the tag is not in the actual text?
>
>Secondly, I noticed with my sort command ":sort \^[A-Z].*[^\.]$\ r"
>(sort all lines beginning with a capital letter and not ending in a
>period) it sends the matches in alphabetical order to the bottom of
>the file. Is there a way to specify a second-order sort by which all
>the matches are sub-sorted, rather than the default alphabetical? And,
>is there a way to send them to the top of the document rather than the
>bottom?
I think you're using the wrong tool. Also, you haven't said why you
need Vim tags on lines. If I'm not mistaken, there are only a limited
number of tags, and if you have that few lines, you're better off doing
this all manually.
Anyway, the tool I'd use is AWK. Not one liners, but real AWK programs.
My first step would be to put every about 3 underscores followed by
the line number at the end of every line, but add one million to
the line number so all line numbers have the same length. This is
trivial in AWK. Now you have a record of the original sort order.
Next, I'd perform whatever kind of two stage or branched sorting you
need to do, once again with AWK.
Next, do whatever you need to do in order to simulate Vim tags. Because
you haven't told us what the tags are used for, I can't comment further.
Next, do whatever you need to do with those simulated tags.
Finally, within Vim, move the ending line numbers to the front of each
line, and re-sort again, to put it in the original order. Finally, use
Vim to get rid of those line numbers.
SteveT
Steve Litt
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20211010042520.5103b5c2%40mydesk.domain.cxm.
Tuesday, October 5, 2021
Re: Sort lines, then tag, then unsort
On Mon, Oct 04, 2021 at 11:52:28AM +0200, Julius Hamilton wrote:
>On Sun 19. Sep 2021 at 16:29, 'Paul' via vim_use <vim_use@googlegroups.com>
>wrote:
>> Will marks suffice?
>
>Thanks for your message.
>
>Not sure, can you apply the same mark, i.e. "h", to multiple lines? I don't
>think so but I'm not sure.
No, you can't, but there are a limited number of marks available.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/YVwin4LGIiRpVAFC%40rainslide.net.
>On Sun 19. Sep 2021 at 16:29, 'Paul' via vim_use <vim_use@googlegroups.com>
>wrote:
>> Will marks suffice?
>
>Thanks for your message.
>
>Not sure, can you apply the same mark, i.e. "h", to multiple lines? I don't
>think so but I'm not sure.
No, you can't, but there are a limited number of marks available.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/YVwin4LGIiRpVAFC%40rainslide.net.
Monday, October 4, 2021
Re: opening utf-16 fileencoded ucs-2 Little Endian
hum, now it's log UCS16 that is bad displayed.
Le lun. 4 oct. 2021 à 18:02, Ni Va <nivaemail@gmail.com> a écrit :
this is better : set fencs=ucs-bom,utf-8,utf16le,latin9Le lun. 4 oct. 2021 à 18:02, Ni Va <nivaemail@gmail.com> a écrit :it's now my vimrc bad displayed with this fencs : set fencs=ucs-bom,utf16le,utf-8,latin9Le lun. 4 oct. 2021 à 13:39, Ni Va <nivaemail@gmail.com> a écrit :Hum I see Jürgen. Thank you.Le lun. 4 oct. 2021 à 13:24, 'Jürgen Krämer' via vim_use <vim_use@googlegroups.com> a écrit :Hi,
Christian Brabandt schrieb am 04.10.2021 um 12:44:
>
> On Mo, 04 Okt 2021, Ni Va wrote:
>
>> No error message but I don't happen to read the file.
>
> And you did use ':e! ++enc=utf16le' for the already loaded file? Because
> with this exact same command, I can reload the loaded file perfectly.
>
> Alternatively, try to add utf16le to the (global) fileencodings
> settings. But you need to add it before utf-8 I believe. So this should
> also work:
>
> ':set fencs=ucs-bom,utf16le,utf-8,latin9'
>
> But I am not sure, if this will not break for utf-8 files, so I tend to
> only explicitly re-load files using the `:e ++enc ` command
this will probably break utf-8 files without BOM. With BOM they would be
correctly detected by ucs-bom. Without a BOM all or almost all utf-8 files
can be interpreted as utf-16 -- even those with an odd number of bytes; in
this case Vim puts out a conversion error, but loads the file anyway. Even
incomplete surrogate pairs don't seem to prevent Vim from loading the file
as utf-16.
Better put utf16le after utf-8, because a misinterpretation of utf16 (both
little endian and big endian) can be detected by Vim.
But then you will probably run into the same dilemma with utf-16 and
latin9 ... :-(
Regards,
Jürgen
--
~
~
~
:wq
--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/92aX9rHFCeE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/6282c4d4-9137-5a70-bea5-ea1a7a818216%40googlemail.com.
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4G2JVmgi87UHinTiCch9ZNfWkMu0iSq5eVyHObi27gBVA%40mail.gmail.com.
Re: opening utf-16 fileencoded ucs-2 Little Endian
this is better : set fencs=ucs-bom,utf-8,utf16le,latin9
Le lun. 4 oct. 2021 à 18:02, Ni Va <nivaemail@gmail.com> a écrit :
it's now my vimrc bad displayed with this fencs : set fencs=ucs-bom,utf16le,utf-8,latin9Le lun. 4 oct. 2021 à 13:39, Ni Va <nivaemail@gmail.com> a écrit :Hum I see Jürgen. Thank you.Le lun. 4 oct. 2021 à 13:24, 'Jürgen Krämer' via vim_use <vim_use@googlegroups.com> a écrit :Hi,
Christian Brabandt schrieb am 04.10.2021 um 12:44:
>
> On Mo, 04 Okt 2021, Ni Va wrote:
>
>> No error message but I don't happen to read the file.
>
> And you did use ':e! ++enc=utf16le' for the already loaded file? Because
> with this exact same command, I can reload the loaded file perfectly.
>
> Alternatively, try to add utf16le to the (global) fileencodings
> settings. But you need to add it before utf-8 I believe. So this should
> also work:
>
> ':set fencs=ucs-bom,utf16le,utf-8,latin9'
>
> But I am not sure, if this will not break for utf-8 files, so I tend to
> only explicitly re-load files using the `:e ++enc ` command
this will probably break utf-8 files without BOM. With BOM they would be
correctly detected by ucs-bom. Without a BOM all or almost all utf-8 files
can be interpreted as utf-16 -- even those with an odd number of bytes; in
this case Vim puts out a conversion error, but loads the file anyway. Even
incomplete surrogate pairs don't seem to prevent Vim from loading the file
as utf-16.
Better put utf16le after utf-8, because a misinterpretation of utf16 (both
little endian and big endian) can be detected by Vim.
But then you will probably run into the same dilemma with utf-16 and
latin9 ... :-(
Regards,
Jürgen
--
~
~
~
:wq
--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/92aX9rHFCeE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/6282c4d4-9137-5a70-bea5-ea1a7a818216%40googlemail.com.
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4EWC%3D7Zyv8PkxTdVp%3DtJfdJr2iLZWELWeLf%2BdAxNUeAeA%40mail.gmail.com.
Re: opening utf-16 fileencoded ucs-2 Little Endian
it's now my vimrc bad displayed with this fencs : set fencs=ucs-bom,utf16le,utf-8,latin9
Le lun. 4 oct. 2021 à 13:39, Ni Va <nivaemail@gmail.com> a écrit :
Hum I see Jürgen. Thank you.Le lun. 4 oct. 2021 à 13:24, 'Jürgen Krämer' via vim_use <vim_use@googlegroups.com> a écrit :Hi,
Christian Brabandt schrieb am 04.10.2021 um 12:44:
>
> On Mo, 04 Okt 2021, Ni Va wrote:
>
>> No error message but I don't happen to read the file.
>
> And you did use ':e! ++enc=utf16le' for the already loaded file? Because
> with this exact same command, I can reload the loaded file perfectly.
>
> Alternatively, try to add utf16le to the (global) fileencodings
> settings. But you need to add it before utf-8 I believe. So this should
> also work:
>
> ':set fencs=ucs-bom,utf16le,utf-8,latin9'
>
> But I am not sure, if this will not break for utf-8 files, so I tend to
> only explicitly re-load files using the `:e ++enc ` command
this will probably break utf-8 files without BOM. With BOM they would be
correctly detected by ucs-bom. Without a BOM all or almost all utf-8 files
can be interpreted as utf-16 -- even those with an odd number of bytes; in
this case Vim puts out a conversion error, but loads the file anyway. Even
incomplete surrogate pairs don't seem to prevent Vim from loading the file
as utf-16.
Better put utf16le after utf-8, because a misinterpretation of utf16 (both
little endian and big endian) can be detected by Vim.
But then you will probably run into the same dilemma with utf-16 and
latin9 ... :-(
Regards,
Jürgen
--
~
~
~
:wq
--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/92aX9rHFCeE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/6282c4d4-9137-5a70-bea5-ea1a7a818216%40googlemail.com.
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4HNP7aW64bKB9OkU4AHyJySMjd_z1xUrx8NSomkwBGs0A%40mail.gmail.com.
Re: opening utf-16 fileencoded ucs-2 Little Endian
Hum I see Jürgen. Thank you.
Le lun. 4 oct. 2021 à 13:24, 'Jürgen Krämer' via vim_use <vim_use@googlegroups.com> a écrit :
Hi,
Christian Brabandt schrieb am 04.10.2021 um 12:44:
>
> On Mo, 04 Okt 2021, Ni Va wrote:
>
>> No error message but I don't happen to read the file.
>
> And you did use ':e! ++enc=utf16le' for the already loaded file? Because
> with this exact same command, I can reload the loaded file perfectly.
>
> Alternatively, try to add utf16le to the (global) fileencodings
> settings. But you need to add it before utf-8 I believe. So this should
> also work:
>
> ':set fencs=ucs-bom,utf16le,utf-8,latin9'
>
> But I am not sure, if this will not break for utf-8 files, so I tend to
> only explicitly re-load files using the `:e ++enc ` command
this will probably break utf-8 files without BOM. With BOM they would be
correctly detected by ucs-bom. Without a BOM all or almost all utf-8 files
can be interpreted as utf-16 -- even those with an odd number of bytes; in
this case Vim puts out a conversion error, but loads the file anyway. Even
incomplete surrogate pairs don't seem to prevent Vim from loading the file
as utf-16.
Better put utf16le after utf-8, because a misinterpretation of utf16 (both
little endian and big endian) can be detected by Vim.
But then you will probably run into the same dilemma with utf-16 and
latin9 ... :-(
Regards,
Jürgen
--
~
~
~
:wq
--
--
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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/92aX9rHFCeE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/6282c4d4-9137-5a70-bea5-ea1a7a818216%40googlemail.com.
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4E89CaiG%3DmN1U9xDy8COd6CbZaSJPK9Tcnv-kGgO_7mEQ%40mail.gmail.com.
Subscribe to:
Posts (Atom)