Re: mapping :W to :w...
>>On 02/23 11:11, Salman Halim wrote: >> I actually prefer to never hit shift, so map ; to : instead. >> >On 2021-02-24, tu...@posteo.de wrote: > Hi Salman, > > oh! :) > > The first is genious Keep in mind that ; is a useful mapping in Vim. Sure, you can remap it to :, but, in my experience, in the long term it is better not to change Vim's default mappings (this is a matter of personal taste, of course), except when their functionality is replicated by other mappings (as in the next paragraph). -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/s15nab%24ph5%241%40ciao.gmane.io.
Re: mapping :W to :w...
On 02/24 08:59, aroc...@vex.net wrote: > > > the distinctive feeling of flat-hand-against-my-fronthead... ;) > > > > Aka (Also known as:) a face-palm. :-)* Ok :) another face-palm (this time correctly spoke...I am no native speaker...sorry... But...how can I ensure, that I am talking about my face and someone else face...? > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_use/03b0da16fc3d8e12971a9d203ee0b12d.squirrel%40webmail.vybenetworks.com. > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210224141114.2bdpvgl7fnobzesk%40solfire.
Re: mapping :W to :w...
> the distinctive feeling of flat-hand-against-my-fronthead... ;) > Aka (Also known as:) a face-palm. :-)* -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/03b0da16fc3d8e12971a9d203ee0b12d.squirrel%40webmail.vybenetworks.com.
Re: mapping :W to :w...
"I use in much the same way and just call :update.* I also save automatically when the Vim window loses focus*." Tell me more about this. On Wednesday, February 24, 2021 at 2:54:17 AM UTC-5 Salman Halim wrote: > I use in much the same way and just call :update. I also save > automatically when the Vim window loses focus. > > -- > > Salman > > On Wed, 24 Feb 2021, 02:33 Tony Mechelynck, > wrote: > >> P.S. My solution to a similar problem was a little different: >> >> map :wa|wv >> map! :wa|wv >> >> Best regards, >> Tony. >> >> -- >> -- >> You received this message from the "vim_use" maillist. >> Do not top-post! Type your reply below the text you are replying to. >> For more information, visit http://www.vim.org/maillist.php >> >> --- >> You received this message because you are subscribed to the Google Groups >> "vim_use" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to vim_use+u...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/vim_use/CAJkCKXvXKsyjh5z_8%3D1AYja9fF0NvceHbiBkLBnghs9Ai848Ug%40mail.gmail.com >> . >> > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/952f24b6-e2f9-47c3-a651-b05683f054c4n%40googlegroups.com.
Re: mapping :W to :w...
I use in much the same way and just call :update. I also save automatically when the Vim window loses focus. -- Salman On Wed, 24 Feb 2021, 02:33 Tony Mechelynck, wrote: > P.S. My solution to a similar problem was a little different: > > map :wa|wv > map! :wa|wv > > Best regards, > Tony. > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_use/CAJkCKXvXKsyjh5z_8%3D1AYja9fF0NvceHbiBkLBnghs9Ai848Ug%40mail.gmail.com > . > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEdbq6Qqm5jt%2BA%3DqvUbOK8ZuJwMC8%2B%3D7cdXsMS7TXhttFA%40mail.gmail.com.
Re: mapping :W to :w...
P.S. My solution to a similar problem was a little different: map :wa|wv map! :wa|wv Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvXKsyjh5z_8%3D1AYja9fF0NvceHbiBkLBnghs9Ai848Ug%40mail.gmail.com.
Re: mapping :W to :w...
On Wed, Feb 24, 2021 at 5:06 AM wrote: > > Hi, > > if my PC is heavily compiling things and I am editing and saving > things repeatedly if often hit :W instead of :w (that is, I am > still pressing SHIFT when hitting w. > > So I tried to map :W to :w...but it does not work for me. > > I tried > > [n]map W w > and > [n]map :W :w > > . > > Is there any way to map the accidentally hit :W > command to :w somehow? > > Cheers! > mcc Like Salman said, you could define a user-comand W executing just w ; but the reason your nmap didn't work is that by the time you'tr typing the W, you aren't in Normal mode anymore, but in Command-line mode; OTOH you don't want any W in the middle of a command's parameters to always lowercased; so another possibility is a command-mode abbreviation, as follows: :cabbrev W ((getcmdtype() == ':' && getcmdpos() <= 4)? 'w' : 'W') Testing getcmdtype() avoids lowercasing the W in a search command, and testing getcmdpos() allows doing it only near the left margin. A user-command is more elegant however; but in order to make it behave like the w command you may want to define that :W command with the appropriate parameters, as follows (untested): :command -nargs=* -complete=file -range=% -bang -bar W ,w which, after all, makes it somewhat less elegant; so you may choose a command or an abbrev to suit youor taste. Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvzVvZZaZ8vEY9grSZNrO_soPwE0oGczrVy1yHF8_m0pA%40mail.gmail.com.
Re: mapping :W to :w...
Hi Salman, oh! :) The first is genious and while reading the second one I had the distinctive feeling of flat-hand-against-my-fronthead... ;) Of course! Thank you very much! That helps me a lot! Cheers! mcc On 02/23 11:11, Salman Halim wrote: > I actually prefer to never hit shift, so map ; to : instead. > > You could simply define a command called W to do what you want: > > command! W w > > -- > > Salman > > On Tue, 23 Feb 2021, 23:06 , wrote: > > > Hi, > > > > if my PC is heavily compiling things and I am editing and saving > > things repeatedly if often hit :W instead of :w (that is, I am > > still pressing SHIFT when hitting w. > > > > So I tried to map :W to :w...but it does not work for me. > > > > I tried > > > > [n]map W w > > and > > [n]map :W :w > > > > . > > > > Is there any way to map the accidentally hit :W > > command to :w somehow? > > > > Cheers! > > mcc > > > > -- > > -- > > You received this message from the "vim_use" maillist. > > Do not top-post! Type your reply below the text you are replying to. > > For more information, visit http://www.vim.org/maillist.php > > > > --- > > You received this message because you are subscribed to the Google Groups > > "vim_use" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to vim_use+unsubscr...@googlegroups.com. > > To view this discussion on the web visit > > https://groups.google.com/d/msgid/vim_use/20210224040623.p4fmrhjxbiyf5e5n%40solfire > > . > > > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_use/CANuxnEcDbZWngA-58DHuvdG_fesuz5%3DCxUh_LBmOqFTzx7YTTA%40mail.gmail.com. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210224043343.y734qf2kskrdfjtm%40solfire.
Re: mapping :W to :w...
I actually prefer to never hit shift, so map ; to : instead. You could simply define a command called W to do what you want: command! W w -- Salman On Tue, 23 Feb 2021, 23:06 , wrote: > Hi, > > if my PC is heavily compiling things and I am editing and saving > things repeatedly if often hit :W instead of :w (that is, I am > still pressing SHIFT when hitting w. > > So I tried to map :W to :w...but it does not work for me. > > I tried > > [n]map W w > and > [n]map :W :w > > . > > Is there any way to map the accidentally hit :W > command to :w somehow? > > Cheers! > mcc > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_use/20210224040623.p4fmrhjxbiyf5e5n%40solfire > . > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CANuxnEcDbZWngA-58DHuvdG_fesuz5%3DCxUh_LBmOqFTzx7YTTA%40mail.gmail.com.
mapping :W to :w...
Hi, if my PC is heavily compiling things and I am editing and saving things repeatedly if often hit :W instead of :w (that is, I am still pressing SHIFT when hitting w. So I tried to map :W to :w...but it does not work for me. I tried [n]map W w and [n]map :W :w . Is there any way to map the accidentally hit :W command to :w somehow? Cheers! mcc -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20210224040623.p4fmrhjxbiyf5e5n%40solfire.
Re: v:count in mapping gets E492: Not an editor command: count
You have a very good point there, Jurgen. Somehow now, I have this uncontrollable urge to go baa-aa-aa at the moon. On Mon, Jul 20, 2020 at 10:20 PM 'Jürgen Krämer' via vim_use < vim_use@googlegroups.com> wrote: > Hi, > > Graham Lawrence schrieb am 19.07.2020 um 22:07: > > :h v:count includes the following example > > | > > map _x :echo "the count is ".v:count > > | > > > > which works as expected, but using > > | > > map :let @n=v:count1... > > | > > > did you really leave out the left-hand-side of the mapping in your .vimrc > or is this just a typo in your mail? > > > produces E492 etc; and instead I must use > > | > > map ;;:exe 'let @n=v:count1'... > > | > > > > for it to work. > > > > Now I have a number of mappings in alternate .vimrc files that use the > 'let' form that now fails, which strongly implies that at one time that > method of saving v:count did work. > > So is this a recent development? Or have I unwittingly set something in > .vimrc that invalidates 'let'? Or is it a vim error that is likely to be > corrected by reverting to the old form? Or ...? > > Regards, > Jürgen > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_use/e18c4134-695a-1d51-1094-926d11ae7481%40googlemail.com > . > -- Graham Lawrence -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CA%2BE5mK7ZedxExMv3QFNB4a5%3DK6STj4h6N-eTbE3C%2B-_r60vTkw%40mail.gmail.com.
Re: v:count in mapping gets E492: Not an editor command: count
Hi, Graham Lawrence schrieb am 19.07.2020 um 22:07: > :h v:count includes the following example > | > map _x :echo "the count is ".v:count > | > > which works as expected, but using > | > map :let @n=v:count1... > | > did you really leave out the left-hand-side of the mapping in your .vimrc or is this just a typo in your mail? > produces E492 etc; and instead I must use > | > map ;;:exe 'let @n=v:count1'... > | > > for it to work. > > Now I have a number of mappings in alternate .vimrc files that use the 'let' > form that now fails, which strongly implies that at one time that method of > saving v:count did work. > So is this a recent development? Or have I unwittingly set something in > .vimrc that invalidates 'let'? Or is it a vim error that is likely to be > corrected by reverting to the old form? Or ...? Regards, Jürgen -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/e18c4134-695a-1d51-1094-926d11ae7481%40googlemail.com.
v:count in mapping gets E492: Not an editor command: count
:h v:count includes the following example map _x :echo "the count is " . v:count which works as expected, but using map :let @n=v:count1 ... produces E492 etc; and instead I must use map ;; :exe 'let @n=v:count1' ... for it to work. Now I have a number of mappings in alternate .vimrc files that use the 'let' form that now fails, which strongly implies that at one time that method of saving v:count did work. So is this a recent development? Or have I unwittingly set something in .vimrc that invalidates 'let'? Or is it a vim error that is likely to be corrected by reverting to the old form? Or ...? -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/63e65a86-4f90-437d-a392-a423c0e8881eo%40googlegroups.com.
Re: nested expr in a mapping
On 2020-02-14, M Kelly wrote: > Hi, > > ok, thank you. > I always thought there had to be quotes around each block, as in () ? 'foo' : > 'bar' > So I was trying \' and \\' and \" and \\" and extra quotes for each additional > nested block to no success. > I will remove all quotes and see if I can get it to work. The quotes are necessary if the expression evaluates to a string and each of the alternatives is a literal string. Here are some simple examples. :let x = 1 :echo x == 1 ? 73 : 88 73 :echo x == 0 ? "hello" : "goodbye" goodbye In the first example, the expression evaluates to a number, while in the second example the expression evaluates to a string. Here's an example of nesting. :let x = 2 :echo x == 1 ? "one" : x == 2 ? "two" : "something else" two I deliberately didn't use any parentheses to show that they're often not necessary, although they can make expressions more clear. If you can't get it to work, post what you've tried here and we'll figure it out. Regards, Gary -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200215071733.GD9366%40phoenix.
Re: nested expr in a mapping
Hi, ok, thank you. I always thought there had to be quotes around each block, as in () ? 'foo' : 'bar' So I was trying \' and \\' and \" and \\" and extra quotes for each additional nested block to no success. I will remove all quotes and see if I can get it to work. take care, -m -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/16fe93d4-4447-457a-a9f0-1fd0a856745d%40googlegroups.com.
Re: nested expr in a mapping
On 2020-02-13, M Kelly wrote: > Hi, > > Is it posible to nest conditionals in a mapping, something like, just for > demonstration: > > vnoremap vv (strlen(@y) == 1) ? ':let ...' : '("vcl" =~ > getregtype("*")) > ? 'some foo' : 'some bar' ' some more ... > > Can we do this ? Yes. See :help 41.3 :help expr1 :help :map- :help matchup.txt " lines 896-900 for some examples > Do I use ''' (3 single quotes) to embed quotes ? (and then 5 > for a 2nd level embed ...) ... ? No. Expressions are not nested using quotes. You may use parentheses if you wish, or just use the precedence rules. It would be easier to help you if we knew what you had tried, the actual results, and what you expected. Regards, Gary -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200214042128.GC9366%40phoenix.
Re: nested expr in a mapping
Hi, I suppose I can call a function to do this :-) -m -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/fc4865e6-2357-4a8c-ae7c-c5fe7796b27a%40googlegroups.com.
nested expr in a mapping
Hi, Is it posible to nest conditionals in a mapping, something like, just for demonstration: vnoremap vv (strlen(@y) == 1) ? ':let ...' : '("vcl" =~ getregtype("*")) ? 'some foo' : 'some bar' ' some more ... Can we do this ? Do I use ''' (3 single quotes) to embed quotes ? (and then 5 for a 2nd level embed ...) ... ? thx as always, -m -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/da6436ec-0159-4364-8ab0-90e9b075764d%40googlegroups.com.
Re: vim mode and mapping
thanks. I am more interested to know why separate mappings don't work and how to make it work, if possible. this two key mapping will have complexity issue, since everything i* now incurs a mapping, and the same issue (one key is subject to mapping and the next one isn't) might manifest somewhere else, a separate investigation and special mapping to work around every case isn't a good solution. On Saturday, November 30, 2019 at 2:05:44 AM UTC-8, Igor wrote: > > noremap ur ip > > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/88e2c674-6fe7-4b8e-82cc-ab8036cfb309%40googlegroups.com.
Re: vim mode and mapping
noremap ur ip -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/ea6bd50b-7ec2-4155-ba0b-1f5c47bacb46%40googlegroups.com.
vim mode and mapping
hi, I use colemak keyboard layout, and put many mappings in my vimrc to simulate vim finger movements on the original querty layout. it mostly works fine but there are some mappings don't work up to expectation and I am trying to understand why. for example, if I have these mappings noremap u inoremap r p I expect pressing vur to select current paragraph since that should be mapped to vip. in reality, however, I have to press vup to select the paragraph. judging from the effect, the u key is correctly translated to i for processing, whereas the next r key isn't and I really have to type in a plain p key for vim to receive a functional sequence. this is pretty inconsistent and confusing and I have to remember the key after v is subject to my mappings, and the next one isn't. what makes to two mapped keys behave differently? as far as I can tell, they should all be available under nvo modes. thanks. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4b05c8b8-7298-41af-95cf-679fa3c72de9%40googlegroups.com.
Re: Mapping erases search count message
On 2019-11-23, Bram Moolenaar wrote: > Gary Johnson wrote: > > > On 2019-08-29, Christian Brabandt wrote: > > > On Do, 29 Aug 2019, Christian Brabandt wrote: > > > > > > > > > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > > > > > On 2019-08-28, Christian Brabandt wrote: > > > > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > > > > > > > > > I just tried exposing the search count message by removing 'S' > > > > > > > from > > > > > > > 'shortmess', but I couldn't see it. I discovered that it is > > > > > > > hidden, > > > > > > > erased and/or not updated by a couple of my mappings. > > > > > > > > > > > > > > nnoremap n nzv:call AdjCursor() > > > > > > > nnoremap N Nzv:call AdjCursor() > > > > > > > > > > > > > > Here is a simple experiment that demonstrates the problem. Create > > > > > > > a file, test.vim, that contains the following. > > > > > > > > > > > > > > set shortmess-=S > > > > > > > nnoremap n n > > > > > > > help map.txt > > > > > > > > > > > > > > Open a standard-sized, 80x24 terminal, and in it run > > > > > > > > > > > > > > $ vim -N -u NONE -i NONE -S test.vim > > > > > > > > > > > > > > Then search for "command": > > > > > > > > > > > > > > /command > > > > > > > > > > > > > > After hitting Enter, the cursor will be at the start of "commands" > > > > > > > on line 7 and the command line will contain this: > > > > > > > > > > > > > > /command [1/>99] > > > > > > > > > > > > > > After hitting 'n', the cursor advances to line 13 and the command > > > > > > > line stays the same, even showing "[1/>99]" when it should be > > > > > > > showing "[2/>99]". > > > > > > > > > > > > > > Another 'n' advances the cursor to line 17, the screen scrolls > > > > > > > up so that that line is at the bottom of the window, and the > > > > > > > command > > > > > > > line is empty--no search count message at all. > > > > > > > > > > > > > > I would think that would prevent the mapping from > > > > > > > disturbing the command line, in which case this is a bug. > > > > > > > > > > > > > > If it's not a bug, then is there some way of defining a mapping > > > > > > > that > > > > > > > does not interfere with the search count message, or some way of > > > > > > > restoring that message at the end of a mapping? > > > > > > > > > > > > Is that with patch 8.1.1288 included? > > > > > > > > > > Sorry, I forgot to include the version information. Yes, I used the > > > > > latest version, 8.1.1933. > > > > > > > > Hm, I need to investigate. > > > > > > I see what is happening. A mapping with the `` flag will set the > > > internal variable cmd_silent to prevent it from being output the command > > > line. So what your mapping does is it acts like 'n' without outputting > > > anything on the command line. > > > > > > But this is not what you want. You want the default behaviour of n, > > > which does output the command to search + the new search index feature. > > > > > > (See the difference on the commandline between a plain `n` and a n > > > mapped with `nnoremap n n`). > > > > > > So the obvious fix would be to remove the `` command. While this > > > fixes your minimal test case, it most likely is no fix for your actual > > > issue, that calling the AdjCursor() function will be output in the > > > command line in addition (possibly overwriting the command line). > > > > > > What might work (depending on the complexity of your AdjCursor() > > > function) is to use an expression mapping that simply returns 'n' a
Re: Mapping erases search count message
Gary Johnson wrote: > On 2019-08-29, Christian Brabandt wrote: > > On Do, 29 Aug 2019, Christian Brabandt wrote: > > > > > > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > > > On 2019-08-28, Christian Brabandt wrote: > > > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > > > > > > > I just tried exposing the search count message by removing 'S' from > > > > > > 'shortmess', but I couldn't see it. I discovered that it is hidden, > > > > > > erased and/or not updated by a couple of my mappings. > > > > > > > > > > > > nnoremap n nzv:call AdjCursor() > > > > > > nnoremap N Nzv:call AdjCursor() > > > > > > > > > > > > Here is a simple experiment that demonstrates the problem. Create > > > > > > a file, test.vim, that contains the following. > > > > > > > > > > > > set shortmess-=S > > > > > > nnoremap n n > > > > > > help map.txt > > > > > > > > > > > > Open a standard-sized, 80x24 terminal, and in it run > > > > > > > > > > > > $ vim -N -u NONE -i NONE -S test.vim > > > > > > > > > > > > Then search for "command": > > > > > > > > > > > > /command > > > > > > > > > > > > After hitting Enter, the cursor will be at the start of "commands" > > > > > > on line 7 and the command line will contain this: > > > > > > > > > > > > /command [1/>99] > > > > > > > > > > > > After hitting 'n', the cursor advances to line 13 and the command > > > > > > line stays the same, even showing "[1/>99]" when it should be > > > > > > showing "[2/>99]". > > > > > > > > > > > > Another 'n' advances the cursor to line 17, the screen scrolls > > > > > > up so that that line is at the bottom of the window, and the command > > > > > > line is empty--no search count message at all. > > > > > > > > > > > > I would think that would prevent the mapping from > > > > > > disturbing the command line, in which case this is a bug. > > > > > > > > > > > > If it's not a bug, then is there some way of defining a mapping that > > > > > > does not interfere with the search count message, or some way of > > > > > > restoring that message at the end of a mapping? > > > > > > > > > > Is that with patch 8.1.1288 included? > > > > > > > > Sorry, I forgot to include the version information. Yes, I used the > > > > latest version, 8.1.1933. > > > > > > Hm, I need to investigate. > > > > I see what is happening. A mapping with the `` flag will set the > > internal variable cmd_silent to prevent it from being output the command > > line. So what your mapping does is it acts like 'n' without outputting > > anything on the command line. > > > > But this is not what you want. You want the default behaviour of n, > > which does output the command to search + the new search index feature. > > > > (See the difference on the commandline between a plain `n` and a n > > mapped with `nnoremap n n`). > > > > So the obvious fix would be to remove the `` command. While this > > fixes your minimal test case, it most likely is no fix for your actual > > issue, that calling the AdjCursor() function will be output in the > > command line in addition (possibly overwriting the command line). > > > > What might work (depending on the complexity of your AdjCursor() > > function) is to use an expression mapping that simply returns 'n' after > > having done whatever action it needs to be doing. However, this might be > > a bit difficult since you want this to happen after the cursor has been > > placed. > > > > Another alternative might be a mapping like this: > > > > nmap n nzv > > nnoremap zv zv:call AdjCursor() > > Thanks for looking further into this, Christian. > > I don't understand how that first mapping in your alternative > mappings works. I thought that using nmap (not nnoremap) to map > n to a rhs including n would c
Re: Mapping erases search count message
On 2019-09-04, Bram Moolenaar wrote: > Christian wrote: > > > On Mi, 04 Sep 2019, Bram Moolenaar wrote: > > > > > Hmm, since nobody runs the tests manually that doesn't help much. > > > How about using a screendump? That makes these things a lot easier to > > > write. > > > > Okay, how about the attached patch then? That fails with v8.1.1965 and > > should work with v8.1.1970 > > Yes, this works, thanks! This is very nice! Thank you both. I just updated to 8.1.1987. I had made some changes to my search mappings that improved the behavior of the search count message but it still wasn't right in all cases. Now the message behaves as I expect it to in all the cases I've tested. Regards, Gary -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190905011459.GA11230%40phoenix.
Re: Mapping erases search count message
Christian wrote: > On Mi, 04 Sep 2019, Bram Moolenaar wrote: > > > Hmm, since nobody runs the tests manually that doesn't help much. > > How about using a screendump? That makes these things a lot easier to > > write. > > Okay, how about the attached patch then? That fails with v8.1.1965 and > should work with v8.1.1970 Yes, this works, thanks! -- hundred-and-one symptoms of being an internet addict: 178. You look for an icon to double-click to open your bedroom window. /// 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_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201909041433.x84EX3AW000703%40masaka.moolenaar.net.
Re: Mapping erases search count message
On Mi, 04 Sep 2019, Christian Brabandt wrote: > Okay, how about the attached patch then? That fails with v8.1.1965 and > should work with v8.1.1970 Small update: [...] > + call delete('XscriptMatchCommon') that should of course be call delete('Xsearchstat') Best, Christian -- Ein schönes, herrliches Weib, das unvermählt bleibt, ist eine stille und doch laute Anklage gegen alle Männer. -- Bogumil Goltz -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190904120539.GR25942%40256bit.org. From dd020996046fa8f64ce9ccec2f5b6f1573641564 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 4 Sep 2019 13:54:09 +0200 Subject: [PATCH] Add screendump test --- src/testdir/dumps/Test_searchstat_1.dump | 10 +++ src/testdir/dumps/Test_searchstat_2.dump | 10 +++ src/testdir/test_search_stat.vim | 35 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 src/testdir/dumps/Test_searchstat_1.dump create mode 100644 src/testdir/dumps/Test_searchstat_2.dump diff --git a/src/testdir/dumps/Test_searchstat_1.dump b/src/testdir/dumps/Test_searchstat_1.dump new file mode 100644 index 0..52b13f2dc --- /dev/null +++ b/src/testdir/dumps/Test_searchstat_1.dump @@ -0,0 +1,10 @@
Re: Mapping erases search count message
On Mi, 04 Sep 2019, Bram Moolenaar wrote: > Hmm, since nobody runs the tests manually that doesn't help much. > How about using a screendump? That makes these things a lot easier to > write. Okay, how about the attached patch then? That fails with v8.1.1965 and should work with v8.1.1970 Best, Christian -- Sargdeckel fällt - die Witwe kichert, der Bauer war wohl gut versichert. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190904120126.GQ25942%40256bit.org. From b6f44bc8cef68df3baf291ed6957eb3a61b50412 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 4 Sep 2019 13:54:09 +0200 Subject: [PATCH] Add screendump test --- src/testdir/dumps/Test_searchstat_1.dump | 10 +++ src/testdir/dumps/Test_searchstat_2.dump | 10 +++ src/testdir/test_search_stat.vim | 35 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 src/testdir/dumps/Test_searchstat_1.dump create mode 100644 src/testdir/dumps/Test_searchstat_2.dump diff --git a/src/testdir/dumps/Test_searchstat_1.dump b/src/testdir/dumps/Test_searchstat_1.dump new file mode 100644 index 0..52b13f2dc --- /dev/null +++ b/src/testdir/dumps/Test_searchstat_1.dump @@ -0,0 +1,10 @@
Re: Mapping erases search count message
Christian wrote: > > > > > On Fr, 30 Aug 2019, Bram Moolenaar wrote: > > > > > > > > > > > Thanks. Yes, I think we should do this. But the allocation should > > > > > > probably be done differently, it looks like with cmd_silent set it > > > > > > still > > > > > > computes the size of the command. This will require some more "if" > > > > > > statements, but makes the size computation more accurate. > > > > > > > > > > Well, yeah I thought this wouldn't hurt. > > > > > > > > > > So how about the attached patch then? It will simply use all > > > > > available > > > > > space in the command line. Not sure this is correct however. > > > > > > > > It's tricky with all the conditions. But it looks OK. All tests pass. > > > > Let's include this and check that nothing goes wrong. Can we cover this > > > > with a test? > > > > > > Apologizes, the last patch was wrong and caused a strtrunc message > > > ('...') > > > > > > Perhaps we don't even need the added condition `|| cmd_silent` at all? > > > > > > Here is a fix including a test. > > > > Thanks. The test doesn't fail without the fix though. > > Yeah, I did not update the test, I tried, but the message is not > truncated when running the test. I think this happens because the output > of `execute()` is actually scrolled. Not sure. > > This patch should do it, but only works when run interactively. > > diff --git a/src/testdir/test_search_stat.vim > b/src/testdir/test_search_stat.vim > index f23952915..33c3858bc 100644 > --- a/src/testdir/test_search_stat.vim > +++ b/src/testdir/test_search_stat.vim > @@ -176,7 +176,9 @@ func! Test_search_stat() >let g:b = split(g:a, "\n")[-1] >let stat = '\[1/2\]' >call assert_notmatch(pat .. stat, g:b) > - call assert_match(stat, g:b) > + " Test that the message is not truncated > + " it would insert '...' into the output. > + call assert_match('^\s\+' .. stat, g:b) >unmap n > >" Clean up Hmm, since nobody runs the tests manually that doesn't help much. How about using a screendump? That makes these things a lot easier to write. -- I'm so disorganized my keyboard isn't even in alphabetical order! /// 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_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201909041121.x84BLsTM024711%40masaka.moolenaar.net.
Re: Mapping erases search count message
On Di, 03 Sep 2019, Bram Moolenaar wrote: > > Christian wrote: > > > > > On Fr, 30 Aug 2019, Bram Moolenaar wrote: > > > > > > > > > Thanks. Yes, I think we should do this. But the allocation should > > > > > probably be done differently, it looks like with cmd_silent set it > > > > > still > > > > > computes the size of the command. This will require some more "if" > > > > > statements, but makes the size computation more accurate. > > > > > > > > Well, yeah I thought this wouldn't hurt. > > > > > > > > So how about the attached patch then? It will simply use all available > > > > space in the command line. Not sure this is correct however. > > > > > > It's tricky with all the conditions. But it looks OK. All tests pass. > > > Let's include this and check that nothing goes wrong. Can we cover this > > > with a test? > > > > Apologizes, the last patch was wrong and caused a strtrunc message > > ('...') > > > > Perhaps we don't even need the added condition `|| cmd_silent` at all? > > > > Here is a fix including a test. > > Thanks. The test doesn't fail without the fix though. Yeah, I did not update the test, I tried, but the message is not truncated when running the test. I think this happens because the output of `execute()` is actually scrolled. Not sure. This patch should do it, but only works when run interactively. diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim index f23952915..33c3858bc 100644 --- a/src/testdir/test_search_stat.vim +++ b/src/testdir/test_search_stat.vim @@ -176,7 +176,9 @@ func! Test_search_stat() let g:b = split(g:a, "\n")[-1] let stat = '\[1/2\]' call assert_notmatch(pat .. stat, g:b) - call assert_match(stat, g:b) + " Test that the message is not truncated + " it would insert '...' into the output. + call assert_match('^\s\+' .. stat, g:b) unmap n " Clean up Mit freundlichen Grüßen Christian -- Das Werk sollte immer ein wenig schlauer sein als der Autor. -- Vaclav Havel -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190904062502.GO25942%40256bit.org.
Re: Mapping erases search count message
Christian wrote: > > > On Fr, 30 Aug 2019, Bram Moolenaar wrote: > > > > > > > Thanks. Yes, I think we should do this. But the allocation should > > > > probably be done differently, it looks like with cmd_silent set it still > > > > computes the size of the command. This will require some more "if" > > > > statements, but makes the size computation more accurate. > > > > > > Well, yeah I thought this wouldn't hurt. > > > > > > So how about the attached patch then? It will simply use all available > > > space in the command line. Not sure this is correct however. > > > > It's tricky with all the conditions. But it looks OK. All tests pass. > > Let's include this and check that nothing goes wrong. Can we cover this > > with a test? > > Apologizes, the last patch was wrong and caused a strtrunc message > ('...') > > Perhaps we don't even need the added condition `|| cmd_silent` at all? > > Here is a fix including a test. Thanks. The test doesn't fail without the fix though. -- hundred-and-one symptoms of being an internet addict: 172. You join listservers just for the extra e-mail. /// 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_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201909032024.x83KO53f022044%40masaka.moolenaar.net.
Re: Mapping erases search count message
On Mo, 02 Sep 2019, Bram Moolenaar wrote: > > Christian wrote: > > > On Fr, 30 Aug 2019, Bram Moolenaar wrote: > > > > > Thanks. Yes, I think we should do this. But the allocation should > > > probably be done differently, it looks like with cmd_silent set it still > > > computes the size of the command. This will require some more "if" > > > statements, but makes the size computation more accurate. > > > > Well, yeah I thought this wouldn't hurt. > > > > So how about the attached patch then? It will simply use all available > > space in the command line. Not sure this is correct however. > > It's tricky with all the conditions. But it looks OK. All tests pass. > Let's include this and check that nothing goes wrong. Can we cover this > with a test? Apologizes, the last patch was wrong and caused a strtrunc message ('...') Perhaps we don't even need the added condition `|| cmd_silent` at all? Here is a fix including a test. diff --git a/src/search.c b/src/search.c index 758c4ef1a..ee66052a9 100644 --- a/src/search.c +++ b/src/search.c @@ -1391,7 +1391,7 @@ do_search( // search stat. Use all the space available, so that the // search state is right aligned. If there is not enough space // msg_strtrunc() will shorten in the middle. - if (msg_scrolled != 0 || cmd_silent) + if (msg_scrolled != 0 && !cmd_silent) // Use all the columns. len = (int)(Rows - msg_row) * Columns - 1; else diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim index cf36f3214..f23952915 100644 --- a/src/testdir/test_search_stat.vim +++ b/src/testdir/test_search_stat.vim @@ -160,7 +160,27 @@ func! Test_search_stat() let stat = '\[1/2\]' call assert_notmatch(pat .. stat, g:a) - " close the window + " normal, n comes from a silent mapping + " First test a normal mapping, then a silent mapping + call cursor(1,1) + nnoremap n n + let @/ = 'find this' + let pat = '/find this\s\+' + let g:a = execute(':unsilent :norm n') + let g:b = split(g:a, "\n")[-1] + let stat = '\[1/2\]' + call assert_match(pat .. stat, g:b) + nnoremap n n + call cursor(1,1) + let g:a = execute(':unsilent :norm n') + let g:b = split(g:a, "\n")[-1] + let stat = '\[1/2\]' + call assert_notmatch(pat .. stat, g:b) + call assert_match(stat, g:b) + unmap n + + " Clean up set shortmess+=S + " close the window bwipe! endfunc Best, Christian -- Sitzt eine Spinne auf dem Klo, wird man des Lebens nicht mehr froh. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190903073725.GN25942%40256bit.org.
Re: Mapping erases search count message
Christian wrote: > On Fr, 30 Aug 2019, Bram Moolenaar wrote: > > > Thanks. Yes, I think we should do this. But the allocation should > > probably be done differently, it looks like with cmd_silent set it still > > computes the size of the command. This will require some more "if" > > statements, but makes the size computation more accurate. > > Well, yeah I thought this wouldn't hurt. > > So how about the attached patch then? It will simply use all available > space in the command line. Not sure this is correct however. It's tricky with all the conditions. But it looks OK. All tests pass. Let's include this and check that nothing goes wrong. Can we cover this with a test? -- "Hit any key to continue" is very confusing when you have two keyboards. /// 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_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201909021945.x82JjHVh019218%40masaka.moolenaar.net.
Re: Mapping erases search count message
On Fr, 30 Aug 2019, Bram Moolenaar wrote: > Thanks. Yes, I think we should do this. But the allocation should > probably be done differently, it looks like with cmd_silent set it still > computes the size of the command. This will require some more "if" > statements, but makes the size computation more accurate. Well, yeah I thought this wouldn't hurt. So how about the attached patch then? It will simply use all available space in the command line. Not sure this is correct however. Best, Christian -- Wie man sein Kind nicht nennen sollte: Carmen Bert -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190902074836.GM25942%40256bit.org. diff --git a/src/search.c b/src/search.c index 46273e11e..21458fae3 100644 --- a/src/search.c +++ b/src/search.c @@ -1354,8 +1354,9 @@ do_search( pat = p; /* put pat after search command */ } - if ((options & SEARCH_ECHO) && messaging() - && !cmd_silent && msg_silent == 0) + if ((options & SEARCH_ECHO) && messaging() && + !msg_silent && + (!cmd_silent || !shortmess(SHM_SEARCHCOUNT))) { char_u *trunc; char_u off_buf[40]; @@ -1365,7 +1366,8 @@ do_search( msg_start(); // Get the offset, so we know how long it is. - if (spats[0].off.line || spats[0].off.end || spats[0].off.off) + if (!cmd_silent && + (spats[0].off.line || spats[0].off.end || spats[0].off.off)) { p = off_buf; *p++ = dirc; @@ -1386,13 +1388,13 @@ do_search( else p = searchstr; - if (!shortmess(SHM_SEARCHCOUNT)) + if (!shortmess(SHM_SEARCHCOUNT) || cmd_silent) { // Reserve enough space for the search pattern + offset + // search stat. Use all the space available, so that the // search state is right aligned. If there is not enough space // msg_strtrunc() will shorten in the middle. - if (msg_scrolled != 0) + if (msg_scrolled != 0 || cmd_silent) // Use all the columns. len = (int)(Rows - msg_row) * Columns - 1; else @@ -1409,62 +1411,67 @@ do_search( if (msgbuf != NULL) { vim_memset(msgbuf, ' ', len); - msgbuf[0] = dirc; msgbuf[len - 1] = NUL; - - if (enc_utf8 && utf_iscomposing(utf_ptr2char(p))) - { - // Use a space to draw the composing char on. - msgbuf[1] = ' '; - mch_memmove(msgbuf + 2, p, STRLEN(p)); - } - else - mch_memmove(msgbuf + 1, p, STRLEN(p)); - if (off_len > 0) - mch_memmove(msgbuf + STRLEN(p) + 1, off_buf, off_len); - - trunc = msg_strtrunc(msgbuf, TRUE); - if (trunc != NULL) + // do not fill the msgbuf buffer, if cmd_silent is set, leave it + // empty for the search_stat feature. + if (!cmd_silent) { - vim_free(msgbuf); - msgbuf = trunc; - } + msgbuf[0] = dirc; -#ifdef FEAT_RIGHTLEFT - // The search pattern could be shown on the right in rightleft - // mode, but the 'ruler' and 'showcmd' area use it too, thus - // it would be blanked out again very soon. Show it on the - // left, but do reverse the text. - if (curwin->w_p_rl && *curwin->w_p_rlc == 's') - { - char_u *r; - size_t pat_len; + if (enc_utf8 && utf_iscomposing(utf_ptr2char(p))) + { + // Use a space to draw the composing char on. + msgbuf[1] = ' '; + mch_memmove(msgbuf + 2, p, STRLEN(p)); + } + else + mch_memmove(msgbuf + 1, p, STRLEN(p)); + if (off_len > 0) + mch_memmove(msgbuf + STRLEN(p) + 1, off_buf, off_len); - r = reverse_text(msgbuf); - if (r != NULL) + trunc = msg_strtrunc(msgbuf, TRUE); + if (trunc != NULL) { vim_free(msgbuf); - msgbuf = r; - // move reversed text to beginning of buffer - while (*r != NUL && *r == ' ') - r++; - pat_len = msgbuf + STRLEN(msgbuf) - r; - mch_memmove(msgbuf, r, pat_len); - // overwrite old text - if ((size_t)(r - msgbuf) >= pat_len) - vim_memset(r, ' ', pat_len); - else - vim_memset(msgbuf + pat_len, ' ', r - msgbuf); + msgbuf = trunc; } + +#ifdef FEAT_RIGHTLEFT + // The search pattern could be shown on the right in rightleft + // mode, but the 'ruler' and 'showcmd' area use it too, thus + // it would be blanked out again very soon. Show it on the + // left, but do reverse the text. + if (curwin->w_p_rl && *curwin->w_p_rlc == 's') + { + char_u *r; + size_t pat_len; + + r = reverse_text(msgbuf); + if (r != NULL) + { + vim_free(msgbuf); + msgbuf = r; + // move reversed text to beginning of buffer + while (*r != NUL && *r == ' ') +r++; +
Re: Mapping erases search count message
Christian wrote: > On Do, 29 Aug 2019, Gary Johnson wrote: > > > In fact, removing all the mappings and just executing Ctrl-E or > > Ctrl-Y to scroll the window after a search erases the search count > > message. I think that's a bug. I can see no reason why scrolling > > should erase that message unless scrolling moves the cursor. > > > > Further, certain motion commands such as j, k and gg _don't_ erase > > the search count message, even though it would make sense for them > > to do so. It's weird to jump from the bottom of a buffer to the top > > with gg and still see the last search count message in the command > > line. > > Hm, yeah I can reproduce it. I am not sure yet, what causes the extra > redraw of the command line. It's probably just the scrolling. And it's probably tricky to keep the counts when moving around in the file. I don't mind too much, so long as it shows right after the search navigation. -- "The sun oozed over the horizon, shoved aside darkness, crept along the greensward, and, with sickly fingers, pushed through the castle window, revealing the pillaged princess, hand at throat, crown asunder, gaping in frenzied horror at the sated, sodden amphibian lying beside her, disbelieving the magnitude of the frog's deception, screaming madly, "You lied!" - Winner of the Bulwer-Lytton contest (San Jose State University), wherein one writes only the first line of a bad novel /// 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_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201908301112.x7UBCrfx004773%40masaka.moolenaar.net.
Re: Mapping erases search count message
Christian wrote: > On Do, 29 Aug 2019, Bram Moolenaar wrote: > > > The argument means that the command won't be echoed. But it > > does not suppress the output of the command like the ":silent" modifier > > does. > > Yeah, but it felt natural to me, to only show the search index feature, > if the command is echoed. I actually played with a simple patch > yesterday, but then thought that works as expected. > > > How about removing the check for cmd_silent in search.c, where > > search_stat() is called? > > It's a bit more convoluted, since msgbuf needs to be properly allocated > and initialized. > > The attached patch does it. Let me know if you think that is okay. I can > write a test then. Thanks. Yes, I think we should do this. But the allocation should probably be done differently, it looks like with cmd_silent set it still computes the size of the command. This will require some more "if" statements, but makes the size computation more accurate. -- Birthdays are healthy. The more you have them, the longer you live. /// 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_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201908301112.x7UBCrnm004785%40masaka.moolenaar.net.
Re: Mapping erases search count message
On Do, 29 Aug 2019, 'Andy Wokula' via vim_use wrote: > > nmap n nzv > > nnoremap zv zv:call AdjCursor() > > :nmap n n(adj-cursor) > :nnoremap (adj-cursor) zv:call AdjCursor() > > > " first command can be written as: > :nmap
Re: Mapping erases search count message
On Do, 29 Aug 2019, Gary Johnson wrote: > In fact, removing all the mappings and just executing Ctrl-E or > Ctrl-Y to scroll the window after a search erases the search count > message. I think that's a bug. I can see no reason why scrolling > should erase that message unless scrolling moves the cursor. > > Further, certain motion commands such as j, k and gg _don't_ erase > the search count message, even though it would make sense for them > to do so. It's weird to jump from the bottom of a buffer to the top > with gg and still see the last search count message in the command > line. Hm, yeah I can reproduce it. I am not sure yet, what causes the extra redraw of the command line. Best, Christian -- Wußten Sie schon... ... daß ein Knall schneller als der Schall sein kann? -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190830062136.GK25942%40256bit.org.
Re: Mapping erases search count message
On Do, 29 Aug 2019, Bram Moolenaar wrote: > The argument means that the command won't be echoed. But it > does not suppress the output of the command like the ":silent" modifier > does. Yeah, but it felt natural to me, to only show the search index feature, if the command is echoed. I actually played with a simple patch yesterday, but then thought that works as expected. > How about removing the check for cmd_silent in search.c, where > search_stat() is called? It's a bit more convoluted, since msgbuf needs to be properly allocated and initialized. The attached patch does it. Let me know if you think that is okay. I can write a test then. Mit freundlichen Grüßen Christian -- Fragt der Arzt: "Rauchen Sie?" "Nein." "Trinken Sie?" "Nein." Darauf der Arzt: "Grinsen Sie nicht so blöd, ich find schon noch was!" -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190830061958.GJ25942%40256bit.org. From 6e56a15734d34a449235145265d5bff26466db93 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 30 Aug 2019 08:17:07 +0200 Subject: [PATCH] Show the search_index feature also for silent mappings --- src/search.c | 106 ++- 1 file changed, 55 insertions(+), 51 deletions(-) diff --git a/src/search.c b/src/search.c index 46273e11e..568b27ecc 100644 --- a/src/search.c +++ b/src/search.c @@ -1354,8 +1354,7 @@ do_search( pat = p; /* put pat after search command */ } - if ((options & SEARCH_ECHO) && messaging() - && !cmd_silent && msg_silent == 0) + if ((options & SEARCH_ECHO) && messaging() && !msg_silent) { char_u *trunc; char_u off_buf[40]; @@ -1409,62 +1408,67 @@ do_search( if (msgbuf != NULL) { vim_memset(msgbuf, ' ', len); - msgbuf[0] = dirc; msgbuf[len - 1] = NUL; - - if (enc_utf8 && utf_iscomposing(utf_ptr2char(p))) - { - // Use a space to draw the composing char on. - msgbuf[1] = ' '; - mch_memmove(msgbuf + 2, p, STRLEN(p)); - } - else - mch_memmove(msgbuf + 1, p, STRLEN(p)); - if (off_len > 0) - mch_memmove(msgbuf + STRLEN(p) + 1, off_buf, off_len); - - trunc = msg_strtrunc(msgbuf, TRUE); - if (trunc != NULL) + // do not fill the msgbuf buffer, if cmd_silent is set, leave it + // empty for the search_stat feature. + if (!cmd_silent) { - vim_free(msgbuf); - msgbuf = trunc; - } + msgbuf[0] = dirc; -#ifdef FEAT_RIGHTLEFT - // The search pattern could be shown on the right in rightleft - // mode, but the 'ruler' and 'showcmd' area use it too, thus - // it would be blanked out again very soon. Show it on the - // left, but do reverse the text. - if (curwin->w_p_rl && *curwin->w_p_rlc == 's') - { - char_u *r; - size_t pat_len; + if (enc_utf8 && utf_iscomposing(utf_ptr2char(p))) + { + // Use a space to draw the composing char on. + msgbuf[1] = ' '; + mch_memmove(msgbuf + 2, p, STRLEN(p)); + } + else + mch_memmove(msgbuf + 1, p, STRLEN(p)); + if (off_len > 0) + mch_memmove(msgbuf + STRLEN(p) + 1, off_buf, off_len); - r = reverse_text(msgbuf); - if (r != NULL) + trunc = msg_strtrunc(msgbuf, TRUE); + if (trunc != NULL) { vim_free(msgbuf); - msgbuf = r; - // move reversed text to beginning of buffer - while (*r != NUL && *r == ' ') - r++; - pat_len = msgbuf + STRLEN(msgbuf) - r; - mch_memmove(msgbuf, r, pat_len); - // overwrite old text - if ((size_t)(r - msgbuf) >= pat_len) - vim_memset(r, ' ', pat_len); - else - vim_memset(msgbuf + pat_len, ' ', r - msgbuf); + msgbuf = trunc; } - } -#endif - msg_outtrans(msgbuf); - msg_clr_eos(); - msg_check(); - gotocmdline(FALSE); - out_flush(); - msg_nowait = TRUE; // don't wait for this message +#ifdef FEAT_RIGHTLEFT + // The search pattern could be shown on the right in rightleft + // mode, but the 'ruler' and 'showcmd' area use it too, thus + // it would be blanked out again very soon. Show it on the + // left, but do reverse the text. + if (curwin->w_p_rl && *curwin->w_p_rlc == 's') + { + char_u *r; + size_t pat_len; + + r = reverse_text(msgbuf); + if (r != NULL) + { + vim_free(msgbuf); + msgbuf = r; + // move reversed text to beginning of buffer + while (*r != NUL && *r == ' ') +r++; + pat_len = msgbuf + STRLEN(msgbuf) - r; + mch_memmove(msgbuf, r, pat_len); + // overwrite old text + if ((size_t)(r - msgbuf) >= pat_len) +
Re: Mapping erases search count message
On 2019-08-29, Christian Brabandt wrote: > On Do, 29 Aug 2019, Christian Brabandt wrote: > > > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > On 2019-08-28, Christian Brabandt wrote: > > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > > > > > I just tried exposing the search count message by removing 'S' from > > > > > 'shortmess', but I couldn't see it. I discovered that it is hidden, > > > > > erased and/or not updated by a couple of my mappings. > > > > > > > > > > nnoremap n nzv:call AdjCursor() > > > > > nnoremap N Nzv:call AdjCursor() > > > > > > > > > > Here is a simple experiment that demonstrates the problem. Create > > > > > a file, test.vim, that contains the following. > > > > > > > > > > set shortmess-=S > > > > > nnoremap n n > > > > > help map.txt > > > > > > > > > > Open a standard-sized, 80x24 terminal, and in it run > > > > > > > > > > $ vim -N -u NONE -i NONE -S test.vim > > > > > > > > > > Then search for "command": > > > > > > > > > > /command > > > > > > > > > > After hitting Enter, the cursor will be at the start of "commands" > > > > > on line 7 and the command line will contain this: > > > > > > > > > > /command [1/>99] > > > > > > > > > > After hitting 'n', the cursor advances to line 13 and the command > > > > > line stays the same, even showing "[1/>99]" when it should be > > > > > showing "[2/>99]". > > > > > > > > > > Another 'n' advances the cursor to line 17, the screen scrolls > > > > > up so that that line is at the bottom of the window, and the command > > > > > line is empty--no search count message at all. > > > > > > > > > > I would think that would prevent the mapping from > > > > > disturbing the command line, in which case this is a bug. > > > > > > > > > > If it's not a bug, then is there some way of defining a mapping that > > > > > does not interfere with the search count message, or some way of > > > > > restoring that message at the end of a mapping? > > > > > > > > Is that with patch 8.1.1288 included? > > > > > > Sorry, I forgot to include the version information. Yes, I used the > > > latest version, 8.1.1933. > > > > Hm, I need to investigate. > > I see what is happening. A mapping with the `` flag will set the > internal variable cmd_silent to prevent it from being output the command > line. So what your mapping does is it acts like 'n' without outputting > anything on the command line. > > But this is not what you want. You want the default behaviour of n, > which does output the command to search + the new search index feature. > > (See the difference on the commandline between a plain `n` and a n > mapped with `nnoremap n n`). > > So the obvious fix would be to remove the `` command. While this > fixes your minimal test case, it most likely is no fix for your actual > issue, that calling the AdjCursor() function will be output in the > command line in addition (possibly overwriting the command line). > > What might work (depending on the complexity of your AdjCursor() > function) is to use an expression mapping that simply returns 'n' after > having done whatever action it needs to be doing. However, this might be > a bit difficult since you want this to happen after the cursor has been > placed. > > Another alternative might be a mapping like this: > > nmap n nzv > nnoremap zv zv:call AdjCursor() Thanks for looking further into this, Christian. I don't understand how that first mapping in your alternative mappings works. I thought that using nmap (not nnoremap) to map n to a rhs including n would cause an infinite recursion, but it doesn't. Those mappings solve part of the problem. That is, if AdjCursor() is an empty function, they work fine--the search count message is always visible. But if AdjCursor() is the actual function (which scrolls the window when needed to keep the cursor at least two lines from the top and bottom), then whenever the window is scrolled, the message disappears. In fact, removing all the mappings and just executing Ctrl-E or C
Re: Mapping erases search count message
Am 29.08.2019 um 17:36 schrieb Christian Brabandt: On Do, 29 Aug 2019, Christian Brabandt wrote: On Di, 27 Aug 2019, Gary Johnson wrote: On 2019-08-28, Christian Brabandt wrote: On Di, 27 Aug 2019, Gary Johnson wrote: I just tried exposing the search count message by removing 'S' from 'shortmess', but I couldn't see it. I discovered that it is hidden, erased and/or not updated by a couple of my mappings. nnoremap n nzv:call AdjCursor() nnoremap N Nzv:call AdjCursor() Here is a simple experiment that demonstrates the problem. Create a file, test.vim, that contains the following. set shortmess-=S nnoremap n n help map.txt Open a standard-sized, 80x24 terminal, and in it run $ vim -N -u NONE -i NONE -S test.vim Then search for "command": /command After hitting Enter, the cursor will be at the start of "commands" on line 7 and the command line will contain this: /command [1/>99] After hitting 'n', the cursor advances to line 13 and the command line stays the same, even showing "[1/>99]" when it should be showing "[2/>99]". Another 'n' advances the cursor to line 17, the screen scrolls up so that that line is at the bottom of the window, and the command line is empty--no search count message at all. I would think that would prevent the mapping from disturbing the command line, in which case this is a bug. If it's not a bug, then is there some way of defining a mapping that does not interfere with the search count message, or some way of restoring that message at the end of a mapping? Is that with patch 8.1.1288 included? Sorry, I forgot to include the version information. Yes, I used the latest version, 8.1.1933. Hm, I need to investigate. I see what is happening. A mapping with the `` flag will set the internal variable cmd_silent to prevent it from being output the command line. So what your mapping does is it acts like 'n' without outputting anything on the command line. But this is not what you want. You want the default behaviour of n, which does output the command to search + the new search index feature. (See the difference on the commandline between a plain `n` and a n mapped with `nnoremap n n`). So the obvious fix would be to remove the `` command. While this fixes your minimal test case, it most likely is no fix for your actual issue, that calling the AdjCursor() function will be output in the command line in addition (possibly overwriting the command line). What might work (depending on the complexity of your AdjCursor() function) is to use an expression mapping that simply returns 'n' after having done whatever action it needs to be doing. However, this might be a bit difficult since you want this to happen after the cursor has been placed. Another alternative might be a mapping like this: This is what
Re: Mapping erases search count message
Christian Brabandt wrote: > On Do, 29 Aug 2019, Christian Brabandt wrote: > > > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > On 2019-08-28, Christian Brabandt wrote: > > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > > > > > I just tried exposing the search count message by removing 'S' from > > > > > 'shortmess', but I couldn't see it. I discovered that it is hidden, > > > > > erased and/or not updated by a couple of my mappings. > > > > > > > > > > nnoremap n nzv:call AdjCursor() > > > > > nnoremap N Nzv:call AdjCursor() > > > > > > > > > > Here is a simple experiment that demonstrates the problem. Create > > > > > a file, test.vim, that contains the following. > > > > > > > > > > set shortmess-=S > > > > > nnoremap n n > > > > > help map.txt > > > > > > > > > > Open a standard-sized, 80x24 terminal, and in it run > > > > > > > > > > $ vim -N -u NONE -i NONE -S test.vim > > > > > > > > > > Then search for "command": > > > > > > > > > > /command > > > > > > > > > > After hitting Enter, the cursor will be at the start of "commands" > > > > > on line 7 and the command line will contain this: > > > > > > > > > > /command [1/>99] > > > > > > > > > > After hitting 'n', the cursor advances to line 13 and the command > > > > > line stays the same, even showing "[1/>99]" when it should be > > > > > showing "[2/>99]". > > > > > > > > > > Another 'n' advances the cursor to line 17, the screen scrolls > > > > > up so that that line is at the bottom of the window, and the command > > > > > line is empty--no search count message at all. > > > > > > > > > > I would think that would prevent the mapping from > > > > > disturbing the command line, in which case this is a bug. > > > > > > > > > > If it's not a bug, then is there some way of defining a mapping that > > > > > does not interfere with the search count message, or some way of > > > > > restoring that message at the end of a mapping? > > > > > > > > Is that with patch 8.1.1288 included? > > > > > > Sorry, I forgot to include the version information. Yes, I used the > > > latest version, 8.1.1933. > > > > Hm, I need to investigate. > > I see what is happening. A mapping with the `` flag will set the > internal variable cmd_silent to prevent it from being output the command > line. So what your mapping does is it acts like 'n' without outputting > anything on the command line. > > But this is not what you want. You want the default behaviour of n, > which does output the command to search + the new search index feature. > > (See the difference on the commandline between a plain `n` and a n > mapped with `nnoremap n n`). > > So the obvious fix would be to remove the `` command. While this > fixes your minimal test case, it most likely is no fix for your actual > issue, that calling the AdjCursor() function will be output in the > command line in addition (possibly overwriting the command line). > > What might work (depending on the complexity of your AdjCursor() > function) is to use an expression mapping that simply returns 'n' after > having done whatever action it needs to be doing. However, this might be > a bit difficult since you want this to happen after the cursor has been > placed. > > Another alternative might be a mapping like this: > > nmap n nzv > nnoremap zv zv:call AdjCursor() The argument means that the command won't be echoed. But it does not suppress the output of the command like the ":silent" modifier does. How about removing the check for cmd_silent in search.c, where search_stat() is called? -- hundred-and-one symptoms of being an internet addict: 131. You challenge authority and society by portnuking people /// 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_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/201908291859.x7TIx2gh026578%40masaka.moolenaar.net.
Re: Mapping erases search count message
On Do, 29 Aug 2019, Christian Brabandt wrote: > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > On 2019-08-28, Christian Brabandt wrote: > > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > > > I just tried exposing the search count message by removing 'S' from > > > > 'shortmess', but I couldn't see it. I discovered that it is hidden, > > > > erased and/or not updated by a couple of my mappings. > > > > > > > > nnoremap n nzv:call AdjCursor() > > > > nnoremap N Nzv:call AdjCursor() > > > > > > > > Here is a simple experiment that demonstrates the problem. Create > > > > a file, test.vim, that contains the following. > > > > > > > > set shortmess-=S > > > > nnoremap n n > > > > help map.txt > > > > > > > > Open a standard-sized, 80x24 terminal, and in it run > > > > > > > > $ vim -N -u NONE -i NONE -S test.vim > > > > > > > > Then search for "command": > > > > > > > > /command > > > > > > > > After hitting Enter, the cursor will be at the start of "commands" > > > > on line 7 and the command line will contain this: > > > > > > > > /command [1/>99] > > > > > > > > After hitting 'n', the cursor advances to line 13 and the command > > > > line stays the same, even showing "[1/>99]" when it should be > > > > showing "[2/>99]". > > > > > > > > Another 'n' advances the cursor to line 17, the screen scrolls > > > > up so that that line is at the bottom of the window, and the command > > > > line is empty--no search count message at all. > > > > > > > > I would think that would prevent the mapping from > > > > disturbing the command line, in which case this is a bug. > > > > > > > > If it's not a bug, then is there some way of defining a mapping that > > > > does not interfere with the search count message, or some way of > > > > restoring that message at the end of a mapping? > > > > > > Is that with patch 8.1.1288 included? > > > > Sorry, I forgot to include the version information. Yes, I used the > > latest version, 8.1.1933. > > Hm, I need to investigate. I see what is happening. A mapping with the `` flag will set the internal variable cmd_silent to prevent it from being output the command line. So what your mapping does is it acts like 'n' without outputting anything on the command line. But this is not what you want. You want the default behaviour of n, which does output the command to search + the new search index feature. (See the difference on the commandline between a plain `n` and a n mapped with `nnoremap n n`). So the obvious fix would be to remove the `` command. While this fixes your minimal test case, it most likely is no fix for your actual issue, that calling the AdjCursor() function will be output in the command line in addition (possibly overwriting the command line). What might work (depending on the complexity of your AdjCursor() function) is to use an expression mapping that simply returns 'n' after having done whatever action it needs to be doing. However, this might be a bit difficult since you want this to happen after the cursor has been placed. Another alternative might be a mapping like this: nmap n nzv nnoremap zv zv:call AdjCursor() Best, Christian -- Man darf nicht das Gras wachsen hören, sonst wird man taub. -- Gerhard Hauptmann -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190829153613.GI25942%40256bit.org.
Re: Mapping erases search count message
On Di, 27 Aug 2019, Gary Johnson wrote: > On 2019-08-28, Christian Brabandt wrote: > > On Di, 27 Aug 2019, Gary Johnson wrote: > > > > > I just tried exposing the search count message by removing 'S' from > > > 'shortmess', but I couldn't see it. I discovered that it is hidden, > > > erased and/or not updated by a couple of my mappings. > > > > > > nnoremap n nzv:call AdjCursor() > > > nnoremap N Nzv:call AdjCursor() > > > > > > Here is a simple experiment that demonstrates the problem. Create > > > a file, test.vim, that contains the following. > > > > > > set shortmess-=S > > > nnoremap n n > > > help map.txt > > > > > > Open a standard-sized, 80x24 terminal, and in it run > > > > > > $ vim -N -u NONE -i NONE -S test.vim > > > > > > Then search for "command": > > > > > > /command > > > > > > After hitting Enter, the cursor will be at the start of "commands" > > > on line 7 and the command line will contain this: > > > > > > /command [1/>99] > > > > > > After hitting 'n', the cursor advances to line 13 and the command > > > line stays the same, even showing "[1/>99]" when it should be > > > showing "[2/>99]". > > > > > > Another 'n' advances the cursor to line 17, the screen scrolls > > > up so that that line is at the bottom of the window, and the command > > > line is empty--no search count message at all. > > > > > > I would think that would prevent the mapping from > > > disturbing the command line, in which case this is a bug. > > > > > > If it's not a bug, then is there some way of defining a mapping that > > > does not interfere with the search count message, or some way of > > > restoring that message at the end of a mapping? > > > > Is that with patch 8.1.1288 included? > > Sorry, I forgot to include the version information. Yes, I used the > latest version, 8.1.1933. Hm, I need to investigate. Best, Christian -- Was die Gesellschaft öffentliche Meinung nennt, heißt beim einzelnen Menschen Vorurteil. -- Karl Heinrich Waggerl -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190829092521.GF25942%40256bit.org.
Re: Mapping erases search count message
On Wed, Aug 28, 2019 at 8:12 AM Gary Johnson wrote: > Yes, if you were to use those first two mappings without the > AdjCursor() function defined, I would expect them to fail as you > describe. You can avoid that by defining AdjCursor() as an empty > function. Alternatively, you can use the mapping that I intended > for you to use to demonstrate the problem, the one defined in > test.vim. > > Regards, > Gary Ah, sorry. Well, with ":noremap n n" the count is indeed not echoed, but with ":noremap n n" instead, it is. I suppose that the switch avoids output from the normal-mode {rhs} and that what the help says about the need for an additional ":silent" in the {rhs} applies to an ex-command, which is not what we have here. Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsAz5Tz3mPomDJfX3%3DpAsgQ8Y%3Dr3wEH1GRp6Ygvh0tjCA%40mail.gmail.com.
Re: Mapping erases search count message
On 2019-08-28, Christian Brabandt wrote: > On Di, 27 Aug 2019, Gary Johnson wrote: > > > I just tried exposing the search count message by removing 'S' from > > 'shortmess', but I couldn't see it. I discovered that it is hidden, > > erased and/or not updated by a couple of my mappings. > > > > nnoremap n nzv:call AdjCursor() > > nnoremap N Nzv:call AdjCursor() > > > > Here is a simple experiment that demonstrates the problem. Create > > a file, test.vim, that contains the following. > > > > set shortmess-=S > > nnoremap n n > > help map.txt > > > > Open a standard-sized, 80x24 terminal, and in it run > > > > $ vim -N -u NONE -i NONE -S test.vim > > > > Then search for "command": > > > > /command > > > > After hitting Enter, the cursor will be at the start of "commands" > > on line 7 and the command line will contain this: > > > > /command [1/>99] > > > > After hitting 'n', the cursor advances to line 13 and the command > > line stays the same, even showing "[1/>99]" when it should be > > showing "[2/>99]". > > > > Another 'n' advances the cursor to line 17, the screen scrolls > > up so that that line is at the bottom of the window, and the command > > line is empty--no search count message at all. > > > > I would think that would prevent the mapping from > > disturbing the command line, in which case this is a bug. > > > > If it's not a bug, then is there some way of defining a mapping that > > does not interfere with the search count message, or some way of > > restoring that message at the end of a mapping? > > Is that with patch 8.1.1288 included? Sorry, I forgot to include the version information. Yes, I used the latest version, 8.1.1933. Regards, Gary -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190828061843.GA27112%40phoenix.
Re: Mapping erases search count message
On 2019-08-28, Tony Mechelynck wrote: > On Wed, Aug 28, 2019 at 7:31 AM Gary Johnson wrote: > > > > I just tried exposing the search count message by removing 'S' from > > 'shortmess', but I couldn't see it. I discovered that it is hidden, > > erased and/or not updated by a couple of my mappings. > > > > nnoremap n nzv:call AdjCursor() > > nnoremap N Nzv:call AdjCursor() > > > > Here is a simple experiment that demonstrates the problem. Create > > a file, test.vim, that contains the following. > > > > set shortmess-=S > > nnoremap n n > > help map.txt > > > > Open a standard-sized, 80x24 terminal, and in it run > > > > $ vim -N -u NONE -i NONE -S test.vim > > > > Then search for "command": > > > > /command > > > > After hitting Enter, the cursor will be at the start of "commands" > > on line 7 and the command line will contain this: > > > > /command [1/>99] > > > > After hitting 'n', the cursor advances to line 13 and the command > > line stays the same, even showing "[1/>99]" when it should be > > showing "[2/>99]". > > > > Another 'n' advances the cursor to line 17, the screen scrolls > > up so that that line is at the bottom of the window, and the command > > line is empty--no search count message at all. > > > > I would think that would prevent the mapping from > > disturbing the command line, in which case this is a bug. > > > > If it's not a bug, then is there some way of defining a mapping that > > does not interfere with the search count message, or some way of > > restoring that message at the end of a mapping? > > > > Regards, > > Gary > > I can't reproduce the problem. > > What I get by hitting n after applying your mappings is: > > E117: Unknown function: AdjCursor > > With no mappings, the count is of course corectly shown. Yes, if you were to use those first two mappings without the AdjCursor() function defined, I would expect them to fail as you describe. You can avoid that by defining AdjCursor() as an empty function. Alternatively, you can use the mapping that I intended for you to use to demonstrate the problem, the one defined in test.vim. Regards, Gary -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190828061339.GA26834%40phoenix.
Re: Mapping erases search count message
On Di, 27 Aug 2019, Gary Johnson wrote: > I just tried exposing the search count message by removing 'S' from > 'shortmess', but I couldn't see it. I discovered that it is hidden, > erased and/or not updated by a couple of my mappings. > > nnoremap n nzv:call AdjCursor() > nnoremap N Nzv:call AdjCursor() > > Here is a simple experiment that demonstrates the problem. Create > a file, test.vim, that contains the following. > > set shortmess-=S > nnoremap n n > help map.txt > > Open a standard-sized, 80x24 terminal, and in it run > > $ vim -N -u NONE -i NONE -S test.vim > > Then search for "command": > > /command > > After hitting Enter, the cursor will be at the start of "commands" > on line 7 and the command line will contain this: > > /command [1/>99] > > After hitting 'n', the cursor advances to line 13 and the command > line stays the same, even showing "[1/>99]" when it should be > showing "[2/>99]". > > Another 'n' advances the cursor to line 17, the screen scrolls > up so that that line is at the bottom of the window, and the command > line is empty--no search count message at all. > > I would think that would prevent the mapping from > disturbing the command line, in which case this is a bug. > > If it's not a bug, then is there some way of defining a mapping that > does not interfere with the search count message, or some way of > restoring that message at the end of a mapping? Is that with patch 8.1.1288 included? Best, Christian -- Wer nicht mit der Zeit geht, geht mit der Zeit! -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190828060810.GA25942%40256bit.org.
Re: Mapping erases search count message
On Wed, Aug 28, 2019 at 7:31 AM Gary Johnson wrote: > > I just tried exposing the search count message by removing 'S' from > 'shortmess', but I couldn't see it. I discovered that it is hidden, > erased and/or not updated by a couple of my mappings. > > nnoremap n nzv:call AdjCursor() > nnoremap N Nzv:call AdjCursor() > > Here is a simple experiment that demonstrates the problem. Create > a file, test.vim, that contains the following. > > set shortmess-=S > nnoremap n n > help map.txt > > Open a standard-sized, 80x24 terminal, and in it run > > $ vim -N -u NONE -i NONE -S test.vim > > Then search for "command": > > /command > > After hitting Enter, the cursor will be at the start of "commands" > on line 7 and the command line will contain this: > > /command [1/>99] > > After hitting 'n', the cursor advances to line 13 and the command > line stays the same, even showing "[1/>99]" when it should be > showing "[2/>99]". > > Another 'n' advances the cursor to line 17, the screen scrolls > up so that that line is at the bottom of the window, and the command > line is empty--no search count message at all. > > I would think that would prevent the mapping from > disturbing the command line, in which case this is a bug. > > If it's not a bug, then is there some way of defining a mapping that > does not interfere with the search count message, or some way of > restoring that message at the end of a mapping? > > Regards, > Gary I can't reproduce the problem. What I get by hitting n after applying your mappings is: E117: Unknown function: AdjCursor With no mappings, the count is of course corectly shown. Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvKtBMUP%2B7v%3D5yM8P4r%2BtMahhr%2B2nZmKqDVR7xVoVcUZg%40mail.gmail.com.
Mapping erases search count message
I just tried exposing the search count message by removing 'S' from 'shortmess', but I couldn't see it. I discovered that it is hidden, erased and/or not updated by a couple of my mappings. nnoremap n nzv:call AdjCursor() nnoremap N Nzv:call AdjCursor() Here is a simple experiment that demonstrates the problem. Create a file, test.vim, that contains the following. set shortmess-=S nnoremap n n help map.txt Open a standard-sized, 80x24 terminal, and in it run $ vim -N -u NONE -i NONE -S test.vim Then search for "command": /command After hitting Enter, the cursor will be at the start of "commands" on line 7 and the command line will contain this: /command [1/>99] After hitting 'n', the cursor advances to line 13 and the command line stays the same, even showing "[1/>99]" when it should be showing "[2/>99]". Another 'n' advances the cursor to line 17, the screen scrolls up so that that line is at the bottom of the window, and the command line is empty--no search count message at all. I would think that would prevent the mapping from disturbing the command line, in which case this is a bug. If it's not a bug, then is there some way of defining a mapping that does not interfere with the search count message, or some way of restoring that message at the end of a mapping? Regards, Gary -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190828053221.GA10925%40phoenix.
Re: ALT key mapping in windows 10
On Fri, Dec 21, 2018 at 12:36 AM John Little wrote: > > On Friday, December 21, 2018 at 2:50:06 AM UTC+13, Deepak kumar wrote: > > > how to map ALT+ LEFT | RIGHT | UP | DOWN keys in vimrc file? > > Generally, to find what vim can map, enter insert mode, type ctrl-v then what > you want to map. If you see something, then that's what you can map. If > not, vim isn't seeing the keys and has trouble mapping it. I see in > gvim for alt+left. > > HTH, and regards, John Little Yes, and in addition, sometimes (especially when running in a terminal, but for some combinations also in gvim) different sets of key+modifiers are not seen as different by Vim and as a result they cannot be mapped separately. The canonical case is Ctrl-a to Ctrl-z which is guaranteed to be seen as identical with Ctrl-Shift-a to Ctrl-Shift-z. For Ctrl + cursor key, the presence vs. absence of Shift may or may not make a difference depending on OS and on gvim vs. Console Vim. For Alt + something, other modifiers are usually, but not always, taken into consideration. You may have to experiment to determine what is and isn't seen as different on your particular system. Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ALT key mapping in windows 10
On Friday, December 21, 2018 at 2:50:06 AM UTC+13, Deepak kumar wrote: > how to map ALT+ LEFT | RIGHT | UP | DOWN keys in vimrc file? Generally, to find what vim can map, enter insert mode, type ctrl-v then what you want to map. If you see something, then that's what you can map. If not, vim isn't seeing the keys and has trouble mapping it. I see in gvim for alt+left. HTH, and regards, John Little -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
ALT key mapping in windows 10
Hi Vim Users, I am a vim user on Unix like machines but for my current project, I have to use it on windows 10 machine. how to map ALT+ LEFT | RIGHT | UP | DOWN keys in vimrc file? currently, I using like this: nmap :wincmd k Can anyone please suggest vim configuration on windows(including NERDTree and all? Thank & Regards, Deepak -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Why does this mapping move my cursor?
Hi, Chris Lott schrieb am 10.10.2018 um 21:05: > > I have a mapping in my .vimrc : > > nnoremap md :write:silent !open -a 'Marked.app' '%:p' > > When I invoke the map, my cursor in Vim moves to the beginning of the > line. This doesn't happen if I run the commands manually. Why does the > cursor move and how can I stop it from doing so? the problem is with the combination of and in your mapping. The will execute the :write command. After that Vim is in normal mode, where is a command to put the cursor in a specified column, i.e. 10| would put the cursor in column 10. Because stands on its own in your mapping the cursor is put in the first column. You only need either or between two commands on the right side of your mapping. You can write it either as nnoremap md :writesilent !open -a 'Marked.app' '%:p' or as nnoremap md :write:silent !open -a 'Marked.app' '%:p' Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Why does this mapping move my cursor?
I have a mapping in my .vimrc : nnoremap md :write:silent !open -a 'Marked.app' '%:p' When I invoke the map, my cursor in Vim moves to the beginning of the line. This doesn't happen if I run the commands manually. Why does the cursor move and how can I stop it from doing so? Thanks! -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Accessing mapping from rhs
On 30/08/2018 20:37, Christian Brabandt wrote: On Do, 30 Aug 2018, John Passaro wrote: Could you implement the function and accompanying mapping as follows? imap MyFunction("cr") imap n MyFunction("Leader-n") This is the typical workaround. The idea was to be able to know in the function which mapping triggered the call to it, without having special arguments (which look like they contain redundant information). Christian, John, thanks for your replies. Yes, that's what I am currently doing in my plugin, and it's a very flexible solution, since the argument of MyFunction does not have to be equal to the lhs. I was just curious whether one could replace it with imap (MyPlug) where (MyPlug) maps to some function. In this case, you cannot pass arguments, so I was wondering whether one could access the lhs of the mapping through the plug (presumably, via some special variable). I couldn't find any way, but I wanted to make sure I wasn't missing anything from the documentation. To be clear, this is not a feature request: the "typical workaround", as I've said, is just fine. Thanks again, Life. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Accessing mapping from rhs
On Do, 30 Aug 2018, John Passaro wrote: > Could you implement the function and accompanying mapping as follows? > > imap MyFunction("cr") > imap n MyFunction("Leader-n") This is the typical workaround. The idea was to be able to know in the function which mapping triggered the call to it, without having special arguments (which look like they contain redundant information). Best, Christian -- Auch wenn es Dich empört: Das Unerlaubte Vergnügen macht Spaß. -- Ovid (43 v.Chr.-18 n.Chr) -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Accessing mapping from rhs
Could you implement the function and accompanying mapping as follows? imap MyFunction("cr") imap n MyFunction("Leader-n") Sorry if this is obvious, if it is impractical for some reason I'm curious why. John Passaro (917) 678-8293 On Thu, Aug 30, 2018 at 1:18 PM, Christian Brabandt wrote: > > On Do, 30 Aug 2018, Lifepillar wrote: > > > Is it possible to access the lhs of a mapping from its rhs? > > For example, given: > > > > imap MyFunction() > > > > is there a way for MyFunction() to know that it was called by ? > > Not that I know of and I have whished for that before. > > Best, > Christian > -- > Wenn ein Kolonialwarenhändler in seinem kleinen Laden so viele > Dummheiten und Fehler machte wie die Staatsmänner und Generäle in > ihren großen Ländern, wäre er in spätestens vier Wochen bankrott. > -- Erich Kästner > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Accessing mapping from rhs
On Do, 30 Aug 2018, Lifepillar wrote: > Is it possible to access the lhs of a mapping from its rhs? > For example, given: > > imap MyFunction() > > is there a way for MyFunction() to know that it was called by ? Not that I know of and I have whished for that before. Best, Christian -- Wenn ein Kolonialwarenhändler in seinem kleinen Laden so viele Dummheiten und Fehler machte wie die Staatsmänner und Generäle in ihren großen Ländern, wäre er in spätestens vier Wochen bankrott. -- Erich Kästner -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Accessing mapping from rhs
Is it possible to access the lhs of a mapping from its rhs? For example, given: imap MyFunction() is there a way for MyFunction() to know that it was called by ? Thanks, Life. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Force dd own mapping take in on nomodifiable buffer
Hi, Assuming that the nomodifiable option is set on a buffer, I am trying to map this kind : nnoremap
Re: terminal mode normal mode mapping ?
Tried with :tnoremap? --Matteo On Sun, Jun 17, 2018 at 3:52 PM, M Kelly wrote: > > Is there a way to map keys only when in normal mode from a terminal ? > > Hi, > > I think something like this works - > > nnoremap( == 'terminal') ? 'i' : > '' > > thx, > -m > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: terminal mode normal mode mapping ?
> Is there a way to map keys only when in normal mode from a terminal ? Hi, I think something like this works - nnoremap( == 'terminal') ? 'i' : '' thx, -m -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
terminal mode normal mode mapping ?
Hi, Is there a way to map keys only when in normal mode from a terminal ? thx, -m -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: conditional mapping of , depending on whether plugin exists
On Wednesday, 30 May 2018 22:02:53 UTC+8, Luc Hermitte wrote: > Hi, > > - Mail original - > > I use https://github.com/terryma/vim-smooth-scroll and so I bind > > & to ":call smooth_scroll#down(, 5, 2)" & > > ":call smooth_scroll#up(, 5, 2)" respectively. However I > > would like & to default to their original behaviour if > > the smooth scroll plugin isn't loaded. > > > > I've tried this: > > > > if exists('g:loaded_smoothscroll') > > noremap :call smooth_scroll#up(, 5, 2) > > noremap :call smooth_scroll#down(, 5, 2) > > endif > > > > but strangely it ignores the mapping if I load it like that. That > > means the exists('g:loaded_smoothscroll') check failed, but doing an > > :echo exists('g:loaded_smoothscroll') does indeed return 1. I'm > > guessing at the moment of sourcing the vimrc g:loaded_smoothscroll > > was 0, then it got set to 1 after after the mapping got read. How do > > I get around that? > > > > If it helps I actually put the variable let g:loaded_smoothscroll = 1 > > into the plugin/smooth_scroll.vim file (which did not exist in the > > author's original version, I had to fork it myself). Is that the > > correct place to put the g:loaded_smoothscroll variable? > > No, it's not. > Autoload plugins aren't expected to have an anti-inclusion guard. Beside, > plain plugins are loaded **after** the .vimrc file has been sourced. > > What you can do instead is to check whether the file exists with > > if !empty(globpath(, 'autoload/smooth_scroll.vim')) > nnoremap ... > > > This needs to be done **after** your plugin manager has kicked in to fill the > `` option. > > > HTH, > > -- > Luc Hermitte Many thanks, it works now with the file check method. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: conditional mapping of , depending on whether plugin exists
Hi, - Mail original - > I use https://github.com/terryma/vim-smooth-scroll and so I bind > & to ":call smooth_scroll#down(, 5, 2)" & > ":call smooth_scroll#up(, 5, 2)" respectively. However I > would like & to default to their original behaviour if > the smooth scroll plugin isn't loaded. > > I've tried this: > > if exists('g:loaded_smoothscroll') > noremap :call smooth_scroll#up(, 5, 2) > noremap :call smooth_scroll#down(, 5, 2) > endif > > but strangely it ignores the mapping if I load it like that. That > means the exists('g:loaded_smoothscroll') check failed, but doing an > :echo exists('g:loaded_smoothscroll') does indeed return 1. I'm > guessing at the moment of sourcing the vimrc g:loaded_smoothscroll > was 0, then it got set to 1 after after the mapping got read. How do > I get around that? > > If it helps I actually put the variable let g:loaded_smoothscroll = 1 > into the plugin/smooth_scroll.vim file (which did not exist in the > author's original version, I had to fork it myself). Is that the > correct place to put the g:loaded_smoothscroll variable? No, it's not. Autoload plugins aren't expected to have an anti-inclusion guard. Beside, plain plugins are loaded **after** the .vimrc file has been sourced. What you can do instead is to check whether the file exists with if !empty(globpath(, 'autoload/smooth_scroll.vim')) nnoremap ... This needs to be done **after** your plugin manager has kicked in to fill the `` option. HTH, -- Luc Hermitte -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
conditional mapping of , depending on whether plugin exists
I use https://github.com/terryma/vim-smooth-scroll and so I bind & to ":call smooth_scroll#down(, 5, 2)" & ":call smooth_scroll#up(, 5, 2)" respectively. However I would like & to default to their original behaviour if the smooth scroll plugin isn't loaded. I've tried this: if exists('g:loaded_smoothscroll') noremap :call smooth_scroll#up(, 5, 2) noremap :call smooth_scroll#down(, 5, 2) endif but strangely it ignores the mapping if I load it like that. That means the exists('g:loaded_smoothscroll') check failed, but doing an :echo exists('g:loaded_smoothscroll') does indeed return 1. I'm guessing at the moment of sourcing the vimrc g:loaded_smoothscroll was 0, then it got set to 1 after after the mapping got read. How do I get around that? If it helps I actually put the variable let g:loaded_smoothscroll = 1 into the plugin/smooth_scroll.vim file (which did not exist in the author's original version, I had to fork it myself). Is that the correct place to put the g:loaded_smoothscroll variable? -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: vim mapping calls xmodmap to swap : with ; in a keyboard with dead keys for accents
resolved! " aux/PXmodmap created through $ xmodmap -pke > aux/PXmodmap " with each dead, non-dead keys 'input source' " (as Unity/Ubuntu 16.04 calls it) " and swapping colon with semicolon nn p; :cal system('xmodmap '.g:prv.paths.vim.'aux/PXmodmap') nn p: :cal system('xmodmap '.g:prv.paths.vim.'aux/PXmodmap2') " Notes: " - can I leave only the chars needed to swap in PXmodmap? e.g. only ; with :? " - i should make this through the system. as in: https://github.com/ttm/prv/blob/master/vimrc Em sábado, 19 de maio de 2018 23:18:42 UTC-3, Renato Fabbri escreveu: > mapping; > > nn p; :cal system('xmodmap ~/.Xmodmap') > > ~/.Xmodmap created with -pke > aux/PXmodmap > and then swapping colon with semicolon > > Ctrl+space swaps dead keys and not dead keys, > set by OS (ubuntu 16.04). > > But > > when swapping dead and no dead keys (c-space), > ; is ; again, : is : again, and i also have to > press p; to swap them again. > > i want to make them independent, > i.e. that c-space does not reset swap of ; with : > > (understand that this is more an OS then a Vim issue, > but even so, you might have good solutions or thoughts) > > any suggestions? -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
vim mapping calls xmodmap to swap : with ; in a keyboard with dead keys for accents
mapping; nn p; :cal system('xmodmap ~/.Xmodmap') ~/.Xmodmap created with -pke > aux/PXmodmap and then swapping colon with semicolon Ctrl+space swaps dead keys and not dead keys, set by OS (ubuntu 16.04). But when swapping dead and no dead keys (c-space), ; is ; again, : is : again, and i also have to press p; to swap them again. i want to make them independent, i.e. that c-space does not reset swap of ; with : (understand that this is more an OS then a Vim issue, but even so, you might have good solutions or thoughts) any suggestions? -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping ?
Am 13.05.2018 um 22:24 schrieb M Kelly: Yes, this is default behaviour on linux. You need to remap first, then map . thx so much nnoremap works great :-) -mark Same on Windows. You don't need . I'd rather map :nnoremap -- Andy -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping ?
> Are you in windows OS? If it is, it will confilct with windows OS shortkey. Hi, no, sorry should have added that. I'm on Linux, Ubuntu 16.04 LTS +hwe -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping ?
On Sunday, May 13, 2018 at 9:38:03 PM UTC+8, M Kelly wrote: > Hi, > > Any idea why this doesn't work ? > > nnoremap :conf qa > > If I don't use the but some other non-ctrl char it works fine. > I keep getting a msg: > > Type :qa! and press to abandon all changes and exit Vim > > On this and also whenever I just type ctrl-c > > thx, > mark Are you in windows OS? If it is, it will confilct with windows OS shortkey. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
mapping ?
Hi, Any idea why this doesn't work ? nnoremap :conf qa If I don't use the but some other non-ctrl char it works fine. I keep getting a msg: Type :qa! and press to abandon all changes and exit Vim On this and also whenever I just type ctrl-c thx, mark -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Mapping for one handed touch typing
I'm also disabled having cerebral palsy with reduced mobility in both hands and arms. While most of my remappings probably won't help you one of the things I've done might: I've remapped most of thecommands to {key} because it's hard for me to hold down two keys simultanously and because I find it easier to hit with either index finger than reaching for the ctrl keys with my little fingers which are almost useless. I also find a longish timeout value very helpful, but that may be different when you have full mobility in one hand. Den fre 23 mar 2018 22:05Robert Bower skrev: > I am a occasional Vim user. It is my default rescue editor and I use it > for a few tasks but not many. I would like to use it for more because it > is so customizable. What holds me back is I am a one handed left handed > touch typist. I only have use of my left arm. > > The problem I have with Vim is while the key maps are natural for a two > handed touch typist, they are awkward for for a one handed typist. The > home row for one handed typing is fghj. That makes the direction keys of > hjkl somewhat unnatural. > > Before, I create my own map, I was wondering has anyone found a remapping > for one handed typing? > > Thanks in advance. > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Mapping for one handed touch typing
On Fri, Mar 23, 2018 at 2:03 PM, Robert Bower <frrobe...@gmail.com> wrote: > > Before, I create my own map, I was wondering has anyone found a remapping > for one handed typing? > When I broke my right hand and it was immobilized, I made a bunch of mappings to allow me to continue to be fairly productive. First, I mapped F1 to F4 to hjkl respectively. This allowed me to somewhat emulate the normal Vim movement keys, and since I had no muscle memory built up, I needed to visually verify my finger position often. I found it convenient that the keys I mapped were laid out in relation to the keys I was mapping so I could check my finger position literally at a glance. A little dab of epoxy resin on F1 and F4 also helped me identify them by touch (simulating the dots on F and J on most keyboards). I also mapped the Leader to be the ` (backtick) character, as the default leader of \ (backslash) was rather inconvenient. I think there was something buggy about this, but I never figured out what, and I don't use the map leader functionality very often. I then mapped the : (colon) to be `` (double backticks), so that I could just mash that key twice in order to access command mode. This, of course, I used A LOT. I also mapped CapsLock to be the Enter key, so that I could access that easily as well. I ended up turning that off sometimes though, because I found that certain all-capital letter sequences were super tedious to type one-handed without Caps Lock. YMMV. I did this with AutoHotKey on Windows, not with native Vim functionality. xmodmap on Linux should do something similar. But, the absolute best thing I did was to get a dictionary file of weighted words (i.e., sorted by frequency of use in the English language) and set my dictionary file to use that. Then I used the ACP (autocompletepop) plugin so that I could tab-complete most English words. When I type two-handed, and my output is English words (not computer code) it's generally faster to type a word than it is to try to have ACP complete it for me, but when typing one handed I found it much, much faster to have ACP suggest words for me.I found a ~200k word file online without too much trouble, sadly I don't remember where anymore. I believe it was some university somewhere. It was freely available, but I don't want to publish my personal copy of it because it isn't my own work, and I didn't think to save the link or the author information. The upshot of all those mappings is, your fingers generally hover near the top-left of the keyboard, largely mitigating the need to keep them near fghj. Tab-completing words ends up being quick enough to offset -in terms of typed words per minute - the distance you have to move your hand to type "p" or "?" or whatnot. My actual .vimrc entries: " LEFT-HANDED """""""""""""""""""""""""""""""""""""""""""""""""""""""""" " let double backticks act like the colon nnoremap `` : " change the Leader key to be ` for left-handed typing let mapleader="`" "map the movement keys to F1 to F4, and follow virtual lines nnoremap h nnoremap gj nnoremap gk nnoremap l vnoremap h vnoremap gj vnoremap gk vnoremap l " turn on the ACP plugin on startup let g:acp_enableAtStartup = 1 set dictionary=~/.vim/dict/weighted_words " LEFT-HANDED """""""""""""""""""""""""""""""""""""""""""""""""""""""""" Hope that helps, Dan -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Mapping for one handed touch typing
On Fri, Mar 23, 2018 at 10:03 PM, Robert Bowerwrote: > I am a occasional Vim user. It is my default rescue editor and I use it for > a few tasks but not many. I would like to use it for more because it is so > customizable. What holds me back is I am a one handed left handed touch > typist. I only have use of my left arm. > > The problem I have with Vim is while the key maps are natural for a two > handed touch typist, they are awkward for for a one handed typist. The home > row for one handed typing is fghj. That makes the direction keys of hjkl > somewhat unnatural. > > Before, I create my own map, I was wondering has anyone found a remapping for > one handed typing? > > Thanks in advance. I'm not a touch-typist, but I usually type one-handed, with most of the fingers of my right hand, which jumps this way and that over the keyboard in a manner similar to how a pianist's hands may jump from one octave to another. I don't use "special" one-handed mappings, though; the mappings I use are either for key sequences which I use often, or ones which are difficult to find on my Belgian AZERTY keyboard (e.g. for Ctrl-] in both Normal mode [to follow Vim's help hotlinks] and Insert mode [to end an abbreviation or to avoid triggering it]). So if you find out that there are complex key sequences that you use repeatedly, or key combinations which are awkward to get on your particular national keyboard, that's what you should assign to the {rhs} of your mappings — which will probably be different than mine, because they should suit you, not me. As {lhs} I recommend the Fn and Shift-Fn keys with the exception of (Help) and maybe also (Menu). Or, in Normal mode only, any non-ASCII key (if there are any) present on your national keyboard: mine has ² ³ é § è ç à ° ù µ £ but yours may have a different set. IMHO any Vim user, touch-typist or not, left-handed, right-handed or both, should learn which keys do what in Vim (in Insert mode, of course, most keys used just by themselves, or only with Shift, insert a character into the current editfile; but even in Normal mode, most keys do something), then it's just a matter of remembering which key or key combination does what. And my counsel is not to try to use only hjkl to move the cursor to the next character cell: Vim understands what the arrow keys do, and it listens to the mouse, so don't be afraid to use them. (Of course, on a desktop keyboard the arrow keys are usually on the far right, and that could be awkward for someone who hasn't got a usable right hand, but it is common to all programs, not only Vim.) To learn which keys do what, I recommend the "vimtutor" utility, distributed together with Vim: it moves the beginner step by step through the elementary use of Vim; and then I recommend to all users, beginners or otherwise, to make good use of the online help: AFAIK, no program available today has such a complete and detailed help system, available at every user's fingertips without even leaving the program. Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Mapping for one handed touch typing
On 2018-03-23 14:03, Robert Bower wrote: > I am a occasional Vim user. It is my default rescue editor and I > use it for a few tasks but not many. I would like to use it for > more because it is so customizable. What holds me back is I am a > one handed left handed touch typist. I only have use of my left > arm. My first thought would be to get a hardware solution like http://www.nanopac.com/Half+Keyboard.htm which would solve issues not only within vim, but in other applications as well. Though at $595, it's a steep investment. > The problem I have with Vim is while the key maps are natural for a > two handed touch typist, they are awkward for for a one handed > typist. The home row for one handed typing is fghj. That makes the > direction keys of hjkl somewhat unnatural. Totally understandable! > Before, I create my own map, I was wondering has anyone found a > remapping for one handed typing? Looks like there are a couple possibilities for pre-existing solutions available here http://www.onehandkeyboard.org/linux-one-handed-keyboards/ -tim -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Mapping for one handed touch typing
I am a occasional Vim user. It is my default rescue editor and I use it for a few tasks but not many. I would like to use it for more because it is so customizable. What holds me back is I am a one handed left handed touch typist. I only have use of my left arm. The problem I have with Vim is while the key maps are natural for a two handed touch typist, they are awkward for for a one handed typist. The home row for one handed typing is fghj. That makes the direction keys of hjkl somewhat unnatural. Before, I create my own map, I was wondering has anyone found a remapping for one handed typing? Thanks in advance. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Mapping mutliple keys
Is there a simple way of mapping say ^[a - ^[z etc. to - etc? -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Questions about mapping information
On 21/03/2018 09:57, Nikolay Aleksandrovich Pavlov wrote: 2018-03-21 10:34 GMT+03:00 Lifepillar <lifepil...@lifepillar.me>: >> :verbose imap shows this: i &@(MUcompleteCR)24_AutoPairsReturn Last set from ~/.vim/pack/bundle/start/auto-pairs/plugin/auto-pairs.vim iMyCR Last set from ~/.vim/vimrc First question: why are there two definitions instead of one? I.e., why is the mapping from my vimrc shown at all? Due to buffer-local mappings there may exist at most {number of loaded buffers present}+1 mapping definitions, with buffer-local mappings attached to the current buffer taking precedence over global mapping definition and buffer-local mappings attached to other buffers ignored. Second question: what does &@ mean in the first definition? There is `:h map-listing` which explains both. You could found that by searching for `&` after `:h :map`; though there are some mishits. Thanks, that's exactly the info I needed! Life. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Questions about mapping information
2018-03-21 10:34 GMT+03:00 Lifepillar <lifepil...@lifepillar.me>: > I am trying to debug an issue with my plugin (µcomplete) and auto-pairs, > and I have a couple of questions about the way Vim displays information > about mappings. > > I have these definitions in my vimrc: > > imap MyCR (MUcompleteCR) > imap MyCR > > Auto-pairs maps , too, and it tries hard not to override an existing > mapping. After loading, :verbose imap shows this: > > i &@(MUcompleteCR)24_AutoPairsReturn > Last set from ~/.vim/pack/bundle/start/auto-pairs/plugin/auto-pairs.vim > > iMyCR > Last set from ~/.vim/vimrc > > I think auto-pairs expands the current mapping and appends its own > definition. > > First question: why are there two definitions instead of one? I.e., why > is the mapping from my vimrc shown at all? Due to buffer-local mappings there may exist at most {number of loaded buffers present}+1 mapping definitions, with buffer-local mappings attached to the current buffer taking precedence over global mapping definition and buffer-local mappings attached to other buffers ignored. > > Second question: what does &@ mean in the first definition? There is `:h map-listing` which explains both. You could found that by searching for `&` after `:h :map`; though there are some mishits. > > For the record, the issue is that, with those definitions in place, > when I type , Vim inserts (MUcompleteCR) literally in the > buffer, although that plug exists. > > Thanks, > Life. > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- You received this message because you are subscribed to the Google > Groups "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Questions about mapping information
I am trying to debug an issue with my plugin (µcomplete) and auto-pairs, and I have a couple of questions about the way Vim displays information about mappings. I have these definitions in my vimrc: imap MyCR (MUcompleteCR) imap MyCR Auto-pairs maps , too, and it tries hard not to override an existing mapping. After loading, :verbose imap shows this: i &@(MUcompleteCR)24_AutoPairsReturn Last set from ~/.vim/pack/bundle/start/auto-pairs/plugin/auto-pairs.vim iMyCR Last set from ~/.vim/vimrc I think auto-pairs expands the current mapping and appends its own definition. First question: why are there two definitions instead of one? I.e., why is the mapping from my vimrc shown at all? Second question: what does &@ mean in the first definition? For the record, the issue is that, with those definitions in place, when I type , Vim inserts (MUcompleteCR) literally in the buffer, although that plug exists. Thanks, Life. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
disable vim default tab mapping in command window
I am trying to disable the default mapping for the tab key to @a in command window. according to :h command-line-window, adding the following two lines in .vimrc should do the job but it doesn't to my test. au CmdwinEnter [:>] iunmap au CmdwinEnter [:>] nunmap below is the min repo vimrc I observed this behavior. set nocompatible au CmdwinEnter [:>] iunmap au CmdwinEnter [:>] nunmap once in command window (either by : then ctrl-f, or q: in normal mode), :map still shows "n @a", which conflicts/overwrites my other mapping for the tab key. set wildchar= seems to avoid the default mapping, but I do want to use tab for auto-completion in vim. I also tried tightening the scope of non-tab wildchar with au CmdwinEnter [:>] set wildchar= au CmdwinLeave [:>] set wildchar= but this doesn't work either. meanwhile, with vim help recommended setting, I always got this error on entering command window: Error detected while processing CmdwinEnter Auto commands for "[:>]": E31: No such mapping Press ENTER or type command to continue it feels like by the time CmdwinEnter is triggered, the default tab mapping is not injected yet, and somehow it comes in at a later phase, but still before my "set wildchar=" takes effect, which is really confusing. how can I disable them permanently? I am on vim 8.0.1420. thanks. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping error.
On Thursday, November 30, 2017 at 1:09:02 PM UTC+5:30, Florian Rehnisch wrote: > On Thu, Nov 30, 2017 at 08:32:17AM +0100, Florian Rehnisch wrote: > > On Wed, Nov 29, 2017 at 11:06:19PM -0800, sinbad wrote: > > > I'm trying to map x in normal mode to do send a command to a pane > > > in tmux. > > > > > > sudo tmux send-keys -t "1" C-z "test" > > > > > > I tried the following. wrote the above command in a test.sh file and made > > > a mapping as below. > > > > > > :nnoremap x 'silent :!./test.sh' > > > > > > I'm getting the following error. > > > > > > E20: Mark not set > > > > > > i think it's due to the following mapping. > > > > > > n ' & :call Showmarks() > > > > > > Isn't nnoremap disable recursive mapping ? > > > here.. > > AFAICS recursive mapping /is/ disabled head. You're getting the error > > message > > because Vim tries to jump to a mark s when hitting the first tick (') in the > > right-hand side of your mapping. Furthermore, silent is AFAIK a command line > > command, so your colon is misplaced. Untested: > > > > :nnoremap x :silent\ !./test.sh > > > > The backslash is for escaping the space. > > Ah, the backslash gives another error (E10). > > :nnoremap x :silent !./test.sh > > Should do the trick. > > Gruß, > fm-r Thanks Florian. It worked. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping error.
On Thu, Nov 30, 2017 at 08:32:17AM +0100, Florian Rehnisch wrote: > On Wed, Nov 29, 2017 at 11:06:19PM -0800, sinbad wrote: > > I'm trying to map x in normal mode to do send a command to a pane in > > tmux. > > > > sudo tmux send-keys -t "1" C-z "test" > > > > I tried the following. wrote the above command in a test.sh file and made a > > mapping as below. > > > > :nnoremap x 'silent :!./test.sh' > > > > I'm getting the following error. > > > > E20: Mark not set > > > > i think it's due to the following mapping. > > > > n ' & :call Showmarks() > > > > Isn't nnoremap disable recursive mapping ? > here.. > AFAICS recursive mapping /is/ disabled head. You're getting the error message > because Vim tries to jump to a mark s when hitting the first tick (') in the > right-hand side of your mapping. Furthermore, silent is AFAIK a command line > command, so your colon is misplaced. Untested: > > :nnoremap x :silent\ !./test.sh > > The backslash is for escaping the space. Ah, the backslash gives another error (E10). :nnoremap x :silent !./test.sh Should do the trick. Gruß, fm-r -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping error.
On Wed, Nov 29, 2017 at 11:06:19PM -0800, sinbad wrote: > I'm trying to map x in normal mode to do send a command to a pane in > tmux. > > sudo tmux send-keys -t "1" C-z "test" > > I tried the following. wrote the above command in a test.sh file and made a > mapping as below. > > :nnoremap x 'silent :!./test.sh' > > I'm getting the following error. > > E20: Mark not set > > i think it's due to the following mapping. > > n ' & :call Showmarks() > > Isn't nnoremap disable recursive mapping ? AFAICS recursive mapping /is/ disabled head. You're getting the error message because Vim tries to jump to a mark s when hitting the first tick (') in the right-hand side of your mapping. Furthermore, silent is AFAIK a command line command, so your colon is misplaced. Untested: :nnoremap x :silent\ !./test.sh The backslash is for escaping the space. Gruß, fm-r -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
mapping error.
Hi, I'm trying to map x in normal mode to do send a command to a pane in tmux. sudo tmux send-keys -t "1" C-z "test" I tried the following. wrote the above command in a test.sh file and made a mapping as below. :nnoremap x 'silent :!./test.sh' I'm getting the following error. E20: Mark not set i think it's due to the following mapping. n ' & :call Showmarks() Isn't nnoremap disable recursive mapping ? thanks -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
q: in mapping not invoking commandline window, only the command line
Here is a mapping using q: that works, copies cursor WORD into @" and uses it to build a substitute command in command line window, ends by waiting for user to type a character the cursor should move back to. nmap W yiWq:i%s/\<^R "\>/^R "/g^[ F Note ^U ^R ^[ ^M are all the ctrl-v ctrl-? form Here is an adaptation of the above to capture 2 or more WORDs at a time nmap n : ^Ulet @n=v:count^M@nyWq:i%s/\<\(^R "\)\>//ge^[ T>a The mapping works as expected thru @nyW, but then fails because q: does not activate the command line window as expected, apparently the q is ignored and the : then fires up the command line instead, resulting in E488 Trailing characters. If one removes the %s... from the right hand end the mapping ends by typing :i in the command line. -- Graham Lawrence -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Evoking the option for :help in a mapping
On Monday, August 28, 2017 at 1:32:32 PM UTC-7, Tony Mechelynck wrote: > On Mon, Aug 28, 2017 at 7:02 PM, Graham Lawrence <gl00...@gmail.com> wrote: > > I have the customary mappings for :help, > > > > nmap :exec "help " . expand("") > > nmap :exec "help " . expand("") > > > > and have been trying to develop similar do the option on the cursor > > word, something like > > > > nmap \\ yiw:h ^R"^[ > > > > but to no avail. Although the mapping does not terminate with a , vim > > treats the ^[ as if it were rather than and goes straight to the > > specific help for the cursor-word. > > > > Is it possible to have vim act on the as it does in the command line? > > > > -- > > Graham Lawrence > > See :help 'wildcharm' > > For instance: > > if has('wildmenu') > set wildmenu wildmode=longest:full,full wildcharm= > map ':help ' . expand('cword') . "\" > map ':help ' . expand('cWORD') . "\" > endif > > See also > :help map- > :help expr-quote > > Best regards, > Tony. Thank you both, Andy and Tony, for referring me to wildcharm/wildmenu. Just the ticket. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Evoking the option for :help in a mapping
On Mon, Aug 28, 2017 at 7:02 PM, Graham Lawrence <gl00...@gmail.com> wrote: > I have the customary mappings for :help, > > nmap :exec "help " . expand("") > nmap :exec "help " . expand("") > > and have been trying to develop similar do the option on the cursor > word, something like > > nmap \\ yiw:h ^R"^[ > > but to no avail. Although the mapping does not terminate with a , vim > treats the ^[ as if it were rather than and goes straight to the > specific help for the cursor-word. > > Is it possible to have vim act on the as it does in the command line? > > -- > Graham Lawrence See :help 'wildcharm' For instance: if has('wildmenu') set wildmenu wildmode=longest:full,full wildcharm= map ':help ' . expand('cword') . "\" map ':help ' . expand('cWORD') . "\" endif See also :help map- :help expr-quote Best regards, Tony. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Evoking the option for :help in a mapping
Am 28.08.2017 um 19:02 schrieb Graham Lawrence: I have the customary mappings for :help, nmap :exec "help " . expand("") nmap :exec "help " . expand("") and have been trying to develop similar do the option on the cursor word, something like nmap \\ yiw:h ^R"^[ But ^[ means Escape, not Tab, and Escape, when used in a mapping, works like Enter (usually): :h c_Esc So you want (right?) which looks more like ^I, but anyway in a mapping you can't use , instead you need to use the key defined with :h 'wildcharm (:set wcm= works for me). but to no avail. Although the mapping does not terminate with a , vim treats the ^[ as if it were rather than and goes straight to the specific help for the cursor-word. Is it possible to have vim act on the as it does in the command line? Your mapping becomes (with above 'wcm' setting): :nnoremap \\ yiw:h " or :nnoremap \\ :h or (I think I'd use) :nnoremap :h -- Andy -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Evoking the option for :help in a mapping
I have the customary mappings for :help, nmap :exec "help " . expand("") nmap :exec "help " . expand("") and have been trying to develop similar do the option on the cursor word, something like nmap \\ yiw:h ^R"^[ but to no avail. Although the mapping does not terminate with a , vim treats the ^[ as if it were rather than and goes straight to the specific help for the cursor-word. Is it possible to have vim act on the as it does in the command line? -- Graham Lawrence -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping list with : v:val and index of v:val
Le dimanche 11 juin 2017 20:09:19 UTC+2, Ni Va a écrit : > Le dimanche 11 juin 2017 18:35:59 UTC+2, Bram Moolenaar a écrit : > > Ni Va wrote: > > > > > Trying this > > > > > > > > > let file = readfile(expand("%:p"),'b') > > > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > > > > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. > > > > Works fine for me (spaces added for readability): > > > > let file = ['aaa', 'bbb', 'ccc'] > > echo map(copy(file), 'v:val . ":" . index(copy(file), v:val)') > > > > ['aaa:0', 'bbb:1', 'ccc:2'] > > > > > > -- > > I am also told that there is a logical proof out there somewhere > > that demonstrates that there is no task which duct tape cannot handle. > > -- Paul Brannan > > > > /// 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/// > > Reproduce it with a list made of 15 lines of a file. > > But effectively I have to use v:key. > Thank you for all. Ok works fine with v:key. let file = readfile(expand("%:p"),'b') call map(file,'v:val.":".v:key') nota : g:file was just to put=g:file result in my buffer to see the result. Thank you ! -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping list with : v:val and index of v:val
Le dimanche 11 juin 2017 18:35:59 UTC+2, Bram Moolenaar a écrit : > Ni Va wrote: > > > Trying this > > > > > > let file = readfile(expand("%:p"),'b') > > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. > > Works fine for me (spaces added for readability): > > let file = ['aaa', 'bbb', 'ccc'] > echo map(copy(file), 'v:val . ":" . index(copy(file), v:val)') > > ['aaa:0', 'bbb:1', 'ccc:2'] > > > -- > I am also told that there is a logical proof out there somewhere > that demonstrates that there is no task which duct tape cannot handle. > -- Paul Brannan > > /// 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/// Reproduce it with a list made of 15 lines of a file. But effectively I have to use v:key. Thank you for all. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping list with : v:val and index of v:val
Le dimanche 11 juin 2017 18:35:59 UTC+2, Bram Moolenaar a écrit : > Ni Va wrote: > > > Trying this > > > > > > let file = readfile(expand("%:p"),'b') > > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. > > Works fine for me (spaces added for readability): > > let file = ['aaa', 'bbb', 'ccc'] > echo map(copy(file), 'v:val . ":" . index(copy(file), v:val)') > > ['aaa:0', 'bbb:1', 'ccc:2'] > > > -- > I am also told that there is a logical proof out there somewhere > that demonstrates that there is no task which duct tape cannot handle. > -- Paul Brannan > > /// 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/// Reproduce it with a list made of 15 lines of a file. But effectively I have to use v:key. Thank you for all. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping list with : v:val and index of v:val
Ni Va wrote: > Trying this > > > let file = readfile(expand("%:p"),'b') > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. Works fine for me (spaces added for readability): let file = ['aaa', 'bbb', 'ccc'] echo map(copy(file), 'v:val . ":" . index(copy(file), v:val)') ['aaa:0', 'bbb:1', 'ccc:2'] -- I am also told that there is a logical proof out there somewhere that demonstrates that there is no task which duct tape cannot handle. -- Paul Brannan /// 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_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: mapping list with : v:val and index of v:val
2017-06-11 18:36 GMT+03:00 Ni Va: > Hi, > > Trying this > > > let file = readfile(expand("%:p"),'b') > let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') > > returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. There is `v:key`, do not use `index()` here; and using `copy()` in `index()` is not needed. And I am unable to reproduce your problem (vim 8.0.582), maybe need a specific set of options or specific file contents: using file created with `writefile(range(10), '/tmp/filename')` for the test. Wondering whether you understand that without the context (is this placed in a function?) `g:file` and `file` are the same variables? (Inside a function `file` would be `l:file`.) Though based on my knowledge of VimL this should not matter in this code: `file` will be reassigned only after expression evaluation finishes. > > > Thank you > > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_use+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
mapping list with : v:val and index of v:val
Hi, Trying this let file = readfile(expand("%:p"),'b') let g:file=map(copy(file),'v:val.":".index(copy(file), v:val)') returns -1 for each v:val of list 'file' out of 0, 1 , 2 etc.. Thank you -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Problematic behavior caused by mapping in matchit plugin
Am 11.05.2017 um 18:52 schrieb Efraim Yawitz: Hi, The docs for the matchit plugin say that the mappings in it may cause strange behavior, but I think this example is worth noting. I was trying to do yV% on lines like this: #ifdef SOMETHING ... #endif //SOMETHING expecting to yank all the lines, but what I got was everything up to the comment, i.e., the last line had only the #endif. A new uninstalled vim (without plugins) did what I had expected originally. After some debugging, what I found was that in this mapping in matchit.vim: onoremap % v:call Match_wrapper('',1,'o') the 'v' in v: was changing the operator to forced characterwise after my 'V' had tried to force it to forced linewise. Doing ounmap % got the behavior I was looking for. I couldn't find yet in the help what v: is supposed to do, but what is significant is that the 'v' in that mapping is evidently being interpreted twice, once as a "force characterwise" signal, and again for what it 'really' means. I imagine this could cause problems in other plugins as well which use this construction. See :h o_v An Ex-command used in Omap-mode :... is an exclusive motion. With v:... it becomes inclusive. It think it's a bug in Vim that Vv:... is kind of undefined yet (at least this was case quite some time ago ...). -- Andy -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Problematic behavior caused by mapping in matchit plugin
On Do, 11 Mai 2017, Efraim Yawitz wrote: > Hi, > > The docs for the matchit plugin say that the mappings in it may cause strange > behavior, but I think this example is worth noting. > > I was trying to do yV% on lines like this: > > #ifdef SOMETHING > ... > #endif //SOMETHING > > expecting to yank all the lines, but what I got was everything up to the > comment, i.e., the last line had only the #endif. A new uninstalled vim > (without plugins) did what I had expected originally. > > After some debugging, what I found was that in this mapping in matchit.vim: > > onoremap % v:call Match_wrapper('',1,'o') > > the 'v' in v: was changing the operator to forced characterwise after my > 'V' had tried to force it to forced linewise. Doing ounmap % got the behavior > I was looking for. > > I couldn't find yet in the help what v: is supposed to do, but what is > significant is that the 'v' in that mapping is evidently being interpreted > twice, once as a "force characterwise" signal, and again for what it 'really' > means. I imagine this could cause problems in other plugins as well which use > this construction. I believe this is the same issue as the one mentioned in the neovim issue tracker: https://github.com/neovim/neovim/issues/5691 I have tried to contact Benji, but unfortunately, he did not react. Best, Christian -- Das Leben besteht in dem, was ein Mensch den ganzen Tag über denkt. -- Ralph Waldo Emerson -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Problematic behavior caused by mapping in matchit plugin
Hi, The docs for the matchit plugin say that the mappings in it may cause strange behavior, but I think this example is worth noting. I was trying to do yV% on lines like this: #ifdef SOMETHING ... #endif //SOMETHING expecting to yank all the lines, but what I got was everything up to the comment, i.e., the last line had only the #endif. A new uninstalled vim (without plugins) did what I had expected originally. After some debugging, what I found was that in this mapping in matchit.vim: onoremap % v:call Match_wrapper('',1,'o') the 'v' in v: was changing the operator to forced characterwise after my 'V' had tried to force it to forced linewise. Doing ounmap % got the behavior I was looking for. I couldn't find yet in the help what v: is supposed to do, but what is significant is that the 'v' in that mapping is evidently being interpreted twice, once as a "force characterwise" signal, and again for what it 'really' means. I imagine this could cause problems in other plugins as well which use this construction. Ephraim -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.