[patch] Text object for entire buffer
This adds a text object ('aa' or 'ii') for the entire buffer. I don't know if this is worthy of being included by default, but I find it convenient for things such as gqaa and =aa. diff -rc vim72.old/runtime/doc/motion.txt vim72.new/runtime/doc/motion.txt *** vim72.old/runtime/doc/motion.txt2008-08-09 14:22:59.0 + --- vim72.new/runtime/doc/motion.txt2009-04-13 06:14:48.0 + *** *** 650,655 --- 650,659 Special case: With a count of 2 the quotes are included, but no extra white space as with a/a'/a`. + aa*v_aa* *aa* + ii*v_ii* *ii* + Shortcut to select the entire buffer. + When used after an operator: For non-block objects: For the a commands: The operator applies to the object and the white *** *** 692,697 --- 696,702 dap delete a paragraph *dap* diB delete inner '{' '}' block *diB* daB delete a '{' '}' block *daB* + daa delete all text from the buffer *daa* Note the difference between using a movement command and an object. The movement command operates from here (cursor position) to where the movement diff -rc vim72.old/src/normal.c vim72.new/src/normal.c *** vim72.old/src/normal.c 2008-07-31 20:03:08.0 + --- vim72.new/src/normal.c 2009-04-13 06:37:13.0 + *** *** 8912,8917 --- 8912,8921 flag = current_quote(cap-oap, cap-count1, include, cap-nchar); break; + case 'a': /* 'aa' = whole buffer */ + case 'i': + flag = current_buffer(cap-oap); + break; #if 0 /* TODO */ case 'S': /* aS = a section */ case 'f': /* af = a filename */ diff -rc vim72.old/src/search.c vim72.new/src/search.c *** vim72.old/src/search.c 2008-07-13 18:18:27.0 + --- vim72.new/src/search.c 2009-04-13 06:34:53.0 + *** *** 4491,4496 --- 4491,4523 return OK; } + /* + * Select entire buffer. + */ + int + current_buffer(oap) + oparg_T *oap; + { + #ifdef FEAT_VISUAL + if (VIsual_active) + { + VIsual.lnum = 1; + VIsual_mode = 'V'; + redraw_curbuf_later(INVERTED); /* update the inversion */ + showmode(); + } + else + #endif + { + oap-start.lnum = 1; + oap-start.col = 0; + oap-motion_type = MLINE; + } + curwin-w_cursor.lnum = curbuf-b_ml.ml_line_count; + curwin-w_cursor.col = 0; + return TRUE; + } + #endif /* FEAT_TEXTOBJ */ #if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(FEAT_TEXTOBJ) \ pgpA9bmeBhwye.pgp Description: PGP signature
Re: [patch] Text object for entire buffer
On 13-Apr-09 9:18, Andy Spencer wrote: This adds a text object ('aa' or 'ii') for the entire buffer. I don't know if this is worthy of being included by default, but I find it convenient for things such as gqaa and =aa. Nice idea, certainly useful! I'm not sure whether this should be implemented in the C code, though, as it could also be done with Vimscript. One suggestion: How about changing 'ii' so that it excludes empty lines at the beginning and end of the buffer, similar to what the other text objects do? I don't like it when outer and inner text object versions are identical. -- regards, ingo --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: [PATCH] configure: $x_includes used even if not set
Tony Mechelynck wrote: On 11/04/09 04:16, Matt Wozniski wrote: On Fri, Apr 10, 2009 at 6:43 PM, Tony Mechelynck wrote: Couldn't you run test just once? Maybe something more or less like if test -n $x_includes -a $x_includes != NONE Just my sense of aesthetics, I'm not on a Mac. Usually, yes - but lore tells of shells where test isn't POSIX compatible, where -a and -o don't behave predictably but and || do... *shrug* ~Matt Hm. What about the shells available on the Mac, and in particular on Mac OS X ? This test is not limited to Mac OS X. I am pretty sure you could reproduce $x_includes == NONE on another platform as well. Rainer --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
[patch] Foldmethod for the quickfix window
The attached patch changes the default 'foldmethod' for the quickfix window to manual. The current behaviour is that the quickfix window inherits the values of 'foldmethod' and 'foldmarker' from the global options, which sometimes causes the contents of the quickfix window to be folded upon opening the window with :copen. Although it can be easily fixed in Vim script, I believe the 'foldmethod' should be explicitly set for quickfix window by Vim. Another way of fixing the problem of folded contents would be resetting the value of 'foldenable', but I sometimes find it valuable to be able to fold some lines of the quickfix window. -- Cheers, Lech --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~--- diff --git a/src/quickfix.c b/src/quickfix.c index ee84160..454ec03 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2347,6 +2347,7 @@ ex_copen(eap) OPT_LOCAL); set_option_value((char_u *)bh, 0L, (char_u *)wipe, OPT_LOCAL); set_option_value((char_u *)diff, 0L, NULL, OPT_LOCAL); + set_option_value((char_u *)foldmethod, 0L, manual, OPT_LOCAL); } /* Only set the height when still in the same tab page and there is no
[patch] Wrong syntax highlighting for quickfix window
The attached patch fixes the problem where file type for the quickfix window is incorrectly detected. Such behaviour can be triggered by entering the src directory in Vim's source code directory and executing: $ vim diff.c :grep close diff.c :copen The quickfix window will be highlighted as if it was a diff file. -- Cheers, Lech --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~--- diff --git a/src/quickfix.c b/src/quickfix.c index ee84160..6747f29 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2607,10 +2607,12 @@ qf_fill_buffer(qi) curbuf-b_p_ma = FALSE; #ifdef FEAT_AUTOCMD +keep_filetype = TRUE; /* don't detect 'filetype' */ apply_autocmds(EVENT_BUFREADPOST, (char_u *)quickfix, NULL, FALSE, curbuf); apply_autocmds(EVENT_BUFWINENTER, (char_u *)quickfix, NULL, FALSE, curbuf); +keep_filetype = FALSE; #endif /* make sure it will be redrawn */
Re: [patch] Foldmethod for the quickfix window
On 2009-04-14, Lech Lorens wrote: The attached patch changes the default 'foldmethod' for the quickfix window to manual. The current behaviour is that the quickfix window inherits the values of 'foldmethod' and 'foldmarker' from the global options, which sometimes causes the contents of the quickfix window to be folded upon opening the window with :copen. Although it can be easily fixed in Vim script, I believe the 'foldmethod' should be explicitly set for quickfix window by Vim. Another way of fixing the problem of folded contents would be resetting the value of 'foldenable', but I sometimes find it valuable to be able to fold some lines of the quickfix window. I'm a little concerned about applying such fine tuning of individual window behavior to the source code. If there is a general rule in vim for the option values that windows inherit when they are created, I think we should use that general rule unless there is a compelling reason to do otherwise. As you say, this could also be fixed with a ftplugin/qf.vim script, which would be a more consistent method of applying such filetype-specific adjustments. Regards, Gary --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: [patch] Foldmethod for the quickfix window
On 4/13/09, Gary Johnson wrote: On 2009-04-14, Lech Lorens wrote: The attached patch changes the default 'foldmethod' for the quickfix window to manual. I'm a little concerned about applying such fine tuning of individual window behavior to the source code. If there is a general rule in vim for the option values that windows inherit when they are created, I think we should use that general rule unless there is a compelling reason to do otherwise. As you say, this could also be fixed with a ftplugin/qf.vim script, which would be a more consistent method of applying such filetype-specific adjustments. Well... I'm not sure I agree. The quickfix, location list, and command-line windows are already very distinct from any other windows you can create. They behave differently, they have special commands that open and close them, they have key bindings that only apply in that one type of window. It seems reasonable that the code for these types of windows should be as centralized as possible - doing it all in vimscript would be a noble goal, but is certainly beyond the abilities that are currently available in vimscript, and barring that, I think that all of their special-case behavior should be held in the source code. ~Matt --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: [patch] Foldmethod for the quickfix window
On 14/04/09 00:50, Matt Wozniski wrote: On 4/13/09, Gary Johnson wrote: On 2009-04-14, Lech Lorens wrote: The attached patch changes the default 'foldmethod' for the quickfix window to manual. I'm a little concerned about applying such fine tuning of individual window behavior to the source code. If there is a general rule in vim for the option values that windows inherit when they are created, I think we should use that general rule unless there is a compelling reason to do otherwise. As you say, this could also be fixed with a ftplugin/qf.vim script, which would be a more consistent method of applying such filetype-specific adjustments. Well... I'm not sure I agree. The quickfix, location list, and command-line windows are already very distinct from any other windows you can create. They behave differently, they have special commands that open and close them, they have key bindings that only apply in that one type of window. It seems reasonable that the code for these types of windows should be as centralized as possible - doing it all in vimscript would be a noble goal, but is certainly beyond the abilities that are currently available in vimscript, and barring that, I think that all of their special-case behavior should be held in the source code. ~Matt Why do you think it's impossible to define quickfix folding in vimscript? IMHO, a reasonable folding scheme would be to fold qf lines together if they refer to errors/matches in the same source file. I don't think that would be hard to implement in vimscript, with a well-crafted expression folding method. As for the command-line window, that's even simpler: I believe it deserves no folding at all. Also, moving everything to C code means harder to debug, harder to change, and practically impossible to customize. I'm in favour of having the maximum possible in vimscript, and only move to C code what cannot be done in vimscript, or only at an unacceptable performance loss. Best regards, Tony. -- I'd love to go out with you, but I'm doing door-to-door collecting for static cling. --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: [patch] Foldmethod for the quickfix window
On 2009-04-13, Matt Wozniski wrote: On 4/13/09, Gary Johnson wrote: On 2009-04-14, Lech Lorens wrote: The attached patch changes the default 'foldmethod' for the quickfix window to manual. I'm a little concerned about applying such fine tuning of individual window behavior to the source code. If there is a general rule in vim for the option values that windows inherit when they are created, I think we should use that general rule unless there is a compelling reason to do otherwise. As you say, this could also be fixed with a ftplugin/qf.vim script, which would be a more consistent method of applying such filetype-specific adjustments. Well... I'm not sure I agree. The quickfix, location list, and command-line windows are already very distinct from any other windows you can create. They behave differently, they have special commands that open and close them, they have key bindings that only apply in that one type of window. It seems reasonable that the code for these types of windows should be as centralized as possible - doing it all in vimscript would be a noble goal, but is certainly beyond the abilities that are currently available in vimscript, and barring that, I think that all of their special-case behavior should be held in the source code. Good argument, especially your point about centralization. The patch seems OK then. Regards, Gary --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: [patch] Foldmethod for the quickfix window
On 4/13/09, Tony Mechelynck wrote: On 14/04/09 00:50, Matt Wozniski wrote: On 4/13/09, Gary Johnson wrote: On 2009-04-14, Lech Lorens wrote: The attached patch changes the default 'foldmethod' for the quickfix window to manual. I'm a little concerned about applying such fine tuning of individual window behavior to the source code. If there is a general rule in vim for the option values that windows inherit when they are created, I think we should use that general rule unless there is a compelling reason to do otherwise. Well... I'm not sure I agree. The quickfix, location list, and command-line windows are already very distinct from any other windows you can create. They behave differently, they have special commands that open and close them, they have key bindings that only apply in that one type of window. It seems reasonable that the code for these types of windows should be as centralized as possible - doing it all in vimscript would be a noble goal, but is certainly beyond the abilities that are currently available in vimscript, and barring that, I think that all of their special-case behavior should be held in the source code. Why do you think it's impossible to define quickfix folding in vimscript? IMHO, a reasonable folding scheme would be to fold qf lines together if they refer to errors/matches in the same source file. I don't think that would be hard to implement in vimscript, with a well-crafted expression folding method. No, you misinterpreted what I said. It's definitely possible to define the *folding* behavior for quickfix windows in vimscript, but it's not possible to create a window that behaves like a quickfix window in vimscript without using the quickfix commands. For instance, there's no way to emulate what :make does in vimscript without duplicating all of the 'errorformat' logic that's currently in C. As for the command-line window, that's even simpler: I believe it deserves no folding at all. Again, I wasn't talking specifically about folding, I was talking about all the behavior for a command-line window. You can't use vimscript to create a window that the cursor can't leave, other than by going through the special-casing in C for a command-line window. Also, moving everything to C code means harder to debug, Yep harder to change, Yep and practically impossible to customize. Well... no. This would only change the default foldmethod, an autocmd could still change the behavior from the default to match the user's preferences. And, a default of no folding with possible user-supplied vimscript to make it possible to fold related lines together is probably better than defaulting to folding related things. I'm in favour of having the maximum possible in vimscript, and only move to C code what cannot be done in vimscript, or only at an unacceptable performance loss. I'm in favor of keeping all of the logic for the special window types in one place. I agree that it would be better if that place could be vimscript, but it can't. ~Matt --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---