Re: SID or s: - General questions about functions
Thank you very much Tony and ZyX. My functions names do only contains letters, digits and underscores. If I've understood you well, I can now unify all my functions and change s: --- SID change function! --- fun! change endfunction! -- endfun! Is that correct? and can I change also this: s/\\d\\{2,}/\\=s:MyFunctionName(submatch(0))/g in: s/\\d\\{2,}/\\=SIDMyFunctionName(submatch(0))/g -- 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
Backtick to move to mark doesn't work (E78: Unknown mark)
Hi. I'm having problems with using the backtick ` character to move to marks. If I do ma to set a mark into 'a' and then do 'a (a single quote not a backtick) everything works and the cursor is moved to the first non-blank on the marked line. However if I try `a I get an error saying E78: Unknown mark. What am I missing? Thanks, Martin -- 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: Backtick to move to mark doesn't work (E78: Unknown mark)
On 13/04/11 5:01 PM, Martin Lundberg wrote: I'm having problems with using the backtick ` character to move to marks. If I do ma to set a mark into 'a' and then do 'a (a single quote not a backtick) everything works and the cursor is moved to the first non-blank on the marked line. However if I try `a I get an error saying E78: Unknown mark. What am I missing? Hmm. Usually you get 'E20: Mark not set' when a mark is not set, and your error message if you use some character which actually cannot be a mark. So that suggests you are not actually typing a after the backtick, but somehow typing some other letter/symbol. Have you accidentally neglected to release a shift key, or is your keyboard layout treating ` as a dead key and producing an accented character or something? Ben. -- 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: Any non-programmer users of Vim here?
On Tue, Apr 12, 2011 at 01:45:53PM -0400, AK wrote: I'm working on a plugin right now that I think allows a much more flexible and easy way to store and lookup notes, snips and references. It uses an sqlite database ... Ahem ... cough ... splutter, the whole _purpose_ of vim-edited plain text notes is to keep them in a flat file, and avoid like the plague, any additional hocus-pocus, _especially_ databases. (And GUIs, and images. In 15 years, there's never been any reason or temptation to involve any of it.) Sorry, but I find it impossible to comprehend how it can really be easier than a two-character alias to vim ~/unix/Help, and I'm in with vim! ;-) Good luck with it though, if it satisfies your needs. Erik -- Do not do unto others as you would they should do unto you. Their tastes may not be the same. - George Bernard Shaw -- 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: Make install stops while compiling vim7.3, need help
On 13/04/11 12:43, Dennis wrote: Hi everyone: I've downloaded the source files from vim.org and the installation stops while I do make install. It stops after this output: -- /bin/sh ./installman.sh install /usr/local/share/man/fr/man1 -fr /usr/local/share/vim /usr/local/share/vim/vim73 /usr/local/share/vim ../runtime/doc 644 vim vimdiff evim installing /usr/local/share/man/fr/man1/vim.1 -- And then nothing happened, without any output, just like it was paused there. My OS is centOSx64. My Gcc is on version 4.1.2 Below is the output, can anyone help me ? -- [dennis@localhost src]$ sudo make install if test -f /usr/local/bin/vim; then \ mv -f /usr/local/bin/vim /usr/local/bin/vim.rm; \ rm -f /usr/local/bin/vim.rm; \ fi cp vim /usr/local/bin strip /usr/local/bin/vim chmod 755 /usr/local/bin/vim cp vimtutor /usr/local/bin/vimtutor chmod 755 /usr/local/bin/vimtutor /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/doc mkdir /usr/local/share/vim/vim73/doc chmod 755 /usr/local/share/vim/vim73/doc /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/print mkdir /usr/local/share/vim/vim73/print chmod 755 /usr/local/share/vim/vim73/print /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/colors mkdir /usr/local/share/vim/vim73/colors chmod 755 /usr/local/share/vim/vim73/colors /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/syntax mkdir /usr/local/share/vim/vim73/syntax chmod 755 /usr/local/share/vim/vim73/syntax /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/indent mkdir /usr/local/share/vim/vim73/indent chmod 755 /usr/local/share/vim/vim73/indent /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/autoload mkdir /usr/local/share/vim/vim73/autoload chmod 755 /usr/local/share/vim/vim73/autoload /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/autoload/xml mkdir /usr/local/share/vim/vim73/autoload/xml chmod 755 /usr/local/share/vim/vim73/autoload/xml /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/plugin mkdir /usr/local/share/vim/vim73/plugin chmod 755 /usr/local/share/vim/vim73/plugin /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/tutor mkdir /usr/local/share/vim/vim73/tutor chmod 755 /usr/local/share/vim/vim73/tutor /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/spell mkdir /usr/local/share/vim/vim73/spell chmod 755 /usr/local/share/vim/vim73/spell /bin/sh ./mkinstalldirs /usr/local/share/vim/vim73/compiler mkdir /usr/local/share/vim/vim73/compiler chmod 755 /usr/local/share/vim/vim73/compiler /bin/sh ./installman.sh install /usr/local/share/man/man1 /usr/local/share/vim /usr/local/share/vim/vim73 /usr/local/share/vim ../runtime/doc 644 vim vimdiff evim installing /usr/local/share/man/man1/vim.1 installing /usr/local/share/man/man1/vimtutor.1 installing /usr/local/share/man/man1/vimdiff.1 installing /usr/local/share/man/man1/evim.1 generating help tags make[1]: Entering directory `/home/dennis/misc/vim73/runtime/doc' /usr/local/bin/vim -u NONE -esX -c helptags ++t . -c quit make[1]: Leaving directory `/home/dennis/misc/vim73/runtime/doc' cd ../runtime/doc; \ files=`ls *.txt tags`; \ files=$files `ls *.??x tags-?? 2/dev/null || true`; \ cp $files /usr/local/share/vim/vim73/doc; \ cd /usr/local/share/vim/vim73/doc; \ chmod 644 $files cp ../runtime/doc/*.pl /usr/local/share/vim/vim73/doc chmod 755 /usr/local/share/vim/vim73/doc/*.pl cp ../runtime/menu.vim /usr/local/share/vim/vim73/menu.vim chmod 644 /usr/local/share/vim/vim73/menu.vim cp ../runtime/synmenu.vim /usr/local/share/vim/vim73/synmenu.vim chmod 644 /usr/local/share/vim/vim73/synmenu.vim cp ../runtime/delmenu.vim /usr/local/share/vim/vim73/delmenu.vim chmod 644 /usr/local/share/vim/vim73/delmenu.vim cp ../runtime/mswin.vim /usr/local/share/vim/vim73/mswin.vim chmod 644 /usr/local/share/vim/vim73/mswin.vim cp ../runtime/evim.vim /usr/local/share/vim/vim73/evim.vim chmod 644 /usr/local/share/vim/vim73/evim.vim cp ../runtime/bugreport.vim /usr/local/share/vim/vim73/bugreport.vim chmod 644 /usr/local/share/vim/vim73/bugreport.vim cp ../runtime/vimrc_example.vim /usr/local/share/vim/vim73 chmod 644 /usr/local/share/vim/vim73/vimrc_example.vim cp ../runtime/gvimrc_example.vim /usr/local/share/vim/vim73 chmod 644 /usr/local/share/vim/vim73/gvimrc_example.vim cp ../runtime/filetype.vim /usr/local/share/vim/vim73/filetype.vim chmod 644 /usr/local/share/vim/vim73/filetype.vim cp ../runtime/ftoff.vim /usr/local/share/vim/vim73/ftoff.vim chmod 644 /usr/local/share/vim/vim73/ftoff.vim cp ../runtime/scripts.vim /usr/local/share/vim/vim73/scripts.vim chmod 644 /usr/local/share/vim/vim73/scripts.vim cp ../runtime/ftplugin.vim /usr/local/share/vim/vim73/ftplugin.vim chmod 644 /usr/local/share/vim/vim73/ftplugin.vim cp ../runtime/ftplugof.vim /usr/local/share/vim/vim73/ftplugof.vim chmod 644
Re: Backtick to move to mark doesn't work (E78: Unknown mark)
Hi, Ben Schmidt wrote: On 13/04/11 8:50 PM, Martin Lundberg wrote: On Wed, Apr 13, 2011 at 9:24 AM, Ben Schmidt mail_ben_schm...@yahoo.com.au wrote: Hmm. Usually you get 'E20: Mark not set' when a mark is not set, and your error message if you use some character which actually cannot be a mark. So that suggests you are not actually typing a after the backtick, but somehow typing some other letter/symbol. Have you accidentally neglected to release a shift key, or is your keyboard layout treating ` as a dead key and producing an accented character or something? Ben. When I type ` it waits for me to enter another key for example a to create à. So maybe when I hit ` vim waits for another key and when I hit a it gets à which is not a valid mark. If so is the case, how would I solve it? I do think that's the problem. But I have no idea how to solve it. CCing the mailing list again so somebody else can help. maybe a simple solution is enough :nmap à `a :nmap è `e :nmap ì `i :nmap ò `o :nmap ù `u Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- 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: Backtick to move to mark doesn't work (E78: Unknown mark)
On 13/04/11 8:50 PM, Martin Lundberg wrote: On Wed, Apr 13, 2011 at 9:24 AM, Ben Schmidt mail_ben_schm...@yahoo.com.au wrote: Hmm. Usually you get 'E20: Mark not set' when a mark is not set, and your error message if you use some character which actually cannot be a mark. So that suggests you are not actually typing a after the backtick, but somehow typing some other letter/symbol. Have you accidentally neglected to release a shift key, or is your keyboard layout treating ` as a dead key and producing an accented character or something? Ben. When I type ` it waits for me to enter another key for example a to create à. So maybe when I hit ` vim waits for another key and when I hit a it gets à which is not a valid mark. If so is the case, how would I solve it? I do think that's the problem. But I have no idea how to solve it. CCing the mailing list again so somebody else can help. It would probably help to know a bit more about your setup (operating system, windo manager, etc.). Ben. -- 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: Backtick to move to mark doesn't work (E78: Unknown mark)
On 13/04/11 13:56, Ben Schmidt wrote: On 13/04/11 8:50 PM, Martin Lundberg wrote: On Wed, Apr 13, 2011 at 9:24 AM, Ben Schmidt mail_ben_schm...@yahoo.com.au wrote: Hmm. Usually you get 'E20: Mark not set' when a mark is not set, and your error message if you use some character which actually cannot be a mark. So that suggests you are not actually typing a after the backtick, but somehow typing some other letter/symbol. Have you accidentally neglected to release a shift key, or is your keyboard layout treating ` as a dead key and producing an accented character or something? Ben. When I type ` it waits for me to enter another key for example a to create à. So maybe when I hit ` vim waits for another key and when I hit a it gets à which is not a valid mark. If so is the case, how would I solve it? I do think that's the problem. But I have no idea how to solve it. CCing the mailing list again so somebody else can help. It would probably help to know a bit more about your setup (operating system, windo manager, etc.). Ben. If Vim received the single à character (SMALL LATIN LETTER A WITH GRAVE) it wouldn't even know that a mark was asked for. The fact that the error is about a mark shows that Vim received either an apostrophe or a backtick; it's what comes just after that which wasn't the name of a mark. If you are on a unix-like OS, are backticks recognized when Vim sends them to the shell? For instance :!ls -l `which vim` should display the directory entry for your Vim executable. Or, in Insert mode, do you know how to type `a as two characters (backtick followed by lowercase latin a) with nothing in between? If you do, the exact same keystrokes in Normal mode ought to bring you to mark a. On my Belgian keyboard, the key I use to produce a backtick (AltGr with µ) is also a dead key: nothing is displayed immediately, if I type o immediately afterwards I get ò, if I want a backtick instead I have to use AltGr-µ followed by space (or followed by itself but that's slower). Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 54. You start tilting your head sideways to smile. -- 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: Inserting output of Ex command into buffer
2011/4/12 Spiros Bousbouras spi...@gmail.com: On Apr 10, 7:47 pm, Tim Chase v...@tim.thechases.com wrote: On 04/10/2011 05:39 PM, Spiros Bousbouras wrote: On Apr 9, 6:29 pm, Tim Chase v...@tim.thechases.com wrote: On 04/09/2011 12:11 PM, Spiros Bousbouras wrote: How can you insert the output of an Ex command into the buffer at the place where the cursor is? 1) use :redir to a register and paste the register contents: Strange that there isn't a simpler method built-in. I totally agree with you. Would be much more simpler if we could wrote something like: :echo 25*47 And the output was directly put in the current buffer in the cursor position. The sequence redir 'something', type a command and then 'redir END' is really to much to do when we need to be fast. To get the result of the calculation above is much more easy just see the value in the command window and write it by your hand in the buffer. This is a feature that a miss in Vim/GVim for quite sometime. Regards. -- 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: Inserting output of Ex command into buffer
On Wed, April 13, 2011 3:01 pm, Alessandro Antonello wrote: I totally agree with you. Would be much more simpler if we could wrote something like: :echo 25*47 And the output was directly put in the current buffer in the cursor position. The sequence redir 'something', type a command and then 'redir END' is really to much to do when we need to be fast. To get the result of the calculation above is much more easy just see the value in the command window and write it by your hand in the buffer. This is a feature that a miss in Vim/GVim for quite sometime. The above is already possible in vim. in insert mode press Ctrl-R=25*47 and that's it. :h i_CTRL-R_= regards, Christian -- 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: Inserting output of Ex command into buffer
Hi, Alessandro Antonello wrote: 2011/4/12 Spiros Bousbouras spi...@gmail.com: On Apr 10, 7:47 pm, Tim Chase v...@tim.thechases.com wrote: On 04/10/2011 05:39 PM, Spiros Bousbouras wrote: On Apr 9, 6:29 pm, Tim Chase v...@tim.thechases.com wrote: On 04/09/2011 12:11 PM, Spiros Bousbouras wrote: How can you insert the output of an Ex command into the buffer at the place where the cursor is? 1) use :redir to a register and paste the register contents: Strange that there isn't a simpler method built-in. I totally agree with you. Would be much more simpler if we could wrote something like: :echo 25*47 And the output was directly put in the current buffer in the cursor position. The sequence redir 'something', type a command and then 'redir END' is really to much to do when we need to be fast. To get the result of the calculation above is much more easy just see the value in the command window and write it by your hand in the buffer. This is a feature that a miss in Vim/GVim for quite sometime. you can insert the output of every VimL expression with C-R=your-expression-goes-hereCR while you are in insert mode. Your example would then be typed as C-R=25*47CR Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- 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: Inserting output of Ex command into buffer
Gary Johnson wrote: On 2011-04-13, ZyX wrote: Reply to message «Re: Inserting output of Ex command into buffer», sent 05:32:06 13 April 2011, Wednesday by Charles E Campbell Jr: Spiros Bousbouras wrote: [snip] I would prefer a vsystem() function (vim system) or whatever you want to call it so that for example you could do ^R=vsystem(swapname) [snip] Why not try your hand at writing a function to do that? Admittedly, it would have to begin with a capital letter. It is not possible: Vsystem(redir @a | echom 'abc' | redir END) won't work. If one were writing a function as Chip suggested, one would put the redir commands in the body of the function, not in the argument. As a further hint -- the Dredir command in the Decho.vim debugging package already does something similar. (http://mysite.verizon.net/astronaut/vim/index.html#DECHO ) Regards, Chip Campbell -- 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: Definition of sentence changes from ')' to 'as'
I can confirm this same behavior with Vim 7.3.138. A bug perhaps? -- 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: Inserting output of Ex command into buffer
On 13/04/11 15:01, Alessandro Antonello wrote: 2011/4/12 Spiros Bousbourasspi...@gmail.com: On Apr 10, 7:47 pm, Tim Chasev...@tim.thechases.com wrote: On 04/10/2011 05:39 PM, Spiros Bousbouras wrote: On Apr 9, 6:29 pm, Tim Chasev...@tim.thechases.comwrote: On 04/09/2011 12:11 PM, Spiros Bousbouras wrote: How can you insert the output of an Ex command into the buffer at the place where the cursor is? 1) use :redir to a register and paste the register contents: Strange that there isn't a simpler method built-in. I totally agree with you. Would be much more simpler if we could wrote something like: :echo 25*47 And the output was directly put in the current buffer in the cursor position. The sequence redir 'something', type a command and then 'redir END' is really to much to do when we need to be fast. To get the result of the calculation above is much more easy just see the value in the command window and write it by your hand in the buffer. This is a feature that a miss in Vim/GVim for quite sometime. Regards. For this particular use case (insert the value of an expression) you can do it by means of the expression register: in Insert mode ^R=25 * 47 (where ^R is a Ctrl-R keystroke), followed by Enter, or in Normal mode =25 * 47↓p where ↓ represents a press on the Enter key. See :help quote= Best regards, Tony. -- Real computer scientists don't comment their code. The identifiers are so long they can't afford the disk space. -- 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: Backtick to move to mark doesn't work (E78: Unknown mark)
On 13/04/11 14:39, Ben Schmidt wrote: maybe a simple solution is enough :nmap à `a :nmap è `e :nmap ì `i :nmap ò `o :nmap ù `u Regards, Jürgen Maybe; but not if you happen to use Vim to type French, Italian, Catalan, or any language using grave-accented Latin letters as a matter of course. I don't think you would regularly use those characters in normal mode, would you, even if using those languages? I certainly don't when I type French! Ben. oops, sorry, :nmap -- and yet I know that Vim is a modal editor! You're right. Best regards, Tony. -- It has just been discovered that research causes cancer in rats. -- 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: Backtick to move to mark doesn't work (E78: Unknown mark)
On 13/04/11 14:36, Ben Schmidt wrote: If you are on a unix-like OS, are backticks recognized when Vim sends them to the shell? For instance :!ls -l `which vim` should display the directory entry for your Vim executable. Of course, this is unlikely to go wrong, since, as far as I know, there is no w grave character. I guess that thought gives something else to test in Vim. Do marks with non-vowels work after the backtick. If so, that is perhaps further evidence that this is indeed the problem. (Like Tony, I think it's a bit odd that typing `a would produce something like `à which is somewhat what I suggested earlier, as it does appear Vim is receiving the backquote. But I think the fact that `a produces à is enough to strongly suggest the problem is related to this.) Ben. If hitting the dead-key twice produces the backtick, then inadvertently hitting it three times, or long enough to trigger the keyboard repeat mechanism, might produce `à when followed by a. So maybe the OP should just be extra careful to release the ` dead key quickly after each press? Or hit ` Space rather than ` ` in order to produce the spacing-grave (backtick) character? Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 55. You ask your doctor to implant a gig in your brain. -- 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: Backtick to move to mark doesn't work (E78: Unknown mark)
Because I'm not sure if I sent this only to Ben from my gmail I'm reposting it here on google groups. Hello everyone! I'm on OSX and I've tried this on both macvim (which is what i normally use), the terminal vim which comes with MacVim and with normal vim. I tried starting them all with: vim -u NONE -U NONE -N To see if it's a plugin problem. And the results is that it works fine in both terminal vims but fails in macvim. So it should have something to do with macvim. I will write a question in mac_vim mailinglist too linking to this thread. If someone want to keep trying to find the problem we can continue the discussion there. Thanks for all the time and help :) -- 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: Inserting output of Ex command into buffer
On Apr 10, 11:39 pm, Spiros Bousbouras spi...@gmail.com wrote: On Apr 9, 6:29 pm, Tim Chase v...@tim.thechases.com wrote: On 04/09/2011 12:11 PM, Spiros Bousbouras wrote: How can you insert the output of an Ex command into the buffer at the place where the cursor is ? Say for example in the 1st line here I want to insert right after you the output of :chdir .So I place the cursor after you and then do what ? [...] 2) use the system() call in an expression-register to perform the command in your OS's command-interpreter: In insert mode in *nix: ^R=system('pwd') I'm on Linux. This works for my specific example For this example^R=getcwd()also works. -- 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: Inserting output of Ex command into buffer
On 04/13/2011 08:52 AM, Jürgen Krämer wrote: How can you insert the output of an Ex command into the buffer at the place where the cursor is? 1) use :redir to a register and paste the register contents: Strange that there isn't a simpler method built-in. I totally agree with you. Would be much more simpler if we could wrote something like: :echo 25*47 And the output was directly put in the current buffer in the cursor position. The sequence redir 'something', type a command and then 'redir END' is really to much to do when we need to be fast. To get the result of the calculation above is much more easy just see the value in the command window and write it by your hand in the buffer. This is a feature that a miss in Vim/GVim for quite sometime. you can insert the output of every VimL expression with C-R=your-expression-goes-hereCR while you are in insert mode. Your example would then be typed as C-R=25*47CR While this works for expressions (the followup question about echo 25*47), it doesn't satisfy the OP's request for arbitrary Ex commands. Assuming the commands to be executed don't include redirs and there's not a redir already in process (that you don't want to terminate), it could be wrapped in a function function! Capture(excmds) redir = s:results exec a:excmds redir END return s:results endfunction You could then use the function in concert with the expression register: c-r=Capture('scriptnames') (odd results if you don't have 'paste' set) in insert mode, or you can use c-r=Capture('scriptnames')crp to paste it in normal mode. The command should also work with multiple pipe-separated commands: Capture('scriptnames|set') Hope this helps, -tim -- 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: Inserting output of Ex command into buffer
Reply to message «Re: Inserting output of Ex command into buffer», sent 09:19:09 13 April 2011, Wednesday by Gary Johnson: If one were writing a function as Chip suggested, one would put the redir commands in the body of the function, not in the argument. I do understand this: I meant that if function argument calls redir itself then redir inside Vsystem function won't work. Original message: On 2011-04-13, ZyX wrote: Reply to message «Re: Inserting output of Ex command into buffer», sent 05:32:06 13 April 2011, Wednesday by Charles E Campbell Jr: Spiros Bousbouras wrote: [snip] I would prefer a vsystem() function (vim system) or whatever you want to call it so that for example you could do ^R=vsystem(swapname) [snip] Why not try your hand at writing a function to do that? Admittedly, it would have to begin with a capital letter. It is not possible: Vsystem(redir @a | echom 'abc' | redir END) won't work. If one were writing a function as Chip suggested, one would put the redir commands in the body of the function, not in the argument. Regards, Gary signature.asc Description: This is a digitally signed message part.
Re: SID or s: - General questions about functions
Reply to message «Re: SID or s: - General questions about functions», sent 10:52:37 13 April 2011, Wednesday by rameo: My functions names do only contains letters, digits and underscores. If I've understood you well, I can now unify all my functions and change s: --- SID change function! --- fun! change endfunction! -- endfun! Is that correct? 1. Yes (for functions only). 2. Yes (though I would prefer to change fun! - function!, not the opposite). 3. Yes (both will throw E477 error because `endfunction' does not accept bang. You may even change this to, for example, `call!' for this reason). and can I change also this: s/\\d\\{2,}/\\=s:MyFunctionName(submatch(0))/g in: s/\\d\\{2,}/\\=SIDMyFunctionName(submatch(0))/g No (first will replace string `\d\{2,}' with `\=s:MyFunctionName(submatch(0))', second will replace it with `\=SIDMyFunctionName(submatch(0))'. You should half the number of backslashes to make it mean the same). Original message: Thank you very much Tony and ZyX. My functions names do only contains letters, digits and underscores. If I've understood you well, I can now unify all my functions and change s: --- SID change function! --- fun! change endfunction! -- endfun! Is that correct? and can I change also this: s/\\d\\{2,}/\\=s:MyFunctionName(submatch(0))/g in: s/\\d\\{2,}/\\=SIDMyFunctionName(submatch(0))/g signature.asc Description: This is a digitally signed message part.
Re: Backtick to move to mark doesn't work (E78: Unknown mark)
With the help of Björn we've now found that the problem was the Draw marked text inline options in macvim settings window. When unchecked everything works as expected except for that I have to hit space after ` to get `a instead of à. Thanks everyone for the help! -- 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: Inserting output of Ex command into buffer
On Apr 13, 3:53 pm, Tim Chase v...@tim.thechases.com wrote: While this works for expressions (the followup question about echo 25*47), it doesn't satisfy the OP's request for arbitrary Ex commands. Assuming the commands to be executed don't include redirs and there's not a redir already in process (that you don't want to terminate), it could be wrapped in a function function! Capture(excmds) redir = s:results exec a:excmds redir END return s:results endfunction Forgot to ask , why not use a local variable i.e. l:results ? -- 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
pdf ref search
Hi all, I'm working with a lot of PDF lately and I'm looking for a way to map a key combination that will allow me to follow object references. Basically that would mean look at the object ref number that is under the cursor right now and find a pattern like ^\s* $refnumber \d* obj where $refnumber is the value found under the cursor. Thanks, Scott -- 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: pdf ref search
On 04/13/2011 01:41 PM, Scottb wrote: Hi all, I'm working with a lot of PDF lately and I'm looking for a way to map a key combination that will allow me to follow object references. Basically that would mean look at the object ref number that is under the cursor right now and find a pattern like ^\s* $refnumber \d* obj where $refnumber is the value found under the cursor. While I don't have a full understanding of what you're describing (some actual data/text would help verify), it looks like something like :nnoremap f4 /^\s* c-rc-w \d* objcr might do the trick. The ^R^W sequence brings the Word under the cursor into the search. Or you can use ^R^A if you need the WORD under the cursor. :help c_CTRL-R_CTRL-W -tim -- 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: pdf ref search
Thanks Tim, that actually works great. Of course, now I want more... so if you are up for more read on. Basically the format for a PDF reference is: N N R where N is an integer and R is literal. So typically you will see something like a PDF Name (which is prefixed with a /), then a reference to an object reference value for that name. For example 5 0 obj /Type /Catalog /Pages 1 0 R /Outlines 19 0 R /PageMode /UseOutlines /Metadata 3 0 R ... 19 0 obj etc.. The reference 19 0 R points to a PDF object declaration somewhere in the file like 19 0 obj. So, right now (thanks to your help) I can put my cursor over the 19 in the /Outlines reference value, hit F4 and navigate directly to the 19 0 obj. Now... it would be even better if I didn't have to put the cursor on the id number itself, just the line it's on. I suppose that would mean navigating to the first reference (\d+\s\d+\sR) and then executing the object search which you just provided. If you want an example of this sort of text, just open any PDF file in Vim and look for /Outlines or /Catalog. BTW... just noticing that characters classes (like \d for digits) don't seem to work in regular Vim / searches, is that really the case? Thanks! Scott On Apr 13, 12:06 pm, Tim Chase v...@tim.thechases.com wrote: On 04/13/2011 01:41 PM, Scottb wrote: Hi all, I'm working with a lot of PDF lately and I'm looking for a way to map a key combination that will allow me to follow object references. Basically that would mean look at the object ref number that is under the cursor right now and find a pattern like ^\s* $refnumber \d* obj where $refnumber is the value found under the cursor. While I don't have a full understanding of what you're describing (some actual data/text would help verify), it looks like something like :nnoremap f4 /^\s* c-rc-w \d* objcr might do the trick. The ^R^W sequence brings the Word under the cursor into the search. Or you can use ^R^A if you need the WORD under the cursor. :help c_CTRL-R_CTRL-W -tim -- 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: pdf ref search
Thanks Tim, that actually works great. Of course, now I want more... so if you are up for more read on. Basically the format for a PDF reference is: N N R where N is an integer and R is literal. So typically you will see something like a PDF Name (which is prefixed with a /), then a reference to an object reference value for that name. For example 5 0 obj /Type /Catalog /Pages 1 0 R /Outlines 19 0 R /PageMode /UseOutlines /Metadata 3 0 R ... 19 0 obj etc.. The reference 19 0 R points to a PDF object declaration somewhere in the file like 19 0 obj. So, right now (thanks to your help) I can put my cursor over the 19 in the /Outlines reference value, hit F4 and navigate directly to the 19 0 obj. Now... it would be even better if I didn't have to put the cursor on the id number itself, just the line it's on. I suppose that would mean navigating to the first reference (\d+\s\d+\sR) and then executing the object search which you just provided. If you want an example of this sort of text, just open any PDF file in Vim and look for /Outlines or /Catalog. BTW... just noticing that characters classes (like \d for digits) don't seem to work in regular Vim / searches, is that really the case? Thanks! Scott On Apr 13, 12:06 pm, Tim Chase v...@tim.thechases.com wrote: On 04/13/2011 01:41 PM, Scottb wrote: Hi all, I'm working with a lot of PDF lately and I'm looking for a way to map a key combination that will allow me to follow object references. Basically that would mean look at the object ref number that is under the cursor right now and find a pattern like ^\s* $refnumber \d* obj where $refnumber is the value found under the cursor. While I don't have a full understanding of what you're describing (some actual data/text would help verify), it looks like something like :nnoremap f4 /^\s* c-rc-w \d* objcr might do the trick. The ^R^W sequence brings the Word under the cursor into the search. Or you can use ^R^A if you need the WORD under the cursor. :help c_CTRL-R_CTRL-W -tim -- 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: why the Up key doesn't work to go through the searching history
On Wed, 13 Apr 2011, wxuyec wrote: I see. thank you. do you have any advice to the problem? If you try the revised version: echo -e '\033[?1h\033=' ; cat ; echo -e '\033[?1l\033' (then press Up, Down, Right, Left, then press Enter, then Ctrl+d), Do you get: ^[[A^[[B^[[C^[[D Or: ^[OA^[OB^[OC^[OD ? I presume the latter. In which case, don't these work? (I thought they were already suggested -- but maybe it was just the last time this came up...) set t_ku=^[OA set t_kd=^[OB set t_kr=^[OC set t_kl=^[OD Where the ^[ is a *single character* entered as a literal escape character: ctrl-vesc Or, try the following, where everything is as it looks (I dislike putting literal control chars in a .vimrc): exe set t_ku=\EscOA exe set t_kd=\EscOB exe set t_kr=\EscOC exe set t_kl=\EscOD -- Best, Ben -- 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: Remove duplicate lines based on match with 1 column
jcordes johncor...@gmail.com [11-04-14 01:32]: I have a log file with records like this: 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:45:03 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:46:44 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 Six fields, the sixth being an IP address. I would like to delete records with identical IPs, i.e. records which have a match in the 6th field. I know how to do simple things -- so I deleted the 2nd through 5th fields, then sorted and uniq'd the file. However, I'd really like to learn a way, within vim, to accomplish this on the complete file, including the date / time stamps. Can anyone help with this? Thanks very much, John Cordes -- 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 Hi John, The trick here is to make :sort to ignore the fields you would deleted otherwise. This can be done with a regular expression: Everything the regexp will match will be ignored by sort. In your case the expression will be something like: :sort /^.*M / (not tried). HTH! :) Best regards, mcc -- 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: Remove duplicate lines based on match with 1 column
On Apr 13, 8:46 pm, meino.cra...@gmx.de wrote: jcordes johncor...@gmail.com [11-04-14 01:32]: I have a log file with records like this: 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:45:03 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:46:44 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 Six fields, the sixth being an IP address. I would like to delete records with identical IPs, i.e. records which have a match in the 6th field. I know how to do simple things -- so I deleted the 2nd through 5th fields, then sorted and uniq'd the file. However, I'd really like to learn a way, within vim, to accomplish this on the complete file, including the date / time stamps. Can anyone help with this? Thanks very much, John Cordes -- 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, visithttp://www.vim.org/maillist.php Hi John, The trick here is to make :sort to ignore the fields you would deleted otherwise. This can be done with a regular expression: Everything the regexp will match will be ignored by sort. In your case the expression will be something like: :sort /^.*M / (not tried). HTH! :) Best regards, mcc Thanks mcc, but I'm not so sure. I can sort your way, or by (something like) sort -nk6,6 to just sort on the 6th field, but I still have the problem of deleting lines which only match on the 6th field. Maybe I missed something about your proposal. I should have mentioned that I am using linux, with the GNU utils available. John -- 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: pdf ref search
On 04/13/2011 04:27 PM, Scottb wrote: The reference 19 0 R points to a PDF object declaration somewhere in the file like 19 0 obj. So, right now (thanks to your help) I can put my cursor over the 19 in the /Outlines reference value, hit F4 and navigate directly to the 19 0 obj. Now... it would be even better if I didn't have to put the cursor on the id number itself, just the line it's on. I suppose that would mean navigating to the first reference (\d+\s\d+\sR) and then executing the object search which you just provided. If you want an example of this sort of text, just open any PDF file in Vim and look for /Outlines or /Catalog. Sounds like something like :nnoremap f4 :nnoremap f4 /^c-r=matchstr(getline('.'), '\d\+')cr\s\+\d\+\s\+objcr would do the trick. That picks out the first digits, so if you have something like /Foo42Bar 19 0 R you'd have to tweak it to :nnoremap f4 /^c-r=matchstr(getline('.'), '\d\+\ze\s\+\d\+\s\+R')cr\s\+\d\+\s\+objcr to get the 19 instead of the 42. -tim -- 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: pdf ref search
On 04/13/2011 05:17 PM, Benjamin R. Haskell wrote: On Wed, 13 Apr 2011, Scottb wrote: I suppose that would mean [...] \d+\s\d+\sR [...] BTW... just noticing that characters classes (like \d for digits) don't seem to work in regular Vim / searches, is that really the case? It's that you need to make the '+' magic. That one trips me up a the time. (Less and less, but still often.) [snip] /\d\+\s\d\+\sR It trips me up regularly as well, but in the opposite direction. I use Vim so much that I get stung having to check when writing regexps in sed or Perl/Python regexps (I'm forever adding extraneous \ before my + in Python...why don't my $%^* Python regexps work?!?! Oh...I'm vimming them :) -tim -- 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: Inserting output of Ex command into buffer
On Apr 13, 5:08 pm, Spiros Bousbouras spi...@gmail.com wrote: On Apr 13, 3:53 pm, Tim Chase v...@tim.thechases.com wrote: While this works for expressions (the followup question about echo 25*47), it doesn't satisfy the OP's request for arbitrary Ex commands. Assuming the commands to be executed don't include redirs and there's not a redir already in process (that you don't want to terminate), it could be wrapped in a function function! Capture(excmds) redir = s:results exec a:excmds redir END return s:results endfunction Regarding the situation where excmds contains redirections i.e. the example Vsystem(redir @a | echom 'abc' | redir END) posted earlier by ZyX , I don't consider it a problem. I hadn't thought of this scenario when I suggested Vsystem() but it makes more sense to me that if some commands in Vsystem's argument redirect their output then this output should not be included in Vsystem's return value. Consider the analogous situation with shell programming: Ok , with more thought I see that it is a problem. Consider Vsystem(command1 | redir @a | echom 'abc' | redir END | command2) The return value of Vsystem() should include the output of command1 and command2 but it won't. prompt shell-script ... Get stuff on the screen ... prompt shell-script file1 Now stdout goes into file1 But if inside shell-script there is somewhere command file2 then the output of command will still go to file2 even when I do shell-script file1 -- 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: Remove duplicate lines based on match with 1 column
I know you said you want to do this within Vim, but on Unix, awk is really ideal for this sort of task. If you pipe your data through the following command, only the first line containing each IP address will be passed through to the output: awk '{if (ip[$6] == ) print; ip[$6] = 1}' If you have the file open in a Vim buffer and want to filter it in-place, you can do so with Vim's `!` command: :%!awk '{if(ip[$6]==)print;ip[$6]=1}' I removed the extraneous spaces to save keystrokes, but you could leave them in to aid readability if you prefer. The `%` tells Vim to filter the entire file; you could substitute any other valid range in order to filter just part of the file. There's probably a way to do the same thing using only Vim's built-in functionality, but I often find it easier and more elegant to pipe text from Vim through some assortment of Unix's powerful text processing tools using `!`. See `:help :range!` for more info on the Vim filter command. -- 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: Remove duplicate lines based on match with 1 column
On 04/13/2011 06:53 PM, jcordes wrote: On Apr 13, 8:46 pm, meino.cra...@gmx.de wrote: jcordesjohncor...@gmail.com [11-04-14 01:32]: 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:45:03 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:46:44 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 I would like to delete records with identical IPs, i.e. records which have a match in the 6th field. [snip] However, I'd really like to learn a way, within vim, to accomplish this on the complete file, including the date / time stamps. [snip] :sort /^.*M / Thanks mcc, but I'm not so sure. I can sort your way, or by (something like) sort -nk6,6 to just sort on the 6th field, but I still have the problem of deleting lines which only match on the 6th field. Maybe I missed something about your proposal. To expand on Meino's suggestion, it sounds like you want this two-shot: :sort /M/ :g/\(M \d\+\%(\.\d\+\)\{3}\)\n.*\1$/d The first one pulls together all the like-IP-addresses. The second one finds all the lines where the subsequent line has the same IP address, and deletes the first one. The unmentioned variable is the time-stamp aspect: you don't say whether you want to keep the oldest date or the most recent date. Because they have text-months (rather than numeric months), sorting them yields weird/useless results, so the date you get is semi-arbitrary. If the initial file is sorted already by date, I believe Vim's :sort is stable-ish (in :help :sort, search forward for the word stable to read the caveat on it), so it will keep them in the original order. My :g command looks for lines deletes the first one which, in this case, is the the earlier/oldest. Hope that helps, -tim PS: please forgive the semi-sloppy IP regexp as it allows invalid addresses like 12345.6789.0.12345678 but better to handle them safely, than to error out because of faulty logging :) -- 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: Inserting output of Ex command into buffer
On 04/13/2011 07:15 PM, Spiros Bousbouras wrote: Consider the analogous situation with shell programming: Ok , with more thought I see that it is a problem. Consider Vsystem(command1 | redir @a | echom 'abc' | redir END | command2) The return value of Vsystem() should include the output of command1 and command2 but it won't. Right...I don't think Vim has a means by which to detect if/where redirection is occurring so it can be saved and restored. So it's a classic case of Patient: Doctor, it hurts when I do this... Doctor: Well, don't do that! where in this case, the do this is nested redirection. :) -tim -- 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: Remove duplicate lines based on match with 1 column
On Apr 13, 9:23 pm, Tim Chase v...@tim.thechases.com wrote: On 04/13/2011 06:53 PM, jcordes wrote: On Apr 13, 8:46 pm, meino.cra...@gmx.de wrote: jcordesjohncor...@gmail.com [11-04-14 01:32]: 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:45:03 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:46:44 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 I would like to delete records with identical IPs, i.e. records which have a match in the 6th field. [snip] However, I'd really like to learn a way, within vim, to accomplish this on the complete file, including the date / time stamps. [snip] :sort /^.*M / Thanks mcc, but I'm not so sure. I can sort your way, or by (something like) sort -nk6,6 to just sort on the 6th field, but I still have the problem of deleting lines which only match on the 6th field. Maybe I missed something about your proposal. To expand on Meino's suggestion, it sounds like you want this two-shot: :sort /M/ :g/\(M \d\+\%(\.\d\+\)\{3}\)\n.*\1$/d The first one pulls together all the like-IP-addresses. The second one finds all the lines where the subsequent line has the same IP address, and deletes the first one. The unmentioned variable is the time-stamp aspect: you don't say whether you want to keep the oldest date or the most recent date. Because they have text-months (rather than numeric months), sorting them yields weird/useless results, so the date you get is semi-arbitrary. If the initial file is sorted already by date, I believe Vim's :sort is stable-ish (in :help :sort, search forward for the word stable to read the caveat on it), so it will keep them in the original order. My :g command looks for lines deletes the first one which, in this case, is the the earlier/oldest. Hope that helps, -tim PS: please forgive the semi-sloppy IP regexp as it allows invalid addresses like 12345.6789.0.12345678 but better to handle them safely, than to error out because of faulty logging :) Many thanks to both Taylor and Tim for these solutions. I haven't yet tried them but have great confidence! Taylor: I have no problem with using awk, either within or outside vim, so will be happy to check out your filter. Tim: yes, it's that second step using the global command which I didn't know how to construct. Thank you both again, John -- 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
searching and cursor postion
I'm trying to figure out how the correct command to search for a string and have the cursor positioned at the end(or beginning) of that string. From the documentation, it seems to me this should work: /string/e But when I try that I get the message: E481: No range allowed. Can someone show me the error in my ways? Thanks, rich -- 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: Remove duplicate lines based on match with 1 column
* jcordes [2011.04.13 19:40]: I have a log file with records like this: 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:45:03 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:46:44 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 Six fields, the sixth being an IP address. I would like to delete records with identical IPs, i.e. records which have a match in the 6th field. I know how to do simple things -- so I deleted the 2nd through 5th fields, then sorted and uniq'd the file. However, I'd really like to learn a way, within vim, to accomplish this on the complete file, including the date / time stamps. I think you'll have to craft a little function for that. Assuming you want to keep only the first occurence of an IP, the following looks like it does what you want: fun! Filter() range let l:line = a:firstline let l:lastline = a:lastline let l:ip = {} while l:line = l:lastline let l:fields = split(getline(l:line)) if has_key(l:ip, l:fields[5]) exe l:line . 'delete' let l:lastline -= 1 else let l:ip[l:fields[5]] = l:line let l:line += 1 endif endwhile endfun Use like so: :%call Filter() And by the way, since you said you use linux, there are myriads of tools that can help you do this succintly and elegantly outside of vim. One example: % cat /tmp/foo 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:45:03 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:46:44 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 % perl -lane 'print unless $seen{$F[5]}++' /tmp/foo 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 HTH, -- JR -- 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
stderr issue with makeprg
Hi All, I've just updated to 7.3.161 (via Mercurial) and I have an issue where vim is no longer capturing gcc output in stderr (i.e. gcc's warnings and errors). I see them in the shell window as vim run's the gcc commands, however doing a :copen only displays the contents of stdout, not stderr. Has something changed in vim's behaviour, in that I need to set some option to capture stderr with makeprg? Any help would be greatly appreciated, thank you. Chris -- Chris Sutcliffe http://emergedesktop.org http://www.google.com/profiles/ir0nh34d -- 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: Remove duplicate lines based on match with 1 column
On Apr 13, 10:03 pm, Jean-Rene David jrda...@magma.ca wrote: * jcordes [2011.04.13 19:40]: I have a log file with records like this: 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:45:03 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:46:44 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 Six fields, the sixth being an IP address. I would like to delete records with identical IPs, i.e. records which have a match in the 6th field. I know how to do simple things -- so I deleted the 2nd through 5th fields, then sorted and uniq'd the file. However, I'd really like to learn a way, within vim, to accomplish this on the complete file, including the date / time stamps. I think you'll have to craft a little function for that. Assuming you want to keep only the first occurence of an IP, the following looks like it does what you want: fun! Filter() range let l:line = a:firstline let l:lastline = a:lastline let l:ip = {} while l:line = l:lastline let l:fields = split(getline(l:line)) if has_key(l:ip, l:fields[5]) exe l:line . 'delete' let l:lastline -= 1 else let l:ip[l:fields[5]] = l:line let l:line += 1 endif endwhile endfun Use like so: :%call Filter() And by the way, since you said you use linux, there are myriads of tools that can help you do this succintly and elegantly outside of vim. One example: % cat /tmp/foo 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:21:10 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:45:03 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 5:46:44 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 % perl -lane 'print unless $seen{$F[5]}++' /tmp/foo 2011Spring.pdf 10/Apr/2011 at 7:50:40 PM 76.11.9.6 2011Spring.pdf 10/Apr/2011 at 8:10:14 PM 24.222.177.150 2011Spring.pdf 11/Apr/2011 at 7:42:23 PM 24.224.145.37 2011Spring.pdf 11/Apr/2011 at 8:11:55 PM 24.138.53.37 2011Spring.pdf 11/Apr/2011 at 8:17:59 PM 142.68.230.20 2011Spring.pdf 11/Apr/2011 at 9:26:29 PM 24.222.164.116 2011Spring.pdf 12/Apr/2011 at 5:44:31 AM 24.138.16.144 2011Spring.pdf 12/Apr/2011 at 6:50:48 AM 174.88.51.25 HTH, -- JR Thank you, Jean-Rene. I like the perl solution too. John -- 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: searching and cursor postion
* Richard Livornese [2011.04.13 21:00]: I'm trying to figure out how the correct command to search for a string and have the cursor positioned at the end(or beginning) of that string. From the documentation, it seems to me this should work: /string/e Indeed it should. But when I try that I get the message: E481: No range allowed. Can someone show me the error in my ways? It would be a pleasure, if you could just show us what 'your ways' is. It isn't obvious from you message how you are using the command. -- JR -- 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: searching and cursor postion
On 04/13/2011 04:03 PM, Richard Livornese wrote: I'm trying to figure out how the correct command to search for a string and have the cursor positioned at the end(or beginning) of that string. From the documentation, it seems to me this should work: /string/e But when I try that I get the message: E481: No range allowed. Are you issuing what you typed, or are you issuing :/string/e (with the colon, performing an Ex-mode search)? I don't believe there's an easy way to position the cursor horizontally with an Ex-mode search. If you just use a regular / search from Normal mode, the /e flag should work fine. -tim -- 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: searching and cursor postion
Richard Livornese wrote: I'm trying to figure out how the correct command to search for a string and have the cursor positioned at the end(or beginning) of that string. From the documentation, it seems to me this should work: /string/e But when I try that I get the message: E481: No range allowed. Are you typing a colon first? Don't! Assuming you have pressed Escape so you are in normal mode, type the following and press Enter: /string/e That should find the next string and position the cursor on the 'g'. Pressing n will repeat for the next occurrence. John -- 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: searching and cursor postion
On 14/04/11 11:19 AM, John Beckett wrote: Richard Livornese wrote: I'm trying to figure out how the correct command to search for a string and have the cursor positioned at the end(or beginning) of that string. From the documentation, it seems to me this should work: /string/e But when I try that I get the message: E481: No range allowed. Are you typing a colon first? Don't! Or if you are using it in a script, use the :normal command. normal! /string/e Ben. -- 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: stderr issue with makeprg
On 13 April 2011 21:06, Chris Sutcliffe wrote: I've just updated to 7.3.161 (via Mercurial) and I have an issue where vim is no longer capturing gcc output in stderr (i.e. gcc's warnings and errors). I see them in the shell window as vim run's the gcc commands, however doing a :copen only displays the contents of stdout, not stderr. It was an issue on my side, not vim. Sorry for the noise. Chris -- Chris Sutcliffe http://emergedesktop.org http://www.google.com/profiles/ir0nh34d -- 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: searching and cursor postion
Folks, Thanks. Completely missed the Ex vs. Normal mode. That does it. Rich -- 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