Re: Print the first field of a table in one line separated by commas

2022-09-06 Thread Arun
This seems to work well too (tested with 8.1):
  %s/\(\S\+\)\>.*\n/xx\1yyy,/

Regards,
-Arun

On Tue, Sep 6, 2022 at 3:43 PM Tim Chase  wrote:

> On 2022-09-06 14:45, andalou wrote:
> > I have the table:
> > 1001 John Sena 4
> > 1002 Jafar Iqbal   6
> > 1003 Meher Nigar   3
> > 1004 Jonny Liver   7
> > I'd like to print the first field, preceded by xx, and followed by yyy,
> > separated by commas, as in:
> > xx1001yyy, xx1002yyy, xx1003yyy, xx1004yyy
>
> I'd do it in two (or three) passes:
>
> 1) optionally copy the data and paste it where you want the resuts
> if you want to preserve it
>
> 2) over the range of that data, do a substitute
>
>   :%s/^\(\S\+\) .*/xx\1yyy,
>
> to put the prefix/suffix/comma in place
>
> 3) then join that range
>
>   :%j
>
> (and optionally remove the trailing comma)
>
> > And I'd like to get this output after the table. I think I can do it
> > with awk, but I'd like to do it with vim, if it is possible
>
> If you want to do it with awk:
>
>   awk '{printf("%sxx%syyy", NR==1?"":", ", $1)}END{print ""}'
>
> -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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/YxfNJuDf//V5NXyp%40thechases.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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CAJUkyiHOwn%3DgN6rCZ9fdZaXrLaw7bBgNTt6UOg%3DRBWF5AnbuTw%40mail.gmail.com.


Re: Gvim message on XDG textedit URL link

2022-09-06 Thread Andrew Bernard
Perhaps I was not clear. The string 'textedit' has nothing to do with gvim 
internals or scripts or plugins. It's the URL used by the xdg-open process 
when running gvim in server mode, so that the file is opened on a given 
line and column. The textedit string is embedded in the PDFs as a way of 
linking objects in the PDF to the source code line for them. It's got 
nothing to do with any plugins. It's a standard and common technique with 
PDF files.

Gvim works fine in servermode, and the file is opened at the right place. 
It very inconvenient to see this long message for no good reason - it's not 
an error, it's not useful information, and to have to press ENTER each 
time, when you are going back and forth between a music score and its note 
objects and the Lilypond source code hundreds of times. I can't see any 
reason for this behaviour from gvim, and it actually makes it pretty much 
unusable for this use case.

If you set up a handler for the MIME type x-scheme-handler/textedit then 
xdg-open textedit:///home/acb/work/test.ly:4:2:3 will open the file test.ly 
in the editor you have set for handling text documents on your system and 
go to the location. In the same way that clicking a URL in a PDF opens your 
browser on the page.

I'm not reporting an error, but a usability issue, bad enough to make me 
have to switch to alternative editor for the task. This used to work int he 
past where you could set cmdheight to 2, but that no longer suppresses the 
message ion version 9.0.

Andrew


-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/33faf6d4-25aa-4777-adaa-74969aec3a86n%40googlegroups.com.


Re: Print the first field of a table in one line separated by commas

2022-09-06 Thread Tim Chase
On 2022-09-06 14:45, andalou wrote:
> I have the table:
> 1001 John Sena 4
> 1002 Jafar Iqbal   6
> 1003 Meher Nigar   3
> 1004 Jonny Liver   7
> I'd like to print the first field, preceded by xx, and followed by yyy,
> separated by commas, as in:
> xx1001yyy, xx1002yyy, xx1003yyy, xx1004yyy

I'd do it in two (or three) passes:

1) optionally copy the data and paste it where you want the resuts
if you want to preserve it

2) over the range of that data, do a substitute

  :%s/^\(\S\+\) .*/xx\1yyy,

to put the prefix/suffix/comma in place

3) then join that range

  :%j

(and optionally remove the trailing comma)

> And I'd like to get this output after the table. I think I can do it
> with awk, but I'd like to do it with vim, if it is possible

If you want to do it with awk:

  awk '{printf("%sxx%syyy", NR==1?"":", ", $1)}END{print ""}'

-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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/YxfNJuDf//V5NXyp%40thechases.com.


Print the first field of a table in one line separated by commas

2022-09-06 Thread andalou

I have the table: 

1001 John Sena 4 
1002 Jafar Iqbal   6 
1003 Meher Nigar   3 
1004 Jonny Liver   7 

I'd like to print the first field, preceded by xx, and followed by yyy, 
separated by commas, as in: 

xx1001yyy, xx1002yyy, xx1003yyy, xx1004yyy 

And I'd like to get this output after the table. I think I can do it with 
awk, but I'd like to do it with vim, if it is possible 

-- 
Cesar 

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/64256999-0bf6-41d5-bd94-9ef51bf4145cn%40googlegroups.com.


Re: Gvim message on XDG textedit URL link

2022-09-06 Thread Charles Campbell

Andrew Bernard wrote:
I have PDF's with links in them and XDG textedit URLs that can take me 
from the PDF to the source file (for lilypond music engraving if 
interested)., The links work and take me to the right line and column 
corresponding to the link in the PDF. But I am unable to turn off the 
lengthy and needless long cryptic message displayed at the bottom of 
the screen despite searching for answers. Having to see this and press 
enter every time is tedious. This is an example:


gvim message.jpg

Here's the sort of textedit link:

textedit:///home/acb/work/test.ly:4:2:3

What should one do?

I am unable to find a "textedit:" string in any of the vim runtime 
files. Sounds like you've installed a plugin to handle textedit links -- 
so I suggest finding out what the plugin name is and contacting its author.


Chip Campbell

--
--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/d4f26911-123e-a70f-6bad-efc5733394b0%40drchip.org.