retab lines matching regular expression
What I would like to do is retab all lines in the file matching a given regular expression. Here's what I've tried :g/^#/ret! 100 however this is simply retabbing the entire file. But if I say :g/^#/d it only deletes the specified lines. How do I make it work? --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: retab lines matching regular expression
With this I am not getting any lines replaced > Just a guess: > :g/^#/.ret! 100 > > regards, > Christian > -- > Contrary to popular belief, Unix is user friendly. > It just happens to be selective about who it makes friends with. > -- Dave Parnas --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: retab lines matching regular expression
> > > Just a guess: > > > :g/^#/.ret! 100 > > > With this I am not getting any lines replaced > > I tried the above command, and it worked fine for me. Okay. Not trying to seem belligerent or anything, but, as I said, it actually does not work for me. You're explanation makes sense, but I've tried it several times. When I place the (.) before (ret), I get no replacements taking place at all. Im using vim 7.1 in a terminal on Ubuntu. Any ideas? --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: retab lines matching regular expression
Okay, now that I'm playing with my settings im getting really inconsistent results that I cant really explain. If I open up a new buffer, with the following two lines in it good tabs #bad tabs the command seems to work exactly correctly, whether my ":set et", or my ":set noet" is active However, in the actual buffer where I'm trying to do this (its been up for several hours) this isn't the case. Like I said, it wasnt working here at all. But after I toggled my ":set et" and ":set noet" it seems to operate the same way regardless of which one is set. But it isnt doing quite what I want. Its only replacing the tabs on the lines I want it to; however, the new tabstop seems to be applied first. So, if the line opens with "#text", after the command I have "#<100 spaces>text" > Just to confirm, what are your relevant settings? > > :set et? ts? sts? :set ts => tabstop=2 :set sts => softtabstop=0 I'm sure there are some more settings I just dont know about which could explain this. Though I didnt set any special settings on my buffer . . . Confused, Todd --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: retab lines matching regular expression
Gary, let me explain what I'm trying to do in as simple of terms as possible. Consider the following file good tab good tab #bad tab #bad tab good tab good tab #bad tab #bad tab I want to run a command which will retab only those lines where it says "bad tab". I match those lines with the regexp /^#/ I exactly reproduced your testcase, with precisely the same results. Your explanation makes complete sense and I believe the entire situation is clear to me now. The key is that the entire retab operation is occuring N times (once per matching line) which includes resetting the tabstop value. Using Tim's suggestion, and going back to my original post, I am now using the command :g/^#/.ret! 100 | set ts=2 which resets the tabstop after each line. With this modification, it works perfectly. Thanks everyone for your comments. --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
syntax highlighting guide
All, Is there a good guide somewhere to writing .vim files, the ones that show up in your /installation/colors directory? I've tried the :help with little luck, as well as searching google and this group. Thanks --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Delete all marks associated with a certain buffer
Is it possible, to unload a buffer completely, including deleting any marks associated with the buffer? I've tried :bdelete and :bunload --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Delete all marks associated with a certain buffer
Yep that's what I needed, thanks. If I do ":marks" afterwards, the ones that referred to the buffer are gone, so thats perfect. On Sep 23, 8:53 am, "Christian Brabandt" wrote: > On Wed, September 23, 2009 4:46 pm, Hoss wrote: > > > Is it possible, to unload a buffer completely, including deleting any > > marks associated with the buffer? I've tried :bdelete and :bunload > > :bwipeout should do the trick. The marks still seem to refer to the old > buffer but are invalid. So accessing those marks does not result in > error E20 but in E92. > > regards, > Christian > -- > :wq! --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: how to view table separated file?
> I have a file, which is basically a table. Each row is a line in the > file. The columns are separated by tabs. I'm wondering if vim can help > view this kind of file with columns aligned and without wrapping > lines. :set tabstop=x if x is sufficiently large, then your columns will appear aligned. --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
tabedit with buffer number
Suppose I have a buffer which is open and I know its number. What command can I use to open a new tabpage with a single window with that buffer open? :help tab shows the ":[count]tab {cmd}" command which says it just runs cmd and opens a new tabpage instead of a new window, but it doesnt work for me. If I say ":tab b 3" I just get buffer 3 opened in the current tabpage. --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: tabedit with buffer number
> The {cmd} has to be a built-in command that would open a window. The > :tab prefix then converts to a a new tab page instead of a window. Try > ":tab sbuf 3". Excellent. Thank you. --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: A better mark plugin
> I tried bookmark plugin and the SuperMarker plugin, both are not fulfill my > requirement. bookmark.vim is simply buggy and it requires use of a mouse. > SuperMarker don't do more than original mark. What I hope is: > > 1. easily jump as the original mark > 2. support use of a work as a mark, not just simply 'a', 'b', 'c' > 3. warn me when I am overwriting a existing mark. > > Is there such a plugin or something similar? Thanks in advance. I'm not totally sure what you're asking for. However, I use the ShowMarks.vim plugin which allows you to see where your marks are placed, hilight the lines they are on if desired, clear all marks, etc. http://www.vim.org/scripts/script.php?script_id=152 --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
matching lines in window
Hi, I know I used to know how to do this but I can't remember... I have a regex that will match several lines in the buffer. Instead of just / searching for it and N'ing through the file, there's a way to execute the regex on the buffer and get a little sub window containing 1 line per match . . . how do you do that? --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: matching lines in window
Okay .. this goes into the error list? thanks. On Sep 25, 2:19 pm, Christian Brabandt wrote: > Hi Hoss! > > On Fr, 25 Sep 2009, Hoss wrote: > > > I have a regex that will match several lines in the buffer. Instead > > of just / searching for it and N'ing through the file, there's a way to > > execute the regex on the buffer and get a little sub window containing > > 1 line per match . . . how do you do that? > > :h :vimgrep > > e.g. > :vimgrep pattern % > > regards, > Christian > -- > % cat /usr/include/sys/errno.h > #define EPERM 1 /* Operation not permitted */ > #define ENOENT 2 /* No such file or directory */ > #define ESRCH 3 /* No such process */ > #define EINTR 4 /* Interrupted system call */ > [...] > #define EMACS 666 /* Editor Too Large */ > % --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
custom operator-pending mapping
Can you create your own "operator-pending" mapping, similar to going to a line number with "25G" ? The specific thing I want to do is put in the number of a buffer, then create a new tabpage with a window open on that buffer, something like 25ob -> open buffer 25 --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: custom operator-pending mapping
> It look like you're trying to make a mapping that accepts a count, > which can also be done. :help v:count Yes; that is exactly what I wanted. Thanks. --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
mapping alt-keys
I am having trouble mapping my alt keys. so if I use this mapping :echo hihi I get nothing when I hold down alt, and press g in normal mode. I have read :map-alt-keys in the documentation, and it suggests there's alot going on with getting the alt key from my keyboard to vim. My question is, is there some diagnostic mode in vim to somehow dump the key data that is going into it, so I can figure out what the issue is? I am using: u...@laptop:~$ vim --version VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 8 2009 02:19:16) Included patches: 1-314 Compiled by bui...@rothera.buildd Huge version with GTK2-GNOME GUI. Features included (+) or not (-): [ excluded for brevity ] on Ubuntu Hardy Heron thanks. --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: mapping alt-keys
> in insert mode, try typing first, then . This should reflect the > exact key code that vim received. Then you can just copy whatever vim > displays into your map command directly (when I do this in > Ubuntu/gnome-terminal/vim-full, I see the escape character followed by g -- > should look like "^[g" but where the "^[" is counted as a single character). This works excellently, except that I can't use exactly what vim displays in my map command. My shows the same thing as yours. However, if I type ":map :echo hi" into a buffer, then execute that line, i get garbage. However, using the knowledge that the "^[" means escape as you say, if I try this map g :echo hi then it works great. Thanks. --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Analog to SHIFT+Asterisk
Esteemed Vim Users, One of the useful key combinations in vim is shift+asterisk, which will locate the word your cursor is "on", and put that word into your "/ buffer (surrounded by \<\> word boundaries). This has the effect of highlighting all occurrences of that word. It also has the effect of jumping the cursor to the next instance of that word in your buffer. Is there an analogous key combination, that will highlight the current word, WITHOUT moving my cursor? Thanks, Todd (I know I can just shift+N afterwards, to get back where I was. Something more elegant?) -- 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
Re: Analog to SHIFT+Asterisk
Great. Exactly what I was looking for. -- 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
intra-line vertical cursor movement
Hi, If I have :set wrap, and a single line of text that spans say 3 physical lines of my display, how do I move the cursor up, and down, one line of physical display at a time? The usual movement keys traverse logical lines, of course. -Todd -- 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
Re: intra-line vertical cursor movement
exactly what I was looking for. Thanks. On Jul 14, 9:08 am, Tony Mechelynck wrote: > On 14/07/10 16:41, Hoss wrote: > > > Hi, > > > If I have :set wrap, and a single line of text that spans say 3 > > physical lines of my display, how do I move the cursor up, and down, > > one line of physical display at a time? The usual movement keys > > traverse logical lines, of course. > > > -Todd > > see > :help gj > :help gk > > For instance > " use to move by "screen" lines, > " jk (Normal mode only) to move by "file" lines > :map gk > :map gj > :imap gk > :imap gj > > Best regards, > Tony. > -- > Others will look to you for stability, so hide when you bite your > nails. -- 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
Replace tabs with spaces - with a twist!
I'm sure this is a familiar topic, but I can't find quite what I need anywhere. Say I have a line in a file with 4 characters followed by a followed by 2 characters and a . Say the tabstops are at positions 5, 10, 15, etc. Then, when viewing this file, the first tab will be displayed as a single space, since it aligns with the tabstop boundary. The second tab will display as 3 spaces in order to align with the tabstop boundary. Its kinda the whole point of tabs. Great. What I would like to be able to do is replace all of these tabs with the number of spaces by which they are being displayed. The first would be 1 space, the 2nd 3 spaces, etc. So, s/\t/ /g will not work, because its the same number of spaces for each tab. Thanks- Hoss --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Replace tabs with spaces - with a twist!
Looks like smart people thought of all this before me. Two things: it would be nice if you could do :retab 20 (or some other sufficiently large number, depending on how many consecutive tabs you have going on) without changing the actual tabstop value. Not a big deal. It would be nice if you could do the reverse operation, i.e. replace spaces with the appropriate number of tabs according to a given tabstop value so that visual positioning was preserved. Thanks again --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: Replace tabs with spaces - with a twist!
What if you wanted retab to behave just as it does, except not modify the existing tabstop value? I always set it back to what it was after using the command. On Oct 14, 8:59 am, "A. S. Budden" <[EMAIL PROTECTED]> wrote: > 2008/10/14 Hoss <[EMAIL PROTECTED]>: > [snip] > > > It would be nice if you could do the reverse operation, i.e. replace > > spaces with the appropriate number of tabs according to a given > > tabstop value so that visual positioning was preserved. > > I'm not sure of the details, but have you tried: > > :set noexpandtab > :retab! > > (Note the '!' on the end of the retab line). This has the > disadvantage that it will use tabs throughout the line rather than > just at the start. If you want to just use tabs for indenting, you > can do: > > execute '[EMAIL PROTECTED]( \{'.&ts.'}\)[EMAIL PROTECTED]("\t", > len(submatch(0))/'.&ts.')@' > > (I have this mapped to the command :RetabIndents) > > Al --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: regexp for grabbing everything between curly braces { }
Justin, It is not possible to formulate a regex that will match everything between matching pairs of tokens ({, }) nested arbitrarily. So if your function can contain any level of nested if/switch/other blocks delimited on {} characters, regex will not do the trick. It's not too complicated to write some code that will do it, however. What you need is a stack data structure. On Oct 15, 10:31 am, Justin Randall <[EMAIL PROTECTED]> wrote: > Hi all, > > I have this regexp that I wrote which will match on the specific C/C++ > function I am looking for right up to the first open brace. What I want to > do is grab everything between the first open brace and the last close brace > for that function { }. Effectively I want my regexp to grab a specific C > function in it's entirety. > > So far my regexp looks like this: > s/\s*\(.*\)\s*\*\(.*\)::recv\s*(\s*int\s*\*\s*\(.*\))\s*\n*\s*\(.*\)\s*\n*\s*{ > > and what it does is it grabs the beginning of any function that matches: > foo* bar::recv(int* foobar) {. > > I want to take it all the way to the end of the function (could be up to 50 > or so lines) so that it matches on foo* bar::recv(int* foobar) { ... }. > Is this at all possible? My ultimate goal is to find and remove a certain > function in many different files. Any suggestions/advice is welcome. > > Thanks, > Justin --~--~-~--~~~---~--~~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
laggy scrolling / ubuntu
I have been dealing with this issue for probably about a year, and I keep ignoring it, but it is actually super annoying so I've decided to post here and see if anyone has any ideas. I'm in vim. I've got tabs and buffers open. I use CTRL+Y and CTRL+E to scroll up, and down, respectively. Now, when I hold down one of these key combinations, I scroll something like, I dont know, 20 lines, then theres a little "freeze", lasting maybe half a second. The effect is choppy scrolling. Same thing happens if I use the arrow keys to scroll, or CTRL+D or CTRL+U to scroll screens at a time. Again this is not a make-or-break issue but I would like to figure this out if possible. possibilities - internal vim buffering - keypress processing in the OS, or in VI, in my keyboard itself .. idk I'm sure there are a dozen more possibilities. $ uname -a Linux hossbeast 3.0.0-16-generic #28-Ubuntu SMP Fri Jan 27 17:44:39 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description:Ubuntu 11.10 Release:11.10 Codename: oneiric $ vim --version VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 6 2011 10:34:41) Included patches: 1-154 Modified by pkg-vim-maintain...@lists.alioth.debian.org Compiled by buildd@ Huge version with GTK2-GNOME GUI. Features included (+) or not (-): +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +lua +menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl +persistent_undo +postscript +printer +profile +python -python3 +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white +tcl +terminfo +termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -pthread -DORBIT2=1 -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/gail-1.0 -I/usr/include/freetype2 -I/usr/include/atk-1.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/cairo -I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/libxml2 -Wall -g -O2 -D_FORTIFY_SOURCE=1 -I/usr/include/tcl8.5 -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_LARGEFILE64_SOURCE=1 Linking: gcc -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -Wl,--as-needed -o vim -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnomevfs-2 -lgnomecanvas-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBit-2 -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgconf-2 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux
Re: laggy scrolling / ubuntu
Also - I experienced the exact same behavior on Ubuntu 9.10, its one of the reasons I upgrade to 11.10. Didn't change it though. -- 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
Re: laggy scrolling / ubuntu
Okay ... this only happens when I run vim under tmux. It does not happen under gnome-terminal or xterm directly, or when running vim under screen. -- 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
Re: laggy scrolling / ubuntu
On Thursday, April 19, 2012 4:02:59 PM UTC-6, Hoss wrote: > Okay ... this only happens when I run vim under tmux. It does not happen > under gnome-terminal or xterm directly, or when running vim under screen. Upgrading from Ubuntu 11.10 stock tmux 1.5 to tmux current 1.6 appears to have fixed the problem. Thanks everyone! -- 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
yank matched portion of a selection of lines
I have a buffer open. I hit /, put in a search, and the matched text, which is the text I am interested in, is highlighted. How do I yank that text, and only that text, in other words, not whole lines? Bonus points if I can also restrict it to a selection of lines, by number. -- 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
Re: yank matched portion of a selection of lines
> 123,456g#pattern# <- operate on all lines between 123 and 456 (inclusive) > which include a match for "pattern" > exec "norm! ..." <- do a normal-mode command on each line, as follows: > /pattern\ <- search for the pattern > \"Ay <- yank from the cursor position and append into "a" register > //e\ <- tells where to yank to, in this case to the end of the match Ideally, the yanked text would consist of each match within the range, concatenated together with a newline between each. So, if each line only has 1 match, this would coincide with an exact copy of the original lines, minus any non-matched text, if that makes sense. I did try your second example but it doesn't seem to work out of the gate, and I'm not having any luck tweaking it. :%g#top="[^"]#exec "norm! /top="[^"]\\"Ay//e\" E15: Invalid expression: ^"]\\"Ay//e\" E15: Invalid expression: "norm! /top="[^"]\\"Ay//e\" -- 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