Re: Extended :normal
You can almost do the same by using normal in conjunction with execute :execute normal ispan\cr/span\esc -dan On Wed, 25 Apr 2007, Halim, Salman wrote: Hello, Since tips on vim.sf.net have been disabled because of spam, I thought I would share this here. I find the :Normal command extremely useful: Behaves like the built-in normal command, except that it takes keys such as f8 right on the command-line. function! Normal( bang, args ) execute 'map Normal_map ' . a:args execute 'normal' . a:bang . ' Normal_map' unmap Normal_map endfunction com! -bang -nargs=+ Normal call Normal( q-bang, q-args ) Typically, when you call :normal, you can't embed keys in there easily -- an example: :normal ispancr/spanesc Produces: spancr/spanesc (Insert mode is automatically exited at the end of the normal command.) However, :Normal ispancr/spanesc Produces: span /span I use it all the time with things like :windo (I have a lot of setting toggles mapped to function keys) to get things the way I like them in one fell swoop. Also, if you prefer to use the old-style keys (c-v followed by the key to get the actual key on the command-line), :Normal still works. Please note that you CAN get this effect with the built in :normal, but you have to do something like this: :execute normal ispan\cr/span\esc (I've gone so far as to set up a command-line abbreviation to always convert :normal to :Normal in my configuration.) Hope this helps, Salman.
RE: Extended :normal
yeah my mistake. On Wed, 25 Apr 2007, Halim, Salman wrote: You didn't actually read the whole thing I sent, did you... Please note that you CAN get this effect with the built in :normal, but you have to do something like this: :execute normal ispan\cr/span\esc Another advantage of using :Normal is in mappings: I have (occasionally) had to create mappings that ended up calling :normal from the command-line. Here's an actual example: Displays the line that declares the variable. Uses execute and Normal instead of just a normal to allow the internal cr to be broken up so it isn't processed as part of the mapping. nmap silent buffer c-cr :Lazy SS SP execute 'Normal gd:#' . 'cr'cr Please take a stab at expressing that broken up cr using a regular :normal in a mapping (where the \cr causes a newline following the \). For the record, Lazy saves, sets and restores 'lazyredraw', SS saves and restores the search and SP saves and restores the position. Salman. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 25, 2007 11:27 AM To: vim@vim.org Subject: Re: Extended :normal You can almost do the same by using normal in conjunction with execute :execute normal ispan\cr/span\esc -dan On Wed, 25 Apr 2007, Halim, Salman wrote: Hello, Since tips on vim.sf.net have been disabled because of spam, I thought I would share this here. I find the :Normal command extremely useful: Behaves like the built-in normal command, except that it takes keys such as f8 right on the command-line. function! Normal( bang, args ) execute 'map Normal_map ' . a:args execute 'normal' . a:bang . ' Normal_map' unmap Normal_map endfunction com! -bang -nargs=+ Normal call Normal( q-bang, q-args ) Typically, when you call :normal, you can't embed keys in there easily -- an example: :normal ispancr/spanesc Produces: spancr/spanesc (Insert mode is automatically exited at the end of the normal command.) However, :Normal ispancr/spanesc Produces: span /span I use it all the time with things like :windo (I have a lot of setting toggles mapped to function keys) to get things the way I like them in one fell swoop. Also, if you prefer to use the old-style keys (c-v followed by the key to get the actual key on the command-line), :Normal still works. Please note that you CAN get this effect with the built in :normal, but you have to do something like this: :execute normal ispan\cr/span\esc (I've gone so far as to set up a command-line abbreviation to always convert :normal to :Normal in my configuration.) Hope this helps, Salman.
RE: problem with shifting block
If you know you want to operate on teh same visual block and move it in the same direction.. you could just repeat the operation with . Otherwise, you can reselect the visual are with gv to move it in the other direction -dan On Fri, 13 Apr 2007, Gene Kwiecinski wrote: i am using visual mode and shift to indent a block of code. the problem i am having is that once i do this, the visual mode is gone. So, i have to re-select everything and do it again. Is there a command to repeat the last shift ? Think I ran into this once/twice, and yeah, I vaguely recall losing the visualness of the block. No idea how to *keep* the block selected, but if you know how much you want to shift it, you can always just do something like 5 to shove it over 5 shiftwidths.
RE: Executing vimfunctions in background
Mr. Yikihiro Nakadaira supplied the following to the list a couple months ago. SNIP In Vim7 feedkeys() can be used. autocmd CursorHold * call Timer() function! Timer() echo strftime(%c) let K_IGNORE = \x80\xFD\x35internal key code that is ignored call feedkeys(K_IGNORE) endfunction /SNIP ... this pretty much simulates a timed event when you leave the keyboard and let vim run. Between this and CursorMoved perhaps you can accomplish what you want -dan On Wed, 4 Apr 2007, Chuck Mason wrote: Doc states, Not re-triggered until the user has pressed a key (i.e. doesn't fire every 'updatetime' ms if you leave Vim to make some coffee. :) So this isn't going to work. How do I put in a feature request for an autocmd that is trigged every 'repeattime' repeatedly? Chuck -Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 1:42 PM To: Chuck Mason Cc: Yakov Lerner; vim@vim.org Subject: Re: Executing vimfunctions in background Chuck Mason wrote: Well, that sample 'myFunc' was just that- a sample. Imagine now, that it doesn't depend on cursor location but on a daemon running on your system. Chuck There are also the CursorHold and CursorHoldI autocommands (q.v.), which are triggered _once_ when the keyboard has been idle for 'updatetime' milliseconds (4000 by default). Best regards, Tony. -- The National Association of Theater Concessionaires reported that in 1986, 60% of all candy sold in movie theaters was sold to Roger Ebert. -- D. Letterman
Re: vim | insert filename into file
If you don't want to put the filename on a new line as :put % does, maybe try :normal %p -dan
Re: vim | insert filename into file
To place at the beginning of each line try :%normal %P -dan
Re: vim | reformatting question (fwd)
Sorry for my personal response to you Tony!! -- Forwarded message -- Date: Wed, 13 Sep 2006 10:55:22 -0600 (MDT) From: [EMAIL PROTECTED] To: A.J.Mechelynck [EMAIL PROTECTED] Subject: Re: vim | reformatting question I guess I'll take a stab at it. Assuming that the lines you are interested in joining are seperated from the rest of your file by a blank line on each side.. vip:normal 3gJ -dan
Re: A few simple questions
I mean that $ accepts a count but ^ does not. Not that $ was itself the count. Sorry for the confusion. On Tue, 29 Aug 2006, Yakov Lerner wrote: On 8/29/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello Vimmers, I've been using vim for a while and think I have a good handle of it. I have a couple questions though 1. Why is it that ^ doesn't accept a count like $. Maybe because $ is not valid count in vim ? Yakov
Re: Formatting a paragraph in insert mode
Dear Vimmers, I believe you can just do a gwap to leave the cursor in the same position. -dan
Re: Another regular expression substitute question
I know you lose some generality with this solution... :%s/.*\(data_\d*\.dat\).*/\1 but it looks a little easier on the eyes. Any cons to doing it this way? On Wed, 26 Jul 2006, Alan G Isaac wrote: On Wed, 26 Jul 2006, Xiaoshen Li apparently wrote: Thank you very much for all your responses. I am sorry. My file is a little different now. It is like following: 1 data_34.dat pre= -7872.11914060 post= -7812.80517600 diff= 59.31396460 2 data_5.dat pre= -7986.76147466 post= -7926.94091800 diff= 59.82055666 3 data_16.dat pre= -8117.66357420 post= -8057.25097700 diff= 60.41259720 4 data_36.dat pre= -7628.28979490 post= -7564.08691400 diff= 64.20288090 5 data_18.dat pre= -8145.31860358 post= -8078.61328100 diff= 66.70532258 How can I use regular expression to get: data_34.dat data_5.dat data_16.dat .. This should work: :[EMAIL PROTECTED](\S\+\)[EMAIL PROTECTED] You need to spend some time with :h :s :h pattern :h \( hth, Alan Isaac