--
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
----
ok, though isn't it more important to prune unnecessary content?
:-|
On 2019/05/21 13:17, 'J S' via vim_use wrote:
> But is also allows the offset (and then length, too, but ignore that
> for now) to be negative. But, alas, as noted in "man bash", if the
> offset is negative, you have to
> put a space after the :, in order to avoid ambiguity with the usual
> ${var:-xxx} construct. So, you have to write:
>
> $ echo ${var: -9:5}
>
> Alas, vim flags this as an error. If I take out the space before the
> -, the highlighting is OK. But with the space, it is flagged as error.
>
> Can this be fixed?
Not that it fixes the syntax, but I've always used "${var:0-9:5}" so the
field
would clearly stand out as starting with an integer and not the ambiguous
'dash'. Is that flagged as an error too?
Just curious....
-l
--
--
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/5CE8295A.80606%40tlinx.org.
For more options, visit https://groups.google.com/d/optout.
Friday, May 24, 2019
Re: how to call vim on files that are the results of a grep -l command in bash?
Another possibility is to tell Vim that the file to be read will be
found on stdin:
grep -l 'foo' | view -
One problem with this approach is that using "view" (because stdin is
essentially non-writable) will make ":new foobar" open the new file
read-only as if you had used :sview rather than :new. IIUC in order to
make the new file writable you will have to use ":setl noro" after
making it current.
Best regards,
Tony.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsJ2QSjuQRBH1_Jjr--Eg_GdAQNHq9fLEWJr9D7znZFGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
found on stdin:
grep -l 'foo' | view -
One problem with this approach is that using "view" (because stdin is
essentially non-writable) will make ":new foobar" open the new file
read-only as if you had used :sview rather than :new. IIUC in order to
make the new file writable you will have to use ":setl noro" after
making it current.
Best regards,
Tony.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsJ2QSjuQRBH1_Jjr--Eg_GdAQNHq9fLEWJr9D7znZFGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: how to call vim on files that are the results of a grep -l command in bash?
On 2019-05-24, DwigtArmyOfChampions wrote:
> From a bash shell I can type "grep -l 'foo' *" and that will
> output a list of files that contain 'foo'. I want to vim that list
> of files. In other words, assuming the grep command returns file1,
> file2, ... filen, I want to run the command:
>
> vim file1 file2 file3 ... filen
>
> I tried "grep -l 'foo' * | vim" and "grep -l 'foo' * | xargs | vim'
> but those didn't work. Any ideas?
Using xargs with an interactive program like vim has problems, such
as leaving your terminal in an odd state after vim exits. A better
solution is to use GNU parallel:
$ grep -l 'foo' * | parallel --tty -X vim
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/20190524152145.GA24449%40phoenix.
For more options, visit https://groups.google.com/d/optout.
> From a bash shell I can type "grep -l 'foo' *" and that will
> output a list of files that contain 'foo'. I want to vim that list
> of files. In other words, assuming the grep command returns file1,
> file2, ... filen, I want to run the command:
>
> vim file1 file2 file3 ... filen
>
> I tried "grep -l 'foo' * | vim" and "grep -l 'foo' * | xargs | vim'
> but those didn't work. Any ideas?
Using xargs with an interactive program like vim has problems, such
as leaving your terminal in an odd state after vim exits. A better
solution is to use GNU parallel:
$ grep -l 'foo' * | parallel --tty -X vim
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/20190524152145.GA24449%40phoenix.
For more options, visit https://groups.google.com/d/optout.
Re: how to call vim on files that are the results of a grep -l command in bash?
On 2019-05-24 04:40, DwigtArmyOfChampions wrote:
> From a bash shell I can type "grep -l 'foo' *" and that will output
> a list of files that contain 'foo'. I want to vim that list of
> files. In other words, assuming the grep command returns file1,
> file2, ... filen, I want to run the command:
>
> vim file1 file2 file3 ... filen
As others have mentioned, you have
vim $(grep -l 'foo' *)
and
grep -l foo * | xargs vim
(which then has vim complain that input isn't from stdin)
Moreover, vim has some built-in grepping functionality which might be
helpful:
:vimgrep foo *
then you can use
:cn
:cN
:crew
to navigate them, as well as (at least as of a somewhat recent
version of vim) the
:cdo
:cfdo
commands which let you perform operations across all the matches or
across all the matching files. Especially since :vimgrep supports all
the power of Vim's regular expressions which can do things that
grep(1) can't do.
-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/20190524083202.4c3ea784%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.
> From a bash shell I can type "grep -l 'foo' *" and that will output
> a list of files that contain 'foo'. I want to vim that list of
> files. In other words, assuming the grep command returns file1,
> file2, ... filen, I want to run the command:
>
> vim file1 file2 file3 ... filen
As others have mentioned, you have
vim $(grep -l 'foo' *)
and
grep -l foo * | xargs vim
(which then has vim complain that input isn't from stdin)
Moreover, vim has some built-in grepping functionality which might be
helpful:
:vimgrep foo *
then you can use
:cn
:cN
:crew
to navigate them, as well as (at least as of a somewhat recent
version of vim) the
:cdo
:cfdo
commands which let you perform operations across all the matches or
across all the matching files. Especially since :vimgrep supports all
the power of Vim's regular expressions which can do things that
grep(1) can't do.
-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/20190524083202.4c3ea784%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.
Re: how to call vim on files that are the results of a grep -l command in bash?
> grep -l 'foo' * | xargs vim
> --
Or, if the number isn't likely huge:
vim $(grep -l 'foo' *)
--
--
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/9f19e9106278ed4fbddd02b423bcd4d9.squirrel%40webmail.vybenetworks.com.
For more options, visit https://groups.google.com/d/optout.
> --
Or, if the number isn't likely huge:
vim $(grep -l 'foo' *)
--
--
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/9f19e9106278ed4fbddd02b423bcd4d9.squirrel%40webmail.vybenetworks.com.
For more options, visit https://groups.google.com/d/optout.
Re: how to call vim on files that are the results of a grep -l command in bash?
grep -l 'foo' * | xargs vim
--
Kit
2019-05-24 13:40 GMT+02:00, DwigtArmyOfChampions > I tried "grep -l
'foo' * | vim" and "grep -l 'foo' * | xargs | vim' but
> those didn't work. Any ideas?
--
--
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/CAAVKVq-TH-Ffu8dXE6znDFJ3V2%2BXvG8dNZJaHGpXLQaFRDf9jQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
Kit
2019-05-24 13:40 GMT+02:00, DwigtArmyOfChampions > I tried "grep -l
'foo' * | vim" and "grep -l 'foo' * | xargs | vim' but
> those didn't work. Any ideas?
--
--
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/CAAVKVq-TH-Ffu8dXE6znDFJ3V2%2BXvG8dNZJaHGpXLQaFRDf9jQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Legacy Email] how to call vim on files that are the results of a grep -l command in bash?
On Fri, 2019-05-24 at 07:50 -0400, Reid Thompson wrote:
> On Fri, 2019-05-24 at 04:40 -0700, DwigtArmyOfChampions wrote:
> > [EXTERNAL SOURCE]
> >
> >
> >
> > From a bash shell I can type "grep -l 'foo' *" and that will output a list of files that contain 'foo'. I want to vim that list of files. In other words, assuming the grep command returns file1,
> > file2, ... filen, I want to run the command:
> >
> > vim file1 file2 file3 ... filen
> >
> > I tried "grep -l 'foo' * | vim" and "grep -l 'foo' * | xargs | vim' but those didn't work. Any ideas?
> >
> > --
>
> vim $(grep -l foo)
>
this is the xargs one
ls ycm* | xargs vim
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ddbd50ad42431a60e0ec6cf5500a37ae3bfdd831.camel%40omnicell.com.
For more options, visit https://groups.google.com/d/optout.
> On Fri, 2019-05-24 at 04:40 -0700, DwigtArmyOfChampions wrote:
> > [EXTERNAL SOURCE]
> >
> >
> >
> > From a bash shell I can type "grep -l 'foo' *" and that will output a list of files that contain 'foo'. I want to vim that list of files. In other words, assuming the grep command returns file1,
> > file2, ... filen, I want to run the command:
> >
> > vim file1 file2 file3 ... filen
> >
> > I tried "grep -l 'foo' * | vim" and "grep -l 'foo' * | xargs | vim' but those didn't work. Any ideas?
> >
> > --
>
> vim $(grep -l foo)
>
this is the xargs one
ls ycm* | xargs vim
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ddbd50ad42431a60e0ec6cf5500a37ae3bfdd831.camel%40omnicell.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Posts (Atom)