Re: Best way to repeat a sequence of keystrokes/commands with a single keypress ?
Tim Chase [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] : While editing a file, I decide to rename someIdentifier to : someIdentifier_ - I will need to append the underscore to : several (but usually not all) instances of the word. : : The typical way to do this would be something like : : :%s/\someIdentifier\/_/g : : If you want confirmation, you can use : : :%s/\someIdentifier\/_/gc Ok. So a possible shortcut to type this could be: *:%s/C-R//_/gc Then: yn to accept/reject substitutions. : The same would happen if I want to rename wonderfulFoo to : : wonderfulBar. I tend to type: *fFceBarESC : : Similarly, one would do something like : : :%s/\wonderfulFoo\/wonderfulBar/g Makes sense. Yet I liked the alternative: : [...] For your second example, you have to do a : little tweaking, as you want to be 3 characters from the : end, you have to use : : /someIdentifier/e-2 Nice! Damn, I remember reading about this flag, but I failed to think of using it ! So here, the find + replace end of word can be typed as: */C-R//e-2CRceBarESC Then: n.n to accept/reject substitutions. [ snipped: examples of the power of :s/.../ ] I like the simplicity/predictability of n., especially when reworking a function/small block within a larger file. But I am not petrified by regular expressions either -- I have been doing some perl programming (though I really am a C++ veteran). After 8 months of vimming (I started with http://www.viemu.com/), it is time for me to get more fluent with Ex commands. Just let me first enjoy the /../e trick for a couple of weeks... : Hope this helps, It did ! Thanks a lot. [ Thank you Tony as well for the additional references and advice for multi-file substitutions. ] Kind regards, Ivan -- http://ivan.vecerina.com/ TV dinner still cooling? Check out Tonight's Picks on Yahoo! TV. http://tv.yahoo.com/
Re: Best way to repeat a sequence of keystrokes/commands with a single keypress ?
Thank you (and Jürgen too), @@ is an easy first step for me. Next: Tim Chase [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] : Alternatively, problems can often be rephrased in terms of an Ex : command that uses the :%s or :g/:v to perform changes : across the entire file. [...] : By changing : your thinking to exploit these commands, sometimes you can get : easy consistent changes without having to manually touch each bit : with a macro. I admit that I am currently more of a visual n.n.nn.nn. kind of person. I should take some time to get into using Ex. If I may seek further guidance with a concrete example: While editing a file, I decide to rename someIdentifier to someIdentifier_ - I will need to append the underscore to several (but usually not all) instances of the word. Starting in normal mode at the first instance of someIdentifier, I would type: *ea_ESC But then I cannot use the n.nn. routine to modify subsequent identifiers -- because the '.' will not apply the change at the end of the word. (I would have to type ne.nne.) The same would happen if I want to rename wonderfulFoo to wonderfulBar. I tend to type: *fFceBarESC But then I cannot use n.nn. to repeat (but maybe n;.nn;.). So: I like using the n-dot pair of commands, but I can only take advantage of it if I rewrite the whole identifier. How would I use Ex or another approach to save me some typing during the process described above (for example repeatedly appending '_' to an identifier) ? And can this trick still be easily applied if only some instances of the identifiers are to be replaced ? Thanks ! Ivan [ wow... I'll be called a nuthead for asking such a question anywhere else on the net ... hopefully not here ;) ] It's here! Your new message! Get new email alerts with the free Yahoo! Toolbar. http://tools.search.yahoo.com/toolbar/features/mail/
Re: How to directly enter visual mode from insert mode ?
Ivan Vecerina [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] : This is a problem I am occasionally stumbling on: : as I am done typing some new next in insert mode, I want : to highlight and erase some text ahead of the insert point. I'm adding i_Ctrl-O to my list of must use commands. C-OD , C-Ow and C-Of) look like promising timesavers. (e.g. I'll be using C-OD often for sure I'm also checking :set inclusive and whichwrap+=, Many thanks for your insights, Ivan -- http://ivan.vecerina.com/
How to directly enter visual mode from insert mode ?
This is a problem I am occasionally stumbling on: as I am done typing some new next in insert mode, I want to highlight and erase some text ahead of the insert point. Best case, I can type: ESClv But if I am at the end of the line, this won't work (the last character I inserted will be selected as well). It would be nice if there was a convenient way to go directly from insert mode to visual mode, while ensuring that the visual selection starts at the current insertion point. Is there an easy way to do so ? -- http://ivan.vecerina.com/
Re: HTML editing with vim: where to start ?
Gerald Lai [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] : On Tue, 16 May 2006, Ivan Vecerina wrote: : You could read Bram Moolenaar's : Seven Habits of Effective Text Editing at: : http://www.moolenaar.net/habits.html A very good read indeed. : I think using matchit is one of the fastest ways to delete block-like : items, including start and end tags. : http://www.vim.org/scripts/script.php?script_id=39 matchit seems like a must-install, too bad it's not activated by default. And it is not mentioned in the vimbook or the FAQs I read so far (maybe because they were pre-vim6). This was a great pointer - thanks. : In order to obtain more support for operations involving HTML tags, you : could search in : : http://www.vim.org/scripts/index.php ... : http://www.vim.org/tips/index.php : : to get a feel of what other users want and have made out of Vim. : Also, stay on this mailing list and you will learn a lot. Yes. Problem with those resources is that they include a lot of noise, and are not up-to-date when it comes to vim7 - which seems to have introduced some useful improvements, as pointed out in Mikolaj's replies. Many thanks, Ivan -- http://ivan.vecerina.com/contact/?subject=NG_POST - email contact form