i have a script that adds numbers in a text module that uses
getline() to grab
data, then uses
--
--
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/CALfSX1z8yzKsiBs5QMFdAVvcMm%3DEVYnHjZ4xQgKKy87jg15ecg%40mail.gmail.com.
Friday, July 31, 2020
Strange behavior of vim-kolor with Markdown
Hello, all
I have a problem with the beautiful vim-kolor plugin, and am
posting my question here because the plugin author seems to
have set up the Github project not to accept any issues:
https://github.com/zeis/vim-kolor
Maybe you can help.
While editing a markdown file (*.md) in GVim with the
following vimrc:
set encoding=utf8
let g:kolor_italic=0
let g:kolor_bold=0
colorscheme kolor
syntax enable
filetype plugin on
set guifont=PxPlus IBM VGA8:h24
italic font style is used for *emphasis* even though it is
disabled in the vimrc. When, however, I explicitely invoke
`:colo kolor', the italic style is turned off. Futhermore,
an explicit invocation of `:colo kolor' turns off italic
even if it is not disabled in vimrc. But the bold style
setting (g:kolor_bold) is respected. This bug (if bug it
is) occurs with .md files, but not with vimrc, so I don't
even know whether it is in the vim-kolor plugin or the
markdown syntax definition...
Is anybody else using this plugin and observing the same
issue?
--
Please, do not forward replies to the list to my e-mail.
--
--
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/20200731121119.de2e6278d763ae5e34eabe09%40gmail.com.
I have a problem with the beautiful vim-kolor plugin, and am
posting my question here because the plugin author seems to
have set up the Github project not to accept any issues:
https://github.com/zeis/vim-kolor
Maybe you can help.
While editing a markdown file (*.md) in GVim with the
following vimrc:
set encoding=utf8
let g:kolor_italic=0
let g:kolor_bold=0
colorscheme kolor
syntax enable
filetype plugin on
set guifont=PxPlus IBM VGA8:h24
italic font style is used for *emphasis* even though it is
disabled in the vimrc. When, however, I explicitely invoke
`:colo kolor', the italic style is turned off. Futhermore,
an explicit invocation of `:colo kolor' turns off italic
even if it is not disabled in vimrc. But the bold style
setting (g:kolor_bold) is respected. This bug (if bug it
is) occurs with .md files, but not with vimrc, so I don't
even know whether it is in the vim-kolor plugin or the
markdown syntax definition...
Is anybody else using this plugin and observing the same
issue?
--
Please, do not forward replies to the list to my e-mail.
--
--
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/20200731121119.de2e6278d763ae5e34eabe09%40gmail.com.
Wednesday, July 29, 2020
Error in bash syntax file
The following line of legal bash code gets flagged as an error:
echo ${@:i:1}
The above line displays the i'th command line argument.
I am running vim 8.1, with lots of patches applied. My sh.vim files (3 of them) are all dated Jun 15, 2019.
--
--
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/362297683.6459386.1596059832744%40mail.yahoo.com.
echo ${@:i:1}
The above line displays the i'th command line argument.
I am running vim 8.1, with lots of patches applied. My sh.vim files (3 of them) are all dated Jun 15, 2019.
--
--
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/362297683.6459386.1596059832744%40mail.yahoo.com.
Monday, July 27, 2020
Re: Opening files in a certain pattern [follow-up]
On Mon, Jul 27, 2020 at 06:50:02PM -0500, Tim Chase wrote:
> On 2020-07-27 18:32, Tim Chase wrote:
> > You might try something like this:
> >
> > $ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp
> > ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L",
> > "/A", "")' dir1/*
>
> Apparently the "tabpagemax" doesn't get set until after Vim has
> opened the args in each tab, so this doesn't work for n>10. So you
> have to do the splitting after changing 'tabpagemax'. I had better
> luck with this
>
> $ vim -c 'set tabpagemax=50' -c 'args dir1/*' -c 'argdo tabe %' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")'
>
> It does open one extra window, but seems to work better than the
> previous one.
>
Can we use `--cmd` instead of `-c` as according to manpage:
--cmd Like using "-c", but the command is executed just before processing any vimrc file.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200728001231.j7yaco7c3u4nypg7%40nitro-5.
> On 2020-07-27 18:32, Tim Chase wrote:
> > You might try something like this:
> >
> > $ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp
> > ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L",
> > "/A", "")' dir1/*
>
> Apparently the "tabpagemax" doesn't get set until after Vim has
> opened the args in each tab, so this doesn't work for n>10. So you
> have to do the splitting after changing 'tabpagemax'. I had better
> luck with this
>
> $ vim -c 'set tabpagemax=50' -c 'args dir1/*' -c 'argdo tabe %' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")'
>
> It does open one extra window, but seems to work better than the
> previous one.
>
Can we use `--cmd` instead of `-c` as according to manpage:
--cmd Like using "-c", but the command is executed just before processing any vimrc file.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200728001231.j7yaco7c3u4nypg7%40nitro-5.
Re: Opening files in a certain pattern [follow-up]
On 2020-07-27 18:32, Tim Chase wrote:
> You might try something like this:
>
> $ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp
> ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L",
> "/A", "")' dir1/*
Apparently the "tabpagemax" doesn't get set until after Vim has
opened the args in each tab, so this doesn't work for n>10. So you
have to do the splitting after changing 'tabpagemax'. I had better
luck with this
$ vim -c 'set tabpagemax=50' -c 'args dir1/*' -c 'argdo tabe %' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")'
It does open one extra window, but seems to work better than the
previous one.
-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/20200727185002.67fa0cf9%40bigbox.attlocal.net.
> You might try something like this:
>
> $ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp
> ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L",
> "/A", "")' dir1/*
Apparently the "tabpagemax" doesn't get set until after Vim has
opened the args in each tab, so this doesn't work for n>10. So you
have to do the splitting after changing 'tabpagemax'. I had better
luck with this
$ vim -c 'set tabpagemax=50' -c 'args dir1/*' -c 'argdo tabe %' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")'
It does open one extra window, but seems to work better than the
previous one.
-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/20200727185002.67fa0cf9%40bigbox.attlocal.net.
Re: Opening files in a certain pattern
On Mon, Jul 27, 2020 at 06:32:01PM -0500, Tim Chase wrote:
> You might try something like this:
>
> $ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")' dir1/*
>
> (there's a space after the "vsp" in case mail between here and there
> decides to eat it)
>
> By default 'tabpagemax' is 10, so you don't need to change that to
> 50 if you have 10 or fewer files. Just set it to the number of files
> you have. The "-p" then opens each dir1/L*.md file in its own tab
> (they're specified on the command-line). It then iterates over each
> of those tabs (tabdo), transforms the current filename into its mate's
> filename (s/dir1/dir2/ and s@/L@/A@) and builds an command to
> vertically split (vsp) as a string, and then :exec's it to do the
> actual vertical split in each tab.
>
> -tim
>
I am sorry, I missed your mail by a minute. That command works
beautifully. I tried it on my directory structure and works.
Thanks everyone for help!
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200727234153.o2vqs3sg3ilqef62%40nitro-5.
> You might try something like this:
>
> $ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")' dir1/*
>
> (there's a space after the "vsp" in case mail between here and there
> decides to eat it)
>
> By default 'tabpagemax' is 10, so you don't need to change that to
> 50 if you have 10 or fewer files. Just set it to the number of files
> you have. The "-p" then opens each dir1/L*.md file in its own tab
> (they're specified on the command-line). It then iterates over each
> of those tabs (tabdo), transforms the current filename into its mate's
> filename (s/dir1/dir2/ and s@/L@/A@) and builds an command to
> vertically split (vsp) as a string, and then :exec's it to do the
> actual vertical split in each tab.
>
> -tim
>
I am sorry, I missed your mail by a minute. That command works
beautifully. I tried it on my directory structure and works.
Thanks everyone for help!
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200727234153.o2vqs3sg3ilqef62%40nitro-5.
Re: Opening files in a certain pattern
On Mon, Jul 27, 2020 at 04:19:06PM -0700, Gary Johnson wrote:
> On 2020-07-28, Manas wrote:
> > On Mon, Jul 27, 2020 at 03:08:49PM -0700, Gary Johnson wrote:
> > > How's this for a start? The number n here is fixed, but you could
> > > use a while loop instead of the for loop, increment n in each
> > > iteration, and break when one of the files doesn't exist. See
> > > ":help filereadable()".
> > >
> > > let n = 4
> > > for i in range(n)
> > > exe "tabnew" printf("dir2/A%d.md", i)
> > > exe "vnew" printf("dir1/L%d.md", i)
> > > endfor
> > >
> > That is the idea which I was thinking but opening other windows (after
> > the first one) is giving me troubles.
>
> If it's still giving you troubles, you could post here what you have
> and we could perhaps find the problem. If you do that, please be
> specific about what you mean by giving you troubles.
>
I found `:tabl` which will take me to last tab. So I come up with
opening first 2 panes in starting window as:
$ vim -O2 dir1/L1.md dir2/A1.md
And for opening next 2 panes in new tab after the first tab, first I
opened one file using tab sp and then going to that tab using tabl,
and then vertical splitting second file from dir2. The final command
looked like this:
$ vim -O2 dir1/L1.md dir2/A1.md -c "tab sp dir1/L2.md" -c "tabl" -c "vsp
dir2/A2.md"
It works for me. And I can generate that command in shell script.
Can there be some improvement upon this?
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200727233330.wljctxf6fisagkmw%40nitro-5.
> On 2020-07-28, Manas wrote:
> > On Mon, Jul 27, 2020 at 03:08:49PM -0700, Gary Johnson wrote:
> > > How's this for a start? The number n here is fixed, but you could
> > > use a while loop instead of the for loop, increment n in each
> > > iteration, and break when one of the files doesn't exist. See
> > > ":help filereadable()".
> > >
> > > let n = 4
> > > for i in range(n)
> > > exe "tabnew" printf("dir2/A%d.md", i)
> > > exe "vnew" printf("dir1/L%d.md", i)
> > > endfor
> > >
> > That is the idea which I was thinking but opening other windows (after
> > the first one) is giving me troubles.
>
> If it's still giving you troubles, you could post here what you have
> and we could perhaps find the problem. If you do that, please be
> specific about what you mean by giving you troubles.
>
I found `:tabl` which will take me to last tab. So I come up with
opening first 2 panes in starting window as:
$ vim -O2 dir1/L1.md dir2/A1.md
And for opening next 2 panes in new tab after the first tab, first I
opened one file using tab sp and then going to that tab using tabl,
and then vertical splitting second file from dir2. The final command
looked like this:
$ vim -O2 dir1/L1.md dir2/A1.md -c "tab sp dir1/L2.md" -c "tabl" -c "vsp
dir2/A2.md"
It works for me. And I can generate that command in shell script.
Can there be some improvement upon this?
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200727233330.wljctxf6fisagkmw%40nitro-5.
Re: Opening files in a certain pattern
On 2020-07-28 02:56, Manas wrote:
> Hi, I have 2 directories, supposedly dir1 and dir2. And both of them
> contains equal number of files (say n each) which are named in the
> following fashion:
> - In dir1: All files are named as L1.md, L2.md, ...., Ln.md
> - In dir2: All files are named as A1.md, A2.md, ...., An.md
>
> How can I open all of those files such that each window contains two
> vertically-split panes namely, Lx.md and Ax.md (where x is any
> number) and they open in n-different windows?
>
> First I was thinking of writing a bash script to open but I got
> stuck at the initial step of finding the appropriate Vim command to
> open two files in a new tab and in vertically-split panes from Ex
> mode (as I would have passed this command using -c flag from my
> script).
You might try something like this:
$ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")' dir1/*
(there's a space after the "vsp" in case mail between here and there
decides to eat it)
By default 'tabpagemax' is 10, so you don't need to change that to
50 if you have 10 or fewer files. Just set it to the number of files
you have. The "-p" then opens each dir1/L*.md file in its own tab
(they're specified on the command-line). It then iterates over each
of those tabs (tabdo), transforms the current filename into its mate's
filename (s/dir1/dir2/ and s@/L@/A@) and builds an command to
vertically split (vsp) as a string, and then :exec's it to do the
actual vertical split in each tab.
-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/20200727183201.41f492e8%40bigbox.attlocal.net.
> Hi, I have 2 directories, supposedly dir1 and dir2. And both of them
> contains equal number of files (say n each) which are named in the
> following fashion:
> - In dir1: All files are named as L1.md, L2.md, ...., Ln.md
> - In dir2: All files are named as A1.md, A2.md, ...., An.md
>
> How can I open all of those files such that each window contains two
> vertically-split panes namely, Lx.md and Ax.md (where x is any
> number) and they open in n-different windows?
>
> First I was thinking of writing a bash script to open but I got
> stuck at the initial step of finding the appropriate Vim command to
> open two files in a new tab and in vertically-split panes from Ex
> mode (as I would have passed this command using -c flag from my
> script).
You might try something like this:
$ vim -p -c 'set tabpagemax=50' -c 'tabdo exec "vsp ".substitute(substitute(expand("%"),"dir1", "dir2", ""), "/L", "/A", "")' dir1/*
(there's a space after the "vsp" in case mail between here and there
decides to eat it)
By default 'tabpagemax' is 10, so you don't need to change that to
50 if you have 10 or fewer files. Just set it to the number of files
you have. The "-p" then opens each dir1/L*.md file in its own tab
(they're specified on the command-line). It then iterates over each
of those tabs (tabdo), transforms the current filename into its mate's
filename (s/dir1/dir2/ and s@/L@/A@) and builds an command to
vertically split (vsp) as a string, and then :exec's it to do the
actual vertical split in each tab.
-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/20200727183201.41f492e8%40bigbox.attlocal.net.
Re: Opening files in a certain pattern
On 2020-07-28, Manas wrote:
> On Mon, Jul 27, 2020 at 03:08:49PM -0700, Gary Johnson wrote:
> > How's this for a start? The number n here is fixed, but you could
> > use a while loop instead of the for loop, increment n in each
> > iteration, and break when one of the files doesn't exist. See
> > ":help filereadable()".
> >
> > let n = 4
> > for i in range(n)
> > exe "tabnew" printf("dir2/A%d.md", i)
> > exe "vnew" printf("dir1/L%d.md", i)
> > endfor
> >
> That is the idea which I was thinking but opening other windows (after
> the first one) is giving me troubles.
If it's still giving you troubles, you could post here what you have
and we could perhaps find the problem. If you do that, please be
specific about what you mean by giving you troubles.
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/20200727231905.GD7280%40phoenix.
> On Mon, Jul 27, 2020 at 03:08:49PM -0700, Gary Johnson wrote:
> > How's this for a start? The number n here is fixed, but you could
> > use a while loop instead of the for loop, increment n in each
> > iteration, and break when one of the files doesn't exist. See
> > ":help filereadable()".
> >
> > let n = 4
> > for i in range(n)
> > exe "tabnew" printf("dir2/A%d.md", i)
> > exe "vnew" printf("dir1/L%d.md", i)
> > endfor
> >
> That is the idea which I was thinking but opening other windows (after
> the first one) is giving me troubles.
If it's still giving you troubles, you could post here what you have
and we could perhaps find the problem. If you do that, please be
specific about what you mean by giving you troubles.
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/20200727231905.GD7280%40phoenix.
Re: Opening files in a certain pattern
On Mon, Jul 27, 2020 at 03:08:49PM -0700, Gary Johnson wrote:
> How's this for a start? The number n here is fixed, but you could
> use a while loop instead of the for loop, increment n in each
> iteration, and break when one of the files doesn't exist. See
> ":help filereadable()".
>
> let n = 4
> for i in range(n)
> exe "tabnew" printf("dir2/A%d.md", i)
> exe "vnew" printf("dir1/L%d.md", i)
> endfor
>
That is the idea which I was thinking but opening other windows (after
the first one) is giving me troubles.
> > First I was thinking of writing a bash script to open but I got stuck at
> > the initial step of finding the appropriate Vim command to open two
> > files in a new tab and in vertically-split panes from Ex mode (as I would
> > have passed this command using -c flag from my script).
>
> vim -c "tabnew dir2/A${n}.md" -c "vnew dir1/L${n}.md"
>
> That's the general idea, but probably not what you want finally as
> it opens only one vim instance and only one pair of files.
>
That's right. Also the above command actually opens an empty buffer also.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200727225741.4l6so2wi27upohf3%40nitro-5.
> How's this for a start? The number n here is fixed, but you could
> use a while loop instead of the for loop, increment n in each
> iteration, and break when one of the files doesn't exist. See
> ":help filereadable()".
>
> let n = 4
> for i in range(n)
> exe "tabnew" printf("dir2/A%d.md", i)
> exe "vnew" printf("dir1/L%d.md", i)
> endfor
>
That is the idea which I was thinking but opening other windows (after
the first one) is giving me troubles.
> > First I was thinking of writing a bash script to open but I got stuck at
> > the initial step of finding the appropriate Vim command to open two
> > files in a new tab and in vertically-split panes from Ex mode (as I would
> > have passed this command using -c flag from my script).
>
> vim -c "tabnew dir2/A${n}.md" -c "vnew dir1/L${n}.md"
>
> That's the general idea, but probably not what you want finally as
> it opens only one vim instance and only one pair of files.
>
That's right. Also the above command actually opens an empty buffer also.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200727225741.4l6so2wi27upohf3%40nitro-5.
Re: Opening files in a certain pattern
On 2020-07-28, Manas wrote:
> Hi, I have 2 directories, supposedly dir1 and dir2. And both of them
> contains equal number of files (say n each) which are named in the
> following fashion:
> - In dir1: All files are named as L1.md, L2.md, ...., Ln.md
> - In dir2: All files are named as A1.md, A2.md, ...., An.md
>
> How can I open all of those files such that each window contains two
> vertically-split panes namely, Lx.md and Ax.md (where x is any number)
> and they open in n-different windows?
How's this for a start? The number n here is fixed, but you could
use a while loop instead of the for loop, increment n in each
iteration, and break when one of the files doesn't exist. See
":help filereadable()".
let n = 4
for i in range(n)
exe "tabnew" printf("dir2/A%d.md", i)
exe "vnew" printf("dir1/L%d.md", i)
endfor
> First I was thinking of writing a bash script to open but I got stuck at
> the initial step of finding the appropriate Vim command to open two
> files in a new tab and in vertically-split panes from Ex mode (as I would
> have passed this command using -c flag from my script).
vim -c "tabnew dir2/A${n}.md" -c "vnew dir1/L${n}.md"
That's the general idea, but probably not what you want finally as
it opens only one vim instance and only one pair of files.
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/20200727220849.GC7280%40phoenix.
> Hi, I have 2 directories, supposedly dir1 and dir2. And both of them
> contains equal number of files (say n each) which are named in the
> following fashion:
> - In dir1: All files are named as L1.md, L2.md, ...., Ln.md
> - In dir2: All files are named as A1.md, A2.md, ...., An.md
>
> How can I open all of those files such that each window contains two
> vertically-split panes namely, Lx.md and Ax.md (where x is any number)
> and they open in n-different windows?
How's this for a start? The number n here is fixed, but you could
use a while loop instead of the for loop, increment n in each
iteration, and break when one of the files doesn't exist. See
":help filereadable()".
let n = 4
for i in range(n)
exe "tabnew" printf("dir2/A%d.md", i)
exe "vnew" printf("dir1/L%d.md", i)
endfor
> First I was thinking of writing a bash script to open but I got stuck at
> the initial step of finding the appropriate Vim command to open two
> files in a new tab and in vertically-split panes from Ex mode (as I would
> have passed this command using -c flag from my script).
vim -c "tabnew dir2/A${n}.md" -c "vnew dir1/L${n}.md"
That's the general idea, but probably not what you want finally as
it opens only one vim instance and only one pair of files.
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/20200727220849.GC7280%40phoenix.
Re: Opening files in a certain pattern
Hi, I have 2 directories, supposedly dir1 and dir2. And both of them
contains equal number of files (say n each) which are named in the
following fashion:
- In dir1: All files are named as L1.md, L2.md, ...., Ln.md
- In dir2: All files are named as A1.md, A2.md, ...., An.md
How can I open all of those files such that each window contains two
vertically-split panes namely, Lx.md and Ax.md (where x is any number)
and they open in n-different windows?
First I was thinking of writing a bash script to open but I got stuck at
the initial step of finding the appropriate Vim command to open two
files in a new tab and in vertically-split panes from Ex mode (as I would
have passed this command using -c flag from my script).
Thanks
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200727212604.gwjniqrrvsk6ipd3%40nitro-5.
contains equal number of files (say n each) which are named in the
following fashion:
- In dir1: All files are named as L1.md, L2.md, ...., Ln.md
- In dir2: All files are named as A1.md, A2.md, ...., An.md
How can I open all of those files such that each window contains two
vertically-split panes namely, Lx.md and Ax.md (where x is any number)
and they open in n-different windows?
First I was thinking of writing a bash script to open but I got stuck at
the initial step of finding the appropriate Vim command to open two
files in a new tab and in vertically-split panes from Ex mode (as I would
have passed this command using -c flag from my script).
Thanks
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200727212604.gwjniqrrvsk6ipd3%40nitro-5.
Sunday, July 26, 2020
Re: How can I find where one word is close to another word?
Tim,
-- I haven't tried your code, yet, but I was wondering about this followup:
Would it be possible to essentially parametrize your command in vimrc, so that I could do something like this?
/ps/firstword/secondword/distance
I'm using 'ps' for 'proximity search', but if that's already a taken command, we'd have to make it something else.
Many thanks for your help!
Cheers,
Adrian
On Saturday, July 25, 2020 at 8:41:55 PM UTC-5, Tim Chase wrote:
On Saturday, July 25, 2020 at 8:41:55 PM UTC-5, Tim Chase wrote:
On 2020-07-25 17:54, Adrian Keister wrote:
> There's an answer on the Stack Exchange site. Does that method work
> also?
That method finds only the case in which you have "aid" *followed by*
"country", so if you have
"This country needs all good men to come to her aid."
it won't find that even though "country" and "aid" are within 10
words of each other.
You might recognize that it's pretty similar to the first half of my
2nd answer: "term1(N optional words)term2" which I then swap around
with "or term2(N optional words)term1".
So if you only need "X with Y following it within N words", that's
an easy solution. If you need to allow for arbitrary ordering of the
words, you need a bit more such as either of my suggestions.
-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/b24310f6-98e1-44a1-b35a-cbeedc810de2o%40googlegroups.com.
Re: How can I find where one word is close to another word?
On 2020-07-25, Adrian Keister <ackbeet@gmail.com> wrote:
>
>
> As most people on this forum are likely aware, searching for a word is
> straight-forward enough. If I want to find occurrences of the word 'arc', I
> can type / arc , with spaces around the three letters, to find basic
> occurrences of the word (ignoring punctuation). But suppose I want to find
> where two words are close together, say, within ten words? Here's an
> example:
>
> Now is the time for all good men to come to the aid of their country.
>
> In this test, I want to find all occurrences where the word 'aid' is within
> ten words of the word 'country'. How can I do that in Vim?
Another idea, based on \%V (see `:help %V`):
1. Search for some text, e.g.:
/country<Enter>
2. Move back the desired amount, e.g., 10 WORDS:
10B
3. Visually select the range to be searched, e.g. 20 WORDS:
v20W
4. Return to Normal mode and search within the previously selected range:
<Esc>/\%Vaid
5. To search for the next match, move forward (10W) and repeat.
Putting all that in a couple of macros, you could do:
qa/country<Enter>10Bv20W<Esc>/\%Vaid<Enter>q
qb10W@aq
Now you may type @b repeatedly to perform your search.
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/rfjeu5%24179l%241%40ciao.gmane.io.
>
>
> As most people on this forum are likely aware, searching for a word is
> straight-forward enough. If I want to find occurrences of the word 'arc', I
> can type / arc , with spaces around the three letters, to find basic
> occurrences of the word (ignoring punctuation). But suppose I want to find
> where two words are close together, say, within ten words? Here's an
> example:
>
> Now is the time for all good men to come to the aid of their country.
>
> In this test, I want to find all occurrences where the word 'aid' is within
> ten words of the word 'country'. How can I do that in Vim?
Another idea, based on \%V (see `:help %V`):
1. Search for some text, e.g.:
/country<Enter>
2. Move back the desired amount, e.g., 10 WORDS:
10B
3. Visually select the range to be searched, e.g. 20 WORDS:
v20W
4. Return to Normal mode and search within the previously selected range:
<Esc>/\%Vaid
5. To search for the next match, move forward (10W) and repeat.
Putting all that in a couple of macros, you could do:
qa/country<Enter>10Bv20W<Esc>/\%Vaid<Enter>q
qb10W@aq
Now you may type @b repeatedly to perform your search.
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/rfjeu5%24179l%241%40ciao.gmane.io.
Saturday, July 25, 2020
Re: How can I find where one word is close to another word?
On 2020-07-25 17:54, Adrian Keister wrote:
> There's an answer on the Stack Exchange site. Does that method work
> also?
That method finds only the case in which you have "aid" *followed by*
"country", so if you have
"This country needs all good men to come to her aid."
it won't find that even though "country" and "aid" are within 10
words of each other.
You might recognize that it's pretty similar to the first half of my
2nd answer: "term1(N optional words)term2" which I then swap around
with "or term2(N optional words)term1".
So if you only need "X with Y following it within N words", that's
an easy solution. If you need to allow for arbitrary ordering of the
words, you need a bit more such as either of my suggestions.
-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/20200725204142.7d61ace4%40bigbox.attlocal.net.
> There's an answer on the Stack Exchange site. Does that method work
> also?
That method finds only the case in which you have "aid" *followed by*
"country", so if you have
"This country needs all good men to come to her aid."
it won't find that even though "country" and "aid" are within 10
words of each other.
You might recognize that it's pretty similar to the first half of my
2nd answer: "term1(N optional words)term2" which I then swap around
with "or term2(N optional words)term1".
So if you only need "X with Y following it within N words", that's
an easy solution. If you need to allow for arbitrary ordering of the
words, you need a bit more such as either of my suggestions.
-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/20200725204142.7d61ace4%40bigbox.attlocal.net.
Re: How can I find where one word is close to another word?
Tim,
-- Many thanks!
There's an answer on the Stack Exchange site. Does that method work also?
Cheers.
On Saturday, July 25, 2020 at 6:42:37 PM UTC-5, Tim Chase wrote:
On Saturday, July 25, 2020 at 6:42:37 PM UTC-5, Tim Chase wrote:
On 2020-07-25 15:59, Adrian Keister wrote:
> Now is the time for all good men to come to the aid of their
> country.
>
> In this test, I want to find all occurrences where the word 'aid'
> is within ten words of the word 'country'. How can I do that in Vim?
It's way ugly and requires using the old regex engine[1] (asserted by
the "\%#=1" in the following pattern) to work, but this should do the
trick and be fairly DRY (only requires putting in each term once):
\%#=1\%(\S\+\_s\+\)\{,9}\<aid\>\&\%(\S\+\_s\+\)\{,9}\< country\>
I might have a fenceposting issue where "9" should be "8" or "10",
but it should give you the foundation to mess around. Also, I added
the "\<" and "\>" to anchor the words so you don't find things like
"I said my uncle is a country boy" (finding the "aid" in "said").
Again, season to taste for your own needs.
The cursor lands a little weirdly (especially noticable if you have
syntax highlighting turned on) because it starts from the point at
which "within the next N words you'll find "aid" and within the next N
words you'll also find "country".
Alternatively, if you don't mind typing your literals more than once,
you can do
/\<aid\>\%(\_s\+\S\+\)\{,10}\_s\+\<country\>\|\<country\>\%( \_s\+\S\+\)\{,10}\_s\+\<aid\>
which will highlight a little more neatly at the cost of extra typing.
However, it also doesn't scale as well if you have more than 2 words
because you need to provide every possible ordering. The method at
the top scales easily for however many words you want within an
N-word range.
Hopefully one or the other works well for you.
-tim
[1] For the record, the new regex engine gives me an
E363: pattern uses more memory than 'maxmempattern'
where the old engine works fine.
--
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/48d56df2-d7dc-4a57-9412-158bc1e629fbo%40googlegroups.com.
Re: How can I find where one word is close to another word?
On 2020-07-25 15:59, Adrian Keister wrote:
> Now is the time for all good men to come to the aid of their
> country.
>
> In this test, I want to find all occurrences where the word 'aid'
> is within ten words of the word 'country'. How can I do that in Vim?
It's way ugly and requires using the old regex engine[1] (asserted by
the "\%#=1" in the following pattern) to work, but this should do the
trick and be fairly DRY (only requires putting in each term once):
\%#=1\%(\S\+\_s\+\)\{,9}\<aid\>\&\%(\S\+\_s\+\)\{,9}\<country\>
I might have a fenceposting issue where "9" should be "8" or "10",
but it should give you the foundation to mess around. Also, I added
the "\<" and "\>" to anchor the words so you don't find things like
"I said my uncle is a country boy" (finding the "aid" in "said").
Again, season to taste for your own needs.
The cursor lands a little weirdly (especially noticable if you have
syntax highlighting turned on) because it starts from the point at
which "within the next N words you'll find "aid" and within the next N
words you'll also find "country".
Alternatively, if you don't mind typing your literals more than once,
you can do
/\<aid\>\%(\_s\+\S\+\)\{,10}\_s\+\<country\>\|\<country\>\%(\_s\+\S\+\)\{,10}\_s\+\<aid\>
which will highlight a little more neatly at the cost of extra typing.
However, it also doesn't scale as well if you have more than 2 words
because you need to provide every possible ordering. The method at
the top scales easily for however many words you want within an
N-word range.
Hopefully one or the other works well for you.
-tim
[1] For the record, the new regex engine gives me an
E363: pattern uses more memory than 'maxmempattern'
where the old engine works fine.
--
--
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/20200725184223.312a64f2%40bigbox.attlocal.net.
> Now is the time for all good men to come to the aid of their
> country.
>
> In this test, I want to find all occurrences where the word 'aid'
> is within ten words of the word 'country'. How can I do that in Vim?
It's way ugly and requires using the old regex engine[1] (asserted by
the "\%#=1" in the following pattern) to work, but this should do the
trick and be fairly DRY (only requires putting in each term once):
\%#=1\%(\S\+\_s\+\)\{,9}\<aid\>\&\%(\S\+\_s\+\)\{,9}\<country\>
I might have a fenceposting issue where "9" should be "8" or "10",
but it should give you the foundation to mess around. Also, I added
the "\<" and "\>" to anchor the words so you don't find things like
"I said my uncle is a country boy" (finding the "aid" in "said").
Again, season to taste for your own needs.
The cursor lands a little weirdly (especially noticable if you have
syntax highlighting turned on) because it starts from the point at
which "within the next N words you'll find "aid" and within the next N
words you'll also find "country".
Alternatively, if you don't mind typing your literals more than once,
you can do
/\<aid\>\%(\_s\+\S\+\)\{,10}\_s\+\<country\>\|\<country\>\%(\_s\+\S\+\)\{,10}\_s\+\<aid\>
which will highlight a little more neatly at the cost of extra typing.
However, it also doesn't scale as well if you have more than 2 words
because you need to provide every possible ordering. The method at
the top scales easily for however many words you want within an
N-word range.
Hopefully one or the other works well for you.
-tim
[1] For the record, the new regex engine gives me an
E363: pattern uses more memory than 'maxmempattern'
where the old engine works fine.
--
--
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/20200725184223.312a64f2%40bigbox.attlocal.net.
How can I find where one word is close to another word?
As most people on this forum are likely aware, searching for a word is straight-forward enough. If I want to find occurrences of the word 'arc', I can type / arc
, with spaces around the three letters, to find basic occurrences of the word (ignoring punctuation). But suppose I want to find where two words are close together, say, within ten words? Here's an example:
Now is the time for all good men to come to the aid of their country.
In this test, I want to find all occurrences where the word 'aid' is within ten words of the word 'country'. How can I do that in Vim?
This is cross-posted on Vi and Vim Beta.
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/b8c05daf-96a6-4840-929e-388f64e2ea37o%40googlegroups.com.
Friday, July 24, 2020
Re: Visual selection via :global
On Thu, Jul 23, 2020 at 08:18:23PM -0500, Tim Chase wrote:
> The ex "y" command yanks and can take an optional register to yank
> to. By default, your
>
> :g/^-/normal yy
>
> (using the normal-mode) would be the same as ex-mode "y" command:
>
> :g/^-/y
>
> which yanks, overwriting the default " register.
>
> If you specify a register, vi/vim will yank into that register
> instead. In normal mode, you'd prefix your command with the
> register-name:
>
> "ayy
>
> to yank the current line into register "a".
>
> The trick is that *uppercase* registers write to the same register as
> their lowercase variants, but they *append* instead of *overwrite*.
>
> :help quote_alpha
>
> So by using
>
> :g/^-/y A
>
> (or as a jump to normal mode
>
> :g/^-/normal "Ayy
>
> would do the same thing) each line matching your pattern gets yanked
> *and appended* to register "a", gathering them all up so you can then
> use the "a" register either to paste or transfer the results to the
> system clipboard (the "+" register) via a `:let` command
>
> :let @+=@a
>
> Hopefully that makes more sense of it?
>
Thanks a lot for your help.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200724110921.bxoxtn3mzsdfr4kx%40nitro-5.
> The ex "y" command yanks and can take an optional register to yank
> to. By default, your
>
> :g/^-/normal yy
>
> (using the normal-mode) would be the same as ex-mode "y" command:
>
> :g/^-/y
>
> which yanks, overwriting the default " register.
>
> If you specify a register, vi/vim will yank into that register
> instead. In normal mode, you'd prefix your command with the
> register-name:
>
> "ayy
>
> to yank the current line into register "a".
>
> The trick is that *uppercase* registers write to the same register as
> their lowercase variants, but they *append* instead of *overwrite*.
>
> :help quote_alpha
>
> So by using
>
> :g/^-/y A
>
> (or as a jump to normal mode
>
> :g/^-/normal "Ayy
>
> would do the same thing) each line matching your pattern gets yanked
> *and appended* to register "a", gathering them all up so you can then
> use the "a" register either to paste or transfer the results to the
> system clipboard (the "+" register) via a `:let` command
>
> :let @+=@a
>
> Hopefully that makes more sense of it?
>
Thanks a lot for your help.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200724110921.bxoxtn3mzsdfr4kx%40nitro-5.
Thursday, July 23, 2020
Re: Visual selection via :global
On 2020-07-24 05:36, Manas wrote:
> On Thu, Jul 23, 2020 at 06:40:17PM -0500, Tim Chase wrote:
> > :let @a='' | g/^-/y A
> >
> It worked like a charm. Apparently, the right command was `:g/^-/y
> A` instead of `:g/^-/normal yy`. Although I am not able understand
> the use of `A` after `y`. Can you please explain that?
The ex "y" command yanks and can take an optional register to yank
to. By default, your
:g/^-/normal yy
(using the normal-mode) would be the same as ex-mode "y" command:
:g/^-/y
which yanks, overwriting the default " register.
If you specify a register, vi/vim will yank into that register
instead. In normal mode, you'd prefix your command with the
register-name:
"ayy
to yank the current line into register "a".
The trick is that *uppercase* registers write to the same register as
their lowercase variants, but they *append* instead of *overwrite*.
:help quote_alpha
So by using
:g/^-/y A
(or as a jump to normal mode
:g/^-/normal "Ayy
would do the same thing) each line matching your pattern gets yanked
*and appended* to register "a", gathering them all up so you can then
use the "a" register either to paste or transfer the results to the
system clipboard (the "+" register) via a `:let` command
:let @+=@a
Hopefully that makes more sense of it?
-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/20200723201823.0b889ff2%40bigbox.attlocal.net.
> On Thu, Jul 23, 2020 at 06:40:17PM -0500, Tim Chase wrote:
> > :let @a='' | g/^-/y A
> >
> It worked like a charm. Apparently, the right command was `:g/^-/y
> A` instead of `:g/^-/normal yy`. Although I am not able understand
> the use of `A` after `y`. Can you please explain that?
The ex "y" command yanks and can take an optional register to yank
to. By default, your
:g/^-/normal yy
(using the normal-mode) would be the same as ex-mode "y" command:
:g/^-/y
which yanks, overwriting the default " register.
If you specify a register, vi/vim will yank into that register
instead. In normal mode, you'd prefix your command with the
register-name:
"ayy
to yank the current line into register "a".
The trick is that *uppercase* registers write to the same register as
their lowercase variants, but they *append* instead of *overwrite*.
:help quote_alpha
So by using
:g/^-/y A
(or as a jump to normal mode
:g/^-/normal "Ayy
would do the same thing) each line matching your pattern gets yanked
*and appended* to register "a", gathering them all up so you can then
use the "a" register either to paste or transfer the results to the
system clipboard (the "+" register) via a `:let` command
:let @+=@a
Hopefully that makes more sense of it?
-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/20200723201823.0b889ff2%40bigbox.attlocal.net.
Re: Visual selection via :global
Sorry for wrong CC'ed on previous mail!
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200724000944.isnblemvyxzhkata%40nitro-5.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200724000944.isnblemvyxzhkata%40nitro-5.
Re: Visual selection via :global
On Thu, Jul 23, 2020 at 06:40:17PM -0500, Tim Chase wrote:
> On 2020-07-24 04:43, Manas wrote:
> >
> > I want to yank those lines in order to paste somewhere else. In this
> > particular case, I wanted to send it to someone.
>
> Ah, the typical idiom here is to empty a register and then
> yank-appending (yank into a capital-letter-named register) each of
> the matching lines like
>
> :let @a='' | g/^-/y A
>
It worked like a charm. Apparently, the right command was `:g/^-/y A`
instead of `:g/^-/normal yy`. Although I am not able understand the use
of `A` after `y`. Can you please explain that?
Once again thanks a lot for your help!
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200724000656.gzp3vydu2cotcebs%40nitro-5.
> On 2020-07-24 04:43, Manas wrote:
> >
> > I want to yank those lines in order to paste somewhere else. In this
> > particular case, I wanted to send it to someone.
>
> Ah, the typical idiom here is to empty a register and then
> yank-appending (yank into a capital-letter-named register) each of
> the matching lines like
>
> :let @a='' | g/^-/y A
>
It worked like a charm. Apparently, the right command was `:g/^-/y A`
instead of `:g/^-/normal yy`. Although I am not able understand the use
of `A` after `y`. Can you please explain that?
Once again thanks a lot for your help!
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200724000656.gzp3vydu2cotcebs%40nitro-5.
Re: Vim Display Corruption
Folks,
After almost two years, I may have stumbled onto the root cause of this vi display corruption problem.
It looks to be related to the character encoding difference between the Linux system that uses UTF-8, and macOS (XQuartz) (X11) which apparently uses something else.
I solved this problem by starting my xterm sessions on macOS with this xterm command option:
-en UTF-8
and removed all other work-arounds on macOS and the Linux systems.
Now the vi edit display on macOS is no longer corrupted.
The key seems to be the the encoding difference seen on macOS as:
Riegner-iMac3:HPE dick$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
And that on one of our typical Linux systems:
linux-pu89:/dickie/text/$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
The root cause seems to be the extended non-ASCII characters in the text file. This solution does not handle all the extended non-ASCII characters exactly the same on macOS and Linux.
For example, on my local Linux xterm, the Linux vi shows the correct text for the local file:
491 If it's not logged in, then login as:
But on my macOS xterm, looking remotely at the same file on Linux, the Linux vi shows that the quote is missing; so vi displaying from Linux back to macOS is close, but not exact:
491 If it s not logged in, then login as:
I copied the Linux file locally to macOS and used the macOS version of vi to display the non-ASCII characters as hex using "set display=uhex":
491 If it <80><99>s not logged in, then login as:
So there are definitely extended non-ASCII characters in this text file contributing to the macOS, Linux, and vi confusion.
Another option is to set the macOS locale environment variables, but I do not know what side-effects and problems that may cause. So I am going with this macOS (XQuartz) (X11) solution:
xterm -en UTF-8
None of the vi display corruption is seen using the macOS Terminal application. This sure looks to be a macOS (XQuartz) (X11) issue, but vi is front-and-center when the display corruption is seen.
I hope this solution turns out to be solid and helps other vi users running XQuartz on macOS.
--
Dick Riegner
dickie@nuveramail.net
--
>
>
>
> I consistently see text display corruption when
> editing a file on a remote Linux system with vim.
>
> I run an xterm window on macOS and ssh into a
> remote Linux machine. The edit session is
> displayed back to an XQuartz server running on
> the same macOS.
>
> I have only seen this problem when displaying
> back to an XQuartz server running on macOS.
>
> I have not seen the problem when displaying back
> to an X11 server running on various Linux
> systems.
>
> This problem occurs with newer versions of vim,
> but not older versions.
>
> Inserting lines causes the INSERT message to be
> displayed in the command line, but it is not
> cleared after hitting the ESC key.
>
> Inserting text also causes extraneous lines of
> text to be added to the body of the original
> text, corrupting the edit display.
>
> I suspect that I am seeing the same vim behavior
> as was reported in this incident:
>
> https://groups.google.com/forum/#!topic/vim_dev/GR9YG8TZy6o
>
> A work-around is to add this statement to the
> .vimrc file:
>
> set ambiwidth=single
>
> I do not know if this is a bug in vim, XQuartz,
> or both. So I am asking for vim help here and
> XQuartz help in another forum.
>
> Here is a summary of editing a file using two
> versions of vim, each with and without, the
> ambiwidth work-around.
>
>
> New Vim
> -------
> VIM - Vi IMproved 7.4 (2013 Aug 10)
> Included patches: 1-207, 209-326
> Compiled by 'http://www.opensuse.org/'
>
> Works with: set ambiwidth=single
> Fails without: set ambiwidth=single
>
>
> Old Vim
> -------
> VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Feb 4 2012 09:50:29)
> Included patches: 1-108
> Compiled by 'http://www.opensuse.org/'
>
> Works with: set ambiwidth=single
> Works without: set ambiwidth=single
>
> --
>
> Dick Riegner
>
>
>
--
--
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/d52c5346-fe28-9b9d-b5c3-8561b44dcb17%40nuveramail.net.
After almost two years, I may have stumbled onto the root cause of this vi display corruption problem.
It looks to be related to the character encoding difference between the Linux system that uses UTF-8, and macOS (XQuartz) (X11) which apparently uses something else.
I solved this problem by starting my xterm sessions on macOS with this xterm command option:
-en UTF-8
and removed all other work-arounds on macOS and the Linux systems.
Now the vi edit display on macOS is no longer corrupted.
The key seems to be the the encoding difference seen on macOS as:
Riegner-iMac3:HPE dick$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
And that on one of our typical Linux systems:
linux-pu89:/dickie/text/$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
The root cause seems to be the extended non-ASCII characters in the text file. This solution does not handle all the extended non-ASCII characters exactly the same on macOS and Linux.
For example, on my local Linux xterm, the Linux vi shows the correct text for the local file:
491 If it's not logged in, then login as:
But on my macOS xterm, looking remotely at the same file on Linux, the Linux vi shows that the quote is missing; so vi displaying from Linux back to macOS is close, but not exact:
491 If it s not logged in, then login as:
I copied the Linux file locally to macOS and used the macOS version of vi to display the non-ASCII characters as hex using "set display=uhex":
491 If it <80><99>s not logged in, then login as:
So there are definitely extended non-ASCII characters in this text file contributing to the macOS, Linux, and vi confusion.
Another option is to set the macOS locale environment variables, but I do not know what side-effects and problems that may cause. So I am going with this macOS (XQuartz) (X11) solution:
xterm -en UTF-8
None of the vi display corruption is seen using the macOS Terminal application. This sure looks to be a macOS (XQuartz) (X11) issue, but vi is front-and-center when the display corruption is seen.
I hope this solution turns out to be solid and helps other vi users running XQuartz on macOS.
--
Dick Riegner
dickie@nuveramail.net
--
>
>
>
> I consistently see text display corruption when
> editing a file on a remote Linux system with vim.
>
> I run an xterm window on macOS and ssh into a
> remote Linux machine. The edit session is
> displayed back to an XQuartz server running on
> the same macOS.
>
> I have only seen this problem when displaying
> back to an XQuartz server running on macOS.
>
> I have not seen the problem when displaying back
> to an X11 server running on various Linux
> systems.
>
> This problem occurs with newer versions of vim,
> but not older versions.
>
> Inserting lines causes the INSERT message to be
> displayed in the command line, but it is not
> cleared after hitting the ESC key.
>
> Inserting text also causes extraneous lines of
> text to be added to the body of the original
> text, corrupting the edit display.
>
> I suspect that I am seeing the same vim behavior
> as was reported in this incident:
>
> https://groups.google.com/forum/#!topic/vim_dev/GR9YG8TZy6o
>
> A work-around is to add this statement to the
> .vimrc file:
>
> set ambiwidth=single
>
> I do not know if this is a bug in vim, XQuartz,
> or both. So I am asking for vim help here and
> XQuartz help in another forum.
>
> Here is a summary of editing a file using two
> versions of vim, each with and without, the
> ambiwidth work-around.
>
>
> New Vim
> -------
> VIM - Vi IMproved 7.4 (2013 Aug 10)
> Included patches: 1-207, 209-326
> Compiled by 'http://www.opensuse.org/'
>
> Works with: set ambiwidth=single
> Fails without: set ambiwidth=single
>
>
> Old Vim
> -------
> VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Feb 4 2012 09:50:29)
> Included patches: 1-108
> Compiled by 'http://www.opensuse.org/'
>
> Works with: set ambiwidth=single
> Works without: set ambiwidth=single
>
> --
>
> Dick Riegner
>
>
>
--
--
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/d52c5346-fe28-9b9d-b5c3-8561b44dcb17%40nuveramail.net.
Re: Visual selection via :global
On 2020-07-24 04:43, Manas wrote:
> On Thu, Jul 23, 2020 at 05:57:51PM -0500, Tim Chase wrote:
>> On 2020-07-24 03:48, Manas wrote:
>>> Hi folks, I have a markdown file containing a couple of
>>> headings and some pointers as shown below.
>>>
>>> ```
>>> # Heading 1
>>> - pointer 1
>>> - pointer 2
>>> - pointer 3
>>>
>>> ## Heading 2
>>> - pointer 4
>>> - pointer 5
>>> ```
>>>
>>> I wanted to visual select all pointers only.
>>
>> Vim doesn't (to the best of my knowledge without hacky plugins)
>> support disjoint selections. That said, you don't mention what
>> you want to *do* with those lines once you've selected them.
>
> I want to yank those lines in order to paste somewhere else. In this
> particular case, I wanted to send it to someone.
Ah, the typical idiom here is to empty a register and then
yank-appending (yank into a capital-letter-named register) each of
the matching lines like
:let @a='' | g/^-/y A
This will gather all the matching lines into register "a" which you
can then either paste elsewhere, or transfer directly to your
system clipboard-register with
:let @+=@a
This lets you use any pattern you want to put matching lines on the
clipboard.
Hope this helps,
-tim
:help quote_alpha
--
--
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/20200723184017.7d8166aa%40bigbox.attlocal.net.
> On Thu, Jul 23, 2020 at 05:57:51PM -0500, Tim Chase wrote:
>> On 2020-07-24 03:48, Manas wrote:
>>> Hi folks, I have a markdown file containing a couple of
>>> headings and some pointers as shown below.
>>>
>>> ```
>>> # Heading 1
>>> - pointer 1
>>> - pointer 2
>>> - pointer 3
>>>
>>> ## Heading 2
>>> - pointer 4
>>> - pointer 5
>>> ```
>>>
>>> I wanted to visual select all pointers only.
>>
>> Vim doesn't (to the best of my knowledge without hacky plugins)
>> support disjoint selections. That said, you don't mention what
>> you want to *do* with those lines once you've selected them.
>
> I want to yank those lines in order to paste somewhere else. In this
> particular case, I wanted to send it to someone.
Ah, the typical idiom here is to empty a register and then
yank-appending (yank into a capital-letter-named register) each of
the matching lines like
:let @a='' | g/^-/y A
This will gather all the matching lines into register "a" which you
can then either paste elsewhere, or transfer directly to your
system clipboard-register with
:let @+=@a
This lets you use any pattern you want to put matching lines on the
clipboard.
Hope this helps,
-tim
:help quote_alpha
--
--
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/20200723184017.7d8166aa%40bigbox.attlocal.net.
Re: Visual selection via :global
On Thu, Jul 23, 2020 at 05:57:51PM -0500, Tim Chase wrote:
> On 2020-07-24 03:48, Manas wrote:
> > Hi folks, I have a markdown file containing a couple of headings and
> > some pointers as shown below.
> >
> > ```
> > # Heading 1
> > - pointer 1
> > - pointer 2
> > - pointer 3
> >
> > ## Heading 2
> > - pointer 4
> > - pointer 5
> > ```
> >
> > I wanted to visual select all pointers only. So what I did was
> > `:g/^-/normal V` but it only selects the last pointer (i.e. pointer
> > 5). Shouldn't it select all pointers?
>
> Vim doesn't (to the best of my knowledge without hacky plugins)
> support disjoint selections. That said, you don't mention what you
> want to *do* with those lines once you've selected them. Change
> their case? Indent them? Only do a :substitute command on
> list-items and not headings? I presume you don't just want the lines
> visually-selected for aesthetic reasons. ;-)
>
I want to yank those lines in order to paste somewhere else. In this
particular case, I wanted to send it to someone.
> > Is this normal behaviour? And what am I missing here?
>
> Yes, it is the normal/expected behavior, so you're not missing
> anything. :-)
>
> > Also according to `:h :normal` while writing `:normal {commands}`,
> >
> > {commands} cannot start with a space. Put a count of
> > 1 (one) before it, "1 " is one space.
> >
> > I did not quite get the meaning out of it. Can someone help me?
>
> Though mostly orthogonal to your previous text, this means that when
> vim is parsing the "normal" command
>
> :normal ~
> ^
> and
>
> :normal ~
> ^^^^^
>
> are both the same thing, that the normal-command(s)-to-be-executed
> don't start until after the leading whitespace. Thus if you really
> do want the first character of your "normal" command to be a space,
> you have to do
>
> :normal 1 ~
> :normal 1 ~
>
> Alternatively, I prefer to execute the expression-register as a macro
> instead:
>
> @=' ~'
>
> which is similar. That said, I'm not sure it has much to do with
> your previous issues.
>
> -tim
>
Really thanks for your explanations and suggestion.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200723231341.qezrydbimd7cdxqj%40nitro-5.
> On 2020-07-24 03:48, Manas wrote:
> > Hi folks, I have a markdown file containing a couple of headings and
> > some pointers as shown below.
> >
> > ```
> > # Heading 1
> > - pointer 1
> > - pointer 2
> > - pointer 3
> >
> > ## Heading 2
> > - pointer 4
> > - pointer 5
> > ```
> >
> > I wanted to visual select all pointers only. So what I did was
> > `:g/^-/normal V` but it only selects the last pointer (i.e. pointer
> > 5). Shouldn't it select all pointers?
>
> Vim doesn't (to the best of my knowledge without hacky plugins)
> support disjoint selections. That said, you don't mention what you
> want to *do* with those lines once you've selected them. Change
> their case? Indent them? Only do a :substitute command on
> list-items and not headings? I presume you don't just want the lines
> visually-selected for aesthetic reasons. ;-)
>
I want to yank those lines in order to paste somewhere else. In this
particular case, I wanted to send it to someone.
> > Is this normal behaviour? And what am I missing here?
>
> Yes, it is the normal/expected behavior, so you're not missing
> anything. :-)
>
> > Also according to `:h :normal` while writing `:normal {commands}`,
> >
> > {commands} cannot start with a space. Put a count of
> > 1 (one) before it, "1 " is one space.
> >
> > I did not quite get the meaning out of it. Can someone help me?
>
> Though mostly orthogonal to your previous text, this means that when
> vim is parsing the "normal" command
>
> :normal ~
> ^
> and
>
> :normal ~
> ^^^^^
>
> are both the same thing, that the normal-command(s)-to-be-executed
> don't start until after the leading whitespace. Thus if you really
> do want the first character of your "normal" command to be a space,
> you have to do
>
> :normal 1 ~
> :normal 1 ~
>
> Alternatively, I prefer to execute the expression-register as a macro
> instead:
>
> @=' ~'
>
> which is similar. That said, I'm not sure it has much to do with
> your previous issues.
>
> -tim
>
Really thanks for your explanations and suggestion.
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200723231341.qezrydbimd7cdxqj%40nitro-5.
Re: Visual selection via :global
On 2020-07-24 03:48, Manas wrote:
> Hi folks, I have a markdown file containing a couple of headings and
> some pointers as shown below.
>
> ```
> # Heading 1
> - pointer 1
> - pointer 2
> - pointer 3
>
> ## Heading 2
> - pointer 4
> - pointer 5
> ```
>
> I wanted to visual select all pointers only. So what I did was
> `:g/^-/normal V` but it only selects the last pointer (i.e. pointer
> 5). Shouldn't it select all pointers?
Vim doesn't (to the best of my knowledge without hacky plugins)
support disjoint selections. That said, you don't mention what you
want to *do* with those lines once you've selected them. Change
their case? Indent them? Only do a :substitute command on
list-items and not headings? I presume you don't just want the lines
visually-selected for aesthetic reasons. ;-)
> Is this normal behaviour? And what am I missing here?
Yes, it is the normal/expected behavior, so you're not missing
anything. :-)
> Also according to `:h :normal` while writing `:normal {commands}`,
>
> {commands} cannot start with a space. Put a count of
> 1 (one) before it, "1 " is one space.
>
> I did not quite get the meaning out of it. Can someone help me?
Though mostly orthogonal to your previous text, this means that when
vim is parsing the "normal" command
:normal ~
^
and
:normal ~
^^^^^
are both the same thing, that the normal-command(s)-to-be-executed
don't start until after the leading whitespace. Thus if you really
do want the first character of your "normal" command to be a space,
you have to do
:normal 1 ~
:normal 1 ~
Alternatively, I prefer to execute the expression-register as a macro
instead:
@=' ~'
which is similar. That said, I'm not sure it has much to do with
your previous issues.
-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/20200723175751.6ac1b668%40bigbox.attlocal.net.
> Hi folks, I have a markdown file containing a couple of headings and
> some pointers as shown below.
>
> ```
> # Heading 1
> - pointer 1
> - pointer 2
> - pointer 3
>
> ## Heading 2
> - pointer 4
> - pointer 5
> ```
>
> I wanted to visual select all pointers only. So what I did was
> `:g/^-/normal V` but it only selects the last pointer (i.e. pointer
> 5). Shouldn't it select all pointers?
Vim doesn't (to the best of my knowledge without hacky plugins)
support disjoint selections. That said, you don't mention what you
want to *do* with those lines once you've selected them. Change
their case? Indent them? Only do a :substitute command on
list-items and not headings? I presume you don't just want the lines
visually-selected for aesthetic reasons. ;-)
> Is this normal behaviour? And what am I missing here?
Yes, it is the normal/expected behavior, so you're not missing
anything. :-)
> Also according to `:h :normal` while writing `:normal {commands}`,
>
> {commands} cannot start with a space. Put a count of
> 1 (one) before it, "1 " is one space.
>
> I did not quite get the meaning out of it. Can someone help me?
Though mostly orthogonal to your previous text, this means that when
vim is parsing the "normal" command
:normal ~
^
and
:normal ~
^^^^^
are both the same thing, that the normal-command(s)-to-be-executed
don't start until after the leading whitespace. Thus if you really
do want the first character of your "normal" command to be a space,
you have to do
:normal 1 ~
:normal 1 ~
Alternatively, I prefer to execute the expression-register as a macro
instead:
@=' ~'
which is similar. That said, I'm not sure it has much to do with
your previous issues.
-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/20200723175751.6ac1b668%40bigbox.attlocal.net.
Re: Visual selection via :global
Hi folks, I have a markdown file containing a couple of headings and
some pointers as shown below.
```
# Heading 1
- pointer 1
- pointer 2
- pointer 3
## Heading 2
- pointer 4
- pointer 5
```
I wanted to visual select all pointers only. So what I did was
`:g/^-/normal V` but it only selects the last pointer (i.e. pointer 5).
Shouldn't it select all pointers?
Is this normal behaviour? And what am I missing here?
Also according to `:h :normal` while writing `:normal {commands}`,
{commands} cannot start with a space. Put a count of
1 (one) before it, "1 " is one space.
I did not quite get the meaning out of it. Can someone help me?
Thanks
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200723221818.eghokxeehxssrpsl%40nitro-5.
some pointers as shown below.
```
# Heading 1
- pointer 1
- pointer 2
- pointer 3
## Heading 2
- pointer 4
- pointer 5
```
I wanted to visual select all pointers only. So what I did was
`:g/^-/normal V` but it only selects the last pointer (i.e. pointer 5).
Shouldn't it select all pointers?
Is this normal behaviour? And what am I missing here?
Also according to `:h :normal` while writing `:normal {commands}`,
{commands} cannot start with a space. Put a count of
1 (one) before it, "1 " is one space.
I did not quite get the meaning out of it. Can someone help me?
Thanks
--
Manas
CSAM Undergraduate | 2022
IIIT-Delhi, India
--
--
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/20200723221818.eghokxeehxssrpsl%40nitro-5.
Fwd: VimConf.live : an online vim conference
Forwarding an announcement posted to reddit.com/r/vim (https://www.reddit.com/r/vim/comments/hupylb/vimconflive_an_online_vim_conference/)
--------------------------------------------------------------------------------------------
We're hosting a global virtual vim conference this year. A way to bring
together vim fans from across the globe to connect and share our love
for vim during this time of corona, where in person conferences are not
an option.
You can checkout the website of the conference here: http://vimconf.live/
And join our discord server here: https://discord.gg/njStVRS
For anyone interested in getting involved beyond attendance, we're
always looking for volunteers to help out the effort!
--
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/CAAW7x7%3DyA_8YEYEcXJnpg%3DwKQ%3Dxt9QrJAxYNSq4Jf43FJPY55g%40mail.gmail.com.
Re: Quote command
Ended up creating an alias in my zshrc
--
--
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/5a47ca76-0a4d-4794-827e-147a73f7fe77n%40googlegroups.com.
On Thursday, July 23, 2020 at 6:14:36 AM UTC-4 Tatenda Biti wrote:
I am trying to write the following as a term start command:wsl -e zsh -ic ranger --choosefile=vim_ranger_current_fileIn powershell this works :wsl -e zsh -ic 'ranger --choosefile=vim_ranger_current_file'How do I quote 'ranger --choosefile=vim_ranger_current_file'in term_start(a:cmd, {'hidden': 1, 'term_finish': 'close', 'cwd': getcwd()})where a:cmd = 'wsl -e zsh -ic ranger --choosefile=vim_ranger_current_file'
--
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/5a47ca76-0a4d-4794-827e-147a73f7fe77n%40googlegroups.com.
Wednesday, July 22, 2020
Re: [backspace key functionality]
Dear all,
I'm sorry to have disturbed you for such a minor thing. I managed to fix it using the following command (https://vim.fandom.com/wiki/Backspace_and_delete_problems):
set backspace=indent,eol,start
Thank you and have a good day ahead!
—
Best wishes,
Maxim
On 22 Jul 2020, at 12:34, Maxim Abalenkov <maxim.abalenkov@gmail.com> wrote:Dear all,I hope all is well with you. I need help with the Backspace key please. Some time ago I noticed it has stopped working in vim. When I press Backspace vim (or the terminal emulator) produces the error sound, but no action of erasing a character before the cursor. Would you please help me to debug the problem and reinstate the original Backspace functionality? Thank you and have a good day ahead!I use the following vim version installed onto a macOS via the MacPorts:VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 29 2019 08:37:22)
macOS version
Included patches: 1-2234
Compiled by MacPorts—Best wishes,Maxim
[backspace key functionality]
Dear all,
I hope all is well with you. I need help with the Backspace key please. Some time ago I noticed it has stopped working in vim. When I press Backspace vim (or the terminal emulator) produces the error sound, but no action of erasing a character before the cursor. Would you please help me to debug the problem and reinstate the original Backspace functionality? Thank you and have a good day ahead!
I use the following vim version installed onto a macOS via the MacPorts:
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 29 2019 08:37:22)
macOS version
Included patches: 1-2234
Compiled by MacPorts
macOS version
Included patches: 1-2234
Compiled by MacPorts
—
Best wishes,
Maxim
Tuesday, July 21, 2020
Re: v:count in mapping gets E492: Not an editor command: count
You have a very good point there, Jurgen. Somehow now, I have this uncontrollable urge to go baa-aa-aa at the moon.
On Mon, Jul 20, 2020 at 10:20 PM 'Jürgen Krämer' via vim_use <vim_use@googlegroups.com> wrote:
Hi,
Graham Lawrence schrieb am 19.07.2020 um 22:07:
> :h v:count includes the following example
> |
> map _x :<C-U>echo "the count is ".v:count<CR>
> |
>
> which works as expected, but using
> |
> map :let @n=v:count1<cr>...
> |
>
did you really leave out the left-hand-side of the mapping in your .vimrc or is this just a typo in your mail?
> produces E492 etc; and instead I must use
> |
> map ;;:<C-U>exe 'let @n=v:count1'<cr>...
> |
>
> for it to work.
>
> Now I have a number of mappings in alternate .vimrc files that use the 'let' form that now fails, which strongly implies that at one time that method of saving v:count did work.
> So is this a recent development? Or have I unwittingly set something in .vimrc that invalidates 'let'? Or is it a vim error that is likely to be corrected by reverting to the old form? Or ...?
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/e18c4134-695a-1d51-1094-926d11ae7481%40googlemail.com.
--
Graham Lawrence
-- --
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/CA%2BE5mK7ZedxExMv3QFNB4a5%3DK6STj4h6N-eTbE3C%2B-_r60vTkw%40mail.gmail.com.
Monday, July 20, 2020
Re: v:count in mapping gets E492: Not an editor command: count
Hi,
Graham Lawrence schrieb am 19.07.2020 um 22:07:
> :h v:count includes the following example
> |
> map _x :<C-U>echo "the count is ".v:count<CR>
> |
>
> which works as expected, but using
> |
> map :let @n=v:count1<cr>...
> |
>
did you really leave out the left-hand-side of the mapping in your .vimrc or is this just a typo in your mail?
> produces E492 etc; and instead I must use
> |
> map ;;:<C-U>exe 'let @n=v:count1'<cr>...
> |
>
> for it to work.
>
> Now I have a number of mappings in alternate .vimrc files that use the 'let' form that now fails, which strongly implies that at one time that method of saving v:count did work.
> So is this a recent development? Or have I unwittingly set something in .vimrc that invalidates 'let'? Or is it a vim error that is likely to be corrected by reverting to the old form? Or ...?
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/e18c4134-695a-1d51-1094-926d11ae7481%40googlemail.com.
Graham Lawrence schrieb am 19.07.2020 um 22:07:
> :h v:count includes the following example
> |
> map _x :<C-U>echo "the count is ".v:count<CR>
> |
>
> which works as expected, but using
> |
> map :let @n=v:count1<cr>...
> |
>
did you really leave out the left-hand-side of the mapping in your .vimrc or is this just a typo in your mail?
> produces E492 etc; and instead I must use
> |
> map ;;:<C-U>exe 'let @n=v:count1'<cr>...
> |
>
> for it to work.
>
> Now I have a number of mappings in alternate .vimrc files that use the 'let' form that now fails, which strongly implies that at one time that method of saving v:count did work.
> So is this a recent development? Or have I unwittingly set something in .vimrc that invalidates 'let'? Or is it a vim error that is likely to be corrected by reverting to the old form? Or ...?
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/e18c4134-695a-1d51-1094-926d11ae7481%40googlemail.com.
WG: WG: how to ask a question
the item is to execute a bash command from the Ex command line. I know only the "filter" command:
!sh -c "echo \"abc # def\" "
# is expanded to a filename, only backslash helps.
Gesendet mit der Telekom Mail App
--- Original-Nachricht ---
Von: Anton Wessel
Betreff: WG: how to ask a question
Datum: 20.07.2020, 10:05 Uhr
An: vim@vim.org
Gesendet mit der Telekom Mail App
if no command exists for inhibiting expansion by vim, how can I automaticalally quote all '#' in a long command in the Ex command line. In my version of vim (8.0 2016 Sep 12) editing Ex command line is very poor.
greetings, thanks
Anton_Wessel@t-online.de
--- Original-Nachricht ---
Von: Anton Wessel
Betreff: how to ask a question
Datum: 20.07.2020, 9:51 Uhr
An: vim@vim.org
Gesendet mit der Telekom Mail App
--
--
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/1595232940857.1858878.4c2b9950cf0f93e325cffd8e628b58141cf76603%40spica.telekom.de.
!sh -c "echo \"abc # def\" "
# is expanded to a filename, only backslash helps.
Gesendet mit der Telekom Mail App
--- Original-Nachricht ---
Von: Anton Wessel
Betreff: WG: how to ask a question
Datum: 20.07.2020, 10:05 Uhr
An: vim@vim.org
Gesendet mit der Telekom Mail App
if no command exists for inhibiting expansion by vim, how can I automaticalally quote all '#' in a long command in the Ex command line. In my version of vim (8.0 2016 Sep 12) editing Ex command line is very poor.
greetings, thanks
Anton_Wessel@t-online.de
--- Original-Nachricht ---
Von: Anton Wessel
Betreff: how to ask a question
Datum: 20.07.2020, 9:51 Uhr
An: vim@vim.org
Gesendet mit der Telekom Mail App
--
--
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/1595232940857.1858878.4c2b9950cf0f93e325cffd8e628b58141cf76603%40spica.telekom.de.
Sunday, July 19, 2020
Quote command
I am trying to write the following as a term start command:
wsl -e zsh -ic ranger --choosefile=vim_ranger_current_file
In powershell this works :
wsl -e zsh -ic 'ranger --choosefile=vim_ranger_current_file'
How do I quote 'ranger --choosefile=vim_ranger_current_file'
in term_start(a:cmd, {'hidden': 1, 'term_finish': 'close', 'cwd': getcwd()})
where a:cmd = 'wsl -e zsh -ic ranger --choosefile=vim_ranger_current_file'
-- --
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/7d8f6815-8ea9-412f-a09b-45e0878937a6n%40googlegroups.com.
Re: gv bug?
Tim Chase wrote:
> > > To replicate
> > >
> > > $ vi -u NONE
> > > :r !jot 15
> > >
> > > (or use `seq 15` to get the numbers 1-15 in your file)
> > >
> > > 3GVG:g/5/d
> > >
> > > This should delete lines 5 and 15 because they contain a "5".
> > > However, issueing
> > >
> > > gv
> > >
> > > does not reselect the text.
> >
> > For me it does. I cannot guess why it doesn't work for you.
>
> I just went to reproduce it and there seems to be something to the
> order of how the lines are selected. I slightly tweaked the order of
> the commands to make it clear what range I was selecting, assuming
> that a-range-was-a-range. Sorry about that confusion.
>
> If I do the selection from top to bottom, it does indeed work as you
> encountered:
>
> $ vim -u NONE
> :r !jot 15
> 3GVG:g/5/d
> gv
>
> But if I select them from bottom-to-top
>
> $ vim -u NONE
> :r !jot 15
> V3G:g/5/d
> gv
>
> I get the (mis)behavior I was seeing...the "gv" doesn't reselect the
> available range.
>
> Again, sorry I messed up reproducing that situation.
Hmm, now I can reproduce it. The mark on the last line has become
invalid. ":marks" shows the "<" mark as "invalid". Weird thing is that
when using "'<" it works, but it actually jumps to the ">" mark
position. The code shows that this is intentional.
I suppose that when the Visual mark is beyond the end of the file, it's
best to put it on the last line.
--
Light travels faster than sound. This is why some people
appear bright until you hear them speak
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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/202007192010.06JKA8At313362%40masaka.moolenaar.net.
> > > To replicate
> > >
> > > $ vi -u NONE
> > > :r !jot 15
> > >
> > > (or use `seq 15` to get the numbers 1-15 in your file)
> > >
> > > 3GVG:g/5/d
> > >
> > > This should delete lines 5 and 15 because they contain a "5".
> > > However, issueing
> > >
> > > gv
> > >
> > > does not reselect the text.
> >
> > For me it does. I cannot guess why it doesn't work for you.
>
> I just went to reproduce it and there seems to be something to the
> order of how the lines are selected. I slightly tweaked the order of
> the commands to make it clear what range I was selecting, assuming
> that a-range-was-a-range. Sorry about that confusion.
>
> If I do the selection from top to bottom, it does indeed work as you
> encountered:
>
> $ vim -u NONE
> :r !jot 15
> 3GVG:g/5/d
> gv
>
> But if I select them from bottom-to-top
>
> $ vim -u NONE
> :r !jot 15
> V3G:g/5/d
> gv
>
> I get the (mis)behavior I was seeing...the "gv" doesn't reselect the
> available range.
>
> Again, sorry I messed up reproducing that situation.
Hmm, now I can reproduce it. The mark on the last line has become
invalid. ":marks" shows the "<" mark as "invalid". Weird thing is that
when using "'<" it works, but it actually jumps to the ">" mark
position. The code shows that this is intentional.
I suppose that when the Visual mark is beyond the end of the file, it's
best to put it on the last line.
--
Light travels faster than sound. This is why some people
appear bright until you hear them speak
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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/202007192010.06JKA8At313362%40masaka.moolenaar.net.
v:count in mapping gets E492: Not an editor command: count
:h v:count includes the following example
map _x :<C-U>echo "the count is " . v:count<CR>
which works as expected, but using
map :let @n=v:count1<cr> ...
produces E492 etc; and instead I must use
map ;; :<C-U>exe 'let @n=v:count1'<cr> ...
for it to work.
Now I have a number of mappings in alternate .vimrc files that use the 'let' form that now fails, which strongly implies that at one time that method of saving v:count did work.
So is this a recent development? Or have I unwittingly set something in .vimrc that invalidates 'let'? Or is it a vim error that is likely to be corrected by reverting to the old form? Or ...?
--
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/63e65a86-4f90-437d-a392-a423c0e8881eo%40googlegroups.com.
Re: gv bug?
On 2020-07-19 17:18, Bram Moolenaar wrote:
> Tim Chase wrote:
> > To replicate
> >
> > $ vi -u NONE
> > :r !jot 15
> >
> > (or use `seq 15` to get the numbers 1-15 in your file)
> >
> > 3GVG:g/5/d
> >
> > This should delete lines 5 and 15 because they contain a "5".
> > However, issueing
> >
> > gv
> >
> > does not reselect the text.
>
> For me it does. I cannot guess why it doesn't work for you.
I just went to reproduce it and there seems to be something to the
order of how the lines are selected. I slightly tweaked the order of
the commands to make it clear what range I was selecting, assuming
that a-range-was-a-range. Sorry about that confusion.
If I do the selection from top to bottom, it does indeed work as you
encountered:
$ vim -u NONE
:r !jot 15
3GVG:g/5/d
gv
But if I select them from bottom-to-top
$ vim -u NONE
:r !jot 15
V3G:g/5/d
gv
I get the (mis)behavior I was seeing...the "gv" doesn't reselect the
available range.
Again, sorry I messed up reproducing that situation.
-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/20200719135401.17ecbbaf%40bigbox.attlocal.net.
> Tim Chase wrote:
> > To replicate
> >
> > $ vi -u NONE
> > :r !jot 15
> >
> > (or use `seq 15` to get the numbers 1-15 in your file)
> >
> > 3GVG:g/5/d
> >
> > This should delete lines 5 and 15 because they contain a "5".
> > However, issueing
> >
> > gv
> >
> > does not reselect the text.
>
> For me it does. I cannot guess why it doesn't work for you.
I just went to reproduce it and there seems to be something to the
order of how the lines are selected. I slightly tweaked the order of
the commands to make it clear what range I was selecting, assuming
that a-range-was-a-range. Sorry about that confusion.
If I do the selection from top to bottom, it does indeed work as you
encountered:
$ vim -u NONE
:r !jot 15
3GVG:g/5/d
gv
But if I select them from bottom-to-top
$ vim -u NONE
:r !jot 15
V3G:g/5/d
gv
I get the (mis)behavior I was seeing...the "gv" doesn't reselect the
available range.
Again, sorry I messed up reproducing that situation.
-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/20200719135401.17ecbbaf%40bigbox.attlocal.net.
Re: gv bug?
Tim Chase wrote:
> To replicate
>
> $ vi -u NONE
> :r !jot 15
>
> (or use `seq 15` to get the numbers 1-15 in your file)
>
> 3GVG:g/5/d
>
> This should delete lines 5 and 15 because they contain a "5".
> However, issueing
>
> gv
>
> does not reselect the text.
For me it does. I cannot guess why it doesn't work for you.
> If instead you have 16 numbers
>
> $ vim -u NONE
> :r !jot 16
>
> and do
>
> 3GVGk:g/5/d
>
> (selecting through the penultimate line, so the same text selected
> as before, followed by the same command, just with a line below '>
> containing "16") followed by
>
> gv
>
> it works, adjusting the '> mark to the line containing "16". So
> there's clearly some "the last line of my visual range was deleted,
> so we need to adjust it" logic, but it doesn't seem to check if that
> adjusment runs of the end of the file and back it off instead.
>
> Thanks!
--
It was recently discovered that research causes cancer in rats.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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/202007191518.06JFI61v237518%40masaka.moolenaar.net.
> To replicate
>
> $ vi -u NONE
> :r !jot 15
>
> (or use `seq 15` to get the numbers 1-15 in your file)
>
> 3GVG:g/5/d
>
> This should delete lines 5 and 15 because they contain a "5".
> However, issueing
>
> gv
>
> does not reselect the text.
For me it does. I cannot guess why it doesn't work for you.
> If instead you have 16 numbers
>
> $ vim -u NONE
> :r !jot 16
>
> and do
>
> 3GVGk:g/5/d
>
> (selecting through the penultimate line, so the same text selected
> as before, followed by the same command, just with a line below '>
> containing "16") followed by
>
> gv
>
> it works, adjusting the '> mark to the line containing "16". So
> there's clearly some "the last line of my visual range was deleted,
> so we need to adjust it" logic, but it doesn't seem to check if that
> adjusment runs of the end of the file and back it off instead.
>
> Thanks!
--
It was recently discovered that research causes cancer in rats.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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/202007191518.06JFI61v237518%40masaka.moolenaar.net.
gv bug?
To replicate
$ vi -u NONE
:r !jot 15
(or use `seq 15` to get the numbers 1-15 in your file)
3GVG:g/5/d
This should delete lines 5 and 15 because they contain a "5".
However, issueing
gv
does not reselect the text. If instead you have 16 numbers
$ vim -u NONE
:r !jot 16
and do
3GVGk:g/5/d
(selecting through the penultimate line, so the same text selected
as before, followed by the same command, just with a line below '>
containing "16") followed by
gv
it works, adjusting the '> mark to the line containing "16". So
there's clearly some "the last line of my visual range was deleted,
so we need to adjust it" logic, but it doesn't seem to check if that
adjusment runs of the end of the file and back it off instead.
Thanks!
-tim
(brought to my attention in this thread
https://www.reddit.com/r/vim/comments/htfc78/vimscript_deletion_inside_visual_selection/
where it caused some odd edge-cases)
--
--
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/20200719082430.385c0664%40bigbox.attlocal.net.
$ vi -u NONE
:r !jot 15
(or use `seq 15` to get the numbers 1-15 in your file)
3GVG:g/5/d
This should delete lines 5 and 15 because they contain a "5".
However, issueing
gv
does not reselect the text. If instead you have 16 numbers
$ vim -u NONE
:r !jot 16
and do
3GVGk:g/5/d
(selecting through the penultimate line, so the same text selected
as before, followed by the same command, just with a line below '>
containing "16") followed by
gv
it works, adjusting the '> mark to the line containing "16". So
there's clearly some "the last line of my visual range was deleted,
so we need to adjust it" logic, but it doesn't seem to check if that
adjusment runs of the end of the file and back it off instead.
Thanks!
-tim
(brought to my attention in this thread
https://www.reddit.com/r/vim/comments/htfc78/vimscript_deletion_inside_visual_selection/
where it caused some odd edge-cases)
--
--
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/20200719082430.385c0664%40bigbox.attlocal.net.
Friday, July 17, 2020
Re: substitution, transform string to list?
On Fri, Jul 17, 2020 at 07:46:06AM -0500, Tim Chase wrote:
> On 2020-07-17 11:10, meine wrote:
> > The data to transform:
> >
> > ABBEEL;1872/253;1882/576;1886/1925;1887/603;1887/1813;1894/1444;1898/3449
> > ABBEELS;1888/1401;1889/562;1891/2371;1899/3088;1902/732;1903/1509;1904/1317
> >
> > should become:
> >
> > ABBEEL;1872/253
> > ABBEEL;1882/576
> > ABBEEL;1886/1925
> > ABBEEL;1887/603
> > ABBEEL;1887/1813
> > ABBEEL;1894/1444
> > ABBEEL;1898/3449
> > ABBEELS;1888/1401
> > ABBEELS;1889/562
> > ABBEELS;1891/2371
> > ABBEELS;1899/3088
> > ABBEELS;1902/732
> > ABBEELS;1903/1509
> > ABBEELS;1904/1317
>
> You can do it in two passes, one to prefix each item on its own line:
>
> :%s/\%(^\([^;]*\).*\)\@<=\(;[^;]*\)/\r\1\2/g
>
> and then a second command to delete all the remnant lines (ones that
> are just the prefix which don't have a ";" in them):
>
> :v/;/d
>
> -tim
Thanks a lot!
//meine
--
--
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/20200717140522.GB999%40trackstand.
> On 2020-07-17 11:10, meine wrote:
> > The data to transform:
> >
> > ABBEEL;1872/253;1882/576;1886/1925;1887/603;1887/1813;1894/1444;1898/3449
> > ABBEELS;1888/1401;1889/562;1891/2371;1899/3088;1902/732;1903/1509;1904/1317
> >
> > should become:
> >
> > ABBEEL;1872/253
> > ABBEEL;1882/576
> > ABBEEL;1886/1925
> > ABBEEL;1887/603
> > ABBEEL;1887/1813
> > ABBEEL;1894/1444
> > ABBEEL;1898/3449
> > ABBEELS;1888/1401
> > ABBEELS;1889/562
> > ABBEELS;1891/2371
> > ABBEELS;1899/3088
> > ABBEELS;1902/732
> > ABBEELS;1903/1509
> > ABBEELS;1904/1317
>
> You can do it in two passes, one to prefix each item on its own line:
>
> :%s/\%(^\([^;]*\).*\)\@<=\(;[^;]*\)/\r\1\2/g
>
> and then a second command to delete all the remnant lines (ones that
> are just the prefix which don't have a ";" in them):
>
> :v/;/d
>
> -tim
Thanks a lot!
//meine
--
--
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/20200717140522.GB999%40trackstand.
Subscribe to:
Posts (Atom)