Re: Chord typing in Vim
On Friday, January 1, 2016 at 4:31:26 PM UTC, gev...@gmail.com wrote: > Last night, just at the New Year, I have discovered for myself a stenotyping > with Plover: > http://stenoknight.com/wiki/FAQ > http://www.openstenoproject.org/ > http://stenoknight.com/kws.html > and I think it is great! > > I do not need or want to learn stenotyping in full (at least because it does > not exist in my native language), but I think that it is a very good idea to > use customizable chords (that is two or more usual keyboard keys pressed at > the same time) in Vim to launch some commands or print some chunk ot text. > > The first such chord, that could save for me a lot of time while typing > cyrillics would be to simultaneously press, say, "о" and "н" keys in insert > mode to go to the nomal mode and switch the keyboard layout to some English > layout (for example with the setxkbmap utility). > > Another very useful chord for me would be to simultaneously press, say, "i" > and "k" keys to return to the insert mode and switch the keyboard layout back > to the cyrillic one. I'm a big fan of Plover myself. You might be interested in Kana's vim-arpeggio plugin: https://github.com/kana/vim-arpeggio Note that you will need an NKRO keyboard of you want to make full use of this style of chord entry. 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
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 <yegapp...@gmail.com> wrote: > Hi, > > On Fri, Aug 7, 2015 at 6:03 AM, Drew Neil <andrew.jr.n...@gmail.com> > 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 > >> <yegapp...@gmail.com> wrote: > >> > Hi, > >> > > >> > On Sun, Jul 26, 2015 at 4:53 AM, Drew Neil <andrew.jr.n...@gmail.com> > >> > 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 > >> >>
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 sw...@ingo-karkat.de 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
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 yegapp...@gmail.com wrote: Hi, On Sat, Jul 25, 2015 at 9:55 AM, h_east h.east@gmail.com 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/\cmdidx\/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_\Esc:w\CR 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/\cmdidx\/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 \cmdidx\ **/*.[ch] 4. Open quickfix window. :copen 5. Do :cdo command. (Intentionally forget the '| update') :cdo s/\cmdidx\/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\CR)
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 andrew.jr.n...@gmail.com 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 yegapp...@gmail.com wrote: Hi, On Sat, Jul 25, 2015 at 9:55 AM, h_east h.east@gmail.com 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/\cmdidx\/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_\Esc:w\CR 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
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 andr...@gmail.com 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 :lfdocommands. 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
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 andrew.jr.n...@gmail.com 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 :lfdocommands. 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.