Re: Patch to add the :cdo and :ldo commands
Hi all, On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > > Yegappan Lakshmanan wrote: > >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo command >> can be used to execute commands over all the buffers in the quickfix list. >> The :ldo command can be used to execute commands over all the buffers in >> the location list. These are similar to the existing :bufdo, :windo >> and :tabdo commands. > > Thanks. I'll add it in the todo list. > I am attaching an updated patch with a lot of test cases against Vim 7.4.671. This patch introduces the ":cdo", ":ldo", ":cfdo" and ":lfdo"commands. The patch to the documentation is also included. - Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. diff -r c0df98c0770c runtime/doc/cmdline.txt --- a/runtime/doc/cmdline.txt Sat Mar 21 14:20:16 2015 +0100 +++ b/runtime/doc/cmdline.txt Sat Mar 21 19:36:52 2015 -0700 @@ -511,6 +511,8 @@ :argdo :autocmd :bufdo +:cdo +:cfdo :command :cscope :debug @@ -521,6 +523,8 @@ :help :helpfind :lcscope +:ldo +:lfdo :make :normal :perl diff -r c0df98c0770c runtime/doc/editing.txt --- a/runtime/doc/editing.txt Sat Mar 21 14:20:16 2015 +0100 +++ b/runtime/doc/editing.txt Sat Mar 21 19:36:52 2015 -0700 @@ -855,7 +855,8 @@ each file. {not in Vi} {not available when compiled without the |+listcmds| feature} - Also see |:windo|, |:tabdo| and |:bufdo|. + Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo| Example: > :args *.c diff -r c0df98c0770c runtime/doc/index.txt --- a/runtime/doc/index.txt Sat Mar 21 14:20:16 2015 +0100 +++ b/runtime/doc/index.txt Sat Mar 21 19:36:52 2015 -0700 @@ -1138,6 +1138,8 @@ |:cc| :cc go to specific error |:cclose| :ccl[ose] close quickfix window |:cd| :cd change directory +|:cdo| :cdoexecute command in each valid error list entry +|:cfdo|:cfdo execute command in each file in error list |:center| :ce[nter] format lines at the center |:cexpr| :cex[pr]read errors from expr and jump to first |:cfile| :cf[ile]read file with error messages and jump to first @@ -1296,6 +1298,8 @@ |:lchdir| :lch[dir] change directory locally |:lclose| :lcl[ose] close location window |:lcscope| :lcs[cope] like ":cscope" but uses location list +|:ldo| :ld[o] execute command in valid location list entries +|:lfdo|:lfd[o] execute command in each file in location list |:left|:le[ft] left align lines |:leftabove| :lefta[bove]make split window appear left or above |:let| :letassign a value to a variable or option diff -r c0df98c0770c runtime/doc/quickfix.txt --- a/runtime/doc/quickfix.txt Sat Mar 21 14:20:16 2015 +0100 +++ b/runtime/doc/quickfix.txt Sat Mar 21 19:36:52 2015 -0700 @@ -298,6 +298,108 @@ au QuickfixCmdPost make call QfMakeConv() +EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: + *:cdo* +:cdo[!] {cmd} Execute {cmd} in each valid entry in the quickfix list. + It works like doing this: > + :cfirst + :{cmd} + :cnext + :{cmd} + etc. +< When the current file can't be |abandon|ed and the [!] + is not present, the command fails. + When an error is detected on one buffer, further + buffers will not be visited. + The last buffer (or where an error occurred) becomes + the current buffer. + {cmd} can contain '|' to concatenate several commands. + Only valid entries in the quickfix list are used. + Note: While this command is executing, the Syntax + autocommand event is disabled by adding it to + 'eventignore'. This considerably speeds up editing + each buffer. + {not in Vi} {not available when compiled without the +
Re: Patch to add the :cdo and :ldo commands
Am Sonntag, 22. März 2015 03:43:22 UTC+1 schrieb yega...@gmail.com: > Hi all, > > On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > > > > Yegappan Lakshmanan wrote: > > > >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo command > >> can be used to execute commands over all the buffers in the quickfix list. > >> The :ldo command can be used to execute commands over all the buffers in > >> the location list. These are similar to the existing :bufdo, :windo > >> and :tabdo commands. > > > > Thanks. I'll add it in the todo list. > > > > I am attaching an updated patch with a lot of test cases against Vim 7.4.671. > This patch introduces the ":cdo", ":ldo", ":cfdo" and ":lfdo"commands. > The patch to the documentation is also included. > > - Yegappan Great patch! Would love to see it in the main package. :) -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com wrote: > Hi all, > > On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > > > > Yegappan Lakshmanan wrote: > > > >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo command > >> can be used to execute commands over all the buffers in the quickfix list. > >> The :ldo command can be used to execute commands over all the buffers in > >> the location list. These are similar to the existing :bufdo, :windo > >> and :tabdo commands. > > > > Thanks. I'll add it in the todo list. > > > > I am attaching an updated patch with a lot of test cases against Vim 7.4.671. > This patch introduces the ":cdo", ":ldo", ":cfdo" and ":lfdo"commands. > The patch to the documentation is also included. Nice work Yegappan. I would love to see these features included in Vim. Drew -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi all, On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com wrote: >> Hi all, >> >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: >> > >> > Yegappan Lakshmanan wrote: >> > >> >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo command >> >> can be used to execute commands over all the buffers in the quickfix list. >> >> The :ldo command can be used to execute commands over all the buffers in >> >> the location list. These are similar to the existing :bufdo, :windo >> >> and :tabdo commands. >> > >> > Thanks. I'll add it in the todo list. >> > >> >> I am attaching an updated patch with a lot of test cases against Vim 7.4.671. >> This patch introduces the ":cdo", ":ldo", ":cfdo" and ":lfdo"commands. >> The patch to the documentation is also included. > > Nice work Yegappan. I would love to see these features included in Vim. > It looks like a lot of people are interested in this feature. It will help if people can apply this patch and try the new commands and give some feedback. Thanks, Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
I finally got round to building Vim with the cdo.diff patch and I'm currently test-driving it. First thing I tried was populating the quickfix list using :Ggrep (a wrapper for git-grep supplied by the fugitive.vim plugin). Then I made a change to every line in the quickfix list: :cdo normal A -- it works! Then I updated each of the files listed in the quickfix list: :cfdo update Both commands worked as expected. I did notice one oddity: after running :cdo, the syntax highlighting is disabled for each file listed in the quickfix list with the exception of the last file, which has syntax highlighting enabled. The documentation says that disabling syntax highlighting gives a performance boost, which is good to know. My guess is that syntax highlighting is supposed to be re-enabled after running :cdo, but there's some bug that causes it to be re-enabled only for the last file in the list. I have observed similar behaviour when using the :argdo command, so perhaps this bug (if it is a bug) is out of scope for this particular patch. These are my initial observations. I'll keep on using my build with the cdo.diff patch and report back with any further findings. Thanks, Drew On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com wrote: > Hi all, > > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com wrote: > >> Hi all, > >> > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > >> > > >> > Yegappan Lakshmanan wrote: > >> > > >> >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo > >> >> command > >> >> can be used to execute commands over all the buffers in the quickfix > >> >> list. > >> >> The :ldo command can be used to execute commands over all the buffers in > >> >> the location list. These are similar to the existing :bufdo, :windo > >> >> and :tabdo commands. > >> > > >> > Thanks. I'll add it in the todo list. > >> > > >> > >> I am attaching an updated patch with a lot of test cases against Vim > >> 7.4.671. > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and ":lfdo"commands. > >> The patch to the documentation is also included. > > > > Nice work Yegappan. I would love to see these features included in Vim. > > > > It looks like a lot of people are interested in this feature. It will > help if people > can apply this patch and try the new commands and give some feedback. > > Thanks, > Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
On Monday, June 29, 2015 at 12:40:28 PM UTC+3, Drew Neil wrote: > I finally got round to building Vim with the cdo.diff patch and I'm currently > test-driving it. > > First thing I tried was populating the quickfix list using :Ggrep (a wrapper > for git-grep supplied by the fugitive.vim plugin). Then I made a change to > every line in the quickfix list: > > :cdo normal A -- it works! > > Then I updated each of the files listed in the quickfix list: > > :cfdo update > > Both commands worked as expected. > > I did notice one oddity: after running :cdo, the syntax highlighting is > disabled for each file listed in the quickfix list with the exception of the > last file, which has syntax highlighting enabled. The documentation says that > disabling syntax highlighting gives a performance boost, which is good to > know. My guess is that syntax highlighting is supposed to be re-enabled after > running :cdo, but there's some bug that causes it to be re-enabled only for > the last file in the list. I have observed similar behaviour when using the > :argdo command, so perhaps this bug (if it is a bug) is out of scope for this > particular patch. > > These are my initial observations. I'll keep on using my build with the > cdo.diff patch and report back with any further findings. > > Thanks, > Drew > > > On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com wrote: > > Hi all, > > > > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: > > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com wrote: > > >> Hi all, > > >> > > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > > >> > > > >> > Yegappan Lakshmanan wrote: > > >> > > > >> >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo > > >> >> command > > >> >> can be used to execute commands over all the buffers in the quickfix > > >> >> list. > > >> >> The :ldo command can be used to execute commands over all the buffers > > >> >> in > > >> >> the location list. These are similar to the existing :bufdo, :windo > > >> >> and :tabdo commands. > > >> > > > >> > Thanks. I'll add it in the todo list. > > >> > > > >> > > >> I am attaching an updated patch with a lot of test cases against Vim > > >> 7.4.671. > > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and ":lfdo"commands. > > >> The patch to the documentation is also included. > > > > > > Nice work Yegappan. I would love to see these features included in Vim. > > > > > > > It looks like a lot of people are interested in this feature. It will > > help if people > > can apply this patch and try the new commands and give some feedback. > > > > Thanks, > > Yegappan I ported the patch to Neovim [1], where CI discovered that it causes test10 to fail. I tested against Vim 7.4.764, and test10 fails there as well (see [2]). Cheers, Florian [1] https://github.com/neovim/neovim/pull/2927 [2] https://travis-ci.org/fwalch/vim-ci/builds/68879635 -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
On Mo, 29 Jun 2015, Florian Walch wrote: > On Monday, June 29, 2015 at 12:40:28 PM UTC+3, Drew Neil wrote: > > I finally got round to building Vim with the cdo.diff patch and I'm > > currently test-driving it. > > > > First thing I tried was populating the quickfix list using :Ggrep (a > > wrapper for git-grep supplied by the fugitive.vim plugin). Then I made a > > change to every line in the quickfix list: > > > > :cdo normal A -- it works! > > > > Then I updated each of the files listed in the quickfix list: > > > > :cfdo update > > > > Both commands worked as expected. > > > > I did notice one oddity: after running :cdo, the syntax highlighting is > > disabled for each file listed in the quickfix list with the exception of > > the last file, which has syntax highlighting enabled. The documentation > > says that disabling syntax highlighting gives a performance boost, which is > > good to know. My guess is that syntax highlighting is supposed to be > > re-enabled after running :cdo, but there's some bug that causes it to be > > re-enabled only for the last file in the list. I have observed similar > > behaviour when using the :argdo command, so perhaps this bug (if it is a > > bug) is out of scope for this particular patch. > > > > These are my initial observations. I'll keep on using my build with the > > cdo.diff patch and report back with any further findings. > > > > Thanks, > > Drew > > > > > > On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com wrote: > > > Hi all, > > > > > > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: > > > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com wrote: > > > >> Hi all, > > > >> > > > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > > > >> > > > > >> > Yegappan Lakshmanan wrote: > > > >> > > > > >> >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo > > > >> >> command > > > >> >> can be used to execute commands over all the buffers in the > > > >> >> quickfix list. > > > >> >> The :ldo command can be used to execute commands over all the > > > >> >> buffers in > > > >> >> the location list. These are similar to the existing :bufdo, :windo > > > >> >> and :tabdo commands. > > > >> > > > > >> > Thanks. I'll add it in the todo list. > > > >> > > > > >> > > > >> I am attaching an updated patch with a lot of test cases against Vim > > > >> 7.4.671. > > > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and ":lfdo"commands. > > > >> The patch to the documentation is also included. > > > > > > > > Nice work Yegappan. I would love to see these features included in Vim. > > > > > > > > > > It looks like a lot of people are interested in this feature. It will > > > help if people > > > can apply this patch and try the new commands and give some feedback. > > I ported the patch to Neovim [1], where CI discovered that it causes test10 > to fail. I tested against Vim 7.4.764, and test10 fails there as well (see > [2]). I think this happens, because with this patch :cf does resolve to :cfdo instead of :cfile. Swapping the order in ex_cmds.h should fix this. Best, Christian -- Glück ist Scharfsinn für Gelegenheiten und die Fähigkeit sie zu nutzen. -- Samuel Goldwyn (eigentl. Goldfish) -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
On Wednesday, July 1, 2015 at 12:48:50 AM UTC+3, Christian Brabandt wrote: > On Mo, 29 Jun 2015, Florian Walch wrote: > > > On Monday, June 29, 2015 at 12:40:28 PM UTC+3, Drew Neil wrote: > > > I finally got round to building Vim with the cdo.diff patch and I'm > > > currently test-driving it. > > > > > > First thing I tried was populating the quickfix list using :Ggrep (a > > > wrapper for git-grep supplied by the fugitive.vim plugin). Then I made a > > > change to every line in the quickfix list: > > > > > > :cdo normal A -- it works! > > > > > > Then I updated each of the files listed in the quickfix list: > > > > > > :cfdo update > > > > > > Both commands worked as expected. > > > > > > I did notice one oddity: after running :cdo, the syntax highlighting is > > > disabled for each file listed in the quickfix list with the exception of > > > the last file, which has syntax highlighting enabled. The documentation > > > says that disabling syntax highlighting gives a performance boost, which > > > is good to know. My guess is that syntax highlighting is supposed to be > > > re-enabled after running :cdo, but there's some bug that causes it to be > > > re-enabled only for the last file in the list. I have observed similar > > > behaviour when using the :argdo command, so perhaps this bug (if it is a > > > bug) is out of scope for this particular patch. > > > > > > These are my initial observations. I'll keep on using my build with the > > > cdo.diff patch and report back with any further findings. > > > > > > Thanks, > > > Drew > > > > > > > > > On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com wrote: > > > > Hi all, > > > > > > > > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: > > > > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com wrote: > > > > >> Hi all, > > > > >> > > > > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > > > > >> > > > > > >> > Yegappan Lakshmanan wrote: > > > > >> > > > > > >> >> I am attaching a patch to add the :cdo and :ldo commands. The > > > > >> >> :cdo command > > > > >> >> can be used to execute commands over all the buffers in the > > > > >> >> quickfix list. > > > > >> >> The :ldo command can be used to execute commands over all the > > > > >> >> buffers in > > > > >> >> the location list. These are similar to the existing :bufdo, > > > > >> >> :windo > > > > >> >> and :tabdo commands. > > > > >> > > > > > >> > Thanks. I'll add it in the todo list. > > > > >> > > > > > >> > > > > >> I am attaching an updated patch with a lot of test cases against Vim > > > > >> 7.4.671. > > > > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and > > > > >> ":lfdo"commands. > > > > >> The patch to the documentation is also included. > > > > > > > > > > Nice work Yegappan. I would love to see these features included in > > > > > Vim. > > > > > > > > > > > > > It looks like a lot of people are interested in this feature. It will > > > > help if people > > > > can apply this patch and try the new commands and give some feedback. > > > > I ported the patch to Neovim [1], where CI discovered that it causes test10 > > to fail. I tested against Vim 7.4.764, and test10 fails there as well (see > > [2]). > > I think this happens, because with this patch :cf does resolve to :cfdo > instead of :cfile. Swapping the order in ex_cmds.h should fix this. > > Best, > Christian > -- > Glück ist Scharfsinn für Gelegenheiten und die Fähigkeit sie zu > nutzen. > -- Samuel Goldwyn (eigentl. Goldfish) I can confirm that swapping the commands fixes the test error [1]. Cheers, Florian [1] https://travis-ci.org/fwalch/vim-ci/builds/69122901 -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
On Wednesday, July 1, 2015 at 12:54:45 PM UTC+1, Florian Walch wrote: > On Wednesday, July 1, 2015 at 12:48:50 AM UTC+3, Christian Brabandt wrote: > > On Mo, 29 Jun 2015, Florian Walch wrote: > > > > > On Monday, June 29, 2015 at 12:40:28 PM UTC+3, Drew Neil wrote: > > > > I finally got round to building Vim with the cdo.diff patch and I'm > > > > currently test-driving it. > > > > > > > > First thing I tried was populating the quickfix list using :Ggrep (a > > > > wrapper for git-grep supplied by the fugitive.vim plugin). Then I made > > > > a change to every line in the quickfix list: > > > > > > > > :cdo normal A -- it works! > > > > > > > > Then I updated each of the files listed in the quickfix list: > > > > > > > > :cfdo update > > > > > > > > Both commands worked as expected. > > > > > > > > I did notice one oddity: after running :cdo, the syntax highlighting is > > > > disabled for each file listed in the quickfix list with the exception > > > > of the last file, which has syntax highlighting enabled. The > > > > documentation says that disabling syntax highlighting gives a > > > > performance boost, which is good to know. My guess is that syntax > > > > highlighting is supposed to be re-enabled after running :cdo, but > > > > there's some bug that causes it to be re-enabled only for the last file > > > > in the list. I have observed similar behaviour when using the :argdo > > > > command, so perhaps this bug (if it is a bug) is out of scope for this > > > > particular patch. > > > > > > > > These are my initial observations. I'll keep on using my build with the > > > > cdo.diff patch and report back with any further findings. > > > > > > > > Thanks, > > > > Drew > > > > > > > > > > > > On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com wrote: > > > > > Hi all, > > > > > > > > > > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: > > > > > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com > > > > > > wrote: > > > > > >> Hi all, > > > > > >> > > > > > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > > > > > >> > > > > > > >> > Yegappan Lakshmanan wrote: > > > > > >> > > > > > > >> >> I am attaching a patch to add the :cdo and :ldo commands. The > > > > > >> >> :cdo command > > > > > >> >> can be used to execute commands over all the buffers in the > > > > > >> >> quickfix list. > > > > > >> >> The :ldo command can be used to execute commands over all the > > > > > >> >> buffers in > > > > > >> >> the location list. These are similar to the existing :bufdo, > > > > > >> >> :windo > > > > > >> >> and :tabdo commands. > > > > > >> > > > > > > >> > Thanks. I'll add it in the todo list. > > > > > >> > > > > > > >> > > > > > >> I am attaching an updated patch with a lot of test cases against > > > > > >> Vim 7.4.671. > > > > > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and > > > > > >> ":lfdo"commands. > > > > > >> The patch to the documentation is also included. > > > > > > > > > > > > Nice work Yegappan. I would love to see these features included in > > > > > > Vim. > > > > > > > > > > > > > > > > It looks like a lot of people are interested in this feature. It will > > > > > help if people > > > > > can apply this patch and try the new commands and give some feedback. > > > > > > I ported the patch to Neovim [1], where CI discovered that it causes > > > test10 to fail. I tested against Vim 7.4.764, and test10 fails there as > > > well (see [2]). > > > > I think this happens, because with this patch :cf does resolve to :cfdo > > instead of :cfile. Swapping the order in ex_cmds.h should fix this. > > > > Best, > > Christian > > -- > > Glück ist Scharfsinn für Gelegenheiten und die Fähigkeit sie zu > > nutzen. > > -- Samuel Goldwyn (eigentl. Goldfish) > > > I can confirm that swapping the commands fixes the test error [1]. > > Cheers, > Florian > > [1] https://travis-ci.org/fwalch/vim-ci/builds/69122901 I built Vim with this patch a week ago. I've been using the patched build every day for a week and have not yet encountered any issues. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi, On Mon, Jun 29, 2015 at 2:32 PM, Florian Walch wrote: > On Monday, June 29, 2015 at 12:40:28 PM UTC+3, Drew Neil wrote: >> I finally got round to building Vim with the cdo.diff patch and I'm >> currently test-driving it. >> >> First thing I tried was populating the quickfix list using :Ggrep (a wrapper >> for git-grep supplied by the fugitive.vim plugin). Then I made a change to >> every line in the quickfix list: >> >> :cdo normal A -- it works! >> >> Then I updated each of the files listed in the quickfix list: >> >> :cfdo update >> >> Both commands worked as expected. >> >> I did notice one oddity: after running :cdo, the syntax highlighting is >> disabled for each file listed in the quickfix list with the exception of the >> last file, which has syntax highlighting enabled. The documentation says >> that disabling syntax highlighting gives a performance boost, which is good >> to know. My guess is that syntax highlighting is supposed to be re-enabled >> after running :cdo, but there's some bug that causes it to be re-enabled >> only for the last file in the list. I have observed similar behaviour when >> using the :argdo command, so perhaps this bug (if it is a bug) is out of >> scope for this particular patch. >> >> These are my initial observations. I'll keep on using my build with the >> cdo.diff patch and report back with any further findings. >> >> Thanks, >> Drew >> >> >> On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com wrote: >> > Hi all, >> > >> > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: >> > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com wrote: >> > >> Hi all, >> > >> >> > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: >> > >> > >> > >> > Yegappan Lakshmanan wrote: >> > >> > >> > >> >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo >> > >> >> command >> > >> >> can be used to execute commands over all the buffers in the quickfix >> > >> >> list. >> > >> >> The :ldo command can be used to execute commands over all the >> > >> >> buffers in >> > >> >> the location list. These are similar to the existing :bufdo, :windo >> > >> >> and :tabdo commands. >> > >> > >> > >> > Thanks. I'll add it in the todo list. >> > >> > >> > >> >> > >> I am attaching an updated patch with a lot of test cases against Vim >> > >> 7.4.671. >> > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and ":lfdo"commands. >> > >> The patch to the documentation is also included. >> > > >> > > Nice work Yegappan. I would love to see these features included in Vim. >> > > >> > >> > It looks like a lot of people are interested in this feature. It will >> > help if people >> > can apply this patch and try the new commands and give some feedback. >> > >> > Thanks, >> > Yegappan > > I ported the patch to Neovim [1], where CI discovered that it causes test10 > to fail. I tested against Vim 7.4.764, and test10 fails there as well (see > [2]). > > Cheers, > Florian > > [1] https://github.com/neovim/neovim/pull/2927 > [2] https://travis-ci.org/fwalch/vim-ci/builds/68879635 > I have an updated patch that already fixes this problem and a few other warnings found by clang. I have also added the proper range handling for these commands. I will send out the updated patch in a few days. - Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi, On Mon, Jul 6, 2015 at 10:24 AM, Drew Neil wrote: > On Wednesday, July 1, 2015 at 12:54:45 PM UTC+1, Florian Walch wrote: >> On Wednesday, July 1, 2015 at 12:48:50 AM UTC+3, Christian Brabandt wrote: >> > On Mo, 29 Jun 2015, Florian Walch wrote: >> > >> > > On Monday, June 29, 2015 at 12:40:28 PM UTC+3, Drew Neil wrote: >> > > > I finally got round to building Vim with the cdo.diff patch and I'm >> > > > currently test-driving it. >> > > > >> > > > First thing I tried was populating the quickfix list using :Ggrep (a >> > > > wrapper for git-grep supplied by the fugitive.vim plugin). Then I made >> > > > a change to every line in the quickfix list: >> > > > >> > > > :cdo normal A -- it works! >> > > > >> > > > Then I updated each of the files listed in the quickfix list: >> > > > >> > > > :cfdo update >> > > > >> > > > Both commands worked as expected. >> > > > >> > > > I did notice one oddity: after running :cdo, the syntax highlighting >> > > > is disabled for each file listed in the quickfix list with the >> > > > exception of the last file, which has syntax highlighting enabled. The >> > > > documentation says that disabling syntax highlighting gives a >> > > > performance boost, which is good to know. My guess is that syntax >> > > > highlighting is supposed to be re-enabled after running :cdo, but >> > > > there's some bug that causes it to be re-enabled only for the last >> > > > file in the list. I have observed similar behaviour when using the >> > > > :argdo command, so perhaps this bug (if it is a bug) is out of scope >> > > > for this particular patch. >> > > > >> > > > These are my initial observations. I'll keep on using my build with >> > > > the cdo.diff patch and report back with any further findings. >> > > > >> > > > Thanks, >> > > > Drew >> > > > >> > > > >> > > > On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com wrote: >> > > > > Hi all, >> > > > > >> > > > > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: >> > > > > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com >> > > > > > wrote: >> > > > > >> Hi all, >> > > > > >> >> > > > > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: >> > > > > >> > >> > > > > >> > Yegappan Lakshmanan wrote: >> > > > > >> > >> > > > > >> >> I am attaching a patch to add the :cdo and :ldo commands. The >> > > > > >> >> :cdo command >> > > > > >> >> can be used to execute commands over all the buffers in the >> > > > > >> >> quickfix list. >> > > > > >> >> The :ldo command can be used to execute commands over all the >> > > > > >> >> buffers in >> > > > > >> >> the location list. These are similar to the existing :bufdo, >> > > > > >> >> :windo >> > > > > >> >> and :tabdo commands. >> > > > > >> > >> > > > > >> > Thanks. I'll add it in the todo list. >> > > > > >> > >> > > > > >> >> > > > > >> I am attaching an updated patch with a lot of test cases against >> > > > > >> Vim 7.4.671. >> > > > > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and >> > > > > >> ":lfdo"commands. >> > > > > >> The patch to the documentation is also included. >> > > > > > >> > > > > > Nice work Yegappan. I would love to see these features included in >> > > > > > Vim. >> > > > > > >> > > > > >> > > > > It looks like a lot of people are interested in this feature. It will >> > > > > help if people >> > > > > can apply this patch and try the new commands and give some feedback. >> > > >> > > I ported the patch to Neovim [1], where CI discovered that it causes >> > > test10 to fail. I tested against Vim 7.4.764, and test10 fails there as >> > > well (see [2]). >> > >> > I think this happens, because with this patch :cf does resolve to :cfdo >> > instead of :cfile. Swapping the order in ex_cmds.h should fix this. >> > >> > Best, >> > Christian >> > -- >> > Glück ist Scharfsinn für Gelegenheiten und die Fähigkeit sie zu >> > nutzen. >> > -- Samuel Goldwyn (eigentl. Goldfish) >> >> >> I can confirm that swapping the commands fixes the test error [1]. >> >> Cheers, >> Florian >> >> [1] https://travis-ci.org/fwalch/vim-ci/builds/69122901 > > I built Vim with this patch a week ago. I've been using the patched build > every day for a week and have not yet encountered any issues. > Thanks for testing the patch. I will send out an updated patch in a few days. Hopefully this time it will get included. This has been outstanding for more than two years. - Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
+1 have this demand too:http://stackoverflow.com/q/19097216/520162 -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Patch to add the :cdo and :ldo commands
On Mon, September 30, 2013 17:53, eckes wrote: > +1 have this demand too:http://stackoverflow.com/q/19097216/520162 While I like the idea of having a :cdo and :ldo command, for the time being, you can script yourself something similar, e.g. http://article.gmane.org/gmane.editors.vim/92691 regards, Christian -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Patch to add the :cdo and :ldo commands
On Monday, September 30, 2013 6:01:58 PM UTC+2, Christian Brabandt wrote: > On Mon, September 30, 2013 17:53, eckes wrote: > > > +1 have this demand too:http://stackoverflow.com/q/19097216/520162 > > > > While I like the idea of having a :cdo and :ldo command, for the time > > being, you can script yourself something similar, e.g. > > http://article.gmane.org/gmane.editors.vim/92691 There's also qargs [1] which adds the command `:Qargs` to populate the arglist with the quickfix list. Afterwards you can use `:argdo` to emulate `:cdo`. +1 for the patch [1] https://github.com/nelstrom/vim-qargs -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Patch to add the :cdo and :ldo commands
On Sunday, June 2, 2013 3:28:05 PM UTC-3, yega...@gmail.com wrote: > I am attaching a patch to add the :cdo and :ldo commands. The :cdo command > > can be used to execute commands over all the buffers in the quickfix list. +1 I'd like to express my support for this feature as well. It would help, for instance, in search and replace across files. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
On Sunday, June 2, 2013 1:28:05 PM UTC-5, yega...@gmail.com wrote: > Hi all, > > > > I am attaching a patch to add the :cdo and :ldo commands. The :cdo command > > can be used to execute commands over all the buffers in the quickfix list. > > The :ldo command can be used to execute commands over all the buffers in > > the location list. These are similar to the existing :bufdo, :windo and :tabdo > > commands. > > > > - Yegappan I like this idea very much, it saves me from recording a macro that applies a change and does :cnfile and repeating it multiple times. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Patch to add the :cdo and :ldo commands
Hi Ben, On Sun, Jun 2, 2013 at 12:44 PM, Ben Fritz wrote: > On Sunday, June 2, 2013 1:28:05 PM UTC-5, yega...@gmail.com wrote: >> Hi all, >> >> I am attaching a patch to add the :cdo and :ldo commands. The :cdo command >> >> can be used to execute commands over all the buffers in the quickfix list. >> >> The :ldo command can be used to execute commands over all the buffers in >> >> the location list. These are similar to the existing :bufdo, :windo and >> :tabdo >> >> commands. >> > > I like this idea very much, it saves me from recording a macro that applies a > change and does :cnfile and repeating it multiple times. > Good to know that this addition will optimize your workflow. I came across a request for this command in the following page: http://vimcasts.org/episodes/project-wide-find-and-replace/ If more people express interest in this feature, then the probability of this getting included in Vim is high. - Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Patch to add the :cdo and :ldo commands
On Sun, Jun 2, 2013 at 8:28 PM, Yegappan Lakshmanan wrote: > I am attaching a patch to add the :cdo and :ldo commands. The :cdo command > can be used to execute commands over all the buffers in the quickfix list. > The :ldo command can be used to execute commands over all the buffers in > the location list. These are similar to the existing :bufdo, :windo and :tabdo > commands. +1 Very useful, thanks. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Patch to add the :cdo and :ldo commands
Yegappan Lakshmanan wrote: > I am attaching a patch to add the :cdo and :ldo commands. The :cdo command > can be used to execute commands over all the buffers in the quickfix list. > The :ldo command can be used to execute commands over all the buffers in > the location list. These are similar to the existing :bufdo, :windo > and :tabdo commands. Thanks. I'll add it in the todo list. -- Be thankful to be in a traffic jam, because it means you own a car. /// Bram Moolenaar -- b...@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_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Patch to add the :cdo and :ldo commands
On Sun, June 2, 2013 20:28, Yegappan Lakshmanan wrote: > I am attaching a patch to add the :cdo and :ldo commands. The :cdo command > can be used to execute commands over all the buffers in the quickfix list. > The :ldo command can be used to execute commands over all the buffers in > the location list. These are similar to the existing :bufdo, :windo and > :tabdo > commands. Just this weekend I thought that a :[cl]do command would be nice and I was just about to write such a patch. regards, Christian -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Patch to add the :cdo and :ldo commands
Hi all, >>> > > > >>> > > > These are my initial observations. I'll keep on using my build with >>> > > > the cdo.diff patch and report back with any further findings. >>> > > > >>> > > > Thanks, >>> > > > Drew >>> > > > >>> > > > >>> > > > On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com wrote: >>> > > > > Hi all, >>> > > > > >>> > > > > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil wrote: >>> > > > > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com >>> > > > > > wrote: >>> > > > > >> Hi all, >>> > > > > >> >>> > > > > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: >>> > > > > >> > >>> > > > > >> > Yegappan Lakshmanan wrote: >>> > > > > >> > >>> > > > > >> >> I am attaching a patch to add the :cdo and :ldo commands. The >>> > > > > >> >> :cdo command >>> > > > > >> >> can be used to execute commands over all the buffers in the >>> > > > > >> >> quickfix list. >>> > > > > >> >> The :ldo command can be used to execute commands over all the >>> > > > > >> >> buffers in >>> > > > > >> >> the location list. These are similar to the existing :bufdo, >>> > > > > >> >> :windo >>> > > > > >> >> and :tabdo commands. >>> > > > > >> > >>> > > > > >> > Thanks. I'll add it in the todo list. >>> > > > > >> > >>> > > > > >> >>> > > > > >> I am attaching an updated patch with a lot of test cases against >>> > > > > >> Vim 7.4.671. >>> > > > > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and >>> > > > > >> ":lfdo"commands. >>> > > > > >> The patch to the documentation is also included. >>> > > > > > >>> > > > > > Nice work Yegappan. I would love to see these features included >>> > > > > > in Vim. >>> > > > > > >>> > > > > >>> > > > > It looks like a lot of people are interested in this feature. It >>> > > > > will >>> > > > > help if people >>> > > > > can apply this patch and try the new commands and give some >>> > > > > feedback. >>> > > >>> > > I ported the patch to Neovim [1], where CI discovered that it causes >>> > > test10 to fail. I tested against Vim 7.4.764, and test10 fails there as >>> > > well (see [2]). >>> > >>> > I think this happens, because with this patch :cf does resolve to :cfdo >>> > instead of :cfile. Swapping the order in ex_cmds.h should fix this. >>> > >>> > Best, >>> > Christian >>> > -- >>> > Glück ist Scharfsinn für Gelegenheiten und die Fähigkeit sie zu >>> > nutzen. >>> > -- Samuel Goldwyn (eigentl. Goldfish) >>> >>> >>> I can confirm that swapping the commands fixes the test error [1]. >>> >>> Cheers, >>> Florian >>> >>> [1] https://travis-ci.org/fwalch/vim-ci/builds/69122901 >> >> I built Vim with this patch a week ago. I've been using the patched build >> every day for a week and have not yet encountered any issues. >> > > Thanks for testing the patch. I will send out an updated patch in a few days. > Hopefully this time it will get included. This has been outstanding for more > than two years. > The updated patch (against vim 7.4.796) is attached. - Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. diff -r 8840c1ae3b50 runtime/doc/cmdline.txt --- a/runtime/doc/cmdline.txt Wed Jul 22 22:46:14 2015 +0200 +++ b/runtime/doc/cmdline.txt Thu Jul 23 21:42:24 2015 -0700 @@ -511,6 +511,8 @@ :argdo :autocmd :bufdo +:cdo +:cfdo :command :cscope :debug @@ -521,6 +523,8 @@ :help :helpfind :lcscope +:ldo +:lfdo :make :normal :perl diff -r 8840c1ae3b50 runtime/doc/editing.txt --- a/runtime/doc/editing.txt Wed Jul 22 22:46:14 2015 +0200 +++ b/runtime/doc/editing.txt Thu Jul 23 21:42:24 2015 -0700 @@ -857,7 +857,8 @@ each file. {not in Vi} {not available when compiled without the |+listcmds| feature} - Also see |:windo|, |:tabdo| and |:bufdo|. + Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo| Example: > :args *.c diff -r 8840c1ae3b50 runtime/doc/index.txt --- a/runtime/doc/index.txt Wed Jul 22 22:46:14 2015 +0200 +++ b/runtime/doc/index.txt Thu Jul 23 21:42:24 2015 -0700 @@ -1138,6 +1138,8 @@ |:cc| :cc go to specific error |:cclose| :ccl[ose] close quickfix window |:cd| :cd change directory +|:cdo| :cdoexecute command in each valid error list entry +|:cfdo|:cfdo execute command in each file in error list |:center| :ce[nter] fo
Re: Patch to add the :cdo and :ldo commands
Yegappan Lakshmanan wrote: > Hi all, > > >>> > > > > >>> > > > These are my initial observations. I'll keep on using my build with > >>> > > > the cdo.diff patch and report back with any further findings. > >>> > > > > >>> > > > Thanks, > >>> > > > Drew > >>> > > > > >>> > > > > >>> > > > On Monday, April 6, 2015 at 6:41:10 PM UTC+1, yega...@gmail.com > >>> > > > wrote: > >>> > > > > Hi all, > >>> > > > > > >>> > > > > On Mon, Apr 6, 2015 at 6:58 AM, Drew Neil > >>> > > > > wrote: > >>> > > > > > On Sunday, March 22, 2015 at 2:43:22 AM UTC, yega...@gmail.com > >>> > > > > > wrote: > >>> > > > > >> Hi all, > >>> > > > > >> > >>> > > > > >> On Sun, Jun 2, 2013 at 2:09 PM, Bram Moolenaar wrote: > >>> > > > > >> > > >>> > > > > >> > Yegappan Lakshmanan wrote: > >>> > > > > >> > > >>> > > > > >> >> I am attaching a patch to add the :cdo and :ldo commands. > >>> > > > > >> >> The :cdo command > >>> > > > > >> >> can be used to execute commands over all the buffers in the > >>> > > > > >> >> quickfix list. > >>> > > > > >> >> The :ldo command can be used to execute commands over all > >>> > > > > >> >> the buffers in > >>> > > > > >> >> the location list. These are similar to the existing > >>> > > > > >> >> :bufdo, :windo > >>> > > > > >> >> and :tabdo commands. > >>> > > > > >> > > >>> > > > > >> > Thanks. I'll add it in the todo list. > >>> > > > > >> > > >>> > > > > >> > >>> > > > > >> I am attaching an updated patch with a lot of test cases > >>> > > > > >> against Vim 7.4.671. > >>> > > > > >> This patch introduces the ":cdo", ":ldo", ":cfdo" and > >>> > > > > >> ":lfdo"commands. > >>> > > > > >> The patch to the documentation is also included. > >>> > > > > > > >>> > > > > > Nice work Yegappan. I would love to see these features included > >>> > > > > > in Vim. > >>> > > > > > > >>> > > > > > >>> > > > > It looks like a lot of people are interested in this feature. It > >>> > > > > will > >>> > > > > help if people > >>> > > > > can apply this patch and try the new commands and give some > >>> > > > > feedback. > >>> > > > >>> > > I ported the patch to Neovim [1], where CI discovered that it causes > >>> > > test10 to fail. I tested against Vim 7.4.764, and test10 fails there > >>> > > as well (see [2]). > >>> > > >>> > I think this happens, because with this patch :cf does resolve to :cfdo > >>> > instead of :cfile. Swapping the order in ex_cmds.h should fix this. > >>> > > >>> > Best, > >>> > Christian > >>> > -- > >>> > Glück ist Scharfsinn für Gelegenheiten und die Fähigkeit sie zu > >>> > nutzen. > >>> > -- Samuel Goldwyn (eigentl. Goldfish) > >>> > >>> > >>> I can confirm that swapping the commands fixes the test error [1]. > >>> > >>> Cheers, > >>> Florian > >>> > >>> [1] https://travis-ci.org/fwalch/vim-ci/builds/69122901 > >> > >> I built Vim with this patch a week ago. I've been using the patched build > >> every day for a week and have not yet encountered any issues. > >> > > > > Thanks for testing the patch. I will send out an updated patch in a few > > days. > > Hopefully this time it will get included. This has been outstanding for more > > than two years. > > > > The updated patch (against vim 7.4.796) is attached. Thanks. So now it's ready to include, right? -- XML is a nice language for computers. Not for humans. /// Bram Moolenaar -- b...@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_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi Bram, On Fri, Jul 24, 2015 at 10:23 AM, Bram Moolenaar wrote: > >> >> >> > >> > Thanks for testing the patch. I will send out an updated patch in a few >> > days. >> > Hopefully this time it will get included. This has been outstanding for >> > more >> > than two years. >> > >> >> The updated patch (against vim 7.4.796) is attached. > > Thanks. So now it's ready to include, right? > Yes. Of course :-) Thanks, Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi Yegappan, Bram and List 2015-7-25(Sat) 2:50:00 UTC+9 yega...@gmail.com: > Hi Bram, > > On Fri, Jul 24, 2015 at 10:23 AM, Bram Moolenaar wrote: > > > >> >> > >> > > >> > Thanks for testing the patch. I will send out an updated patch in a few > >> > days. > >> > Hopefully this time it will get included. This has been outstanding for > >> > more > >> > than two years. > >> > > >> > >> The updated patch (against vim 7.4.796) is attached. > > > > Thanks. So now it's ready to include, right? > > > > Yes. Of course :-) I confirmed this patch. I found unexpected behaviors. Case#1 How to reproduce: 1. cd to vim src dir. $ cd (Vim clone dir)/vim/src 2. Start Vim. (including this patch version Vim) $ vim -N -u NONE 3. Grep word "cmdidx" from source and header using vimgrep. :vimgrep "\" **/*.[ch] 4. Open quickfix window. :copen 5. Do :cdo command. (Intentionally forget the '| update') :cdo s/\/ex_&/g Expect behavior: - E37 occurs once. Actual behavior: - E37 occurs continuously. Case#2 How to reproduce: 1~4. (Same abobe.) 5. Do :cdo command. (Intentionally forget the ":w\") :exec "cdo norm!iex_\" Expect behavior: - E37 occurs once. Actual behavior: - E37 occurs continuously. And, When press Ctrl-C after the '-- More --' display, buffer.c was modified unexpectedly. [original buffer.c:4901] if (eap->cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide) [modified buffer.c:4901] if (eap->exexexexexexexexexexexexexexexexexexexexexexexex___ _cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide) This is my opnion. When the search pattern exists more in a row, I think :cdo/:ldo confuse to use. and the processing time tends to be long. Thanks. -- Best regards, Hirohito Higashi (a.k.a h_east) -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi Hirohito, On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: > Hi Yegappan, Bram and List > >> >> > >> >> > Thanks for testing the patch. I will send out an updated patch in a few >> >> > days. >> >> > Hopefully this time it will get included. This has been outstanding for >> >> > more >> >> > than two years. >> >> > >> >> >> >> The updated patch (against vim 7.4.796) is attached. >> > >> > Thanks. So now it's ready to include, right? >> > >> >> Yes. Of course :-) > > I confirmed this patch. > > I found unexpected behaviors. > Thanks for testing the patch and sending the bug report. I am attaching an updated patch that fixes the two problems. Let me know if you see any issues with this attached patch. Thanks, Yegappan > > Case#1 > How to reproduce: > 1. cd to vim src dir. > $ cd (Vim clone dir)/vim/src > 2. Start Vim. (including this patch version Vim) > $ vim -N -u NONE > 3. Grep word "cmdidx" from source and header using vimgrep. > :vimgrep "\" **/*.[ch] > 4. Open quickfix window. > :copen > 5. Do :cdo command. (Intentionally forget the '| update') > :cdo s/\/ex_&/g > > Expect behavior: > - E37 occurs once. > > Actual behavior: > - E37 occurs continuously. > > > > Case#2 > How to reproduce: > 1~4. (Same abobe.) > 5. Do :cdo command. (Intentionally forget the ":w\") > :exec "cdo norm!iex_\" > > Expect behavior: > - E37 occurs once. > > Actual behavior: > - E37 occurs continuously. > > And, When press Ctrl-C after the '-- More --' display, buffer.c was > modified unexpectedly. > > [original buffer.c:4901] > if (eap->cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide) > > [modified buffer.c:4901] > if > (eap->exexexexexexexexexexexexexexexexexexexexexexexex___ > _cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide) > > > > This is my opnion. > When the search pattern exists more in a row, I think :cdo/:ldo confuse to > use. > and the processing time tends to be long. > > > Thanks. > -- > Best regards, > Hirohito Higashi (a.k.a h_east) -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. diff -r 8840c1ae3b50 runtime/doc/cmdline.txt --- a/runtime/doc/cmdline.txt Wed Jul 22 22:46:14 2015 +0200 +++ b/runtime/doc/cmdline.txt Fri Jul 24 20:23:43 2015 -0700 @@ -511,6 +511,8 @@ :argdo :autocmd :bufdo +:cdo +:cfdo :command :cscope :debug @@ -521,6 +523,8 @@ :help :helpfind :lcscope +:ldo +:lfdo :make :normal :perl diff -r 8840c1ae3b50 runtime/doc/editing.txt --- a/runtime/doc/editing.txt Wed Jul 22 22:46:14 2015 +0200 +++ b/runtime/doc/editing.txt Fri Jul 24 20:23:43 2015 -0700 @@ -857,7 +857,8 @@ each file. {not in Vi} {not available when compiled without the |+listcmds| feature} - Also see |:windo|, |:tabdo| and |:bufdo|. + Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo| Example: > :args *.c diff -r 8840c1ae3b50 runtime/doc/index.txt --- a/runtime/doc/index.txt Wed Jul 22 22:46:14 2015 +0200 +++ b/runtime/doc/index.txt Fri Jul 24 20:23:43 2015 -0700 @@ -1138,6 +1138,8 @@ |:cc| :cc go to specific error |:cclose| :ccl[ose] close quickfix window |:cd| :cd change directory +|:cdo| :cdoexecute command in each valid error list entry +|:cfdo|:cfdo execute command in each file in error list |:center| :ce[nter] format lines at the center |:cexpr| :cex[pr]read errors from expr and jump to first |:cfile| :cf[ile]read file with error messages and jump to first @@ -1296,6 +1298,8 @@ |:lchdir| :lch[dir] change directory locally |:lclose| :lcl[ose] close location window |:lcscope| :lcs[cope] like ":cscope" but uses location list +|:ldo| :ld[o] execute command in valid location list entries +|:lfdo|:lfd[o] execute command in each file in location list |:left|:le[ft] left align lines |:leftabove| :lefta[bove]make split window appear left or above |:let| :letassign a value to a variable or option diff -r 8840c1ae3b50 runtime/doc/quickfix.txt --- a/runtime/doc/quickfix.txt Wed Jul 22 22:46:14 2015 +0200 +++ b/runtime/doc/quickfix.txt Fri Jul 24 20:23:43 2015 -0700 @@ -298,6 +298,108 @@ au
Re: Patch to add the :cdo and :ldo commands
Hi Yegappan and Bram 2015-7-25(Sat) 12:27:56 UTC+9 yega...@gmail.com: > Hi Hirohito, > > On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: > > Hi Yegappan, Bram and List > > > >> >> > > >> >> > Thanks for testing the patch. I will send out an updated patch in a > >> >> > few days. > >> >> > Hopefully this time it will get included. This has been outstanding > >> >> > for more > >> >> > than two years. > >> >> > > >> >> > >> >> The updated patch (against vim 7.4.796) is attached. > >> > > >> > Thanks. So now it's ready to include, right? > >> > > >> > >> Yes. Of course :-) > > > > I confirmed this patch. > > > > I found unexpected behaviors. > > > > Thanks for testing the patch and sending the bug report. I am attaching > an updated patch that fixes the two problems. Let me know if you see any > issues with this attached patch. I confirmed that reported problem have been fixed. Thank you for quickly fixes. I think it is better to discuss. > > This is my opnion. > > When the search pattern exists more in a row, I think :cdo/:ldo confuse to > > use. > > and the processing time tends to be long. Do you understand that the results of the following two commands are different, When the search pattern exists more in a row? (1) :cdo s/\/ex_&/g | update (2) :exec "cdo norm!iex_\:w\" The (1) is processed all search pattern. But, The (2) is processed first search pattern in a row. ':cdo' is not necessary, When use only :substitute. When we use the ':cfdo' command such as ':cdo', Speed is also faster. :cfdo %s/\/ex_&/g | update So I propose to including patch only ':cfdo' and ':lfdo'. How do you think? -- Best regards, Hirohito Higashi (a.k.a h_east) > > Thanks, > Yegappan > > > > > Case#1 > > How to reproduce: > > 1. cd to vim src dir. > > $ cd (Vim clone dir)/vim/src > > 2. Start Vim. (including this patch version Vim) > > $ vim -N -u NONE > > 3. Grep word "cmdidx" from source and header using vimgrep. > > :vimgrep "\" **/*.[ch] > > 4. Open quickfix window. > > :copen > > 5. Do :cdo command. (Intentionally forget the '| update') > > :cdo s/\/ex_&/g > > > > Expect behavior: > > - E37 occurs once. > > > > Actual behavior: > > - E37 occurs continuously. > > > > > > > > Case#2 > > How to reproduce: > > 1~4. (Same abobe.) > > 5. Do :cdo command. (Intentionally forget the ":w\") > > :exec "cdo norm!iex_\" > > > > Expect behavior: > > - E37 occurs once. > > > > Actual behavior: > > - E37 occurs continuously. > > > > And, When press Ctrl-C after the '-- More --' display, buffer.c was > > modified unexpectedly. > > > > [original buffer.c:4901] > > if (eap->cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide) > > > > [modified buffer.c:4901] > > if > > (eap->exexexexexexexexexexexexexexexexexexexexexexexex___ > > _cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide) > > > > > > > > This is my opnion. > > When the search pattern exists more in a row, I think :cdo/:ldo confuse to > > use. > > and the processing time tends to be long. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi, On Sat, Jul 25, 2015 at 9:55 AM, h_east wrote: > Hi Yegappan and Bram > > 2015-7-25(Sat) 12:27:56 UTC+9 yega...@gmail.com: >> Hi Hirohito, >> >> On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: >> > Hi Yegappan, Bram and List >> > >> >> >> > >> >> >> > Thanks for testing the patch. I will send out an updated patch in a >> >> >> > few days. >> >> >> > Hopefully this time it will get included. This has been outstanding >> >> >> > for more >> >> >> > than two years. >> >> >> > >> >> >> >> >> >> The updated patch (against vim 7.4.796) is attached. >> >> > >> >> > Thanks. So now it's ready to include, right? >> >> > >> >> >> >> Yes. Of course :-) >> > >> > I confirmed this patch. >> > >> > I found unexpected behaviors. >> > >> >> Thanks for testing the patch and sending the bug report. I am attaching >> an updated patch that fixes the two problems. Let me know if you see any >> issues with this attached patch. > > I confirmed that reported problem have been fixed. > Thank you for quickly fixes. > > I think it is better to discuss. >> > This is my opnion. >> > When the search pattern exists more in a row, I think :cdo/:ldo confuse to >> > use. >> > and the processing time tends to be long. > > Do you understand that the results of the following two commands are > different, > When the search pattern exists more in a row? > The ":cdo" command executes the supplied command for every valid entry in the quickfix list. It is upto the supplied command to perform the appropriate action for every entry. > > (1) :cdo s/\/ex_&/g | update > In this case, the supplied substitute command replaces all the occurrences of cmdidx in the current line. > > (2) :exec "cdo norm!iex_\:w\" > In this case, the supplied replaces only the first occurrence of cmdidx. This is not a problem with the ":cdo" command. This is a problem with the user supplied command. > > The (1) is processed all search pattern. > But, The (2) is processed first search pattern in a row. > This is the expected behavior as this is a problem with the user supplied command. > > ':cdo' is not necessary, When use only :substitute. > > When we use the ':cfdo' command such as ':cdo', Speed is also faster. > > :cfdo %s/\/ex_&/g | update > > So I propose to including patch only ':cfdo' and ':lfdo'. > > How do you think? > No. In some cases the ":cdo/:ldo" commands are useful and in some other cases ":cfdo/:lfdo" commands are useful. You are assuming that the ":cdo/:cfdo" commands will only be used to perform substitutions and the results in the quickfix/location lists are from a search command (e.g. vimgrep). This is not always the case. You can populate the quickfix list with output from various tools (e.g. cscope, tags, lid, global, build output, static analysis output, etc.). Regards, Yegappan >> > >> > Case#1 >> > How to reproduce: >> > 1. cd to vim src dir. >> > $ cd (Vim clone dir)/vim/src >> > 2. Start Vim. (including this patch version Vim) >> > $ vim -N -u NONE >> > 3. Grep word "cmdidx" from source and header using vimgrep. >> > :vimgrep "\" **/*.[ch] >> > 4. Open quickfix window. >> > :copen >> > 5. Do :cdo command. (Intentionally forget the '| update') >> > :cdo s/\/ex_&/g >> > >> > Expect behavior: >> > - E37 occurs once. >> > >> > Actual behavior: >> > - E37 occurs continuously. >> > >> > >> > >> > Case#2 >> > How to reproduce: >> > 1~4. (Same abobe.) >> > 5. Do :cdo command. (Intentionally forget the ":w\") >> > :exec "cdo norm!iex_\" >> > >> > Expect behavior: >> > - E37 occurs once. >> > >> > Actual behavior: >> > - E37 occurs continuously. >> > >> > And, When press Ctrl-C after the '-- More --' display, buffer.c was >> > modified unexpectedly. >> > >> > [original buffer.c:4901] >> > if (eap->cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide) >> > >> > [modified buffer.c:4901] >> > if >> > (eap->exexexexexexexexexexexexexexexexexexexexexexexex___ >> > _cmdidx == CMD_unhide || eap->cmdidx == CMD_sunhide) >> > >> > >> > >> > This is my opnion. >> > When the search pattern exists more in a row, I think :cdo/:ldo confuse to >> > use. >> > and the processing time tends to be long. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
I agree with h_east that if you’re planning to run the :substitute command across multiple files, it makes sense to use: :cfdo %s/pattern/replacement/g and not: :cdo s/pattern/replacement/g I can also see myself wanting to use the :cdo command in combination with :normal for certain types of task. But I’ve come across another problem. Suppose that we have a text file containing these four lines of text: http://example.com http://example.org http://example.net http://example.com http://example.org http://example.net Now let’s say that we want to turn each occurrence of ‘http’ to ‘https’. (We could use the :substitute command here, but let me use this to demonstrate a problem with using :normal). We’ll use :vimgrep to populate the quickfix list with 6 matches: :vimgrep /http\zs:/g % Then we’ll insert the ’s’ character in front of the colon with this command: :cdo normal is The resulting text looks like this: https://example.com https://example.org https://example.net https://example.com httsp://example.org htstp://example.net In the last line, we get ‘https’, then ‘httsp’, then ‘htstp’. Not ideal! The problem here is that the quickfix list records line and column numbers. If characters are added or removed near the start of the line, the column numbers for later matches on that line will no longer line up with the match that created the original quickfix list entry. I’m not sure if this is a problem with the quickfix list, with :cdo, or with :normal. Drew On Sat, Jul 25, 2015 at 6:22 PM, Yegappan Lakshmanan wrote: > Hi, > > On Sat, Jul 25, 2015 at 9:55 AM, h_east wrote: > > Hi Yegappan and Bram > > > > 2015-7-25(Sat) 12:27:56 UTC+9 yega...@gmail.com: > >> Hi Hirohito, > >> > >> On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: > >> > Hi Yegappan, Bram and List > >> > > >> >> >> > > >> >> >> > Thanks for testing the patch. I will send out an updated patch > in a few days. > >> >> >> > Hopefully this time it will get included. This has been > outstanding for more > >> >> >> > than two years. > >> >> >> > > >> >> >> > >> >> >> The updated patch (against vim 7.4.796) is attached. > >> >> > > >> >> > Thanks. So now it's ready to include, right? > >> >> > > >> >> > >> >> Yes. Of course :-) > >> > > >> > I confirmed this patch. > >> > > >> > I found unexpected behaviors. > >> > > >> > >> Thanks for testing the patch and sending the bug report. I am attaching > >> an updated patch that fixes the two problems. Let me know if you see any > >> issues with this attached patch. > > > > I confirmed that reported problem have been fixed. > > Thank you for quickly fixes. > > > > I think it is better to discuss. > >> > This is my opnion. > >> > When the search pattern exists more in a row, I think :cdo/:ldo > confuse to use. > >> > and the processing time tends to be long. > > > > Do you understand that the results of the following two commands are > different, > > When the search pattern exists more in a row? > > > > The ":cdo" command executes the supplied command for every valid entry > in the quickfix list. It is upto the supplied command to perform the > appropriate > action for every entry. > > > > > (1) :cdo s/\/ex_&/g | update > > > > In this case, the supplied substitute command replaces all the occurrences > of > cmdidx in the current line. > > > > > (2) :exec "cdo norm!iex_\:w\" > > > > In this case, the supplied replaces only the first occurrence of cmdidx. > This is > not a problem with the ":cdo" command. This is a problem with the user > supplied > command. > > > > > The (1) is processed all search pattern. > > But, The (2) is processed first search pattern in a row. > > > > This is the expected behavior as this is a problem with the user > supplied command. > > > > > ':cdo' is not necessary, When use only :substitute. > > > > When we use the ':cfdo' command such as ':cdo', Speed is also faster. > > > > :cfdo %s/\/ex_&/g | update > > > > So I propose to including patch only ':cfdo' and ':lfdo'. > > > > How do you think? > > > > No. In some cases the ":cdo/:ldo" commands are useful and in some > other cases ":cfdo/:lfdo" commands are useful. > > You are assuming that the ":cdo/:cfdo" commands will only be used > to perform substitutions and the results in the quickfix/location lists are > from a search command (e.g. vimgrep). This is not always the case. > You can populate the quickfix list with output from various tools > (e.g. cscope, tags, lid, global, build output, static analysis output, > etc.). > > Regards, > Yegappan > > >> > > >> > Case#1 > >> > How to reproduce: > >> > 1. cd to vim src dir. > >> > $ cd (Vim clone dir)/vim/src > >> > 2. Start Vim. (including this patch version Vim) > >> > $ vim -N -u NONE > >> > 3. Grep word "cmdidx" from source and header using vimgrep. > >> > :vimgrep "\" **/*.[ch] > >> > 4. Open quickfix window. > >> > :copen > >> > 5. Do :cdo command. (Intentionally forget the '| update') > >> >
Re: Patch to add the :cdo and :ldo commands
Using the same example as before, with this text: http://example.com http://example.org http://example.net http://example.com http://example.org http://example.net This time running the commands: :vimgrep /http\zs:/g % :cdo normal o That should create a new empty line after each match in the quickfix list. To my surprise this worked just fine, producing this output: http://example.com http://example.org http://example.net http://example.com http://example.org http://example.net [eof - three blank lines before end of file] I was expecting this to suffer from a similar problem as the previous example. This time it’s the line numbers (not column numbers) that would fall out of sync with the matches. But it doesn’t happen. Here’s the addresses in the quickfix list before running those commands: 1 col 5 2 col 5 3 col 5 4 col 5 4 col 24 4 col 43 After running the `:cdo normal o` command, the quickfix list contains these addresses: 1 col 5 3 col 5 5 col 5 7 col 5 7 col 24 7 col 43 This suggests that the quickfix list is somehow updated between edits that modify the number of lines in a file. Would it be possible to update the quickfix list could also between edits that modify the number of characters in a line? Drew On Sun, Jul 26, 2015 at 12:53 PM, Drew Neil wrote: > I agree with h_east that if you’re planning to run the :substitute command > across multiple files, it makes sense to use: > > :cfdo %s/pattern/replacement/g > > and not: > > :cdo s/pattern/replacement/g > > I can also see myself wanting to use the :cdo command in combination with > :normal for certain types of task. But I’ve come across another problem. > Suppose that we have a text file containing these four lines of text: > > http://example.com > http://example.org > http://example.net > http://example.com http://example.org http://example.net > > Now let’s say that we want to turn each occurrence of ‘http’ to ‘https’. > (We could use the :substitute command here, but let me use this to > demonstrate a problem with using :normal). We’ll use :vimgrep to populate > the quickfix list with 6 matches: > > :vimgrep /http\zs:/g % > > Then we’ll insert the ’s’ character in front of the colon with this > command: > > :cdo normal is > > The resulting text looks like this: > > https://example.com > https://example.org > https://example.net > https://example.com httsp://example.org htstp://example.net > > In the last line, we get ‘https’, then ‘httsp’, then ‘htstp’. Not ideal! > > The problem here is that the quickfix list records line and column > numbers. If characters are added or removed near the start of the line, the > column numbers for later matches on that line will no longer line up with > the match that created the original quickfix list entry. > > I’m not sure if this is a problem with the quickfix list, with :cdo, or > with :normal. > > Drew > > > > On Sat, Jul 25, 2015 at 6:22 PM, Yegappan Lakshmanan > wrote: > >> Hi, >> >> On Sat, Jul 25, 2015 at 9:55 AM, h_east wrote: >> > Hi Yegappan and Bram >> > >> > 2015-7-25(Sat) 12:27:56 UTC+9 yega...@gmail.com: >> >> >> Hi Hirohito, >> >> >> >> On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: >> >> > Hi Yegappan, Bram and List >> >> > >> >> >> >> > >> >> >> >> > Thanks for testing the patch. I will send out an updated patch >> in a few days. >> >> >> >> > Hopefully this time it will get included. This has been >> outstanding for more >> >> >> >> > than two years. >> >> >> >> > >> >> >> >> >> >> >> >> The updated patch (against vim 7.4.796) is attached. >> >> >> > >> >> >> > Thanks. So now it's ready to include, right? >> >> >> > >> >> >> >> >> >> Yes. Of course :-) >> >> > >> >> > I confirmed this patch. >> >> > >> >> > I found unexpected behaviors. >> >> > >> >> >> >> Thanks for testing the patch and sending the bug report. I am attaching >> >> an updated patch that fixes the two problems. Let me know if you see >> any >> >> issues with this attached patch. >> > >> > I confirmed that reported problem have been fixed. >> > Thank you for quickly fixes. >> > >> > I think it is better to discuss. >> >> > This is my opnion. >> >> > When the search pattern exists more in a row, I think :cdo/:ldo >> confuse to use. >> >> > and the processing time tends to be long. >> > >> > Do you understand that the results of the following two commands are >> different, >> > When the search pattern exists more in a row? >> > >> >> The ":cdo" command executes the supplied command for every valid entry >> in the quickfix list. It is upto the supplied command to perform the >> appropriate >> action for every entry. >> >> > >> > (1) :cdo s/\/ex_&/g | update >> > >> >> In this case, the supplied substitute command replaces all the >> occurrences of >> cmdidx in the current line. >> >> > >> > (2) :exec "cdo norm!iex_\:w\" >> > >> >> In this case, the supplied replaces
Re: Patch to add the :cdo and :ldo commands
Hi, On Sun, Jul 26, 2015 at 4:53 AM, Drew Neil wrote: > I agree with h_east that if you’re planning to run the :substitute command > across multiple files, it makes sense to use: > > :cfdo %s/pattern/replacement/g > > and not: > > :cdo s/pattern/replacement/g > Depending on the task, you can use either the ":cdo" or the ":cfdo" commands. If you want to perform text search/replace across all the files in the quickfix list, then the ":cfdo" command with ":%s/.../g" is the correct option (as it is more optimal). This is similar to using the "g" argument to the ":substitute" command to replace all the matching text in a single line. And using the "%" range to replace text in all the lines. If you want to replace multiple matching text across all the lines in a file, then you have to pass both "%" and "g". If you don't, then the text will not be correctly replaced. This is not a problem with the ":substitute" command. > > I can also see myself wanting to use the :cdo command in combination with > :normal for certain types of task. But I’ve come across another problem. > Suppose that we have a text file containing these four lines of text: > > http://example.com > http://example.org > http://example.net > http://example.com http://example.org http://example.net > > Now let’s say that we want to turn each occurrence of ‘http’ to ‘https’. (We > could use the :substitute command here, but let me use this to demonstrate a > problem with using :normal). We’ll use :vimgrep to populate the quickfix > list with 6 matches: > > :vimgrep /http\zs:/g % > > Then we’ll insert the ’s’ character in front of the colon with this command: > > :cdo normal is > > The resulting text looks like this: > > https://example.com > https://example.org > https://example.net > https://example.com httsp://example.org htstp://example.net > > In the last line, we get ‘https’, then ‘httsp’, then ‘htstp’. Not ideal! > > The problem here is that the quickfix list records line and column numbers. > If characters are added or removed near the start of the line, the column > numbers for later matches on that line will no longer line up with the match > that created the original quickfix list entry. > > I’m not sure if this is a problem with the quickfix list, with :cdo, or with > :normal. > This is a problem with the quickfix list functionality. Currently when a line is added or removed, then the line numbers in the quickfix list entries are updated. But when a line is modified, the column numbers in the quickfix list entries are not updated. Refer to the qf_mark_adjust() function. In the above example, you should use ":s/../g" instead of the ":normal" command. Regards, Yegappan > > On Sat, Jul 25, 2015 at 6:22 PM, Yegappan Lakshmanan > wrote: >> >> Hi, >> >> On Sat, Jul 25, 2015 at 9:55 AM, h_east wrote: >> > Hi Yegappan and Bram >> > >> > 2015-7-25(Sat) 12:27:56 UTC+9 yega...@gmail.com: >> >> >> Hi Hirohito, >> >> >> >> On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: >> >> > Hi Yegappan, Bram and List >> >> > >> >> >> >> > >> >> >> >> > Thanks for testing the patch. I will send out an updated patch >> >> >> >> > in a few days. >> >> >> >> > Hopefully this time it will get included. This has been >> >> >> >> > outstanding for more >> >> >> >> > than two years. >> >> >> >> > >> >> >> >> >> >> >> >> The updated patch (against vim 7.4.796) is attached. >> >> >> > >> >> >> > Thanks. So now it's ready to include, right? >> >> >> > >> >> >> >> >> >> Yes. Of course :-) >> >> > >> >> > I confirmed this patch. >> >> > >> >> > I found unexpected behaviors. >> >> > >> >> >> >> Thanks for testing the patch and sending the bug report. I am attaching >> >> an updated patch that fixes the two problems. Let me know if you see >> >> any >> >> issues with this attached patch. >> > >> > I confirmed that reported problem have been fixed. >> > Thank you for quickly fixes. >> > >> > I think it is better to discuss. >> >> > This is my opnion. >> >> > When the search pattern exists more in a row, I think :cdo/:ldo >> >> > confuse to use. >> >> > and the processing time tends to be long. >> > >> > Do you understand that the results of the following two commands are >> > different, >> > When the search pattern exists more in a row? >> > >> >> The ":cdo" command executes the supplied command for every valid entry >> in the quickfix list. It is upto the supplied command to perform the >> appropriate >> action for every entry. >> >> > >> > (1) :cdo s/\/ex_&/g | update >> > >> >> In this case, the supplied substitute command replaces all the occurrences >> of >> cmdidx in the current line. >> >> > >> > (2) :exec "cdo norm!iex_\:w\" >> > >> >> In this case, the supplied replaces only the first occurrence of cmdidx. >> This is >> not a problem with the ":cdo" command. This is a problem with the user >> supplied >> command. >> >> > >> > The (1) is processed all search pattern. >> > But, The (2) is processed first search pat
Re: Patch to add the :cdo and :ldo commands
Hi, On Sun, Jul 26, 2015 at 5:06 AM, Drew Neil wrote: > Using the same example as before, with this text: > > http://example.com > http://example.org > http://example.net > http://example.com http://example.org http://example.net > > This time running the commands: > > :vimgrep /http\zs:/g % > :cdo normal o > > That should create a new empty line after each match in the quickfix list. > To my surprise this worked just fine, producing this output: > > http://example.com > > http://example.org > > http://example.net > > http://example.com http://example.org http://example.net > > > > [eof - three blank lines before end of file] > > I was expecting this to suffer from a similar problem as the previous > example. This time it’s the line numbers (not column numbers) that would > fall out of sync with the matches. But it doesn’t happen. Here’s the > addresses in the quickfix list before running those commands: > > 1 col 5 > 2 col 5 > 3 col 5 > 4 col 5 > 4 col 24 > 4 col 43 > > After running the `:cdo normal o` command, the quickfix list contains these > addresses: > > 1 col 5 > 3 col 5 > 5 col 5 > 7 col 5 > 7 col 24 > 7 col 43 > > This suggests that the quickfix list is somehow updated between edits that > modify the number of lines in a file. Would it be possible to update the > quickfix list could also between edits that modify the number of characters > in a line? > As I mentioned in my previous e-mail, the qf_mark_adjust() function is used to adjust the line numbers in the quickfix list whenever a line is added or removed from a file. But when a line is modified, the column numbers in the quickfix list are not currently updated. This is a bug in the quickfix functionality and needs to be fixed. - Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi all, On Sun, Jul 26, 2015 at 12:22 PM, Yegappan Lakshmanan wrote: > Hi, > > On Sun, Jul 26, 2015 at 4:53 AM, Drew Neil wrote: >> I agree with h_east that if you’re planning to run the :substitute command >> across multiple files, it makes sense to use: >> >> :cfdo %s/pattern/replacement/g >> >> and not: >> >> :cdo s/pattern/replacement/g >> > > Depending on the task, you can use either the ":cdo" or the ":cfdo" commands. > I haven't see any replies so far. I am not sure whether we are agreeing to add both the commands or only the cfdo/lfdo commands? Do you guys think that only the cfdo/lfdo commands will be useful? Regards, Yegappan > > If you want to perform text search/replace across all the files in the > quickfix > list, then the ":cfdo" command with ":%s/.../g" is the correct option (as it > is > more optimal). > > This is similar to using the "g" argument to the ":substitute" command to > replace all the matching text in a single line. And using the "%" range > to replace text in all the lines. If you want to replace multiple matching > text across all the lines in a file, then you have to pass both "%" and "g". > If you don't, then the text will not be correctly replaced. This is not a > problem with the ":substitute" command. > >> >> I can also see myself wanting to use the :cdo command in combination with >> :normal for certain types of task. But I’ve come across another problem. >> Suppose that we have a text file containing these four lines of text: >> >> http://example.com >> http://example.org >> http://example.net >> http://example.com http://example.org http://example.net >> >> Now let’s say that we want to turn each occurrence of ‘http’ to ‘https’. (We >> could use the :substitute command here, but let me use this to demonstrate a >> problem with using :normal). We’ll use :vimgrep to populate the quickfix >> list with 6 matches: >> >> :vimgrep /http\zs:/g % >> >> Then we’ll insert the ’s’ character in front of the colon with this command: >> >> :cdo normal is >> >> The resulting text looks like this: >> >> https://example.com >> https://example.org >> https://example.net >> https://example.com httsp://example.org htstp://example.net >> >> In the last line, we get ‘https’, then ‘httsp’, then ‘htstp’. Not ideal! >> >> The problem here is that the quickfix list records line and column numbers. >> If characters are added or removed near the start of the line, the column >> numbers for later matches on that line will no longer line up with the match >> that created the original quickfix list entry. >> >> I’m not sure if this is a problem with the quickfix list, with :cdo, or with >> :normal. >> > > This is a problem with the quickfix list functionality. Currently when a line > is added or removed, then the line numbers in the quickfix list entries > are updated. But when a line is modified, the column numbers in the > quickfix list entries are not updated. Refer to the qf_mark_adjust() > function. > > In the above example, you should use ":s/../g" instead of the ":normal" > command. > > Regards, > Yegappan > >> >> On Sat, Jul 25, 2015 at 6:22 PM, Yegappan Lakshmanan >> wrote: >>> >>> Hi, >>> >>> On Sat, Jul 25, 2015 at 9:55 AM, h_east wrote: >>> > Hi Yegappan and Bram >>> > >>> > 2015-7-25(Sat) 12:27:56 UTC+9 yega...@gmail.com: >>> >>> >> Hi Hirohito, >>> >> >>> >> On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: >>> >> > Hi Yegappan, Bram and List >>> >> > >>> >> >> >> > >>> >> >> >> > Thanks for testing the patch. I will send out an updated patch >>> >> >> >> > in a few days. >>> >> >> >> > Hopefully this time it will get included. This has been >>> >> >> >> > outstanding for more >>> >> >> >> > than two years. >>> >> >> >> > >>> >> >> >> >>> >> >> >> The updated patch (against vim 7.4.796) is attached. >>> >> >> > >>> >> >> > Thanks. So now it's ready to include, right? >>> >> >> > >>> >> >> >>> >> >> Yes. Of course :-) >>> >> > >>> >> > I confirmed this patch. >>> >> > >>> >> > I found unexpected behaviors. >>> >> > >>> >> >>> >> Thanks for testing the patch and sending the bug report. I am attaching >>> >> an updated patch that fixes the two problems. Let me know if you see >>> >> any >>> >> issues with this attached patch. >>> > >>> > I confirmed that reported problem have been fixed. >>> > Thank you for quickly fixes. >>> > >>> > I think it is better to discuss. >>> >> > This is my opnion. >>> >> > When the search pattern exists more in a row, I think :cdo/:ldo >>> >> > confuse to use. >>> >> > and the processing time tends to be long. >>> > >>> > Do you understand that the results of the following two commands are >>> > different, >>> > When the search pattern exists more in a row? >>> > >>> >>> The ":cdo" command executes the supplied command for every valid entry >>> in the quickfix list. It is upto the supplied command to perform the >>> appropriate >>> action for every entry. >>> >>> > >>> > (1) :cdo s/\/ex_&/g | update >>>
Re: Patch to add the :cdo and :ldo commands
Am 2015-07-29 22:34, schrieb Yegappan Lakshmanan: I haven't see any replies so far. I am not sure whether we are agreeing to add both the commands or only the cfdo/lfdo commands? Do you guys think that only the cfdo/lfdo commands will be useful? I think, depending on the task, both options could be useful. Best, Christian -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 30-Jul-2015 08:21, Christian Brabandt wrote: > Am 2015-07-29 22:34, schrieb Yegappan Lakshmanan: >> I haven't see any replies so far. I am not sure whether we are >> agreeing to add both the commands or only the cfdo/lfdo commands? >> Do you guys think that only the cfdo/lfdo commands will be >> useful? > > I think, depending on the task, both options could be useful. I agree; my ArgsAndMore plugin (http://www.vim.org/scripts/script.php?script_id=4152) also provides both :CDoEntry and :CDoFile commands. - -- regards, ingo -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (MingW32) iQEcBAEBAgAGBQJVunY+AAoJEA7ziXlAzQ/vL6kIAJRbiSHCSL4JDT07ia8DRPwS gaQGk7/tmngUs8vpwg8Qokx2KthS75eep69dS5KuzL2/f9c+Mdcs/sYbe7QJYE4Y r3uZvYhxnnvSWyle6+5OCSurUrc4YqG6qozT4EaBTXS9HvuUS4wVO1COTfirUwsG +IUYfg6X7esgBegTRyV1S2zliUv6y03de3r44L1zfUgU7/96/ODFFanGhb62Ehwc ZCaSD1X3ElVDOiFN4ZI3g/I7C/WUH1ndp8dB6EkFEM4+VyJVJdwT6W3/scbrDv3P eEnF5nJIQqgyN4JULRmFEaxYA8V2P0bzsaUvsxGP7g0nPlrtByxKEkxiWtCVa3E= =jwPs -END PGP SIGNATURE- -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
I can see myself finding uses for both :cdo and :cfdo. On Thu, Jul 30, 2015 at 8:08 PM, Ingo Karkat wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 30-Jul-2015 08:21, Christian Brabandt wrote: > > Am 2015-07-29 22:34, schrieb Yegappan Lakshmanan: > >> I haven't see any replies so far. I am not sure whether we are > >> agreeing to add both the commands or only the cfdo/lfdo commands? > >> Do you guys think that only the cfdo/lfdo commands will be > >> useful? > > > > I think, depending on the task, both options could be useful. > > I agree; my ArgsAndMore plugin > (http://www.vim.org/scripts/script.php?script_id=4152) also provides > both :CDoEntry and :CDoFile commands. > > - -- regards, ingo > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.17 (MingW32) > > iQEcBAEBAgAGBQJVunY+AAoJEA7ziXlAzQ/vL6kIAJRbiSHCSL4JDT07ia8DRPwS > gaQGk7/tmngUs8vpwg8Qokx2KthS75eep69dS5KuzL2/f9c+Mdcs/sYbe7QJYE4Y > r3uZvYhxnnvSWyle6+5OCSurUrc4YqG6qozT4EaBTXS9HvuUS4wVO1COTfirUwsG > +IUYfg6X7esgBegTRyV1S2zliUv6y03de3r44L1zfUgU7/96/ODFFanGhb62Ehwc > ZCaSD1X3ElVDOiFN4ZI3g/I7C/WUH1ndp8dB6EkFEM4+VyJVJdwT6W3/scbrDv3P > eEnF5nJIQqgyN4JULRmFEaxYA8V2P0bzsaUvsxGP7g0nPlrtByxKEkxiWtCVa3E= > =jwPs > -END PGP SIGNATURE- > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to a topic in the > Google Groups "vim_dev" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/vim_dev/dfyt-G6SMec/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > vim_dev+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Would it make sense to break this patch in two? One patch could contain the implementation for :cfdo and :lfdo. The other patch could contain the implementation for :cdo and :ldo. I think that :cfdo is ready to merge. Whereas :cdo seems to be a bit more controversial and perhaps needs more work? Drew On Wed, Jul 29, 2015 at 9:34 PM, Yegappan Lakshmanan wrote: > Hi all, > > On Sun, Jul 26, 2015 at 12:22 PM, Yegappan Lakshmanan > wrote: > > Hi, > > > > On Sun, Jul 26, 2015 at 4:53 AM, Drew Neil > wrote: > >> I agree with h_east that if you’re planning to run the :substitute > command > >> across multiple files, it makes sense to use: > >> > >> :cfdo %s/pattern/replacement/g > >> > >> and not: > >> > >> :cdo s/pattern/replacement/g > >> > > > > Depending on the task, you can use either the ":cdo" or the ":cfdo" > commands. > > > > I haven't see any replies so far. I am not sure whether we are > agreeing to add both the > commands or only the cfdo/lfdo commands? Do you guys think that only > the cfdo/lfdo > commands will be useful? > > Regards, > Yegappan > > > > > If you want to perform text search/replace across all the files in the > quickfix > > list, then the ":cfdo" command with ":%s/.../g" is the correct option > (as it is > > more optimal). > > > > This is similar to using the "g" argument to the ":substitute" command to > > replace all the matching text in a single line. And using the "%" range > > to replace text in all the lines. If you want to replace multiple > matching > > text across all the lines in a file, then you have to pass both "%" and > "g". > > If you don't, then the text will not be correctly replaced. This is not a > > problem with the ":substitute" command. > > > >> > >> I can also see myself wanting to use the :cdo command in combination > with > >> :normal for certain types of task. But I’ve come across another problem. > >> Suppose that we have a text file containing these four lines of text: > >> > >> http://example.com > >> http://example.org > >> http://example.net > >> http://example.com http://example.org http://example.net > >> > >> Now let’s say that we want to turn each occurrence of ‘http’ to > ‘https’. (We > >> could use the :substitute command here, but let me use this to > demonstrate a > >> problem with using :normal). We’ll use :vimgrep to populate the quickfix > >> list with 6 matches: > >> > >> :vimgrep /http\zs:/g % > >> > >> Then we’ll insert the ’s’ character in front of the colon with this > command: > >> > >> :cdo normal is > >> > >> The resulting text looks like this: > >> > >> https://example.com > >> https://example.org > >> https://example.net > >> https://example.com httsp://example.org htstp://example.net > >> > >> In the last line, we get ‘https’, then ‘httsp’, then ‘htstp’. Not ideal! > >> > >> The problem here is that the quickfix list records line and column > numbers. > >> If characters are added or removed near the start of the line, the > column > >> numbers for later matches on that line will no longer line up with the > match > >> that created the original quickfix list entry. > >> > >> I’m not sure if this is a problem with the quickfix list, with :cdo, or > with > >> :normal. > >> > > > > This is a problem with the quickfix list functionality. Currently when a > line > > is added or removed, then the line numbers in the quickfix list entries > > are updated. But when a line is modified, the column numbers in the > > quickfix list entries are not updated. Refer to the qf_mark_adjust() > > function. > > > > In the above example, you should use ":s/../g" instead of the ":normal" > > command. > > > > Regards, > > Yegappan > > > >> > >> On Sat, Jul 25, 2015 at 6:22 PM, Yegappan Lakshmanan < > yegapp...@gmail.com> > >> wrote: > >>> > >>> Hi, > >>> > >>> On Sat, Jul 25, 2015 at 9:55 AM, h_east wrote: > >>> > Hi Yegappan and Bram > >>> > > >>> > 2015-7-25(Sat) 12:27:56 UTC+9 yega...@gmail.com: > >>> > >>> >> Hi Hirohito, > >>> >> > >>> >> On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: > >>> >> > Hi Yegappan, Bram and List > >>> >> > > >>> >> >> >> > > >>> >> >> >> > Thanks for testing the patch. I will send out an updated > patch > >>> >> >> >> > in a few days. > >>> >> >> >> > Hopefully this time it will get included. This has been > >>> >> >> >> > outstanding for more > >>> >> >> >> > than two years. > >>> >> >> >> > > >>> >> >> >> > >>> >> >> >> The updated patch (against vim 7.4.796) is attached. > >>> >> >> > > >>> >> >> > Thanks. So now it's ready to include, right? > >>> >> >> > > >>> >> >> > >>> >> >> Yes. Of course :-) > >>> >> > > >>> >> > I confirmed this patch. > >>> >> > > >>> >> > I found unexpected behaviors. > >>> >> > > >>> >> > >>> >> Thanks for testing the patch and sending the bug report. I am > attaching > >>> >> an updated patch that fixes the two problems. Let me know if you see > >>> >> any > >>> >> issues with this attached patch. > >>> > > >>> > I confirmed that reported
Re: Patch to add the :cdo and :ldo commands
Hi, On Fri, Aug 7, 2015 at 6:03 AM, Drew Neil wrote: > Would it make sense to break this patch in two? One patch could contain the > implementation for :cfdo and :lfdo. The other patch could contain the > implementation for :cdo and :ldo. I think that :cfdo is ready to merge. > Whereas :cdo seems to be a bit more controversial and perhaps needs more > work? > I think the last patch is ready for inclusion into Vim. I have fixed all the reported issues. I am not sure what else needs to be fixed in the ":cdo" implementation. Regards, Yegappan > > On Wed, Jul 29, 2015 at 9:34 PM, Yegappan Lakshmanan > wrote: >> >> Hi all, >> >> On Sun, Jul 26, 2015 at 12:22 PM, Yegappan Lakshmanan >> wrote: >> > Hi, >> > >> > On Sun, Jul 26, 2015 at 4:53 AM, Drew Neil >> > wrote: >> >> I agree with h_east that if you’re planning to run the :substitute >> >> command >> >> across multiple files, it makes sense to use: >> >> >> >> :cfdo %s/pattern/replacement/g >> >> >> >> and not: >> >> >> >> :cdo s/pattern/replacement/g >> >> >> > >> > Depending on the task, you can use either the ":cdo" or the ":cfdo" >> > commands. >> > >> >> I haven't see any replies so far. I am not sure whether we are >> agreeing to add both the >> commands or only the cfdo/lfdo commands? Do you guys think that only >> the cfdo/lfdo >> commands will be useful? >> >> Regards, >> Yegappan >> >> > >> > If you want to perform text search/replace across all the files in the >> > quickfix >> > list, then the ":cfdo" command with ":%s/.../g" is the correct option >> > (as it is >> > more optimal). >> > >> > This is similar to using the "g" argument to the ":substitute" command >> > to >> > replace all the matching text in a single line. And using the "%" range >> > to replace text in all the lines. If you want to replace multiple >> > matching >> > text across all the lines in a file, then you have to pass both "%" and >> > "g". >> > If you don't, then the text will not be correctly replaced. This is not >> > a >> > problem with the ":substitute" command. >> > >> >> >> >> I can also see myself wanting to use the :cdo command in combination >> >> with >> >> :normal for certain types of task. But I’ve come across another >> >> problem. >> >> Suppose that we have a text file containing these four lines of text: >> >> >> >> http://example.com >> >> http://example.org >> >> http://example.net >> >> http://example.com http://example.org http://example.net >> >> >> >> Now let’s say that we want to turn each occurrence of ‘http’ to >> >> ‘https’. (We >> >> could use the :substitute command here, but let me use this to >> >> demonstrate a >> >> problem with using :normal). We’ll use :vimgrep to populate the >> >> quickfix >> >> list with 6 matches: >> >> >> >> :vimgrep /http\zs:/g % >> >> >> >> Then we’ll insert the ’s’ character in front of the colon with this >> >> command: >> >> >> >> :cdo normal is >> >> >> >> The resulting text looks like this: >> >> >> >> https://example.com >> >> https://example.org >> >> https://example.net >> >> https://example.com httsp://example.org htstp://example.net >> >> >> >> In the last line, we get ‘https’, then ‘httsp’, then ‘htstp’. Not >> >> ideal! >> >> >> >> The problem here is that the quickfix list records line and column >> >> numbers. >> >> If characters are added or removed near the start of the line, the >> >> column >> >> numbers for later matches on that line will no longer line up with the >> >> match >> >> that created the original quickfix list entry. >> >> >> >> I’m not sure if this is a problem with the quickfix list, with :cdo, or >> >> with >> >> :normal. >> >> >> > >> > This is a problem with the quickfix list functionality. Currently when a >> > line >> > is added or removed, then the line numbers in the quickfix list entries >> > are updated. But when a line is modified, the column numbers in the >> > quickfix list entries are not updated. Refer to the qf_mark_adjust() >> > function. >> > >> > In the above example, you should use ":s/../g" instead of the ":normal" >> > command. >> > >> > Regards, >> > Yegappan >> > >> >> >> >> On Sat, Jul 25, 2015 at 6:22 PM, Yegappan Lakshmanan >> >> >> >> wrote: >> >>> >> >>> Hi, >> >>> >> >>> On Sat, Jul 25, 2015 at 9:55 AM, h_east wrote: >> >>> > Hi Yegappan and Bram >> >>> > >> >>> > 2015-7-25(Sat) 12:27:56 UTC+9 yega...@gmail.com: >> >>> >> >>> >> Hi Hirohito, >> >>> >> >> >>> >> On Fri, Jul 24, 2015 at 3:42 PM, h_east wrote: >> >>> >> > Hi Yegappan, Bram and List >> >>> >> > >> >>> >> >> >> > >> >>> >> >> >> > Thanks for testing the patch. I will send out an updated >> >>> >> >> >> > patch >> >>> >> >> >> > in a few days. >> >>> >> >> >> > Hopefully this time it will get included. This has been >> >>> >> >> >> > outstanding for more >> >>> >> >> >> > than two years. >> >>> >> >> >> > >> >>> >> >> >> >> >>> >> >> >> The updated patch (against vim 7.4.796) is attached. >> >>> >> >> > >> >>> >> >> > Thanks. So now it's
Re: Patch to add the :cdo and :ldo commands
If you use homebrew on os x, you can now install Vim with the cdo.diff patch applied by running: brew install nelstrom/vim/vim --with-cdo I made this homebrew tap+formula to make it easier to test out this patch: https://github.com/nelstrom/homebrew-vim Drew On Sat, Aug 8, 2015 at 7:33 AM, Yegappan Lakshmanan wrote: > Hi, > > On Fri, Aug 7, 2015 at 6:03 AM, Drew Neil > wrote: > > Would it make sense to break this patch in two? One patch could contain > the > > implementation for :cfdo and :lfdo. The other patch could contain the > > implementation for :cdo and :ldo. I think that :cfdo is ready to merge. > > Whereas :cdo seems to be a bit more controversial and perhaps needs more > > work? > > > > I think the last patch is ready for inclusion into Vim. I have fixed all > the reported issues. I am not sure what else needs to be fixed > in the ":cdo" implementation. > > Regards, > Yegappan > > > > > On Wed, Jul 29, 2015 at 9:34 PM, Yegappan Lakshmanan < > yegapp...@gmail.com> > > wrote: > >> > >> Hi all, > >> > >> On Sun, Jul 26, 2015 at 12:22 PM, Yegappan Lakshmanan > >> wrote: > >> > Hi, > >> > > >> > On Sun, Jul 26, 2015 at 4:53 AM, Drew Neil > >> > wrote: > >> >> I agree with h_east that if you’re planning to run the :substitute > >> >> command > >> >> across multiple files, it makes sense to use: > >> >> > >> >> :cfdo %s/pattern/replacement/g > >> >> > >> >> and not: > >> >> > >> >> :cdo s/pattern/replacement/g > >> >> > >> > > >> > Depending on the task, you can use either the ":cdo" or the ":cfdo" > >> > commands. > >> > > >> > >> I haven't see any replies so far. I am not sure whether we are > >> agreeing to add both the > >> commands or only the cfdo/lfdo commands? Do you guys think that only > >> the cfdo/lfdo > >> commands will be useful? > >> > >> Regards, > >> Yegappan > >> > >> > > >> > If you want to perform text search/replace across all the files in the > >> > quickfix > >> > list, then the ":cfdo" command with ":%s/.../g" is the correct option > >> > (as it is > >> > more optimal). > >> > > >> > This is similar to using the "g" argument to the ":substitute" command > >> > to > >> > replace all the matching text in a single line. And using the "%" > range > >> > to replace text in all the lines. If you want to replace multiple > >> > matching > >> > text across all the lines in a file, then you have to pass both "%" > and > >> > "g". > >> > If you don't, then the text will not be correctly replaced. This is > not > >> > a > >> > problem with the ":substitute" command. > >> > > >> >> > >> >> I can also see myself wanting to use the :cdo command in combination > >> >> with > >> >> :normal for certain types of task. But I’ve come across another > >> >> problem. > >> >> Suppose that we have a text file containing these four lines of text: > >> >> > >> >> http://example.com > >> >> http://example.org > >> >> http://example.net > >> >> http://example.com http://example.org http://example.net > >> >> > >> >> Now let’s say that we want to turn each occurrence of ‘http’ to > >> >> ‘https’. (We > >> >> could use the :substitute command here, but let me use this to > >> >> demonstrate a > >> >> problem with using :normal). We’ll use :vimgrep to populate the > >> >> quickfix > >> >> list with 6 matches: > >> >> > >> >> :vimgrep /http\zs:/g % > >> >> > >> >> Then we’ll insert the ’s’ character in front of the colon with this > >> >> command: > >> >> > >> >> :cdo normal is > >> >> > >> >> The resulting text looks like this: > >> >> > >> >> https://example.com > >> >> https://example.org > >> >> https://example.net > >> >> https://example.com httsp://example.org htstp://example.net > >> >> > >> >> In the last line, we get ‘https’, then ‘httsp’, then ‘htstp’. Not > >> >> ideal! > >> >> > >> >> The problem here is that the quickfix list records line and column > >> >> numbers. > >> >> If characters are added or removed near the start of the line, the > >> >> column > >> >> numbers for later matches on that line will no longer line up with > the > >> >> match > >> >> that created the original quickfix list entry. > >> >> > >> >> I’m not sure if this is a problem with the quickfix list, with :cdo, > or > >> >> with > >> >> :normal. > >> >> > >> > > >> > This is a problem with the quickfix list functionality. Currently > when a > >> > line > >> > is added or removed, then the line numbers in the quickfix list > entries > >> > are updated. But when a line is modified, the column numbers in the > >> > quickfix list entries are not updated. Refer to the qf_mark_adjust() > >> > function. > >> > > >> > In the above example, you should use ":s/../g" instead of the > ":normal" > >> > command. > >> > > >> > Regards, > >> > Yegappan > >> > > >> >> > >> >> On Sat, Jul 25, 2015 at 6:22 PM, Yegappan Lakshmanan > >> >> > >> >> wrote: > >> >>> > >> >>> Hi, > >> >>> > >> >>> On Sat, Jul 25, 2015 at 9:55 AM, h_east > wrote: > >> >>> > Hi Yegappan and Bram > >> >>>
Re: Patch to add the :cdo and :ldo commands
Drew Neil wrote: > If you use homebrew on os x, you can now install Vim with the cdo.diff > patch applied by running: > > brew install nelstrom/vim/vim --with-cdo > > I made this homebrew tap+formula to make it easier to test out this patch: > https://github.com/nelstrom/homebrew-vim BTW: if you see any problems with this patch, let me know. I might include it one of these days. -- The problem with political jokes is that they get elected. /// Bram Moolenaar -- b...@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_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
On 04/09 21:18, Bram Moolenaar wrote: Drew Neil wrote: If you use homebrew on os x, you can now install Vim with the cdo.diff patch applied by running: brew install nelstrom/vim/vim --with-cdo I made this homebrew tap+formula to make it easier to test out this patch: https://github.com/nelstrom/homebrew-vim BTW: if you see any problems with this patch, let me know. I might include it one of these days. I just saw the presentation by Drew Neil about this and I would really appreciate it, if this patch could be merged. And now I have to see what the most easy way is to get a vim that includes this patch for Linux. Niels -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Patch to add the :cdo and :ldo commands
Hi Bram, On Fri, Sep 4, 2015 at 12:18 PM, Bram Moolenaar wrote: > > Drew Neil wrote: > >> If you use homebrew on os x, you can now install Vim with the cdo.diff >> patch applied by running: >> >> brew install nelstrom/vim/vim --with-cdo >> >> I made this homebrew tap+formula to make it easier to test out this patch: >> https://github.com/nelstrom/homebrew-vim > > BTW: if you see any problems with this patch, let me know. I might > include it one of these days. > I have updated the patch against the latest Vim (7.4.854). It is attached to this e-mail. - Yegappan -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 94fe977..fe2ef76 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -511,6 +511,8 @@ followed by another Vim command: :argdo :autocmd :bufdo +:cdo +:cfdo :command :cscope :debug @@ -521,6 +523,8 @@ followed by another Vim command: :help :helpfind :lcscope +:ldo +:lfdo :make :normal :perl diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 49a96f6..5666e68 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -868,7 +868,8 @@ USING THE ARGUMENT LIST each file. {not in Vi} {not available when compiled without the |+listcmds| feature} - Also see |:windo|, |:tabdo| and |:bufdo|. + Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|, + |:cfdo| and |:lfdo| Example: > :args *.c diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index e8171a9..70258b9 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1138,6 +1138,8 @@ tag command action ~ |:cc| :cc go to specific error |:cclose| :ccl[ose] close quickfix window |:cd| :cd change directory +|:cdo| :cdoexecute command in each valid error list entry +|:cfdo|:cfdo execute command in each file in error list |:center| :ce[nter] format lines at the center |:cexpr| :cex[pr]read errors from expr and jump to first |:cfile| :cf[ile]read file with error messages and jump to first @@ -1296,6 +1298,8 @@ tag command action ~ |:lchdir| :lch[dir] change directory locally |:lclose| :lcl[ose] close location window |:lcscope| :lcs[cope] like ":cscope" but uses location list +|:ldo| :ld[o] execute command in valid location list entries +|:lfdo|:lfd[o] execute command in each file in location list |:left|:le[ft] left align lines |:leftabove| :lefta[bove]make split window appear left or above |:let| :letassign a value to a variable or option diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 22d99b9..e554c01 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -298,6 +298,108 @@ use this code: > au QuickfixCmdPost make call QfMakeConv() +EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST: + *:cdo* +:cdo[!] {cmd} Execute {cmd} in each valid entry in the quickfix list. + It works like doing this: > + :cfirst + :{cmd} + :cnext + :{cmd} + etc. +< When the current file can't be |abandon|ed and the [!] + is not present, the command fails. + When an error is detected on one buffer, further + buffers will not be visited. + The last buffer (or where an error occurred) becomes + the current buffer. + {cmd} can contain '|' to concatenate several commands. + Only valid entries in the quickfix list are used. + Note: While this command is executing, the Syntax + autocommand event is disabled by adding it to + 'eventignore'. This considerably speeds up editing + each buffer. + {not in Vi} {not available when compiled without