Re: [patch] allow to vimgrep current buffer
Am 2014-10-27 23:08, schrieb Bee: On Monday, October 27, 2014 1:06:12 PM UTC-7, Christian Brabandt wrote: Bram, here is a patch, that allows to use :vimgrep /foobar/ to search only the current buffer. You might want to argue this is already possible just use '%' as the filename, but that does not work, if the current buffer does not have a name yet. Then vimgrep complains about not being able to access an unknown file, although it wouldn't have to load the file, since it is already in memory, so it should be possible to do so, without writing temporary files. Just curious... How is that different from simply using `/` ? Is this a `just in case` scenario? I find it convenient to have all search results in the quickfix buffer. Best, Christian -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: bug in matchparen.vim: matching paren not highlighted when scrolled into view
On 2008-05-10 22:16, Bram Moolenaar wrote: Gary Johnson wrote: I just discovered that the parenthesis matching the one the cursor is on is not highlighted if it was initially off-screen and is brought on-screen by scrolling or by the zt or zb commands. >>[..] Well, the matchparen is only triggered when the cursor moves. Scrolling doesn't trigger it. There currently is no autocommand event for scrolling. I'm not sure if it's useful enough to add this. Has anything changed in vim in the past 6 years that might make it possible to fix this bug? Just checking :) Thanks, Eelis -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [patch] allow to vimgrep current buffer
On Monday, October 27, 2014 1:06:12 PM UTC-7, Christian Brabandt wrote: > Bram, > here is a patch, that allows to use > :vimgrep /foobar/ > to search only the current buffer. You might want to argue this is > already possible just use '%' as the filename, but that does not work, > if the current buffer does not have a name yet. Then vimgrep complains > about not being able to access an unknown file, although it wouldn't > have to load the file, since it is already in memory, so it should be > possible to do so, without writing temporary files. > > Best, > Christian > -- > Man erzürnt sich immer mehr gegen einen, für den man erst den Zorn > einige Zeit aufheben muß - und genade ihm dann Gott! > -- Jean Paul Christian Just curious... How is that different from simply using `/` ? Is this a `just in case` scenario? Bill -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[patch] allow to vimgrep current buffer
Bram, here is a patch, that allows to use :vimgrep /foobar/ to search only the current buffer. You might want to argue this is already possible just use '%' as the filename, but that does not work, if the current buffer does not have a name yet. Then vimgrep complains about not being able to access an unknown file, although it wouldn't have to load the file, since it is already in memory, so it should be possible to do so, without writing temporary files. Best, Christian -- Man erzürnt sich immer mehr gegen einen, für den man erst den Zorn einige Zeit aufheben muß - und genade ihm dann Gott! -- Jean Paul -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -607,23 +607,26 @@ 5.1 using Vim's internal grep pattern must start with an ID character. Example: > :vimgrep Error *.c -< + +:vim[grep][!] {pattern} + Like above, but only search current buffer. + *:lv* *:lvimgrep* -:lv[imgrep][!] /{pattern}/[g][j] {file} ... -:lv[imgrep][!] {pattern} {file} ... +:lv[imgrep][!] /{pattern}/[g][j] [{file} ...] +:lv[imgrep][!] {pattern} [{file} ...] Same as ":vimgrep", except the location list for the current window is used instead of the quickfix list. *:vimgrepa* *:vimgrepadd* -:vimgrepa[dd][!] /{pattern}/[g][j] {file} ... -:vimgrepa[dd][!] {pattern} {file} ... +:vimgrepa[dd][!] /{pattern}/[g][j] [{file} ...] +:vimgrepa[dd][!] {pattern} [{file} ...] Just like ":vimgrep", but instead of making a new list of errors the matches are appended to the current list. *:lvimgrepa* *:lvimgrepadd* -:lvimgrepa[dd][!] /{pattern}/[g][j] {file} ... -:lvimgrepa[dd][!] {pattern} {file} ... +:lvimgrepa[dd][!] /{pattern}/[g][j] [{file} ...] +:lvimgrepa[dd][!] {pattern} [{file} ...] Same as ":vimgrepadd", except the location list for the current window is used instead of the quickfix list. diff --git a/src/quickfix.c b/src/quickfix.c --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3175,6 +3175,7 @@ ex_vimgrep(eap) char_u *target_dir = NULL; #ifdef FEAT_AUTOCMD char_u *au_name = NULL; +int only_curbuf = FALSE; switch (eap->cmdidx) { @@ -3242,8 +3243,8 @@ ex_vimgrep(eap) p = skipwhite(p); if (*p == NUL) { - EMSG(_("E683: File name missing or invalid pattern")); - goto theend; + only_curbuf = TRUE; + fcount = 1; } if ((eap->cmdidx != CMD_grepadd && eap->cmdidx != CMD_lgrepadd && @@ -3258,7 +3259,7 @@ ex_vimgrep(eap) ; /* parse the list of arguments */ -if (get_arglist_exp(p, &fcount, &fnames, TRUE) == FAIL) +if (!only_curbuf && get_arglist_exp(p, &fcount, &fnames, TRUE) == FAIL) goto theend; if (fcount == 0) { @@ -3284,29 +3285,38 @@ ex_vimgrep(eap) seconds = (time_t)0; for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi) { - fname = shorten_fname1(fnames[fi]); - if (time(NULL) > seconds) + if (!only_curbuf) { - /* Display the file name every second or so, show the user we are - * working on it. */ - seconds = time(NULL); - msg_start(); - p = msg_strtrunc(fname, TRUE); - if (p == NULL) - msg_outtrans(fname); - else + fname = shorten_fname1(fnames[fi]); + if (time(NULL) > seconds) { - msg_outtrans(p); - vim_free(p); + /* Display the file name every second or so, show the user we are + * working on it. */ + seconds = time(NULL); + msg_start(); + p = msg_strtrunc(fname, TRUE); + if (p == NULL) + msg_outtrans(fname); + else + { + msg_outtrans(p); + vim_free(p); + } + msg_clr_eos(); + msg_didout = FALSE; /* overwrite this message */ + msg_nowait = TRUE; /* don't wait for this message */ + msg_col = 0; + out_flush(); } - msg_clr_eos(); - msg_didout = FALSE; /* overwrite this message */ - msg_nowait = TRUE; /* don't wait for this message */ - msg_col = 0; - out_flush(); + + buf = buflist_findname_exp(fnames[fi]); } - - buf = buflist_findname_exp(fnames[fi]); + else + { + buf = curbuf; + fname = NULL; + } + if (buf == NULL || buf->b_ml.ml_mfp == NULL) { /* Remember that a buffer with this name already exists. */ @@ -3472,7 +3482,8 @@ ex_vimgrep(eap) } } -FreeWild(fcount, fnames); +if (!only_curbuf) + FreeWild(fcount, fnames); qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE; qi->qf_lists[qi->qf_curlist].qf_ptr = qi->qf_lists[qi->qf_curlist].q
Re: [patch] vartabstops: (a) readded src/testdir/test_vartabs.{in,ok} (b) fixed diff hunk erroneously applied due to context change in 7.4.456
Hi Roland! On So, 26 Okt 2014, Roland Eggner wrote: > When options breakindent, wrap and vartabstop are used all together, > there are erroneous indentation offsets of continuation lines, as if > breakindentopt=shift:N would specify nonzero values of N depending on > number of tab characters at start of line, even if vartabstop is set > to a single number, e.g. “set vartabstop=4”. Is there a simple way to reproduce the issue? Sounds like we should add a test for that. > Otherwise the patch works for me as advertised. > > Many thanks to Christian and all the other contributors for this > patch, vartabstop is a very useful feature! Thanks for contributing. For now I have updated your version of the patch at the usual place https://github.com/chrisbra/vim-mq-patches/blob/master/var_tabstops Best, Christian -- Macht den Reichtum billiger! -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[patch] When specify a negative number to 'topline' by winrestview(), display becomes strange.
Hi list! How to reproduce: - start vim $ vim -N -u NONE -c "se nu" - Input below. ia :call winrestview({'topline': -3}) Expected behavior: - Display this. (Display does not change) 1 a Actual behavior: - Displayed below. (Invalid line number!) -3 a -2 a -1 a 0 a 1 a I attached a patch. Please check this. -- Best regards, Hirohito Higashi -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. diff -r 47b1887483da src/eval.c --- a/src/eval.c Fri Sep 19 22:38:48 2014 +0200 +++ b/src/eval.c Tue Sep 23 23:21:47 2014 +0900 @@ -19576,7 +19576,7 @@ # endif changed_window_setting(); - if (curwin->w_topline == 0) + if (curwin->w_topline <= 0) curwin->w_topline = 1; if (curwin->w_topline > curbuf->b_ml.ml_line_count) curwin->w_topline = curbuf->b_ml.ml_line_count;
Documentation patch: :global [cmd] can have a range
Bram, Here is a small documentation patch that indicates the [cmd] associated with the :global command may contain a range. Tim Chase pointed out a couple of pre-existing examples in the documentation, so I've linked to them from :global, which required adding one extra tag in usr_25.txt. diff -r 8bb4ca7fba40 runtime/doc/repeat.txt --- a/runtime/doc/repeat.txtWed Oct 22 22:09:01 2014 +0200 +++ b/runtime/doc/repeat.txtMon Oct 27 07:04:58 2014 -0400 @@ -64,6 +64,8 @@ For the definition of a pattern, see |pattern|. +NOTE [cmd] may contain a range as well; see |collapse| and |edit-paragraph-join|. + The global commands work by first scanning through the [range] lines and marking each line where a match occurs (for a multi-line pattern, only the start of the match matters). diff -r 8bb4ca7fba40 runtime/doc/usr_25.txt --- a/runtime/doc/usr_25.txtWed Oct 22 22:09:01 2014 +0200 +++ b/runtime/doc/usr_25.txtMon Oct 27 07:04:58 2014 -0400 @@ -402,7 +402,7 @@ :map gj -TURNING A PARAGRAPH INTO ONE LINE +TURNING A PARAGRAPH INTO ONE LINE *edit-paragraph-join* If you want to import text into a program like MS-Word, each paragraph should be a single line. If your paragraphs are currently separated with empty Thanks, Michael Henry -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.