RE: OT: Vi in a browser...
-Original Message- From: Yongwei Wu [mailto:[EMAIL PROTECTED] Sent: 1. juni 2007 07:32 To: vim@vim.org Subject: Re: OT: Vi in a browser... On 31/05/07, A.J.Mechelynck [EMAIL PROTECTED] wrote: Edward L. Fox wrote: [...] A friend told me that he is developing a Firefox addon to emulate the Vi/Vim behaviors in all text areas in Firefox, without launching external applications. I'm looking forward to it. [...] I don't think any Vim extension aiming at reproducing Vim's behaviour without actually calling it, will be able to come near the result of the gazillions of man-hours Bram (with a few others) has put and is still putting into it. Many browsers are able to interact with any external editor (such as true-blue Vim) these days, which also means that any bugfix or improvement to Vim gets reflected in the editing behaviour of the browser. Or you could always write the text in Vim, then use the clipboard to paste it into the browser, even with no special external editor function. Agreed. Maybe Edward should persuade his friend to use the OLE interface of Vim instead. Yongwei -- Wu Yongwei URL: http://wyw.dcweb.cn/ Personally, I don't agree with you. When editing short text items on web pages, I feel that the overhead of copying/pasting back and forth from vim is too much. I am currently using the View Source With-addon, which is great, but I would actually prefer a limited vi-implementation for use inside Firefox. So, Edward, please post to this list if/when your friend has something that we may try out :-) Thomas Svensen Senior Solutions Engineer FAST
Re: vim 7.1 and cr/lf interpretation
2007/5/15, Micah Cowan [EMAIL PROTECTED]: Please note that he had already given you this exact same answer already in his last message, including and especially the bit that \n is an end-of-line (line terminator), not a open-new-line (line separator). This is generally true for all operating systems, not just Unix (substituting \r or \r\n as necessary). This is the part that he shouted, since apparently he thought you'd notice it more this time around if he did. While I don't approve of shouting, I do understand his frustration: asking questions to learn about mysteries is definitely a good thing, and to be encouraged; but please do take the time to thoroughly read the answers that people spend time writing. I think my problem stems from the fact that I usually do not hold this true: 0x10 alone gives an *end* of line, not necessarily a *begin* of line. In the programming language I currently write, using the seperator string somewhere in the string I'm parsing gives a new entry. So a string containing only a line seperator char/pattern would have 2 entries, which in this case would mean 2 lines. As I see now, this is handled differently in vim. IIRC, even a java string tokenizer would work the same way, and by the original name, line feed in fact /does/ mean a new line on a serialized terminal. But that's arguing semantics when the core of the problem is known now. I apologize for having a different set of mind and not understanding the problem instantly. Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: vim 7.1 and cr/lf interpretation
2007/5/15, Micah Cowan [EMAIL PROTECTED]: Thomas Michael Engelke wrote: But that's arguing semantics when the core of the problem is known now. I apologize for having a different set of mind and not understanding the problem instantly. This is not a fair remark, considering I pointed out to you, privately, that he made the statement fairly clearly before his last post, which is why he said it all-caps/bold the second time around. It's not that you didn't understand the problem instantly: the problem was explained fairly clearly; it's that you made him repeat his answers, indicating that you hadn't read them. Damn. I apologize again, this time for replying your mail on the list. Now I know why there was no Reply to all, which I thought to be a glitch in GMail. And yes, you are right about the other thing, too. I did understand what he wrote but discarded it as not possible. I think I fell into that pattern when I read the first reply to my problem which was bollocks, obviously by someone who did not read what I wrote as he suggested something I already did and described. I promise to read the replies I will be given better from now on and not discard them so easily. Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: vim 7.1 and cr/lf interpretation
2007/5/14, Andy Wokula [EMAIL PROTECTED]: Thomas Michael Engelke schrieb: :set fileformats? gives fileformats=dos,unix, so both formats are available, yet the detection and switching does not seem to work. Are you sure _every_ line ends in ^M? Positive. Every single line shows an ^M at the end. set fileformat gives unix after loading. Setting fileformat to dos doesn't change the files interpretation in vim. Somehow I think I miss something. -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: vim 7.1 and cr/lf interpretation
2007/5/15, A.J.Mechelynck [EMAIL PROTECTED]: Thomas Michael Engelke wrote: 2007/5/14, Andy Wokula [EMAIL PROTECTED]: Thomas Michael Engelke schrieb: :set fileformats? gives fileformats=dos,unix, so both formats are available, yet the detection and switching does not seem to work. Are you sure _every_ line ends in ^M? Positive. Every single line shows an ^M at the end. set fileformat gives unix after loading. Setting fileformat to dos doesn't change the files interpretation in vim. Somehow I think I miss something. If 'fileformats' includes dos, then if _all_ lines end in CR+LF, the 'fileformat' should be set (locally) to dos. But a single line without a CR causes 'fileformat' to be set to unix, and all other lines show a ^M Test 1: Load the file. Then: /[^[:return:]]$ If there is a line ending in LF-without-CR, this search should find it. Test 2, variant a: To remove all carriage-returns at end-of-line: :set fileformats= :e ++ff=dos filename :setlocal ff=unix :w Test 2, variant b: to repair any lines where a CR is missing, (by adding it): same as 2a, but omit the line with :setlocal ff=unix. Then exit Vim and reload the file with your usual settings to see if the problem has gone away. If it hasn't, do you still see it with vim -u /usr/local/share/vim/vim71/vimrc_example.vim (replace the path if necessary by wherever Vim sets $VIMRUNTIME on your installation: on Windows it might be vim -u C:\Program Files\Vim\vim71\vimrc_example.vim instead)? Hello Tony, and thanks for your extensive answer. Unfortunately, this is what I can report. To make things easier, I'll attach the file I am talking about to this message so that you can either check for yourselves and/or see that I'm telling the truth. What is the current state: Of course, there's one line without 0x13 0x10 at the end, and that is the last line. As I checked using your regex (I'm always forgetting the :word:-syntax is available as well, which makes it difficult as I can never remember how to search for a hex char), I found one single line except the last one without 0x13 0x10 at the end. I removed the line in joining it with the line above (multi line command) and saved the file. I closed it, closed vim and reopened the file again. The problem persists. Now the only line your regex finds is the last one. set fileformats still evaluates to dos,unix. set fileformat after loading the file evaluates to unix. Setting it to dos via set fileformat=dos does not help the issue. The example file of vim (in my case, c:\Programme\vim\vim71a\vimrc_example.vim) loads fine and gets the fileformat dos, as expected. Thank you for your help, guys. Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc list02.p Description: Binary data
Re: vim 7.1 and cr/lf interpretation
2007/5/15, A.J.Mechelynck [EMAIL PROTECTED]: Thomas Michael Engelke wrote: 2007/5/15, A.J.Mechelynck [EMAIL PROTECTED]: Thomas Michael Engelke wrote: 2007/5/14, Andy Wokula [EMAIL PROTECTED]: Thomas Michael Engelke schrieb: :set fileformats? gives fileformats=dos,unix, so both formats are available, yet the detection and switching does not seem to work. Are you sure _every_ line ends in ^M? Positive. Every single line shows an ^M at the end. set fileformat gives unix after loading. Setting fileformat to dos doesn't change the files interpretation in vim. Somehow I think I miss something. If 'fileformats' includes dos, then if _all_ lines end in CR+LF, the 'fileformat' should be set (locally) to dos. But a single line without a CR causes 'fileformat' to be set to unix, and all other lines show a ^M Test 1: Load the file. Then: /[^[:return:]]$ If there is a line ending in LF-without-CR, this search should find it. Test 2, variant a: To remove all carriage-returns at end-of-line: :set fileformats= :e ++ff=dos filename :setlocal ff=unix :w Test 2, variant b: to repair any lines where a CR is missing, (by adding it): same as 2a, but omit the line with :setlocal ff=unix. Then exit Vim and reload the file with your usual settings to see if the problem has gone away. If it hasn't, do you still see it with vim -u /usr/local/share/vim/vim71/vimrc_example.vim (replace the path if necessary by wherever Vim sets $VIMRUNTIME on your installation: on Windows it might be vim -u C:\Program Files\Vim\vim71\vimrc_example.vim instead)? Hello Tony, and thanks for your extensive answer. Unfortunately, this is what I can report. To make things easier, I'll attach the file I am talking about to this message so that you can either check for yourselves and/or see that I'm telling the truth. What is the current state: Of course, there's one line without 0x13 0x10 at the end, and that is the last line. As I checked using your regex (I'm always forgetting the :word:-syntax is available as well, which makes it difficult as I can never remember how to search for a hex char), I found one single line except the last one without 0x13 0x10 at the end. I removed the line in joining it with the line above (multi line command) and saved the file. I closed it, closed vim and reopened the file again. The problem persists. Now the only line your regex finds is the last one. set fileformats still evaluates to dos,unix. set fileformat after loading the file evaluates to unix. Setting it to dos via set fileformat=dos does not help the issue. Apparently your last line still has a LF without CR, causing the heuristic to detect the file's 'fileformat' as unix. Ends of lines are line ENDINGS, not line SEPARATORS: even the last line must have one, for various reasons, the most obvious of which is that, if file1 lacks a proper end-of-file, copy file1+file2 file3 will concatenate the last line of file1 with the first line of file2, making them a single line somewhere in the middle of file3. Try, as I said in my previous post, vim :set fileformats= cancel autodetect of fileformat :edit ++ff=dos list02.pforce 'dos' fileformat Then saving the file should add a proper CR+LF ending to the last line (and to any other line lacking a CR). The example file of vim (in my case, c:\Programme\vim\vim71a\vimrc_example.vim) loads fine and gets the fileformat dos, as expected. With -u before it on the Vim command-line, Vim should use it instead of your vimrc, not as an editfile. Assuming that fileformat unix means 0x10 means open a new line which seems to be the case (0x13 stays as ^M, 0x10 is interpreted as a new line), shouldn't this mean that in the last line there is a line break missing? If I would have seen a line there with no ^M at the end I would have seen the problem right away. But this way, it seems a little odd that although 0x13 0x10 gives a ^M and a new line, 0x10 alone does not give a new line. -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: where to install tlib?
I moved tmru.vim into ~/.vim/plugin, but where do I install tlib.vba? Open the file in vim and type: :so % See http://www.vim.org/scripts/script.php?script_id=1502 for details. With 7.0, you might need to install a current version of vimball first. (I'm not sure about that though.)
vim 7.1 and cr/lf interpretation
Hello! I just opened one of the files we develop, written by another programmer. I can see a ^M at the end of every line. I quickly check the mailing list archive and find out, that this mainly depends on the setting of fileformat. I check fileformat and find out that it's unix. Ah, the problem. I set it to dos. But nothing changes. How does vim determine what fileformat a file should have? I mean, a 0x13 before every linebreaking 0x10 should give at least some hint that this might not be a unix file. Maybe the file contains something that makes vim think this is a unix fileformat file? And why doesn't the interpretation change when I change fileformat? binary is set to nobinary, as I read in the help that this might cause problems. Regards, Thomas Engelke Berlin, Germany -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: vim 7.1 and cr/lf interpretation
:set fileformats? gives fileformats=dos,unix, so both formats are available, yet the detection and switching does not seem to work. 2007/5/14, Yongwei Wu [EMAIL PROTECTED]: Hi Thomas, On 14/05/07, Thomas Michael Engelke [EMAIL PROTECTED] wrote: Hello! I just opened one of the files we develop, written by another programmer. I can see a ^M at the end of every line. I quickly check the mailing list archive and find out, that this mainly depends on the setting of fileformat. I check fileformat and find out that it's unix. Ah, the problem. I set it to dos. But nothing changes. How does vim determine what fileformat a file should have? I mean, a 0x13 before every linebreaking 0x10 should give at least some hint that this might not be a unix file. Maybe the file contains something that makes vim think this is a unix fileformat file? And why doesn't the interpretation change when I change fileformat? binary is set to nobinary, as I read in the help that this might cause problems. Try: :set fileformats? :help fileformats -- Wu Yongwei URL: http://wyw.dcweb.cn/ -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: RSS not working
Luis A. Florit wrote: * El 07/05/07 a las 10:37, Thomas chamullaba: For scripts you can also use: http://feed43.com/vim-scripts.xml This is an inofficial feed using a free screen scraping service (which explain the small ad in the item footer) though.
Re: RSS not working
For scripts you can also use: http://feed43.com/vim-scripts.xml Regards, Thomas.
Viminfo dictionaries
Hi, Part two in this week's installment of unsolicited comment on vimscript: I also realized that viminfo doesn't save upper case letter variables the values of which are dictionaries. This can be solved by using VimEnter VimLeavePre autocommands and by converting the variable to from strings. If this is intended to be so, I think this should be noted in the help -- AFAIK it currently isn't. Regards, Thomas.
Re: Syntax error: let a1 = 1 | let b = [1,2,3] | echo b[a1:-1] = Undefined variable a1:
Using : both for scopes and Sublist is not ideal. But it's hard to think of something that is better. Ruby uses .. for this (eg a[2..-1]), which has a mathematical touch. Putting spaces before and after the colon is perfectly ok for me though -- now that I know it.
Re: wish: allow a: in the function def
Also would it be _recommended_ to ever use a window-local variable without the w: prefix? ... IMHO not. Well, it would make it easier for the user to configure scripts. I'm myself not convinced that it's a good idea to allow this for all variables, though. But I think it could be useful in some situations when you want the user to set a variable per buffer/window or use the global value. I sometimes end up with code like this if a:0 = 1 let x = a:1 elseif exists('b:foo') let x = b:foo else let x = g:foo endif The idea was to solve this with some magic. Of course, with the exception of s:, a user-defined function could help too, which probably is sufficient. let x = a:0 = 1 ? a:1 : GetValue('foo', 'bg')
Re: search-related question
Hale Boyes, Kevin wrote: How do I search in a document to the next line that doesn't contain a specific string? Something along the lines of grep -v. If you need all lines that don't contain pattern, try :v/pattern/ If you want to jump to the next line that does not match pattern, you could do this: :while getline(line(.)) =~ 'pattern' : norm j :endwhile Of course, you can't use this in a range. So if you would like to :5,/xpattern/ command with xpattern addressing the next line that does not match pattern, you are out of luck. In that case, you would need to do use marks: ma :while getline(line(.)) =~ 'pattern' : norm j :endwhile mb :'a,'b command Thanks, Kevin. Ciao, Thomas -- Thomas Köhler Email: [EMAIL PROTECTED] WWW: http://gott-gehabt.de IRC: tkoehler PGP public key available from Homepage! signature.asc Description: Digital signature
Re: suggestion
No. Delete the buffer, but keep the window open. Something like http://www.vim.org/tips/tip.php?tip_id=1078 Regards, Thomas.
Re: setting title of gvim window inside a bash script
--- Kamaraju S Kusumanchi [EMAIL PROTECTED] wrote: I tried /usr/bin/gview -c 'set ft=man nomod nolist titlestring=$1' - /usr/bin/gview -c 'set ft=man nomod nolist titlestring=$1' - The problem here is that you're forgetting that string interpolation _doesn't_ happen within single quotes. Hence what you want to do is use: /usr/bin/gview -c set ft=man nomod nolist titlestring=$1 - -- Thomas Adam ___ Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html
completion functions (completefunc): Is it possible for completion items to contain newlines?
Hi, vim help says about completion functions for use with completefunc: Each list item can either be a string or a Dictionary. When it is a string it is used as the completion. When it is a Dictionary it can contain these items: wordthe text that will be inserted, mandatory abbrabbreviation of word; when not empty it is used in the menu instead of word I'd like to have a completion that spans several lines, i.e. include newline characters. I tried several possibilities but neither one worked: call add(t, {'word': a\nb, 'abbr': 'a'}) call add(t, {'word': 'a\nb', 'abbr': 'b'}) call add(t, {'word': a\crb, 'abbr': 'c'}) call add(t, {'word': a\c-jb, 'abbr': 'd'}) Is it possible? If yes, how? If not, is it somehow possible to make a completion call a function instead of inserting the text? This probably is rather a feature request, but I was thinking of complementing a new field called 'agent' or 'function' that is supposed to do the actual work of inserting the text after an item was selected. An entry could then look like: call add(t, {'function': 'InsertText(a\nb)', 'abbr': 'a'}) So I imagine the text stump would then be removed and the function called with the cursor at the position where the text should begin or so. Regards, Thomas.
I'm back
Hello all, I just wanted to let you know that I am back on the vim and vim-dev mailinglists. I won't have time to write many mails, but my colleagues at work started to ask me a lot of questions about vim when they found out that I wrote syn on and colorscheme koehler in root's vimrc of all servers so I thought it might be good to get back to the old habit of learning by reading the solutions of fellow vim users to the questions of other vim users. :-) I might as well throw in a few mails, but as I only read my private mail on the weekends there will be only a few mails from me... Ciao, Thomas -- Thomas Köhler Email: [EMAIL PROTECTED] WWW: http://gott-gehabt.de IRC: tkoehler PGP public key available from Homepage! signature.asc Description: Digital signature
compiler plugin for the ARM compiler
Hi, Is a compiler plugin for the ARM compiler (armcc) already available? (Couldn't find it in the Vim site) I am basically looking for the errorformat for the ARM compiler. Regards, Sibin DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
I'm back
Hello all, I just wanted to let you know that I am back on the vim and vim-dev mailinglists. I won't have time to write many mails, but my colleagues at work started to ask me a lot of questions about vim when they found out that I wrote syn on and colorscheme koehler in root's vimrc of all servers so I thought it might be good to get back to the old habit of learning by reading the solutions of fellow vim users to the questions of other vim users. :-) I might as well throw in a few mails, but as I only read my private mail on the weekends there will be only a few mails from me... Ciao, Thomas -- Thomas Köhler Email: [EMAIL PROTECTED] WWW: http://gott-gehabt.de IRC: tkoehler PGP public key available from Homepage! signature.asc Description: Digital signature
Re: Question about paragraphs: make lines containing only whitespace characters a paragraph separator
autocmd BufRead,BufWrite * if ! bin | silent! %s/\s\+$//ge | endif Thanks. I think this is about what I was looking for. Regards, Thomas.
compiler plugin for the ARM compiler
Hi, Is a compiler plugin for the ARM compiler (armcc) already available? (Couldn't find it in the Vim site) I am basically looking for the errorformat for the ARM compiler. Regards, Sibin DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
Question about paragraphs: make lines containing only whitespace characters a paragraph separator
Hi, This is something that I found annoying quite a time now and I'm pretty sure there is a simple solution for this problem. Paragraphs are defined as: A paragraph begins after each empty line, and also at each of a set of paragraph macros, specified by the pairs of characters in the 'paragraphs' option. I often end up with seemingly blank lines that contain whitespace characters. Is there a way to make vim handle these lines as paragraph boundaries too as ip does? One could remap the {} keys but AFAIK these maps would be ignored by norm! and noremap commands. Does somebody know a way to do this? I understand this could also be considered a finesse/feature, but I personally would like to have to choice to treat lines containing only whitespace characters as empty lines. Thanks, Thomas.
Re: Question about paragraphs: make lines containing only whitespace characters a paragraph separator
Maybe I misunderstand the problem but can't you change those lines with just blanks to empty lines? Sure I can remove the whitespace characters. But I'd rather simply not have to care about them (but this is filetype-dependent because for some filetypes this really could be what I want). I was just wondering if there maybe already is a (buffer local) option to do this. Regards, Thomas.
Question about b:did_ftplugin
Hi, When I set a filetype for a buffer the variable b:did_ftplugin is set. The help says: If you are writing a filetype plugin to be used by many people, they need a chance to disable loading it. Put this at the top of the plugin: Only do this when not done yet for this buffer if exists(b:did_ftplugin) finish endif let b:did_ftplugin = 1 Now, when I do set ft=X from the command line, it happens that the ftplugin X doesn't get loaded because it finishes when b:did_ftplugin is set. When is b:did_ftplugin ever unset? What's the rationale of setting b:did_ftplugin and not b:did_ftplugin_X? Regards, Thomas.
BUG vim 7.0-204?: autocmd CusorMoved vs select/visual mode vs :behave mswin vs norm!
Hi, When I use the following command (for demonstration purposes): au CursorMoved * norm! zz When I now press s-c-left or s-c-right, zz get inserted in the buffer. These cursor key seem to be set by :behave mswin. In summary: :au CursorMoved * norm! zz :behave mswin Press s-c-left or s-c-right zz gets inserted. Is there a work-around? Regards, Thomas.
Re: BUG vim 7.0-204?: autocmd CusorMoved vs select/visual mode vs :behave mswin vs norm!
When in Select mode you are still in sort-of Normal mode. Your autocommand will have to take care of mode stuff by itself. You can use CTRL-\ CTRN-N to make sure you are in Normal mode. Okay, I now wrapped the norm! commands in a function and check via mode() if we are in select mode and then prepend c-o to the command if that's the case. It works without destroying the selection but it looks strange to me. Regards, Thomas. ___ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
RE: How to cut, copy and paste the VIM-way
-Original Message- From: Eric Leenman [mailto:[EMAIL PROTECTED] Sent: Sunday, March 25, 2007 3:40 PM To: vim@vim.org Subject: How to cut, copy and paste the VIM-way Hi, I'm used to cut, copy and paste the windows-way. Meaning, selecting text and then press CTRL-X, CTRL-C or CTRL-V. In VIM (and correct me if I'm wrong) you yank (y) for copy put (p) for paste . for cut With this in mind, how to cut, copy and paste the VIM-way? Because when I select text and see select-mode in the lowest line and then press y, I see a letter y in my text and the selected text is gone. How come? Rgds, Eric _ Get a FREE Web site, company branded e-mail and more from Microsoft Office Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/ When you press y after selecting text you will replace the entire text with the y; this is because you are in the select mode. This is the kind of behaviour you would get in, lets say Notepad or most other editors. What you want is, to be in the visual mode before pressing y. There are two ways - 1. After selecting text (you can see a '---SELECT---' at the bottom of your screen.) press CTRL-g, that is 'Ctrl + g' to toggle between visual and select mode. :h v_CTRL-G 2. Whenever you select text you can directly enter visual mode by default, instead of the select mode by setting the 'selectmode' options appropriately. :h selectmode Regards, Sibin DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
Re: How to display a omni-comletion menu from a vim script function?
Let me rephrase my question: Is it possible to display the omni-completion menu in normal mode, eg from a function called in normal mode? I don't want to set omnifunc or completefunc for this. Regards, Thomas.
Re: create a fill-in macro.
Can you create and activate a macro that goes like this: [Activate macro] First-Name: [first fill-in place] Last-Name: [second fill in place] CR Country: [third fill-in place] [Macro ended] So that when you fill this in you get in insert-mode this as plain text: First-Name: Eric Last-Name: Leenman Country: Holland There are some plugins that do this: http://www.vim.org/scripts/script_search_results.php?keywords=skeleton http://www.vim.org/scripts/script_search_results.php?keywords=template Regards, Thomas.
How to display a omni-comletion menu from a vim script function?
Hi, I would like to use the new vim7 drop-down menu that is used with the new omni-completion from a vim script in order to let the user select an item from a list. I figured I could temporarily set omnifunc and use this to build the list. But I wasn't able to find a way to trigger the display of the menu from within a vim script. Does somebody have an idea of how to display the menu? Say, we have: fun! MyComplete(findstart, base) ... endf fun! DoSomething() let omnifunc = omnifunc let omnifunc = 'MyComplete' try +++DISPLAY MENU+++ return 0 finally let omnifunc = omnifunc endtry endf How would the DISPLAY MENU part look like? Regards, Thomas.
Re: rss feed for vim plugins
Is there a way that we can subscribe to this feed, or do we have to create our own personal instance at free43? The user agreement for free feed conversion allows polling of the feed only once every 6 hours, which was one reason why I was asking if somebody knew a better (free) web-scraping service. You could use this feed: http://feed43.com/vim-scripts.xml Not sure yet, if this really works. Regards, Thomas. ___ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
Re: Bug report: mapping fails with a few characters (i.e.: « :imap ’ foo » fails)
2007/3/2, A.J.Mechelynck [EMAIL PROTECTED]: Mapping seems to be buggy with some characters. For instance: :imap ' foo does not work (the apostrophe is U+2019). What is 'encoding' set to? Using multibyte characters (e.g. in a mapping) will only work if 'encoding' (which defines how characters are represented internally in Vim memory) is set to an appropriate multibyte setting beforehand The encoding is set to utf-8. My point is, mapping works with some multibyte characters, but not all of them. For example: :imap ∀ foo ... that is, mapping the forall symbol (U+2200), works. Since I can map some multibyte characters, there is in my opinion no issue with the encoding. The question is: why is it possible to map U+2200 but not U+2019? Regards, thomas
vim7.0: End completion mode when typing a new/unknown word
Hi, Say the buffer contains: foo or foo1 foo2 and say I type: foo and now c-p. As soon as there is a possible completion, I switch to (omni)completion mode (no idea if this is the official name for it). When there are more than one possible completions I get a menu and so. So far, so good. Now when I simply continue typing (say: a), vim still searches for completions although there are no possible completions for fooa. Is there a way to make vim automatically leave completion mode when I start typing and there are no known competions for the word? I'm not sure if I was able to understand the problem and I assume there already is an option for this -- which I simply wasn't able to find. Is there such an option? The only relevant setting in my vimrc file is: set completeopt+=longest autocmd FileType * execute setlocal complete+=.k$HOME/vimfiles/syntax/.getbufvar(%,current_syntax)..vim autocmd FileType * execute setlocal complete+=.k$VIMRUNTIME/syntax/.getbufvar(%,current_syntax)..vim Regards, Thomas.
RE: How do I make the current working directory follow the active document in Gvim?
-Original Message- From: cga2000 [mailto:[EMAIL PROTECTED] Sent: Monday, February 26, 2007 10:28 PM To: vim@vim.org Subject: Re: How do I make the current working directory follow the active document in Gvim? On Sun, Feb 25, 2007 at 07:57:39PM EST, A.J.Mechelynck wrote: [..] - To change (once) to the dir of the current file :cd %:p:h Nice. But I'm not going to remember it until I understand it. I scoured the :help files but couldn't find and explanation of the syntax. :p is short for :print and :h is help. So there's two things I don't know: 1. The symbolic (?) language you are using - the same that's used when scripting vim, I would imagine. 2. How to use vim's help efficiently :-) Thanks, Cga 2. How to use vim's help efficiently -- try :help topic. If that doesn't give you what you want try - :helpgrep topic (followed by :cwin if needed). Try :helpgrep %:p:h you will find the meaning of %:p:h Regards, Sibin DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
Problem with opening files from UNC
I'm using vim7 from my Total Commander under Windows XP with the following command line: vim70\gvim.exe --remote-tab-silent filename Whenever I try to open a file from a UNC path (e.g. \\Cd-server\HKR_304B\install.inf ), I get the attached message, roughly translated as Directory \CD-server\HKR_304B could not be found in 'cdpath' I'm not sure if this is a problem of vim. Trying the same on a random command line (cmd.exe) using absolute path to vim and UNC for the file, I get the file opened with no contents and vim claims, it's a new file. vim also hickups away one \ and claims the final path is \Cd-server\HKR_304B\install.inf. It would save the file now to localharddisc:\Cd-server\HKR_304B\install.inf, which is hardly what I tried to do :) Thanks. Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: vim on calcs, PDAs, palms
I'd like to know if any ports of vim to them are supported out of the box The Sharp Zaurus (no new products to be expected) and the Nokia N800 are linux-based devices and to my knowledge run vim if this is what you wanted to know.
search command in visual mode - how to?
Hi all, I am stuck in one of my scripting attempts! The context : Suppose I want to delete the string bio from the following line The biosphere is huge and I want to do it in this way - /biosCR vCR //eCR dCR Now I want to do the same thing, but conditionally...basically I want to use the :if construct. I tried - :if (@0=~something) | exe /bios | exe normal v | exe //e | endif This where I am stuck; I am not able to reproduce the effect of //eCR through the :if construct. In this case I get the error e481: No range allowed and if I try - exe normal //e it just stays in visual mode doing nothing. Can anyone help me out here? This is going to play a huge part in most of my scripts! Regards, Sibin DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
RE: search command in visual mode - how to?
Thanks a lot Charles and Tim for providing me the answer. (It really was just the case of missing the \r or \cr) And surely there was no necessity for such complex steps for this particular example, but it was just an indicative example of one of the steps I needed for my script. But rest assured I really do need this. Regards, Sibin -Original Message- From: Charles E Campbell Jr [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 14, 2007 12:31 AM To: Sibin P. Thomas Cc: vim@vim.org Subject: Re: search command in visual mode - how to? Sibin P. Thomas wrote: Hi all, I am stuck in one of my scripting attempts! The context : Suppose I want to delete the string bio from the following line The biosphere is huge and I want to do it in this way - /biosCR vCR //eCR dCR Now I want to do the same thing, but conditionally...basically I want to use the :if construct. I tried - :if (@0=~something) | exe /bios | exe normal v | exe //e | endif This where I am stuck; I am not able to reproduce the effect of //eCR through the :if construct. In this case I get the error e481: No range allowed and if I try - exe normal //e it just stays in visual mode doing nothing. Can anyone help me out here? This is going to play a huge part in most of my scripts! Several notes 1. exe /bios might fail. You probably should use the search() function: if search('bios') ... endif 2. bios might be part of a word (example: symbiosis) and get found when you don't want it to be. Perhaps search('\bios') would be better? 3. Why not do the search substitute directly from ex? /\bios/s/// 4. If for some odd reason you feel you absolutely must use visual mode for this, then try exe norm! v//e\crd Regards, Chip Campbell DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
Mapping: Pick occurance of word under cursor, vim7-style
Hello! I am using the following mapping: map F4 [I:let nr = input(Match: )Barexe normal . nr .[\tCR This displays a list of all lines with occurances of the word under the cursor on it, assigns an incremental number to it and lets me pick one to jump to. This works fine. But I know that vim7 (or possible an earlier version, too?) can do those context menus that pup up in the editing area rather than at the command line below. Can anybody give me a hint on how to rewrite the mapping so I get such a conext menu instead of a numbered list? Thank you, Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: Vim presentation in Mountain View
2007/2/6, Vigil [EMAIL PROTECTED]: Hopefully this will be available on google videos. Yes, as a german it's an awfully long way just to meet Bram once. I hope to see this lecture pop up as a Torrent or or Goggle Video.
Re: Mapping: Pick occurance of word under cursor, vim7-style
2007/2/8, Marc Weber [EMAIL PROTECTED]: On Thu, Feb 08, 2007 at 01:30:37PM +0100, Thomas Michael Engelke wrote: Can anybody give me a hint on how to rewrite the mapping so I get such a conext menu instead of a numbered list? Get the word under the cursor using expand('cword') See completion examples (:h complete-functions) to filter and get the list. To get the lines you can use getline using with range(0,line('$')) HTH If you need more info post again. Aeh.. Perhaps its faster to get all lines and use the filter() function There is also c-xc-l which completes lines. But this is not exactly what you want to do... The mapping is done by assigning omnifunc or completefunc omnifunc is often used by $VIMRUNTIME/**/complet* scripts so completefunc is the better choice. Hello Marc, and thank you for replying. However, this information, however right it might be, will do me not much good. I consider vimscript a much harder language than anything I've encountered before (aside from brainfuck and maybe whitespace). I do get the expand-part. In any codepiece, expand('cword') expands to the word at the cursor position. I do get the difference between the two approaches. The first one (previous) used an included function [I. Your new approach uses a script, possible a function and utilizes the new completion technique via omnifunc. However, how those parts fit together completely eludes me. I can try to give as much information as possible and hope this makes it easy for one of the pros to hack a line together: The regex to search would be '\'.expand('cword').'\' The list should appear at the cursor position Well, I don't have anything more. Thanks. Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: vim paste buffer
2007/2/8, Guillaume Bog [EMAIL PROTECTED]: Hi everbody, I'm new on this list. I use vim in a terminal on ubuntu everyday and still need some help for efficient use. If the file i'm editing is longer than one screen and I want to paste it somewhere else (say in a firefox textarea), I have to go out of vim, cat the file i'm editing, select it and then paste it (with middle mouse button). I now the visual mode, and how to highlight all (gg v G). But this operation doesn't fill the proper buffer. As I understand it, the register * represents the systemwide clipboard, whatever that means to the actual OS implementation. So yanking to the register * should do the trick. Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
how do u visually select a search pattern?
Hi all, How can one visually select a pattern which is searched for? In the following text : get_register_primitive 7 get_register_test_case_primitive 8 parameters address--- variable - set_register_primitive 11 parameters set_reg--- variable - reg_resp_primitive 9 reg_resp_test_case_primitive 10 parameters decode_reg--- variable - I would like to search for the pattern para\_.\{-}variable. When I am on the highlighted selections (3 pairs of lines in this case), I would like to yank the highlighted portion to a register (for evaluation etc). Regards, Sibin DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
RE: how do u visually select a search pattern?
True, this will work for the present case. But what I exactly wanted was to visually select whatever is highlighted due to the previous search, to be precise only one of the matches at a time. For instance if my search string were para\_.\{-}var (notice that I am not searching for an entire word), I want to visually select only the part highlighted by the search operation. Regards, Sibin -Original Message- From: Michael Brailsford [mailto:[EMAIL PROTECTED] Sent: Thursday, February 08, 2007 10:10 PM To: Sibin P. Thomas Subject: Re: how do u visually select a search pattern? :set hlsearch This will highlight all matches of the previous match pattern. For yanking, search for para the press v, then search for variable, then press wy. That will highlight from the beginning of para to the end of variable. -Michael - Original Message From: Sibin P. Thomas [EMAIL PROTECTED] To: Vim Mailing List vim@vim.org Sent: Thursday, February 8, 2007 10:29:52 AM Subject: how do u visually select a search pattern? Hi all, How can one visually select a pattern which is searched for? In the following text : get_register_primitive 7 get_register_test_case_primitive 8 parameters address--- variable - set_register_primitive 11 parameters set_reg--- variable - reg_resp_primitive 9 reg_resp_test_case_primitive 10 parameters decode_reg--- variable - I would like to search for the pattern para\_.\{-}variable. When I am on the highlighted selections (3 pairs of lines in this case), I would like to yank the highlighted portion to a register (for evaluation etc). Regards, Sibin DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
RE: how do u visually select a search pattern?
Yup that was useful, but I am stuck at the next step of my quest. I visually select the search pattern using //crv//ecr, then yank it to a register - say 0 (0yy). After that, I want to evaluate the yanked text to delete the highlighted part if it meets a condition, as in - :if (!(@0=~set_reg)) | exe normal // | exe normal v | exe normal //e | exe normal d| endif But here instead visually selecting and deleting the match this command gets stuck at - exe normal v; i.e. it gets into the visual mode but fails to do the next set of commands. What should it be instead of - exe normal //e ? Regards, Sibin -Original Message- From: Tim Chase [mailto:[EMAIL PROTECTED] Sent: Thursday, February 08, 2007 10:40 PM To: Sibin P. Thomas Cc: Vim Mailing List Subject: Re: how do u visually select a search pattern? I would like to search for the pattern para\_.\{-}variable. When I am on the highlighted selections (3 pairs of lines in this case), I would like to yank the highlighted portion to a register (for evaluation etc). Well, it's not quite what you describe, but it's like the n/N functionality for finding the *next* (or previous) match and highlighting it: :nnoremap f4 //crv//ecr :nnoremap f5 ??ecrv??cr It might also be handy to have some visual-mode mappings such as :vmap f4 escf4 :vmap f5 escf5 So you can continue forward/backward in your searching. Getting it to highlight the results immediatedly after searching is a considerably more difficult stunt. Doable, but not without a number of crazy stunts and mindbendingly opaque mappings. At least from my determination of matters. YMMV ;) HTH, -tim DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
/Pattern with grouping ([]) and word character abrev (\w)
Hello, I'm trying to use a regex for searching in a file. I noticed that inside square brackets \w seems to loose all magical matching abilities. Is there a way to reverse that loss or do I have to specify everything inside [] explicitly? Regards, Thomas Engelke Berlin, Germany -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
RE: How can I do to always opening files into a tab ?
-Original Message- From: Eddine [mailto:[EMAIL PROTECTED] Sent: Sunday, January 14, 2007 5:06 PM To: Vim Mailing List Subject: How can I do to always opening files into a tab ? Hello Vimmers ! I got few questions for vim under win32 (XP) - How can I do to _always_ open files into its own tab ? -- Also is there a way to set an option so this tip also runs with the Edit with Vim context menu. - Is there an option so when a file is vertically splitted, scrolling down and up, keeps both left and right panel on the same line, in a way is there a mean to synchronize the up and down scrolling of both views ? Hope I have been clear enough with my questions. Many thanks and regards ! Eddine. Hi, This is what I do to open files in their own tabs - 1. I browse my working directory with the :Vexplore feature of Vim. When I come across the file I want to open all I do is type gf when I am over it. The following line in my vimrc file is the one that does the trick - nmap gf c :tabe cfileCR 2. go to ur SendTo folder most likely to be at C:\Documents and Settings\your login name\SendTo and by default this folder is hidden. Once u are there right click and create a new shortcut. When it asks for location type this - C:\Program Files\Vim\vim70\gvim.exe --servername GVIM --remote-tab-silent (maybe the location of ur gvim is different) and then give it a name u like; and voila u can right click on any file and send it to it's own tab in gvim. Regards, Sibin DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
Bug in non-gui vim 7.0-178: Command line expansion for emenu doesn't work for menu entries containing a period.
Hi, In the following, command line expansion works in gvim but not in vim: set nocompatible set wildmenu amenu test.etc\..1 :echo 1cr emenu test.{press tab} This presents no possible completion in vim, but correctly shows the submenu in gvim. Regards, Thomas.
Re: Bug in non-gui vim 7.0-178: Command line expansion for emenu doesn't work for menu entries containing a period.
set nocompatible set wildmenu amenu test.etc\..1 :echo 1cr emenu test.{press tab} This presents no possible completion in vim, but correctly shows the submenu in gvim. It works fine for me. Could there be something else that matters? I tried this with the terminal version on linux windows (compiled with GUI=no) and it didn't work when invoking vim as vim -u NONE. It works when running gvim (@ winxp) though. I first noticed this problem already some time ago when I first tried the :emenu command because I happen to have some custom functions listed in a tml.Vim\ etc\. submenu. I can still execute the menu entry when I know the name, but command line completion doesn't work -- which is somewhat bad because I put stuff into the menu I use so seldomn that there isn't use in remembering it. Anyway, I now renamed the menu. ___ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
Re: Indendation of Progress code
2007/1/10, Jürgen Krämer [EMAIL PROTECTED]: Hi, Thomas Michael Engelke schrieb: I have a problem with indendation of a piece of Progress code. It's representative of a bit of indendation problems I have now and again, always indenting way too far without any visible cause. I hope someone can reproduce the issue. I've attached the problematic file (zipped) to this post. When I am in line 771 and use O (shift+o, that's the letter, not the number), I get the cursor one line up, but indented by 49 chars, not (as I would expect) 7. I'm not sure if this is a problem of vim, a problem of the Progress syntax file or a problem of my configuration. Please hint me in the right direction. you seem to have set cindent somewhere in one of your loaded scripts. Check where it has been set with verbose set cindent? and remove it from the script. Regards, Jürgen Hello Jürgen and the others, thanks, that fixed the problem asap. I love this mailing list. On a related matter, I actually liked the indendation most of the time. Seldom I had a problem like this one today. Is there a indent like the next/previous line, whichever has code-solution build-in? Regards, Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Bug in 7.0.178? autocmd BufReadCmd * DoSomething expand(afile) fails if the filename contains %
Hi, I have the following line in my source: exec 'autocmd BufReadCmd '. pattern .' call '. rcmd .'(1, expand(afile), , %)' This fails if the filename contains % which is replaced with expand('%'). I can't seem to escape the % at any point, can I? Wrapping the exand(afile) in a escape(, %) doesn't help. Regards, Thomas.
Re: vim70: Dictionaries echo vs echom: Bug?
You can already do quite a lot if you define your own assert function or command for this. Ok, I now uploaded a plugin[1] that does this. Maybe somebody finds this useful too. The handling of script local functions is suboptimal though, which is why I still think this should be integrated into the interpreter. Regards, Thomas. [1] http://www.vim.org/scripts/script.php?script_id=1730
Re: vim70: Dictionaries echo vs echom: Bug?
Looking back, now that Vim script has become much more complex, a bit more type checking would be good. A valid point. Mabye this could be done by an assert command/function that checks its arguments or does nothing depending on an option (maybe 'debug')/flag/variable? Problem is the syntax of type declarations. Would require function prototypes, for example. Vim script follows Python here: no type declarations. I'm not sure if I can follow you here. I was thinking of something really simple in the line of: fun! Foo(a, b) assert a:a = 0 a:a = 10 assert type(a:b) == 0, Not a string return a:a + a:b endf assert Foo(1, 2) == 3 assert Foo(1, -2) == -1 and maybe assert_raise Foo(1, bla) Similar commands are used in some other languages. The idea is that vim scripts could run in some sort of debug mode where these assertions are evaluated and in normal mode where they are ignored/stripped at read/compile-time (if this is possible with the current interpreter) and thus don't result in a speed penalty. That's probably not quite what you meant but I think it would help (IMHO sufficiently) when writing slightly non-trivial functions. ___ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
Re: vim70: Dictionaries echo vs echom: Bug?
As mentioned in the documentation, automatic conversion only happens between numbers and strings, not with Lists and Dictionaries. This is to avoid mistakes, e.g., trying to concatenate a List and a String. Something like let l = [1,2,3] exec Foo . l could come handy though -- which isn't possible now. Looking back, now that Vim script has become much more complex, a bit more type checking would be good. A valid point. Mabye this could be done by an assert command/function that checks its arguments or does nothing depending on an option (maybe 'debug')/flag/variable?
Re: vim70: Dictionaries echo vs echom: Bug?
Something like let l = [1,2,3] exec Foo . l could come in handy though -- which isn't possible now. Although I just realized that lists seem to be passed on by reference and this would create a new copy if the string presentation of a list were a parseable list. Which leads to another point: How do I pass a list by reference to Foo, what most likely should be done in this example? Maybe I should read the manual once again. I noticed that v:val in map() type of functions does this properly, eg fun! Foo(l, a) call add(a:l, a:a) endf let l = [] call map([1,2,3], 'Foo(l, v:val)') works properly. But I'm digressing. Regards.
Re: vim70: Dictionaries echo vs echom: Bug?
let l = [1,2,3] exec Foo . l Which leads to another point: How do I pass a list by reference to Foo Sorry, I somehow seem to have forgot what the original problem was -- which I should able to solve with the function() call() functions.
Strange O-behaviour
Hello, I'm using vim excessively for developing in Progress 4GL. Sometimes, I stumble upon an odd behaviour and don't know if it's due to a setting in the syntax file (progress.vim) or due to a problem in vim itself. Finally, I have a reproducable for one of those oddities. In the attached file, I have the cursor on line 52. I use O from the command mode to insert a new line below. The cursor stands in column 37. I would have expected it to stand in column 5, like the beginning of the line before. For proper reproduction, use the Progress syntax file included in vim. I am using gvim 7 for Windows 32 (7th of May 2006). Any ideas? Thanks, Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc te-kor84965.p Description: Binary data
Wron Block-Insert (p)
Hello, I have found an oddity in vim which I'm not sure is a bug and/or known. I have yanked a visual block of some lines of code and try to put it in somewhere else. There a strange effect happens: depending on if there is either a character or a beginning of line left besides the cursor, paste via p works different. When I have a BOL or a char to the left, it gets pasted and uses the cursor position as upper left corner. When there's no char/BOL, it uses the char right beside the cursor position as upper left corner. It's easily reproducable by just moving the cursor one position to the right and paste the block again. Anybody that can reproduce the problem and/or shed some light on it? Note: Shift+P works as a workaround. Regards, Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: Wron Block-Insert (p)
2006/12/6, A.J.Mechelynck [EMAIL PROTECTED]: Thomas Michael Engelke wrote: Hello, I have found an oddity in vim which I'm not sure is a bug and/or known. I have yanked a visual block of some lines of code and try to put it in somewhere else. There a strange effect happens: depending on if there is either a character or a beginning of line left besides the cursor, paste via p works different. When I have a BOL or a char to the left, it gets pasted and uses the cursor position as upper left corner. When there's no char/BOL, it uses the char right beside the cursor position as upper left corner. It's easily reproducable by just moving the cursor one position to the right and paste the block again. Anybody that can reproduce the problem and/or shed some light on it? Note: Shift+P works as a workaround. Regards, Thomas I don't understand what you mean. p means put after cursor; P (shift-p) is put before. Depending on whether the selection to be pasted is characterwise, linewise or blockwise, the result will be different. Now let's assume it's blockwise, and that 'virtualedit' is off (e.g. empty). Using p inserts the selection after the cursor character, and after the character in the same column on successive lines. If some of the lines are shorter, spaces are inserted so that the block will be inserted as a rectangle. The exception is when the cursor is on an empty line: in that case there is no character at the cursor, and the block gets pasted after character zero, i.e., at the start of the current line and of successive lines after that. I don't see any problem. What is it that you don't understand? Hello, I'll try to elaborate here. Sometimes, I have to align statements in a large assign-statement like this: assign var1 = var2 = . I block-yank a block containing, left-upper, v of var1, right-lower 2 of var2, to insert both variable names after the equal-signs. So my cursor stands in the spot behind the equals on the first row. I press p. This is what I get: assign var1 =var1 var2 =var2 . I think: Oh, it gets pasted from exactly where my cursor is. I must be standing wrong. I undo the change, go 1 spot to the right and press p again. I end up with this: assign var1 = var1 var2 = var2 . Note that there are 2 spaces after each equal-sign. that is what I do not understand. Doing the same action, modified by 1 column to the right, should paste the same, but all one spot to the right. Is that assumption wrong? Assuming that what you said hits the spot, p at the described spot should insert the block with only 1 space between the equal-sign and the first column of the block. Hope this clears it up. Regards, Thomas -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
RE: your best vim scripting tip
Hi, While we are at the subject of tips for budding Vim scripters - I had created this mapping -- nmap com ^:if search('\/\*.*\*\/','c',line(.))!=0CR :.s/\/\*\(.*\)\*\//\1/gCR :elseCR :.s/\(\s*\)\(.*\)\(\s*\)/\1\/\*\2\*\/\3/gCR :endifCR :nohCR this command basically toggles C-style commenting on a line i.e. if the line wasn't commented it comments out the entire line and vice-versa. I spent an intense hour of exploring the help pages and plenty of effort in trial and error before I could reach the 'Eureka' moment. What I wanted to know is could the same functionality have been achieved by a better sequence of commands? Can an experienced 'vimmer' do better? Regards, Sibin -Original Message- From: Mikolaj Machowski [mailto:[EMAIL PROTECTED] Sent: Sunday, December 03, 2006 7:18 PM To: vim@vim.org Subject: Re: your best vim scripting tip On nie gru 3 2006, vim@vim.org wrote: Hi, It you should give one (or more) tips to a person who was going to start creating scripts for vim, then what would it be? (besides know your :help :-) ) ideas could be: Do's and dont's Keep ff=unix . In other case your scripts won't be working under non windows systems. Always supply modeline to make sure basic editing things will be working for others. When changing options use setlocal not set - be polite to user environment. Try to cut on g:variables (see above). Try to maintain documentation, not only for use of script but also for messing with it. best util script Each script covers only part of Vim functionality. It is hard to say which one is best for learning. often used functions It depends on what are you want to achieve. ways of optimization Avoid \| in complex regexps, often two, separate substite() are faster than one substite() with \|. Avoid * whenever possible, try to use \+ if appropriate. \x class is faster than [collection] When doing complex substitutions it is often faster to check if some part of pattern already exists and only if this is true execute substitution. m. -- I am social scientist - I don't know the difference between good and bad, only the difference between difference. DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
Re: Call a vim function from the command line
Is it possible to invoke a function in vim automatically? I'd like to process a text file automatically. I *could* write an onload for the specific file that calls a functions, saves and exists, but it does not strike me as very elegant. Is there anything like vim -auto -text_file -function :h starting.txt Something like: vim -c call function() -c qa! text_file or so?
Upcase every keyword while editing
Hello! I am looking for a way to mimic a functionality I've seen in the editor ED4Win (http://www.softasitgets.com/). What I want to do is to automagically upcase every written word that is considered a keyword. I program in Progress 4GL and use the syntax file from the gvim standard distribution. Theoretically, in my understanding of the problem, I would need to write a function to check the word before the cursor against the keywords list and map this one to something. Usually, I leave the boundaries of a keyword by using either space, tab, :, ,, enter or .. So I would have to map this function to every of those keys in insert mode. This is not very elegant, but it would work. I'm not very good in (g)vim scripting and would like to have some help in writing this function or a pointer on where I could find a plugin performing this feat. Thank you for your time, Thomas Engelke gvim.exe --version says: VIM - Vi IMproved 7.0 (2006 May 7, compiled May 7 2006 16:23:43) MS-Windows 32 Bit GUI Version mit OLE-Unterstützung Übersetzt von [EMAIL PROTECTED] Große Version mit GUI. Ein- (+) oder ausschließlich (-) der Eigenschaften: +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +folding -footer +gettext/dyn -hangul_input +iconv/dyn +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang -mzscheme +netbeans_intg +ole -osfiletype +path_extra +perl/dyn -postscript +printer -profile +python/dyn +quickfix +reltime +rightleft +ruby/dyn +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white +tcl/dyn -tgetent -termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -xfontset -xim -xterm_save +xpm_w32 System-vimrc-Datei: $VIM\vimrc Benutzer-vimrc-Datei: $HOME\_vimrc zweite Benutzer-vimrc-Datei: $VIM\_vimrc Benutzer-exrc-Datei: $HOME\_exrc zweite Benutzer-exrc-Datei: $VIM\_exrc System-gvimrc-Datei: $VIM\gvimrc Benutzer-gvimrc-Datei: $HOME\_gvimrc zweite Benutzer-gvimrc-Datei: $VIM\_gvimrc System-Menü-Datei: $VIMRUNTIME\menu.vim Übersetzt: cl -c /W3 /nologo -D_MT -MT -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_XPM_W32 -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 /Fo.\ObjGOLYTR/ /Ox -DNDEBUG -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\tcl83.dll\ -DDYNAMIC_TCL_VER=\8.3\ -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\python24.dll\ -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\perl58.dll\ -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=18 -DDYNAMIC_RUBY_DLL=\msvcrt-ruby18.dll\ -DFEAT_BIG /Zi /Fd.\ObjGOLYTR/ Linken: link /RELEASE /nologo /subsystem:windows /incremental:no /nodefaultlib:libc advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib oldnames.lib kernel32.lib gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib user32.lib /nodefaultlib:python24.lib e:\tcl\lib\tclstub83.lib WSock32.lib e:\xpm\lib\libXpm.lib /PDB:.\ObjGOLYTR/gvim.pdb -debug -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: UTL plugin query
* file.txt * other.txt Why not simply use gf in such a situation? The (shameless plug) viki plugin also provides advanced hyperlinking facilities. Thomas.
Cut Paste Repeat
This is not new behavior for VIM, but I am finally asking. I would like to be able to repeat via '.' my last cut/paste action. For example: cw5C-V After I do the above, the repeat function '.' does not work. This does work on my old 'vi' that I use on Solaris. Tom Hertneky The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to read it. If you think you received it in error, please notify the sender. Do not forward or copy without permission of the sender. This message may contain an advertisement of a product or service and thus may constitute a commercial electronic mail message under US Law. PNCs postal address is 249 Fifth Avenue, Pittsburgh, PA 15222. If you do not wish to receive any additional advertising or promotional messages from PNC at this e-mail address, click here to Unsubscribe. https://pnc.p.delivery.net/m/u/pnc/uni/p.asp By unsubscribing to this message, you will be unsubscribed from all advertising or promotional messages from PNC. Removing your e-mail address from this mailing list will not affect your subscription to alerts, e-newsletters or account servicing e-mails..
Windows Batch file with Tabs
I thought that this would be easy, but I can not figure it out. I have had a simple Windows CMD file for a long time to open several files in VIM. Each one gets its own window. Now with V7.0 I would like to have a simple batch file to open the files in one window, but with tabs. I have found some complicated discussions in the archive about Windows and tabs, but they don't seem to fit. Thank you for any help. Tom Hertneky The contents of this email are the property of PNC. If it was not addressed to you, you have no legal right to read it. If you think you received it in error, please notify the sender. Do not forward or copy without permission of the sender. This message may contain an advertisement of a product or service and thus may constitute a commercial electronic mail message under US Law. PNCs postal address is 249 Fifth Avenue, Pittsburgh, PA 15222. If you do not wish to receive any additional advertising or promotional messages from PNC at this e-mail address, click here to Unsubscribe. https://pnc.p.delivery.net/m/u/pnc/uni/p.asp By unsubscribing to this message, you will be unsubscribed from all advertising or promotional messages from PNC. Removing your e-mail address from this mailing list will not affect your subscription to alerts, e-newsletters or account servicing e-mails..
Re: How pair g /g
Peng Yu wrote: I'm writing some xml code in vim. In xml, there are some pair like g /g. Would you please let me know how to pair them as { and } such that I can us % to visit them? source $VIMRUNTIME/macros/matchit.vim let b:match_words = 'g:/g' see $VIMRUNTIME/macros/matchit.txt for help. Regards, Thomas
backreferences with expression-syntax?
Hi, when matching regular expressions with perl, backreferences will be stored in $1 to $9. Does vim do anything similar? I have a script with several lines like this if cline =~ '^\s*[._a-z0-9]\+\s\+\([-._a-z0-9]\+\)\s\+' ... endif and I'd like to have the part which is in parantheses just like in perl. I could not find anything about backreferences in the vim manual. Thanks in advance, Thomas
RE: vim | multiple files editing and delete question
If u have Cygwin then creating a batch file with the following would be the simplest solution - set TARGETDIR=C:\something set SCRIPTDIR=C:\something_else find %TARGETDIR% -name *.[ch] -exec gvim -s %SCRIPTDIR%\win32_vimscript.vim {} ; Basically use find to help u (actually it's just one instruction, so u don't even need to have a batch file for it) Regards, Sibin -Original Message- From: Nikolaos A. Patsopoulos [mailto:[EMAIL PROTECTED] Sent: Thursday, September 14, 2006 3:31 PM To: vim@vim.org Subject: vim | multiple files editing and delete question Hi, I have a series of questions: 1. I want to edit multiple files from command line so I created a vim script with all the commands (20). I use a batch file in WinXP: |@echo off vim -s script file.txt exit however I need to run this script on multiple files. In vim's help there is this code for use in bash(?) shell ||for file in *.txt; do| | vim -e -s $file change.vim| | lpr -r tempfile| |done however it doesn't seem to work under Cygwin. 2.Can I delete after a pattern search? Sth like this: :/^html\_.{-}body: /-3d and how can I repeat this globally? 3. This is not Vim related but I wonder if anyone knows sth. I have the following structure of folders and files: .. folder1 file1 file2 folder2 file1 file2 . and want to add the folder name into the filename: || folder1 ||folder1|_|file1 ||folder1|_|||file2 folder2 ||folder2|_|||file1 ||folder2|_|||file2 Thanks in advance, Nikos | - Disclaimer - This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. -
RE: quick and dirty compile
I have tested it and it works without any hitch on my system. (WinXp SP2 with Cygwin) Regards, Sibin -Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 06, 2006 12:55 PM To: Sibin P. Thomas Cc: Yegappan Lakshmanan; vim@vim.org Subject: Re: quick and dirty compile Sibin P. Thomas wrote: Thank a lot to everyone! I added the following to my _vimrc file to get what I wanted nmap C-F9 :MakecompileCR nmap F5 :MakexecCR :!%.exeCR command Makecompile :se makeprg=gcc\ -o\ %.o\ % | :make! command Makexec :se makeprg=gcc\ -o\ %\ % | :make! Regards, Sibin We're not within a makefile: I don't believe % will be interpreted. Passing %.o (with % interpreted by Vim) to the shell would mean the current file, and read stdio from a file named .o. Use %:r.o or, if it doesn't work, command Makexec -nargs=0 -bar \ exe 'set makeprg=gcc\ -o\ ' \ . fnamemodify(expand('%'),':p:r') \ . '.o\ ' \ . expand('%') \ | make! with single quotes to avoid interpretation of backslashes before the :set command. See :help filename-modifiers Best regards, Tony. - Disclaimer - This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. -
Bug in vim7? cursor postion col() vs. utf8-character for showbreak
I set showbreak to ¦ (some extended character). This works fine for latin1 etc. but causes troubles when the encoding is utf8. Cursor position, col() virtcol() values etc. are miscalculated for (soft)wrapped lines. Regards, Thomas.
quick and dirty compile
Hi, Could someone let me know how to quickly compile my current buffer? I want a key map like nmap F5 x to do -- gcc -o current_file.o current_file.c also another map to make an executable, like nmap F5 x to do -- gcc -o current_file current_file.c Also it would be convenient if this command could give a list of errors like :make. Regards, Sibin - Disclaimer - This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. -
RE: Execute something when I enter in a directory
Use :se exrc in ur _vimrc file And then create a _vimrc file local to the directory in question. Check help for more details. Regards, Sibin -Original Message- From: Andrea Spadaccini [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 05, 2006 3:17 PM To: vim@vim.org Subject: Execute something when I enter in a directory Hello vimmers, I'd like to load some settings when I enter in a directory, like for instance setting makeprg. Is there a way to do it? Thanks in advance from a lurker! :) -- [ Andrea Spadaccini - a.k.a. Lupino - from Catania - ICQ #: 91528290 ] [ GPG ID: 5D41ABF0 - key on keyservers - Gentoo GNU / Linux - 2.6.16 ] [ Linux Registered User 313388 - @: a.spadaccini(at)catania.linux.it ] - Disclaimer - This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. -
utf8 vs string handling vs virtcol
Hi, In a plugin on mine, I have the following lines: let col = virtcol(.) let line = strpart(getline(.), col - 1) The idea is to get the line right of the cursor including the character under the cursor. This works fine for latin1 encoding but yields wrong results when the encoding is eg utf8 and if there is a 16bit character before the cursor -- the string in front of the cursor then obviously is longer than one would expect from the value of virtcol(). Do you have a suggestion on how to robustly extract the line right of the cursor? Regards, Thomas.
Re: utf8 vs string handling vs virtcol
This is wrong. You need: let col = col(.) let line = strpart(getline(.), col - 1) Unfortunately, IIRC this doesn't work with wrapped lines which is why I chose virtcol() ... But, well can't reproduce what I did (or thought that I did) 10 minutes ago. Anyway, it doesn't work with enc=utf8 and when there are malformed characters (not valid utf8) that are displayed as xx. Interestingly, virtcol() doesn't work in this situation either. But you're 99% right I guess. Thanks. Regards, Thomas.
Re: utf8 vs string handling vs virtcol
Yes it does. Take simple example, Create line with 1 high utf-8 char entering Ctrl-Vu1234 then a. Ok, you're right as far as col() is concerned. I'm having here some problems though with enc=utf8 soft-wrapped lines showbreak=¦, which I mistook as being a issue related to col(). The cursor appears to be slightly off position. Regards, Thomas.
Re: Does Vim have any scripts like Org-mode of Emacs?
Org - an Emacs mode for notes and project planning http://staff.science.uva.nl/~dominik/Tools/org/ viki[1] has some (highlighting) support for todo lists but it doesn't sort them for you. I also started building some pim functionality on top of it but haven't got it to actually work to test it so that you could rely on it. Thomas. [1] http://www.vim.org/scripts/script.php?script_id=861
RE: Vim and cscope
Could someone help me here; I tried what Dave suggested but with no success. Regards, Sibin -Original Message- From: Sibin P. Thomas [mailto:[EMAIL PROTECTED] Sent: Monday, July 31, 2006 6:25 AM ... I tried integrating Cscope 15.4 with Vim7.0 on WinXP (I have installed cygwin too); but whenever I try to use cscope in Vim I get the following error - E623: Could not spawn cscope process. Sounds like you are using the cscope from the open source project. You need a special version of cscope that is integrated with Vim. :h cscope-info Will point you to different downloads locations. Since you are on win32, you need to download it from: http://iamphet.nm.ru/cscope/index.html :h cscope-win32 HTH, Dave - Disclaimer - This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. -
Vim and cscope
Hi, I tried integrating Cscope 15.4 with Vim7.0 on WinXP (I have installed cygwin too); but whenever I try to use cscope in Vim I get the following error - E623: Could not spawn cscope process. Has anyone come across this problem before and more importantly found a solution? Regards, Sibin - Disclaimer - This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. -
RE: Vim and cscope
Thanks for the reply, but the problem persists. Is there somehow I could get hold of the source of this version of cscope? Regards, Sibin -Original Message- From: David Fishburn [mailto:[EMAIL PROTECTED] Sent: Monday, July 31, 2006 6:12 PM To: Sibin P. Thomas Cc: vim@vim.org Subject: RE: Vim and cscope -Original Message- From: Sibin P. Thomas [mailto:[EMAIL PROTECTED] Sent: Monday, July 31, 2006 6:25 AM ... I tried integrating Cscope 15.4 with Vim7.0 on WinXP (I have installed cygwin too); but whenever I try to use cscope in Vim I get the following error - E623: Could not spawn cscope process. Sounds like you are using the cscope from the open source project. You need a special version of cscope that is integrated with Vim. :h cscope-info Will point you to different downloads locations. Since you are on win32, you need to download it from: http://iamphet.nm.ru/cscope/index.html :h cscope-win32 HTH, Dave - Disclaimer - This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. -
Re: edit-with-vim context menu item disappeared with vim7 upgrade
My next step, I suppose is to review all the relevant registry keys, but I wanted to see if there were other thoughts on this...? At least in the source, there is a GvimExt.reg file. You can edit this file (add absolute paths) and add it to the registry (double-clicking on it should do that). install.exe appears to be kind of non-working here. Thomas.
Re: Making :grep easier to use
On Tue, 2005-12-06 at 12:32 -0800, David Frey wrote: Often times I am looking at a file and there is a certain string sitting infront of me that I want to grep for. Right now, I go into command mode and type :grep some_string *.extension Is it possible to yank some_string and then paste it into the command? It would save me a lot of typing when I am grepping for strings. On the command line C-R insert the contents of the unnamed yank buffer. :he c_C-R Thanks
Preserving undo through save
Hello! I'm not sure if it was always the case or if this is a recent change (through vim 7). I am not able to undo anything after saving a file. Is this normal? What settings are involved? How can I change this behaviour? The help-file for undo is pretty silent regarding this. Regards, Thomas Engelke -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: Preserving undo through save
2006/6/30, Michael Naumann [EMAIL PROTECTED]: Do you have :set hidden If not, you should. HTH, Michael On Friday 30 June 2006 11:59, Thomas Michael Engelke wrote: Hello! I'm not sure if it was always the case or if this is a recent change (through vim 7). I am not able to undo anything after saving a file. Is this normal? What settings are involved? How can I change this behaviour? The help-file for undo is pretty silent regarding this. I'm not sure if I made my problem perfectly clear. I have a file. I edit it, deleting a line. I can then u and Ctrl-R these changes to no end. I undo once and redo once, ending up with the original file. I use :w to save the buffer. I use u and get the message Bereits bei der ältesten Änderung (rougly: Already at oldest change). Edit: Amazing. Restarting vim did the trick. I'll keep my eyes open for another occurence. Problem solved. Regards, Thomas Engelke -- GPG-Key: tengelke.de/thomas_michael_engelke.asc
Re: Possible bug in window placement after changing buffers
--- A.J.Mechelynck [EMAIL PROTECTED] wrote: Thomas Mellman wrote: When moving from buffer to buffer using the :bp and :bn commands, vim normally positions the file and cursor such that the last line visited is presented in the middle of the screen and the cursor is on that line. In certain circumstances, however, it does not do this. In those circumstances, when one opens the file, the cursor is indeed placed on the last line visited - but that line is positioned at the bottom of the window. This apparently only happens when syntax is on - but for all (tested) syntaxes. Now, in particular, this happens if the cursor is positioned on the line of the file that falls within a range starting at the window height. The extent of this range appears to be a function of the file length - for example, in one case, the window height is 70 lines. The range causing the problem starts at line 70 of the file and - for very long files - extents to line 104. When the cursor is place on line 105, moving into the buffer causes the last line to be positioned in the middle of the window. When the cursor is placed on line 104, reentering the buffer puts the line at the bottom of the window. In this particular case, if the file is longer than 104 lines but shorter than 139 lines, the event happens anywhere after line 69 - but note that only lines 35-104 would be required to display line 70 in the middle of the window. See :help 'scrolloff'. Setting 'scrolloff' to a large number (large enough to always be larger than half the value of 'lines') will always keep the cursor line near the middle of the screen, except when it is in the very first or last few lines of the file (e.g., the first line of the file will never start lower than the first line of the window). This method seems to change the behaviour of the cursor so that cursor stays in middle of the screen and the file moves. That's something different. What I'm seeing is clearly a bug, because vim behaves in a non-logical manner. There's some problem with the positioning algorithm with respect to window and file boundaries. There's no reason for the cursor to dive to the bottom of the window in certain positional situations and not in others. Now, it's clear - if there's not enough lines to position the cursor in the center of the screen, it would be logical that the line couldn't be positioned in the middle. But that's not the problem. The problem happens when there *are* enough lines. You could also use z. (zed-fullstop or zee-period depending on your flavour of English) in Normal mode, to move just once the cursor line to the middle. Ah, what do you mean with just once? That's exactly the problem: I have to z. everytime I visit the file. If I'm comparing a pivot spot in 5 files (the source code, the data output, the include file definition, the specification document, and my notes file, for example), certain files - at certain positions - will have to be z.-ed every time they're revisited. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Possible bug in window placement after changing buffers
When moving from buffer to buffer using the :bp and :bn commands, vim normally positions the file and cursor such that the last line visited is presented in the middle of the screen and the cursor is on that line. In certain circumstances, however, it does not do this. In those circumstances, when one opens the file, the cursor is indeed placed on the last line visited - but that line is positioned at the bottom of the window. This apparently only happens when syntax is on - but for all (tested) syntaxes. Now, in particular, this happens if the cursor is positioned on the line of the file that falls within a range starting at the window height. The extent of this range appears to be a function of the file length - for example, in one case, the window height is 70 lines. The range causing the problem starts at line 70 of the file and - for very long files - extents to line 104. When the cursor is place on line 105, moving into the buffer causes the last line to be positioned in the middle of the window. When the cursor is placed on line 104, reentering the buffer puts the line at the bottom of the window. In this particular case, if the file is longer than 104 lines but shorter than 139 lines, the event happens anywhere after line 69 - but note that only lines 35-104 would be required to display line 70 in the middle of the window. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
[FAO]: Tim Chase: :g/^/+,/^[EMAIL PROTECTED]/-1! par 72q (formatting email).
Hello All, (Tim -- apologise for the broadcast announcement, but you were the original person who gave me this solution). Some time ago, I asked a question on this list about reformatting lines of text (lines in an email reply). Tim Chase was kind enough to give me a rather thorough break-down which I published in the Linux Gazette (http://linuxgazette.net/108/tag/1.html). The idea behind it was to reformat all lines that started with to a width of 72 characters, and for any split lines that occured once that had been done, to add a at the start of the line. Indeed, from that I came up with this: :g/^/+,/^[EMAIL PROTECTED]/-1! par 72q Which works fine -- almost. The one niggle I have with it is that if an email I am replying to has a shell-script snippet (example as it appears in an email I am replying to): `` #!/bin/sh some_command other_command '' What happens in the email after formatting is I see this: ``#!/bin/sh some_command other_command '' I don't want this, since I have to then go through the block by hand and undo it -- it's especially annoying since the formatting of things like code-snippets when you need to critique them is important. Of course, I assume this to be the correct behaviour for the command that's formatting this -- and it _is_ doing what it has been asked. But I don't understand why it happens for the example above (and other examples). I'd have expected it to happen for ALL lines in an email, i.e.: some text other text more text But that's not the case (luckily). So my question is, what is it about the command: :g/^/+,/^[EMAIL PROTECTED]/-1! par 72q Which causes this to happen? I've tried changing it but the result is always the same. Many thanks in advance for any hints you might be able to provide. -- Thomas Adam ___ All new Yahoo! Mail The new Interface is stunning in its simplicity and ease of use. - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html
Re: Tim Chase: :g/^/+,/^[EMAIL PROTECTED]/-1! par 72q (formatting email).
--- Tim Chase [EMAIL PROTECTED] wrote: As to why it does correctly handle quoting, par was built to handle such cases, so it gracefully considers leader characters. By default, I believe par considers whitespace, a and the pipe character as its default set of leader characters that it will treat in a similar fashion. Ah. I might have read something like this in par's somewhat limited documentation. Although I freely admit that I find par very confusing indeed, even though it is very useful for tasks such as this. The par utility is a rather complex tool with piles of nobs and dials for the twiddling. In most cases, the default does what is wanted. However, I don't believe there's any intelligent way for it to detect scripts within quoted text. I thought as much. What I might do is (as you say) look at trying to see if there are any markers which define where the shell-code is and change the regexps. I know of two cases where this is likely to be the case, so I'll keep you posted. To see what's going on, simply write an excerpt of a quoted script to a file and simply run it through par, as Vim is doing for each block in question. You'll notice that par is what is doing the mangling. For just reformatting purpose, it's conceivable to use vim's internal reformatting--however, it too lacks the superpowers to discern code from non-code in a quotation. I should point out that it's not just shell code that exhibits this problem -- but you're right -- it's most likely par treating various leaders characters. The short answer, sadly, is I'm afraid there's no nice way to do this. No worries, I'll just have to convert it back by hand. :) Thank you as always, Tim. Thomas. ___ All new Yahoo! Mail The new Interface is stunning in its simplicity and ease of use. - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html
Re: Comments/Additional Notes for scripts
The comments section for vimtips is not very reliable (who goes back every day to see if his tips have got a new comment added to them?). Since vim-online scripts (unlike tips) require logging in, if you have a comment you can email the maintainer. A forum that generates an rss feed for new postings for tips comments discussion could turn out to be useful. As the vim site is hosted by sf.net, one (i.e. one of the vim project developers) could, for a start, create a forum for scripts and tips and maybe allow anonymous posting -- although sf.net forums have some minor usability issues. I think people usually write plugin authors only when the plugin stops working. With new/unknown plugins, I assume the decision would rather be to uninstall the plugin. An anonymous forum would probably lower the threshold to give feedback -- if this really is what you want :-).
Re: VIM: map seq.s must be typed slowly
I have discovered some interesting additional information about this problem: - The problem occurs with my mappings, e.g.: :map ]v * :map ]t ^t etc. - The problem does NOT occur with the following mappings: :map aa * :map )V * I can type this as fast as I want and it jumps to the next occurance of the word under the cursor I tried turning off showmatch, but it didn't help. Is there something special about [ and ]? I'm currently runnig version 6.3.84 --- Thomas Mellman [EMAIL PROTECTED] wrote: After upgrading to a new version of VIM a while back, I have now to type key-sequences slowly, or I get a visual bell (and no sequence recognized). Does anybody know what changed to cause this, and how I can turn it off? For example, I use the '[' and ']' keys to introduce various shortcuts (e.g. ]v and [v find the next or previous occurance of the word under the cursor). But now I have to always wait 500ms - 1000ms or my sequence is aborted. I looked at timeout and ttimeout, but they seem to be for the opposite case - making sure that VIM waits for the typist before attempting to interpret. I can't discern an effect on typing too fast . I can't see why there should be a problem if the keys are already sitting in the buffer. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: URL-Encoding
Johannes Schwarz wrote: Is there a builtin url-encoding function available in vim? Or has s.o. wrote a script already? Do you mean something like this (based on code from eval.txt): fun! EncodeChar(char) if a:char == '%' return '%%' elseif a:char == ' ' return '+' else Taken from eval.txt let n = char2nr(a:char) let r = '' while n let r = '0123456789ABCDEF'[n % 16] . r let n = n / 16 endwhile return '%'. r endif endf fun! EncodeURL(url) return substitute(a:url, '\([^a-zA-Z0-9_.-]\)', '\=EncodeChar(submatch(1))', 'g') endf Cheers, Thomas.
E108: No such variable: b:current_syntax
I had been getting this error (or something very similar) for a while now when editing PHP files, but now I'm also getting it when editing Cheetah templates. - Error detected while processing /usr/share/vim/vim70/syntax/html.vim: line 200: E108: No such variable: b:current_syntax - Is it a bug in the syntax file? Is there something strange about my configuration that could be triggering this? I've been hacking up the /usr/share/.../html.vim file to make it check for the existence of that variable before it unlets it, but obviously, that gets changed back every time I upgrade vim. I'd like to find a more permanent fix. -- Tom Schumm http://www.phong.org/
vim7: vimball (was: vim7: formatoptions)
Please try the netrw v100j from my website: http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs , see Network Oriented Reading, Writing, and Browsing. May I ask: Does vimball provide a way to uninstall a vimball? If not, maybe a vimball's contents (or a list of the files created) should be saved in, e.g., ~/.vim/vimballs/NAME.lst so that one could at least feed this file to rm afterwards as in: rm `cat LST`. A :VimballUninstall command would be helpful too. With more complex plugins, it could be necessary to uninstall a vimball before installing a new version in order to avoid zombie files. I think this would be helpful if vimballs gain ground and when temporarily installing plugins/vimballs that are actually part of the vim standard distribution. Also, this would allow to get a quick overview over installed vimballs (:!ls ~/.vim/vimballs/*.lst). Regards, Thomas.
vim7: formatoptions
Hi, I just realized that editing a directory removes t from formatoptions. E.g. set formatoptions+=rw fo = tcqrw e Foo fo = tcqrw e . fo = cqrw e Bar fo = cqrw This doesn't happen with the --noplugin switch so I'd assume that some standard vim plugin is causing this -- maybe netrw? Can somebody verify this? Regards, Thomas.
Patch for AsNeeded to define proxy commands
Hi, Here is a small patch for AsNeeded that eliminates the need to call AN(X) for commands. It creates a file called ~/.vim/AsNeeded/ANautoload that contains lines like: command! -range -nargs=* Command delcommand Command | ANX Command Regards, Thomas. --- AsNeeded.vim2006-05-10 20:48:42.442003200 +0200 +++ /cygdrive/f/.vim/plugin/AsNeeded.vim2006-05-10 20:45:13.381388800 +0200 @@ -227,6 +227,14 @@ return -1 endfun +fun! SIDAutoloadFilename(vimfiles) +return substitute(a:vimfiles,'AsNeeded.*','AsNeeded/ANautoload','e') +endf + +fun! SIDVimfiles() +return substitute(globpath(rtp,AsNeeded/*.vim),'\n',',',ge) +endf + - MakeANtags: makes the (optional) ANtags file {{{1 fun! MakeANtags() @@ -265,8 +273,9 @@ - search for all commands, maps, and functions: {{{2 - - let vimfiles= substitute(globpath(rtp,AsNeeded/*.vim),'\n',',',ge) + let vimfiles= SIDVimfiles() let ANtags = substitute(vimfiles,'AsNeeded.*','AsNeeded/ANtags','e') + let ANautoloads = SIDAutoloadFilename(vimfiles) let first = 1 call Decho(ANtags.ANtags.) @@ -323,7 +332,12 @@ let vimfile= endwhile + exec 'silent edit '. ANtags + silent v/^c\t/d + silent %s/^c\t\(.\{-}\)\t.*$/command! -range -nargs=* \1 delcommand \1 | ANX \1/ + exe 'silent w! '. ANautoloads q! + exec 'silent source '. ANautoloads -- restore registers and settings {{{2 @@ -336,6 +350,11 @@ call Dret(MakeANtags) endfun +let s:autoloads = SIDAutoloadFilename(SIDVimfiles()) +if filereadable(s:autoloads) +exec 'silent source '. s:autoloads +endif + - SaveSettings: {{{1 fun! s:SaveSettings()
Behavior of synIDattr() varies
Hi, Vims excellent script support just asks to be exploited, and I am in the process of putting 2html.vim to use. I have been getting different results from this script, which I've tracked down to synIDattr() returning different attribute values for given syntax IDs depending upon the environment from which vim is called. Calling /usr/bin/vim -e +syntax on +set syntax=c +run! syntax/2html.vim +wq +q /tmp/helloworld.c from the command line results in a different HTML file than calling it via a system call from within mod_perl. In particular synIDattr() doesn't return 1 anymore for the attribute bold and for the fg attribute it maps to different cterm colors, even two different colors to the same cterm color which weakens the highlighting effect. This is not a switch from 8 cterm colors to 16 or vice versa, both work with 8 colors. I realize that this may possibly need to be fixed in mod_perl and not vim, but at this stage I'm just fishing for pointers what might cause synIDattr() to behave differently. I've verified this behavior in vim 6.3 and the latest 7.0 beta. Any ideas? Thomas
Re: Symbolic links to Vim plugins not working for Cygwin
Windows shortcuts are different things than cygwin symlinks. There is an option though to make cygwin symlinks be windows shortcuts but these need some attribute (R I think) to be set. I don't know if this help in this situation though. Thomas.
Re: VIM: map seq.s must be typed slowly
--- Yegappan Lakshmanan [EMAIL PROTECTED] wrote: Hello, On 4/22/06, Thomas Mellman [EMAIL PROTECTED] wrote: For example, I use the '[' and ']' keys to introduce various shortcuts (e.g. ]v and [v find the next or previous occurance of the word under the cursor). You can use * to search forward for word under cursor and # to search backward for word under cursor. Thank you. In fact, that's what my sequences map to. It's just that I find that I can type [v and ]v faster then I can type the # and * (which are shifted on a US keyboard). Too fast, I'm afraid. But that's new (within the last year). I've been using those mappings for many years. - Yegappan __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: ruby-script editing, execution cycle ?
--- Meino Christian Cramer [EMAIL PROTECTED] wrote: Write a ruby script (not related to vim itsself) in vim, then evetually save the script to a file, execute the script with ruby interpreter while getting the output (stdout + stderr) into another vim buffer, fix the bugs in the script, save the script eventually and so forth... :h quickfix This effectively evaluates your program, and informs you of any errors. However, you might find the following post of use. I sent this to the vim-ruby mailing list: http://rubyforge.org/pipermail/vim-ruby-devel/2006q1/000459.html It explains some useful evaluative techniques that I use. -- Thomas Adam ___ Yahoo! Photos NEW, now offering a quality print service from just 7p a photo http://uk.photos.yahoo.com