Sunday, September 26, 2021

Re: How to suppress "Input is not from a terminal" message?

Thank you very much for your answers.

I changed line from:
vim +"so dummy.vim" << EOF
to line
vim +"so dummy.vim" -e << EOF
and "annoying" message is suppressed, like I wanted.

Just additional question.
Does -e switch has some negative side effect, like some commands not working or working differently like in standard vim?
I am reading about about "Ex mode" (-e switch) and "Improved Ed mode" (-E switch).

--
--
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/3bfc0cbf-02b3-413d-a55d-9361def0408cn%40googlegroups.com.

Saturday, September 25, 2021

Re: How to suppress "Input is not from a terminal" message?

On Fri, Sep 24, 2021 at 9:37 AM Igor <igor2x@gmail.com> wrote:
>
> Hi,
> I would like to embed vim code inside bash script.
>
> I have simple text file text_file.txt with content:
> aaa
>
> Content sample.sh file:
> #!/bin/bash
> echo "Start running vim commands inside bash program."
> vim +"so dummy.vim" << EOF
> :e text_file.txt
> :s/a/b/
> :x
> EOF
> echo "End of running run vim commands inside bash program."
>
> Above code opens text_file.txt, replaces letter a with b and saves the file.
> When I run sample.sh file from shell: ./sample.sh
> The output on terminal is:
> Start running vim commands inside bash program.
> Vim: Warning: Input is not from a terminal
> End of running run vim commands inside bash program.
>
> and script does get executed, so file text_file.txt correctly gets changed to baa
> The only little bit annoying thing is the Vim: Warning: Input is not from a terminal message in terminal. How to suppress this message?
> Thanks.

See :help --not-a-term

Best regards,
Tony.

--
--
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/CAJkCKXu8%2B1nFwjq6%2BaaCvRq4PkpMduKvi66_9B4Z%2BcdU6aZUkg%40mail.gmail.com.

Friday, September 24, 2021

Re: How to suppress "Input is not from a terminal" message?

>
> I would like to embed vim code inside bash script.
>

Have you considered using sed, which was designed for this sort of job.
rather than twisting vim inside out?


--
--
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/b1da88356c35d2ac333ecfe1e694feec.squirrel%40webmail.vybenetworks.com.

Re: How to suppress "Input is not from a terminal" message?

On 24.09.21 09:36, Igor wrote:
> Content sample.sh file:
> #!/bin/bash
> echo "Start running vim commands inside bash program."
> vim +"so dummy.vim" << EOF
> :e text_file.txt
> :s/a/b/
> :x
> EOF
> echo "End of running run vim commands inside bash program."
...
> The only little bit annoying thing is the *Vim: Warning: Input is not from
> a terminal* message in terminal. How to suppress this message?

Start vim in Ex-mode?

vim +"so dummy.vim" -e << EOF

Bye, Andreas

--
--
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/d7c50152-e608-c774-fc00-c33136b16992%40gmail.com.

How to suppress "Input is not from a terminal" message?

Hi,
I would like to embed vim code inside bash script.

I have simple text file text_file.txt with content:
aaa

Content sample.sh file:
#!/bin/bash
echo "Start running vim commands inside bash program."
vim +"so dummy.vim" << EOF
   :e text_file.txt
   :s/a/b/
   :x
EOF
echo "End of running run vim commands inside bash program."


Above code opens text_file.txt, replaces letter a with b and saves the file.
When I run sample.sh file from shell: ./sample.sh
The output on terminal is:
Start running vim commands inside bash program.
Vim: Warning: Input is not from a terminal
End of running run vim commands inside bash program.

and script does get executed, so file text_file.txt correctly gets changed to baa
The only little bit annoying thing is the Vim: Warning: Input is not from a terminal message in terminal. How to suppress this message?
Thanks.

--
--
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/cd79d44d-2c23-4c45-9c5b-1fc259b3a73fn%40googlegroups.com.

Wednesday, September 22, 2021

Re: Specify a range for a python command alias

Hi,

Haslett, Garvin schrieb am 22.09.2021 um 13:04:
> Following the web page listed below I've created the following command alias in my .vimrc to conveniently prettify .json files:
> command! Pj %!python -m json.tool
>
> It works great but, ideally, I'd like to specify ranges. I tried the following:
> command! -range=% Pj !python -m json.tool
> But the command just hangs until such times as I Ctrl-C to abort.
>
> I'm surprised by this since entering `3,4!python -m json.tool` at the command buffer works as expected.
>
> What subtlety am I missing here?

you need to tell Vim where you want to insert the range into
the replacement text for the user-defined command. You do this
by including the escape sequence <range> in the replacement
text.

In your case

:command! -range=% Pj <range>!python -m json.tool

should do the trick.

Regards,
Jürgen

--
--
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/4e193854-be1d-20c5-9456-b62adbf30eb3%40googlemail.com.

Specify a range for a python command alias

Following the web page listed below I've created the following command alias in my .vimrc to conveniently prettify .json files:
command! Pj %!python -m json.tool

It works great but, ideally, I'd like to specify ranges. I tried the following:
command! -range=% Pj !python -m json.tool
But the command just hangs until such times as I Ctrl-C to abort.

I'm surprised by this since entering `3,4!python -m json.tool` at the command buffer works as expected.

What subtlety am I missing here?

Web page mentioned above:
https://pascalprecht.github.io/posts/pretty-print-json-in-vim

--
--
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/CWLP265MB51867E258B0CBBF075536A5E83A29%40CWLP265MB5186.GBRP265.PROD.OUTLOOK.COM.

Monday, September 20, 2021

Re: Sort lines, then tag, then unsort

I think the plugin you need is https://github.com/kshenoy/vim-signature

Christian Brabandt <cblists@256bit.org> 于2021年9月14日周二 下午8:17写道:

On Di, 14 Sep 2021, Julius Hamilton wrote:

> 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?

I think this can be done using text-properties.
Have a look at :h text-prop-intro

Best,
Christian
--
Ungleich den Franzosen und Engländern, loben die Deutschen nichts (an
einem Autor, Menschen), ohne alles zu loben; sie glauben parteiisch
sein zu müssen.
                -- Jean Paul

--
--
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/20210914121742.GB2645325%40256bit.org.


--
王子陌
James Wang
+86 178-5314-3397

--
--
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/CABiu85CSJtOUN2w8G3PNBNENGcy%3DCG4QaxqvZPFyeAGW_p%3Dcsg%40mail.gmail.com.

Sunday, September 19, 2021

Re: Sort lines, then tag, then unsort

On Tue, Sep 14, 2021 at 01:57:34PM +0200, Julius Hamilton wrote:
>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?

Will marks suffice?

--
--
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/YUdJO79Aw4eNziOd%40rainslide.net.

Saturday, September 18, 2021

Any idea why tests run in a shell fail?

I'm (re)writing a plugin and writing some tests for it. The same tests,
using the same vimrc, fail if started from a shell script, but if I run
the same commands with the same vimrc, directly in the editor, they
work. Any idea why this happens?

Actually not all tests fail, but some does.

For example I have a test:

let g:tests = ['A']

fun! A()
silent tabedit txt/ins1
Norm gm;a123
noau silent write
call assert_equalfile('txt/ins1', 'out/ins1-A')
silent undo
noau silent write
Norm ^]
close!
endfun

where Norm is just 'normal <args>', if started automatically in a shell
script it fails, if I run the same manually it works.

--
--
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/b34c70e6-58ed-7589-4f9f-9702d6cd8449%40gmail.com.

Re: New User Several Questions and Concerns

You can also use buffers.

After having multiple files open (either by passing multiple files to
vim when starting it, or by using :e </path/to/file.extension> after Vim
has already been open), you can do:

:ls

And you will see the open files, prefixed with a number.

To go to a specific file, you can do:

:b<buffer-number>

There are also keyboard shortcuts but since I don't use them, I don't
really remember them.

Best Regards,
IFo Hancroft

On 2021-09-17 08:37, Bernard wrote:
> Greetings I am learning Vim (Windows 10) It is of no use to me unless
> I can effortlessly edit multiple files w/o a mouse I learned of tabs
> but am surprised I can see no way to select any tab of my choice I
> assumed each tab would be identified w/ a number so one can merely
> type something like ":gototab3" let's say to edit the tab so labeled
> But when I enter ":tabedit" multiple times all I see is each tab
> labeled "[ No Name ]" w/ no further distinguishing mark upon it I do
> not wish to step through a series of tabs to reach my intended
> destination I prefer random access not sequential Furthermore one
> horizontal line of text of course offers finite space I saw no mention
> in the Help file as to how Vim responds to the situation of more tabs
> created than will fit Of course upon experimentation I observed the
> result The Help file offers no guidance of course as to how to scroll
> the list of tabs in such an instance Furthermore I do not see why Vim
> does not offer filename completion when entering a file name for
> editing and provide the ability to scroll up/down the list of file and
> directory names relative to the current directory or relative to the
> directory entered Furthermore Upon merely starting Vim and resizing
> the console window it crashes - Cheerio
>
> --
> --
> 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/1883d4cf-7fbc-4b67-81f0-9f830596b642n%40googlegroups.com
> [1].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/vim_use/1883d4cf-7fbc-4b67-81f0-9f830596b642n%40googlegroups.com?utm_medium=email&utm_source=footer

--
--
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/f9bb02e9ea40c79370ac90584452c782%40ifohancroft.com.

Friday, September 17, 2021

Re: New User Several Questions and Concerns

Using tabs as you suggested is a really good idea.


Sent from ProtonMail mobile



-------- Original Message --------
On Sep 17, 2021, 13:01, Lifepillar < lifepillar@lifepillar.me> wrote:

On 2021-09-17, Bernard <bpwlodarski@gmail.com> wrote:
> I assumed each tab would be identified w/ a number

Yes, that is the case. If you want the number to show up in the tab
label, you may customize the tab line. See `:help setting-tabline`.

> so one can merely type something like ":gototab3"

:3tabnext

(See `:help :tabnext`). Or use gt, as already suggested.

> Furthermore one horizontal line of text of course offers finite space

I don't think there is a way to show tab labels that do not fit, except
by enlarging the terminal (or GUI) window.

You haven't specified what your use case is for lots of tabs. But if you
tend to open each file in a separate tab, that is not how tabs are meant
to be used. You should think of tabs as workspaces (groups of windows),
not files.

Hope this helps,
Life.

--
--
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/si2omg%24jam%241%40ciao.gmane.io.

--
--
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/qGTCS3QTV-KUHaMaqMjVTjzHmgxYUjgYKDiZLrr9Y_mnZqpA4BH6IYZSL-0LSGwBBLl2yDV3G9L4UUVO-5ZBfGh-SJAJ3OsU9A0GvXbVBbU%3D%40protonmail.com.

Re: New User Several Questions and Concerns

On 2021-09-17, Bernard <bpwlodarski@gmail.com> wrote:
> I assumed each tab would be identified w/ a number

Yes, that is the case. If you want the number to show up in the tab
label, you may customize the tab line. See `:help setting-tabline`.

> so one can merely type something like ":gototab3"

:3tabnext

(See `:help :tabnext`). Or use gt, as already suggested.

> Furthermore one horizontal line of text of course offers finite space

I don't think there is a way to show tab labels that do not fit, except
by enlarging the terminal (or GUI) window.

You haven't specified what your use case is for lots of tabs. But if you
tend to open each file in a separate tab, that is not how tabs are meant
to be used. You should think of tabs as workspaces (groups of windows),
not files.

Hope this helps,
Life.

--
--
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/si2omg%24jam%241%40ciao.gmane.io.

Re: New User Several Questions and Concerns

On 2021-09-17, Bernard wrote:
> Greetings I am learning Vim (Windows 10) It is of no use to me unless I can
> effortlessly edit multiple files w/o a mouse I learned of tabs but am surprised
> I can see no way to select any tab of my choice I assumed each tab would be
> identified w/ a number so one can merely type something like ":gototab3" let's
> say to edit the tab so labeled But when I enter ":tabedit" multiple times all I
> see is each tab labeled "[ No Name ]" w/ no further distinguishing mark upon it
> I do not wish to step through a series of tabs to reach my intended destination
> I prefer random access not sequential

:help :tabnext

> Furthermore one horizontal line of text
> of course offers finite space I saw no mention in the Help file as to how Vim
> responds to the situation of more tabs created than will fit Of course upon
> experimentation I observed the result The Help file offers no guidance of
> course as to how to scroll the list of tabs in such an instance

I don't know of a solution for that.

> Furthermore I
> do not see why Vim does not offer filename completion when entering a file name
> for editing

It does have filename completion. See

:help cmdline-completion

What have you tried that doesn't seem to be working?

> and provide the ability to scroll up/down the list of file and
> directory names relative to the current directory or relative to the directory
> entered

It has this, too. See

:help :browse

> Furthermore Upon merely starting Vim and resizing the console window it
> crashes

If this is reproducible, send reproduction steps to this list and
someone will have a look.

Regards,
Gary

--
--
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/20210917163630.GC20592%40phoenix.

Re: New User Several Questions and Concerns

I use <tab#>gt. so to go to the 5th tab i enter:

5gt


-----Original Message-----
From: Bernard <bpwlodarski@gmail.com>
To: vim_use <vim_use@googlegroups.com>
Sent: Fri, Sep 17, 2021 10:37 am
Subject: New User Several Questions and Concerns

Greetings I am learning Vim (Windows 10) It is of no use to me unless I can effortlessly edit multiple files w/o a mouse I learned of tabs but am surprised I can see no way to select any tab of my choice I assumed each tab would be identified w/ a number so one can merely type something like ":gototab3" let's say to edit the tab so labeled But when I enter ":tabedit" multiple times all I see is each tab labeled "[ No Name ]" w/ no further distinguishing mark upon it I do not wish to step through a series of tabs to reach my intended destination I prefer random access not sequential Furthermore one horizontal line of text of course offers finite space I saw no mention in the Help file as to how Vim responds to the situation of more tabs created than will fit Of course upon experimentation I observed the result The Help file offers no guidance of course as to how to scroll the list of tabs in such an instance Furthermore I do not see why Vim does not offer filename completion when entering a file name for editing and provide the ability to scroll up/down the list of file and directory names relative to the current directory or relative to the directory entered Furthermore Upon merely starting Vim and resizing the console window it crashes  - Cheerio

--
--
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/1883d4cf-7fbc-4b67-81f0-9f830596b642n%40googlegroups.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/1667299414.927098.1631895333970%40mail.yahoo.com.

New User Several Questions and Concerns

Greetings I am learning Vim (Windows 10) It is of no use to me unless I can effortlessly edit multiple files w/o a mouse I learned of tabs but am surprised I can see no way to select any tab of my choice I assumed each tab would be identified w/ a number so one can merely type something like ":gototab3" let's say to edit the tab so labeled But when I enter ":tabedit" multiple times all I see is each tab labeled "[ No Name ]" w/ no further distinguishing mark upon it I do not wish to step through a series of tabs to reach my intended destination I prefer random access not sequential Furthermore one horizontal line of text of course offers finite space I saw no mention in the Help file as to how Vim responds to the situation of more tabs created than will fit Of course upon experimentation I observed the result The Help file offers no guidance of course as to how to scroll the list of tabs in such an instance Furthermore I do not see why Vim does not offer filename completion when entering a file name for editing and provide the ability to scroll up/down the list of file and directory names relative to the current directory or relative to the directory entered Furthermore Upon merely starting Vim and resizing the console window it crashes  - Cheerio

--
--
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/1883d4cf-7fbc-4b67-81f0-9f830596b642n%40googlegroups.com.

Tuesday, September 14, 2021

Re: Unable to turn off spelling for words followed by punctuation characters

Hi,

Steve Dondley schrieb am 07.09.2021 um 13:47:
> I'm have a tough time turning off spell checking for words that immediately follow a punctuation character.
>
> For example, I don't want any of the words in this path to be spellchecked:
>
> /kjkj/kasjdf/kjdsf
>
> So I did:
>
> syn match UrlNoSpell '[\/]w\+' contains=@NoSpell
>
> This works.
>
> However, this doesn't:
>
> syn match UrlNoSpell '[:punct:]w\+' contains=@NoSpell

the syntax for a character class inside a collection is wrong. You
need to use two sets of brackets, i.e.,

syn match UrlNoSpell '[[:punct:]]\w\+' contains=@NoSpell

(I assume the missing backslash before w\+ was just a typo in your mail
or the result of some backslash interpretation by you mail client.)

Regards,
Jürgen


--
--
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/2ddfa439-03d9-d61e-8896-b976ceb48b35%40googlemail.com.

Re: Sort lines, then tag, then unsort

To be fair, I was thinking of ad-hoc creating properties, not using a script parsing a file.

On Tuesday, September 14, 2021 at 8:52:33 AM UTC-4 rwmit...@gmail.com wrote:
Interesting, I did not know about text properties although it only seems marginally useful:

```When a buffer is unloaded, all the text properties are gone.  There is no way
to store the properties in a file.  You can only re-create them```

What would it take to save them to a shadow file?

On Tuesday, September 14, 2021 at 8:17:57 AM UTC-4 cbl...@256bit.org wrote:

On Di, 14 Sep 2021, Julius Hamilton wrote:

> 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?

I think this can be done using text-properties.
Have a look at :h text-prop-intro

Best,
Christian
--
Ungleich den Franzosen und Engländern, loben die Deutschen nichts (an
einem Autor, Menschen), ohne alles zu loben; sie glauben parteiisch
sein zu müssen.
-- Jean Paul

--
--
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/9a3dc629-8638-43ca-be0e-510c6bc9fa97n%40googlegroups.com.

Re: Sort lines, then tag, then unsort

Interesting, I did not know about text properties although it only seems marginally useful:

```When a buffer is unloaded, all the text properties are gone.  There is no way
to store the properties in a file.  You can only re-create them```

What would it take to save them to a shadow file?

On Tuesday, September 14, 2021 at 8:17:57 AM UTC-4 cbl...@256bit.org wrote:

On Di, 14 Sep 2021, Julius Hamilton wrote:

> 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?

I think this can be done using text-properties.
Have a look at :h text-prop-intro

Best,
Christian
--
Ungleich den Franzosen und Engländern, loben die Deutschen nichts (an
einem Autor, Menschen), ohne alles zu loben; sie glauben parteiisch
sein zu müssen.
-- Jean Paul

--
--
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/ebe00758-eb50-45bd-a626-5713aeb5cc67n%40googlegroups.com.

Re: Sort lines, then tag, then unsort

On Di, 14 Sep 2021, Julius Hamilton wrote:

> 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?

I think this can be done using text-properties.
Have a look at :h text-prop-intro

Best,
Christian
--
Ungleich den Franzosen und Engländern, loben die Deutschen nichts (an
einem Autor, Menschen), ohne alles zu loben; sie glauben parteiisch
sein zu müssen.
-- Jean Paul

--
--
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/20210914121742.GB2645325%40256bit.org.

Sort lines, then tag, then unsort

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?

Thanks very much,
Julius

--
--
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/CAEsMKX2btY6zAjVE0PRcJHhtoC58MK1xA5LMAwLgHgfThgeX-Q%40mail.gmail.com.

Friday, September 10, 2021

Re: Vim functions documentation

> Is there a reference manual chapter on functions and vim script?

See :h usr_41, to a certain extent :h usr_40, and :h eval (particularly
section 4 on builtin functions and section 5 on defining functions).

- DLD

--
--
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/YTtEur%2B/HbxI5Ebb%40icerm-dld.

Re: Vim functions documentation

Julius Hamilton wrote:

> I would like to write a command or function in Vim which will return True
> or False based on some properties of the text in the file. I assume this
> will be done with the Vim Script language (
> http://vimdoc.sourceforge.net/htmldoc/usr_41.html).
>
> I thought that sections of the User Manual usually corresponded to a more
> definitive, in-depth chapter in the Reference Manual, but I see no
> discussion of a corresponding reference manual section here.
>
> Is there a reference manual chapter on functions and vim script?

How about :help user-functions

I'll add a reference at the end of 41.7.

--
hundred-and-one symptoms of being an internet addict:
22. You've already visited all the links at Yahoo and you're halfway through
Lycos.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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/202109101044.18AAi7aM293751%40masaka.moolenaar.net.

Vim functions documentation

Hey,

I would like to write a command or function in Vim which will return True or False based on some properties of the text in the file. I assume this will be done with the Vim Script language (http://vimdoc.sourceforge.net/htmldoc/usr_41.html).

I thought that sections of the User Manual usually corresponded to a more definitive, in-depth chapter in the Reference Manual, but I see no discussion of a corresponding reference manual section here.

Is there a reference manual chapter on functions and vim script?

Thank you,
Julius

--
--
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/CAEsMKX0L9DyKihwZABhMSUeNXQ_OVfVdnwmD5tgLUAAoyHK2SQ%40mail.gmail.com.

Thursday, September 9, 2021

Re: Find patterns in Gvim

Julius Hamilton wrote:

> From trying it myself, it seems that the "find" menu option in Gvim does
> not allow entering patterns or regular expressions, such as a period to
> represent any character, or "\n" to represent a newline, but only literal,
> explicit text matching.
>
> I was curious why this is and if there is any GUI / menu way to search for
> regular expression patterns or if you must use the Vim text-based command
> "/" for this.

This was an intentional choice. The idea is that the menu would be used
by beginners, who don't know the keyboard commands yet. These users
would also not know what characters need to be escaped in a pattern.

As Christian mentioned, once you know Vim a bit you would just use
"/pattern" and ":s/from/to".

--
hundred-and-one symptoms of being an internet addict:
16. You step out of your room and realize that your parents have moved and
you don't have a clue when it happened.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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/202109091742.189Hgae9114368%40masaka.moolenaar.net.

Re: Find patterns in Gvim

On Do, 09 Sep 2021, Julius Hamilton wrote:

> From trying it myself, it seems that the "find" menu option in Gvim does not allow entering patterns or regular expressions, such as a period to represent any character, or "\n" to represent a newline, but only literal, explicit text
> matching.
>
> I was curious why this is and if there is any GUI / menu way to search for regular expression patterns or if you must use the Vim text-based command "/" for this.

Yes, I think the :promptfind and :promptreplace commands do a literal
search and replace only. If you want to use regexes, just use the `/`
(for finding) or `:%s` (for replacing) command.

Best,
Christian
--
Frau Weber liest in einem Gedichtband. Auf einmal ruft sie: "Du, Theo,
stell Dir vor, hier hat doch tatsächlich ein gewisser Rilke das
Gedicht abgeschrieben, das Du vor dreißig Jahren eigens für mich
geschrieben hast!"

--
--
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/20210909123654.GC3962222%40256bit.org.

Find patterns in Gvim

Hey,

From trying it myself, it seems that the "find" menu option in Gvim does not allow entering patterns or regular expressions, such as a period to represent any character, or "\n" to represent a newline, but only literal, explicit text matching.

I was curious why this is and if there is any GUI / menu way to search for regular expression patterns or if you must use the Vim text-based command "/" for this.

Thank you very much,
Julius

--
--
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/CAEsMKX3j8Gu%2BNKyv_Ma5HOzmDrXLcBchB%2BmpfdD4cuUmFP89Hw%40mail.gmail.com.

Re: Temporarily edit a vim document without actually changing file

hi,

On Thu, 9 Sept 2021 at 12:11, Julius Hamilton
<juliushamilton100@gmail.com> wrote:
> I was curious, is there any mode or plug-in in Vim where you could preview the result of a command,

if after executing a command the result is not what you expected, will
a simple "undo" not do?

> for example a global search and replace function, but by default the edit has not actually been written to file, and that requires a specific command to actually save the previewed changed?
>
> Thank you,
> Julius

--
regards, jr.

You have the right to free speech, as long as you're not dumb enough
to actually try it.
(The Clash 'Know Your Rights')

--
--
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/CAM-dBgqKG2Lj10A9hZ8uL6OQsGGMHkF2%2BtZb86F6wrL%2BcLUN6A%40mail.gmail.com.

Re: Temporarily edit a vim document without actually changing file

That's the default behavior. Nothing is written to disk unless you tell it to.

On Thu, Sep 9, 2021, 13:11 Julius Hamilton <juliushamilton100@gmail.com> wrote:
Hey,

I was curious, is there any mode or plug-in in Vim where you could preview the result of a command, for example a global search and replace function, but by default the edit has not actually been written to file, and that requires a specific command to actually save the previewed changed?

Thank you,
Julius

--
--
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/CAEsMKX1%2B3L1Zy0nTuwz%2BgjK%3DU0eQHMfz0hyTDA60ZYG10u1iuQ%40mail.gmail.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/CAPAv2u5f1A-yCv3vN%2B3DudZBRfRWM90J0a1YqPBqPMqanDyEDQ%40mail.gmail.com.

Wednesday, September 8, 2021

Temporarily edit a vim document without actually changing file

Hey,

I was curious, is there any mode or plug-in in Vim where you could preview the result of a command, for example a global search and replace function, but by default the edit has not actually been written to file, and that requires a specific command to actually save the previewed changed?

Thank you,
Julius

--
--
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/CAEsMKX1%2B3L1Zy0nTuwz%2BgjK%3DU0eQHMfz0hyTDA60ZYG10u1iuQ%40mail.gmail.com.

vim/gvim and ligature support

Hi there,
I am on Ubuntu 20.04 LTS and vim/gvim is 8.1.2269.

I love ligature support in the editor and I like to understand how
ligature support works in vim.


vim

Here it is easy. If the terminal has ligature support then it is
automatically available in vim.


gvim

Here I only can say what my observations are.

In my settings I have

if has('gui_running')
set guifont=Fira\ Code\ 13
endif

Now ligature support is available with certain themes I use. But with
some other themes there is no ligature support.

Question: How does this work in gvim?


Thanks.

--
Manfred

--
--
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/20210908083554.471b6541%40hogwart.

Tuesday, September 7, 2021

Syntax pattern delimiters (was: Unable to turn off spelling for words followed by punctuation characters)

Den tis 7 sep. 2021 14:01Steve Dondley <sdondley@gmail.com> skrev:
OK, looks like the type of quotes makes the difference.

I don't think syntax pattern strings follow the rules for ordinary quoted strings since you can use any punctuation character as delimiter just like with :s, and like with :s forward slash seems to be the standard, but if the pattern contains forward slashes you can use some other character which does not occur in the pattern.

However it is not clear to me whether single quotes are in any way special here. It seems :h :syn-pattern does not mention anything on it. Does anyone know? (I'm curious! :-)




--
--
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/CADAJKhAioRngnrARjSh0Z%3D3wecrS%3DdMcdE1c6im9oh%2BDd4ZODw%40mail.gmail.com.

Re: Unable to turn off spelling for words followed by punctuation characters

OK, looks like the type of quotes makes the difference. With double quotes, things seem to be working now.

On Tuesday, September 7, 2021 at 7:52:29 AM UTC-4 Steve Dondley wrote:
I'm have a tough time turning off spell checking for words that immediately follow a punctuation character.

For example, I don't want any of the words in this path to be spellchecked:

/kjkj/kasjdf/kjdsf

So I did:

syn match UrlNoSpell '[\/]w\+' contains=@NoSpell

This works.

However, this doesn't:

syn match UrlNoSpell '[:punct:]w\+' contains=@NoSpell

Even this doesn't work:

"syn match UrlNoSpell '[\/\.]w\+' contains=@NoSpell

Any words preceded with a period are still spell checked. I tried with both magic and no magic. Nothing works.

I obviously don't know how character classes work in vim. Didn't find anything in :h regex that gave me any hints as to what the problem might be. Can someone clue me in?

--
--
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/3b7ed7b8-aa8f-4b6c-b08f-35ac28403a69n%40googlegroups.com.

Unable to turn off spelling for words followed by punctuation characters

I'm have a tough time turning off spell checking for words that immediately follow a punctuation character.

For example, I don't want any of the words in this path to be spellchecked:

/kjkj/kasjdf/kjdsf

So I did:

syn match UrlNoSpell '[\/]w\+' contains=@NoSpell

This works.

However, this doesn't:

syn match UrlNoSpell '[:punct:]w\+' contains=@NoSpell

Even this doesn't work:

"syn match UrlNoSpell '[\/\.]w\+' contains=@NoSpell

Any words preceded with a period are still spell checked. I tried with both magic and no magic. Nothing works.

I obviously don't know how character classes work in vim. Didn't find anything in :h regex that gave me any hints as to what the problem might be. Can someone clue me in?

--
--
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/081c45c1-fe53-4811-bd61-640e18d84522n%40googlegroups.com.

Saturday, September 4, 2021

Re: How to replace pattern with shell command's output using matched pattern

On 2021-09-04 18:43, Lifepillar wrote:
>> > :%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_
> ⋮
> >> :%s/\[\zs\d\+\ze\]/\=strftime("%c", submatch(0))
>
> Learning Vim is a never-ending experience: I didn't know (or
> remember) about submatch()!
>
> Can you explain why \zs... \ze is to be preferred to capturing with
> \( and \)?

In this case, it was mostly to prevent the need to add the "[" back
in at the begining.

In this particular case, assuming every line had the timestamp at the
beginning, it could really have just skipped the "["/"]" aspects and
just replaced the first run of digits on each line without the need
to capture anything:

:%s/\d\+/\=strftime("%c", submatch(0))

but I find using the \zs and \ze makes it clear what I expect to
match/replace.

tl;dr: my weird personal preferences? ;-)

-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 on the web visit https://groups.google.com/d/msgid/vim_use/20210904135305.028739dc%40bigbox.attlocal.net.

Re: How to replace pattern with shell command's output using matched pattern

On 2021-09-04, rwmit...@gmail.com <rwmitchell@gmail.com> wrote:
> I'm just curious, is the file being otherwise edited in vim? I usually
> just use less to view logs, in which case, a command line filter would be
> more efficient (for me).

Thanks that's a good suggestion in general. In this case, yes, I am
going to perform more editing.

> On Saturday, September 4, 2021 at 11:23:28 AM UTC-4 Tim Chase wrote:
>
>> On 2021-09-04 14:07, Andreas Perstinger wrote:
>> > Alternatively, without using an external command:
>> >
>> > :%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_
>>
>> This is much better than the suggestion I gave, keeping it all
>> internal to vim. To clean it up, I'd tweak it to
>>
>> :%s/\[\zs\d\+\ze\]/\=strftime("%c", submatch(0))

Learning Vim is a never-ending experience: I didn't know (or remember)
about submatch()!

Can you explain why \zs... \ze is to be preferred to capturing with \(
and \)?

Thanks,
Life.

--
--
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/sh0ep4%24q6g%241%40ciao.gmane.io.

Re: How to replace pattern with shell command's output using matched pattern

I'm just curious, is the file being otherwise edited in vim?  I usually just use less to view logs, in which case, a command line filter would be more efficient (for me).

If you're writing a report, makes sense to keep it in vim.

On Saturday, September 4, 2021 at 11:23:28 AM UTC-4 Tim Chase wrote:
On 2021-09-04 14:07, Andreas Perstinger wrote:
> Alternatively, without using an external command:
>
> :%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_

This is much better than the suggestion I gave, keeping it all
internal to vim. To clean it up, I'd tweak it to

:%s/\[\zs\d\+\ze\]/\=strftime("%c", submatch(0))

-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 on the web visit https://groups.google.com/d/msgid/vim_use/bc644ff5-e96a-4204-be18-24bc1c70b90cn%40googlegroups.com.

Re: How to replace pattern with shell command's output using matched pattern

On 2021-09-04 14:07, Andreas Perstinger wrote:
> Alternatively, without using an external command:
>
> :%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_

This is much better than the suggestion I gave, keeping it all
internal to vim. To clean it up, I'd tweak it to

:%s/\[\zs\d\+\ze\]/\=strftime("%c", submatch(0))

-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 on the web visit https://groups.google.com/d/msgid/vim_use/20210904102320.26dc731f%40bigbox.attlocal.net.

vim terminal normal mode place cursor with ?

Hi,

Inside a terminal in vim, when the terminal is in normal mode,
I cannot seem to place the cursor where I left click with the mouse.
I have mouse=a and this works fine in vim when not in a vim-terminal.
A double-click in the vim-terminal in normal mode selects a word but not where I clicked but where the cursor is/was.
Is there a mapping or setting to allow placing the cursor where the click was when inside a vim-terminal in normal mode ?

thx for all things vim,
-m

--
--
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/136ade58-0a3a-4362-902b-722963f52d04n%40googlegroups.com.

Re: How to replace pattern with shell command's output using matched pattern

On 2021-09-04 09:15, Lifepillar wrote:
> Use case at hand: replace Unix timestamps with date/time in a log
> file:
>
> [1630720618] unbound[63495:0] info: 127.0.0.1 foo.bar.com AAAA IN
> [1630720618] unbound[63495:1] info: 127.0.0.1 foo.bar.com A IN
> ...
>
> The shell command I'd apply is `date -r <timestamp>`. How would you
> perform the substitution?
>
> The desired output is:
>
> [Sat Sep 4 03:56:58 CEST 2021] unbound[63495:0] info: 127.0.0.1
> foo.bar.com AAAA IN [Sat Sep 4 03:56:58 CEST 2021]
> unbound[63495:1] info: 127.0.0.1 foo.bar.com A IN ...

This should do the trick

%s/\[\zs\d\+\ze\]/\=substitute(system('date -r '.submatch(0)), '\n',
'', '')

It took a bit of testing to get right since GNU `date` expects a file
for -r where FreeBSD `date` uses it like you wanted, so I had to test
on the right OS. :-)

It's not particularly speedy, so if you have thousands of them, you're
invoking a command for every single one of them, but it's vastly
faster than doing each by hand.

It should also allow you to alter the format if you prefer (some
shell commands mung "%" with the current filename, but in this case,
system() doesn't, so you're safe)

-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 on the web visit https://groups.google.com/d/msgid/vim_use/20210904080843.46ddb91d%40bigbox.attlocal.net.

Re: How to replace pattern with shell command's output using matched pattern

On 04.09.21 11:15, Lifepillar wrote:
> Use case at hand: replace Unix timestamps with date/time in a log file:
>
> [1630720618] unbound[63495:0] info: 127.0.0.1 foo.bar.com AAAA IN
> [1630720618] unbound[63495:1] info: 127.0.0.1 foo.bar.com A IN
> ...
>
> The shell command I'd apply is `date -r <timestamp>`. How would you
> perform the substitution?

:%s_^\[\(\d\+\)_\="[" . systemlist("date -r " . submatch(1))[0]_

Alternatively, without using an external command:

:%s_^\[\(\d\+\)_\="[" . strftime("%c", submatch(1))_

Bye, Andreas

--
--
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/ceb43426-f262-ff90-3847-58e4205d9161%40gmail.com.

How to replace pattern with shell command's output using matched pattern

Use case at hand: replace Unix timestamps with date/time in a log file:

[1630720618] unbound[63495:0] info: 127.0.0.1 foo.bar.com AAAA IN
[1630720618] unbound[63495:1] info: 127.0.0.1 foo.bar.com A IN
...

The shell command I'd apply is `date -r <timestamp>`. How would you
perform the substitution?

The desired output is:

[Sat Sep 4 03:56:58 CEST 2021] unbound[63495:0] info: 127.0.0.1 foo.bar.com AAAA IN
[Sat Sep 4 03:56:58 CEST 2021] unbound[63495:1] info: 127.0.0.1 foo.bar.com A IN
...

Thanks,
Life.

--
--
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/sgvdf3%2413g6%241%40ciao.gmane.io.

Friday, September 3, 2021

Prob: won't run tty vim on windows

The version listed below won't run inside a TTY.

Have tried "SecureCRT" (30 day free trial) that I've used for
many years, and tried "xterm" (runs via "X11").
SecureCRT can be setup to ssh back into localhost, or
you can setup rsh/rlogin to only allow login from localhost
(which is what i do).

With both I get:

> /prog64/vim/current/vim
Vim: Error: This version of Vim does not run in a Cygwin terminal

Any idea why it thinks everything is a cygwin terminal?

What terminal emulators does it work with on windows?

Maybe this related to it not working w/24-bit color?





Version info:
/prog64/vim/current/vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 23 2021 22:02:48)
MS-Windows 64-bit console version
Included patches: 1-2803
Compiled by appveyor@APPVYR-WIN
Huge version without GUI. Features included (+) or not (-):
+acl +ex_extra +multi_lang +tcl/dyn
+arabic +extra_search +mzscheme/dyn +termguicolors
+autocmd -farsi -netbeans_intg +terminal
+autochdir +file_in_path +num64 -termresponse
+autoservername +find_in_path +packages +textobjects
-balloon_eval +float +path_extra +textprop
+balloon_eval_term +folding +perl/dyn -tgetent
-browse -footer +persistent_undo +timers
++builtin_terms +gettext/dyn +popupwin +title
+byte_offset -hangul_input -postscript -toolbar
+channel +iconv/dyn +printer +user_commands
+cindent +insert_expand +profile +vartabs
+clientserver +ipv6 +python/dyn +vertsplit
+clipboard +job +python3/dyn +virtualedit
+cmdline_compl +jumplist +quickfix +visual
+cmdline_hist +keymap +reltime +visualextra
+cmdline_info +lambda +rightleft +viminfo
+comments +langmap +ruby/dyn +vreplace
+conceal +libcall +scrollbind +vtp
+cryptv +linebreak +signs +wildignore
+cscope +lispindent +smartindent +wildmenu
+cursorbind +listcmds +sound +windows
+cursorshape +localmap +spell +writebackup
+dialog_con +lua/dyn +startuptime -xfontset
+diff +menu +statusline -xim
+digraphs +mksession -sun_workshop -xpm_w32
-dnd +modify_fname +syntax -xterm_save
-ebcdic +mouse +tag_binary
+emacs_tags -mouseshape -tag_old_static
+eval +multi_byte_ime/dyn -tag_any_white
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
2nd user vimrc file: "$HOME\vimfiles\vimrc"
3rd user vimrc file: "$VIM\_vimrc"
user exrc file: "$HOME\_exrc"
2nd user exrc file: "$VIM\_exrc"
defaults file: "$VIMRUNTIME\defaults.vim"
Compilation: cl -c /W3 /GF /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32
-DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_SOUND -DFEAT_JOB_CHANNEL
-DFEAT_IPV6 -DWINVER=0x0501 -D_WIN32_WINNT=0x0501
/source-charset:utf-8 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG /Zl /MT
/D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DFEAT_MBYTE_IME
-DDYNAMIC_IME -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL
-DDYNAMIC_TCL_DLL=\"tcl86t.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA
-DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON
-DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3
-DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python39.dll\" -DFEAT_MZSCHEME
-I "C:\Program Files\Racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME
-DDYNAMIC_MZSCH_DLL=\"libracket3m_a36fs8.dll\"
-DDYNAMIC_MZGC_DLL=\"libracket3m_a36fs8.dll\" -DFEAT_PERL
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL
-DDYNAMIC_PERL_DLL=\"perl528.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY
-DDYNAMIC_RUBY_DLL=\"x64-msvcrt-ruby240.dll\" -DRUBY_VERSION=24
-DFEAT_HUGE /Fd.\ObjCULYHTRZAMD64/ /Zi
Linking: link /nologo /opt:ref /LTCG:STATUS oldnames.lib kernel32.lib
advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib netapi32.lib
uuid.lib /machine:AMD64 libcmt.lib user32.lib
/nodefaultlib:lua53.lib /STACK:8388608 /nodefaultlib:python27.lib
/nodefaultlib:python39.lib "C:\Tcl\lib\tclstub86.lib" winmm.lib
WSock32.lib Ws2_32.lib /PDB:vim.pdb -debug


--
--
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/61322E80.9010700%40tlinx.org.

Re: repost in new thread...how does Vim open a TTY window?

On 2021/08/18 11:43, Bram Moolenaar wrote:
>> Does vim do it's own TTY / terminal extension, or does it use the one
>> in Win10.
>>
> What do you mean with "terminal extension"? Vim runs in the console,
> can use the Windows terminal and also has a built-in terminal emulator.
>
----
Sorry I meant the graphical version of vim -- gvim.
This came out of the note entitled
"RedHat Athena: GUI vim is extremely slow using terminal"
by "Aleksandr Jakušev", date+time 2021/05/07 07:57(PDT).

He said the new ":term" function in Gvim_v8 (wasn't in V7) was
really slow, example: ":term ls -l" takes several minutes to run.

I couldn't try to repeat his problem at the time because I still
was running gvim 7.x on my linx at the time.

Anyway, got that upgraded and realized I could also use the
gvim running natively on Windows as it was also at 8.2.2803.
(running on linux, displaying on Windows).
>> I.e. I thought someone said they didn't think it would work under
>> Win7?
>>
> The Windows terminal is not available in Windows 7.
>
yeah, but the gvim ":term" feature doesn't use the Windows
terminal feature, so it works regardless.

What I notice as a bit 'odd' is that the emulated
terminal feature set isn't consistent. For example,
I have a shellscript to show 24-bit color (attached).
The native Win version, _maybe_ has 256 colors at most.
but definitely not 24-bit:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 23 2021 22:01:55)
MS-Windows 64-bit GUI version with OLE support
Included patches: 1-2803
Compiled by appveyor@APPVYR-WIN
Huge version with GUI.


But in the Cygwin version:
VIM - Vi IMproved 8.2.486
Mod+compiled by <cygwin@cygwin.com>
Huge version with GTK3 GUI.

as well as a linux version(s) (displayed on same cygwin-X):
Vim 8.2.3204
Compiled by 'http://www.opensuse.org/'
Huge version with GTK3 GUI.

24-bit color fully works and is fast!

Why would vim's terminal emulation be different and
less capable using native Win calls, vs.
when it's displayed via 'X'?












--
--
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/61321612.7040201%40tlinx.org.

Re: how to replace very slow html/css syntax plugin

On Do, 02 Sep 2021, Eike Rathke wrote:

> Hi,
>
> On Thursday, 2021-09-02 16:44:45 +0200, Christian Brabandt wrote:
>
> > Does fedora really ship
> > https://github.com/skammer/vim-css-color/blob/master/after/syntax/css.vim
> > as default css syntax plugin?
>
> No, the default is the https://github.com/jsit/css.vim one that
> redirects to https://github.com/vim-language-dept/css-syntax.vim and is
> the same as
> https://github.com/vim/vim/blob/master/runtime/syntax/css.vim you
> mentioned.
>
> There's an additional package vim-syntastic-css of
> https://github.com/vim-syntastic/syntastic that "runs files through
> external syntax checkers and displays any resulting errors", maybe
> that's installed and could explain some slowness.
>
> The skammer plugin was mentioned by the OP only because they just
> happened to have come across it on the net (citing from
> https://github.com/vim/vim/issues/8825 "As I was searching around found
> this with more or less the same problem").

Ah okay, makes sense. However, looking at the profile from
https://github.com/vim/vim/issues/8825

FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
294 1.590729 0.847627 67_Rgb2xterm()
224910 0.743102 67_pow()
2599 0.032777 67_PreviewCSSColorInLine()
147 1.598205 0.005605 67_SetNamedColor()
255 0.004275 67_Xterm2rgb()
147 0.001871 67_FGforBG()
3 0.000565 60_AddITags()
2 0.000613 0.000549 8_LoadFTPlugin()
1 0.000445 56_define_commands()
2 3.323722 0.000407 3_SynSet()
1 0.000316 0.000271 14_EchoFuncInitialize()
2 0.000208 HtmlIndent_CheckUserSettings()
2 0.000183 56_Map()
1 0.000220 0.000172 FugitiveExtractGitDir()
1 1.665048 0.000166 dist#ft#FThtml()
2 0.002720 0.000149 10_LoadIndent()
1 0.000215 0.000144 fugitive#Find()
1 0.000184 0.000099 56_TempReadPre()
5 0.000091 60_AddBlockTag()
1 0.001002 0.000084 fugitive#Init()

That indicates that script 67 in the output of `:scriptnames` is causing
some slowdown. So to the OP: please show the output of :scriptnames or
better, even use :67scriptnames and show the top of the file.

That function is not in the default syntax plugin for css files, so it
must come from somewhere else.

If that is causing problems, you might want to disable that script (or
delete it if you do not need it). Looks to me like some kind of
un-needed plugin that can be disabled and then Vim should be performant
again :)

Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Eugen Sinn

--
--
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/20210903071922.GC1795913%40256bit.org.

Thursday, September 2, 2021

Re: how to replace very slow html/css syntax plugin

Hi,

On Thursday, 2021-09-02 16:44:45 +0200, Christian Brabandt wrote:

> Does fedora really ship
> https://github.com/skammer/vim-css-color/blob/master/after/syntax/css.vim
> as default css syntax plugin?

No, the default is the https://github.com/jsit/css.vim one that
redirects to https://github.com/vim-language-dept/css-syntax.vim and is
the same as
https://github.com/vim/vim/blob/master/runtime/syntax/css.vim you
mentioned.

There's an additional package vim-syntastic-css of
https://github.com/vim-syntastic/syntastic that "runs files through
external syntax checkers and displays any resulting errors", maybe
that's installed and could explain some slowness.

The skammer plugin was mentioned by the OP only because they just
happened to have come across it on the net (citing from
https://github.com/vim/vim/issues/8825 "As I was searching around found
this with more or less the same problem").

Eike

--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/

--
--
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/YTE5EgC6U8Us2BLg%40kulungile.erack.de.