Re: how to replace ESC to some other key?
map something to , and it will insert a real tab character for you. for example: inoremap will map F6 for you, replace it with anything you want. I always need such a map, since I've set 'expandtab' all the time. -- Sincerely, Pan, Shi Zhu. ext: 2606 wangxu <[EMAIL PROTECTED]> 写于 2007-04-11 23:16:08: > That's a very good tip: ) > I also wanna know how to insert a "Tab" when I editing files like > /etc/hosts? > Can I? > > [EMAIL PROTECTED] wrote: > > wangxu <[EMAIL PROTECTED]> 写于 2007-04-05 21:08:43: > > > >> but in this situation,is there any way to auto-indent *.py? > >> > >> > > > > << is "decrease indent" (hold on Shift, then '<' twice) > > >> is "increase indent" > > You can use << or >> command in Normal mode and Visual mode. which is as > > good as, if no better than, the key. > > > > -- > > Sincerely, Pan, Shi Zhu. ext: 2606 >
Re: Using variables in syntax definitions
On 4/10/07, Peter Hodge <[EMAIL PROTECTED]> wrote: Hello, You'll probably need to use 'execute': execute 'syn match myPattern' s:mypattern but again, highlighting won't work for you then. I see what you're talking about in the syntax files like rst, c, sql, and gdb. I wonder how hard it would be to modify the vim.vim syntax file to highlight just that construct, e.g. execute 'syn...'. --- Ian Tegebo <[EMAIL PROTECTED]> wrote: > Is doesn't seem possible to store my patterns in variables for use in syntax > definitions like the following: > > let s:mypattern = '#.*' > syn match myPattern s:mypattern > > I get 'pattern delimiter not found' and what not. Is there a way to achieve > this? > > The general "problem" I'm trying to solve is having to update patterns in > syntax files when they're used in multiple places and to reduce the line > length of syntax definitions; I've tried using line continuations but > highlighting in the definition file itself seems to fail in this case. > > -- > Ian Tegebo > Send instant messages to your online friends http://au.messenger.yahoo.com -- Ian Tegebo
Re: how to replace ESC to some other key?
On 4/11/07, wangxu <[EMAIL PROTECTED]> wrote: That's a very good tip: ) I also wanna know how to insert a "Tab" when I editing files like /etc/hosts? Can I? What I did for indenting is I usually use space to replace the TAB with the following settings: set expandtab set tabstop=4 But if I indeed need a realy TAB, I press "CTRL+V TAB" to get one. This may be not what you want, because I didn't go through the whole thread. Anyway, hope that helps a bit. :) -- Best, Zhaojun (Joseph) [EMAIL PROTECTED] wrote: > wangxu <[EMAIL PROTECTED]> 写于 2007-04-05 21:08:43: > >> but in this situation,is there any way to auto-indent *.py? >> >> > > << is "decrease indent" (hold on Shift, then '<' twice) > >> is "increase indent" > You can use << or >> command in Normal mode and Visual mode. which is as > good as, if no better than, the key. > > -- > Sincerely, Pan, Shi Zhu. ext: 2606
Re: how to replace ESC to some other key?
That's a very good tip: ) I also wanna know how to insert a "Tab" when I editing files like /etc/hosts? Can I? [EMAIL PROTECTED] wrote: > wangxu <[EMAIL PROTECTED]> 写于 2007-04-05 21:08:43: > >> but in this situation,is there any way to auto-indent *.py? >> >> > > << is "decrease indent" (hold on Shift, then '<' twice) > >> is "increase indent" > You can use << or >> command in Normal mode and Visual mode. which is as > good as, if no better than, the key. > > -- > Sincerely, Pan, Shi Zhu. ext: 2606
Re: Using variables in syntax definitions
Hello, You'll probably need to use 'execute': execute 'syn match myPattern' s:mypattern but again, highlighting won't work for you then. regards, Peter --- Ian Tegebo <[EMAIL PROTECTED]> wrote: > Is doesn't seem possible to store my patterns in variables for use in syntax > definitions like the following: > > let s:mypattern = '#.*' > syn match myPattern s:mypattern > > I get 'pattern delimiter not found' and what not. Is there a way to achieve > this? > > The general "problem" I'm trying to solve is having to update patterns in > syntax files when they're used in multiple places and to reduce the line > length of syntax definitions; I've tried using line continuations but > highlighting in the definition file itself seems to fail in this case. > > -- > Ian Tegebo > Send instant messages to your online friends http://au.messenger.yahoo.com
Using variables in syntax definitions
Is doesn't seem possible to store my patterns in variables for use in syntax definitions like the following: let s:mypattern = '#.*' syn match myPattern s:mypattern I get 'pattern delimiter not found' and what not. Is there a way to achieve this? The general "problem" I'm trying to solve is having to update patterns in syntax files when they're used in multiple places and to reduce the line length of syntax definitions; I've tried using line continuations but highlighting in the definition file itself seems to fail in this case. -- Ian Tegebo
remote-silent and stdin
I am trying to do something to the effect of ls | gvim - --remote-client. or ls | gvim --remote-client - However, vi sees the - as a file name and opens a new filename. Is there way to open the stdin output on a gvim server? Thanks Mahesh
Re: Help on search and replace
Dudley Fox wrote: Hello Vim List, I have used vim for a while, and though no expert I am fairly comfortable with the common commands. Recently I ran into a situation where I just couldn't find a way to do a search and replace. I was hoping some of you experts could help me out. Starting text: nameTable[pattern with spaces0] = ("pattern with spaces0", 12345) nameTable[pattern with spaces1] = ("pattern with spaces1", 67890) nameTable[pattern with spaces2] = ("pattern with spaces2", 243) nameTable[pattern with spaces3] = ("pattern with spaces3", 421) nameTable[pattern with spaces4] = ("pattern with spaces4", 3455) nameTable[pattern with spaces5] = ("pattern with spaces5", ) Desired Text: nameTable[patternwithspaces0] = ("pattern with spaces0", 12345) nameTable[patternwithspaces1] = ("pattern with spaces1", 67890) nameTable[patternwithspaces2] = ("pattern with spaces2", 243) nameTable[patternwithspaces3] = ("pattern with spaces3", 421) nameTable[patternwithspaces4] = ("pattern with spaces4", 3455) nameTable[patternwithspaces5] = ("pattern with spaces5", ) Notice that the only difference is that the spaces are removed from the pattern in between the square brackets. I think I want to use \zs and \ze, but I couldn't wrap my head around the syntax. Any help would be appreciated. In addition to the various regexp solutions you've been given: if what you want done is actually contiguous linewise as shown, then vis.vim makes it fairly straightforward (http://mysite.verizon.net/astronaut/vim/index.html#VIS or http://vim.sourceforge.net/scripts/script.php?script_id=1195): select pattern with spaces0 ... pattern with spaces5 using ctrl-v and motion. :B s/ //g Regards, Chip Campbell
Re: copy pasting HTML code into vim
On 4/10/07, Jürgen Krämer <[EMAIL PROTECTED]> wrote: Hi, me wrote: > > actually, the selected HTML code might be available from the clipboard. > E.g., both Firefox and Internet Explorer put it there in multiple > formats. The following are lists of the available formats after copying > from FF and IE, respectively: > > 49161: DataObject > 49422: text/html > 49366: HTML Format > 49776: text/_moz_htmlcontext > 49778: text/_moz_htmlinfo > 13: CF_UNICODETEXT > 1: CF_TEXT > 49171: Ole Private Data > 16: CF_LOCALE > 7: CF_OEMTEXT > > 49161: DataObject > 1: CF_TEXT > 13: CF_UNICODETEXT > 49366: HTML Format > 49330: Rich Text Format > 49171: Ole Private Data > 16: CF_LOCALE > 7: CF_OEMTEXT > > The formats starting with CF_ are pre-defined clipboard formats, the > remaining ones are registered through Windows' RegisterClipboardFormat() > function. I don't know how widely understood they are, but at least > Microsoft Word is able to render headlines and other HTML-formatting > instructions when text copied from Firefox is pasted into a document. > It seems, the clipboard object associated with "HTML Format" contains > enough information for correct rendering. > > A different point is how to access the HTML content in VIM. I doubt it > would be a good idea to always paste the HTML source when accessing the > clipboard through the + or * register. Probably a "pasteclipboard()" > function which takes an argument for determining the preferred format > would be a better way. This function function could then be used inside > a mapping whenever a VIM user wants to paste the original HTML source. sorry, I forgot to mention explicitly that this is totally Microsoft Windows-centric. But I think other OSs might also support multiple formats on the clipboard. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) Yeah, I know it is somehow available in linux, even though most of the time it drives me crazy. I will copy paste a bunch of stuff into OO and it will format it all the way it was on the site. I'll bet that this could be done with a vim plugin that used a small external tool to get the html data copied. I assume external because I don't know how you could use vim to get at that information, but with C/C++ or even some scripting language it could probably be done. -fREW
Re: How to recognize a single line via regexs
how can I identify a single line no longer than e.g. 60 characters preceded and followed by a blank line via regexs. This way I want to identify section headings. What I did was mark every blank line with %s/^$/>>>/ and than chomp the CR %s/\n//g and if the text between the >>>'s isn't longer than 60 characters put it into \section{}, and replace every >>> with \r\r. But in larger files this takes a while. Is there a smarter solution to the problem? You might try: /^\s*\n\zs.\{1,60}\ze\n\s*$ /^\n\zs.\{1,60}\ze\n$ which should find what you describe (the former allows a "blank" line to contain whitespace while the latter looks for a truely "blank" line with zero whitespace). It breaks down as ^ the start of line \s*(the optional whitespace, as described) \n a newline \zstreat this as the beginning of the match .\{1,60} 1-60 non-newline characters \zeyou could optionally use this here to treat this as the end of the match \n another newline \s*(more optional whitespace, as described) $ the end of a line The above regexp(s) (with or without the "\s*" or the "\ze") can also be used in ":s" commands to do things like :%s/^\s*\n\zs.\{1,60}\ze\n\s*$/\U& to uppercase all your titles, or :%s/^\s*\n\zs.\{1,60}\ze\n\s*$/\=submatch(0)."\n".substitute(submatch(0), '.', '=', 'g') which will underline all your hits with a row of "=" the same length as your section-title. Just a few ideas, -tim
Re: How to recognize a single line via regexs
Informationen wrote: Hi, how can I identify a single line no longer than e.g. 60 characters preceded and followed by a blank line via regexs. This way I want to identify section headings. What I did was mark every blank line with %s/^$/>>>/ and than chomp the CR %s/\n//g and if the text between the >>>'s isn't longer than 60 characters put it into \section{}, and replace every >>> with \r\r. But in larger files this takes a while. Is there a smarter solution to the problem? The following regexp will do the match: ^\n\zs.\{1,60}\ze\n$ ^ beginning of line \n newline \zs pattern really starts here (but must be precededed by the foregoing) .\{1,60} one to sixty characters \ze pattern really ends here (but must be followed by the trailing pattern) \n newline $ end-of-line Please read: :help regexp for (much) more. Regards, Chip Campbell
How to recognize a single line via regexs
Hi, how can I identify a single line no longer than e.g. 60 characters preceded and followed by a blank line via regexs. This way I want to identify section headings. What I did was mark every blank line with >>> %s/^$/>>>/ and than chomp the CR %s/\n//g and if the text >>> between the >>>'s isn't longer than 60 characters put it into >>> \section{}, and replace every >>> with \r\r. But in larger files this takes a while. Is there a smarter solution to the problem? Thanks in advance Chris
Re: Fwd: Perl colour coding bug
Jon Combe wrote: The following snippet of code, when saved with a ".pl" file extension breaks the colour coding in Vim #!/usr/bin/perl -w my $surname = "ABC-DEF GHI"; @split = split ( / |-|\/|\"/ , $surname , -1 ); foreach ( @split ) { print "$_\n"; } The lines after the split (that contains a regular expression) are highlighted as if they are within a double quoted string. The colour coding is being confused by the " character in the regular expression and thinks (incorrectly) that it marks the start of a string. Is it possible to fix this problem? For example the "foreach" text should appear in yellow. The maintainer for perl is: Nick Hibma ; he's the appropriate contact for this sort of thing. I found his name in vim70/syntax/perl.vim; syntax file maintainers generally put their contact information in the syntax file they maintain. Regards, Chip Campbell
Re: CTRL+gf new tab position
Ralf, I use shift-control-g to open the file under the cursor in a new tab, placing the new tab at the end of the tablist thusly: map gf:tabm 999 Oddly enough, this mapping also takes over plain old control-g, which is fine for me. When I'm editing JSP files that have lots of includes, it helps me be SO much more productive than my poor work-mates scrolling and scrolling through 100s of similarly-named files with Dreamweaver or whatever. Dave On Apr 10, 2007, at 6:05 AM, Ralf Schmitt wrote: Hi, I often use CTRL-gf to open the word under cursor in a new tab page. This opens a new tab for the file at tab pos 0. Is it possible to control at which position CTRL-gf opens the new tab? I tried it with an autocommand on event "TabEnter" but that also triggers when I change into a already present tab. Any suggestions? regards Ralf
Fwd: Perl colour coding bug
The following snippet of code, when saved with a ".pl" file extension breaks the colour coding in Vim #!/usr/bin/perl -w my $surname = "ABC-DEF GHI"; @split = split ( / |-|\/|\"/ , $surname , -1 ); foreach ( @split ) { print "$_\n"; } The lines after the split (that contains a regular expression) are highlighted as if they are within a double quoted string. The colour coding is being confused by the " character in the regular expression and thinks (incorrectly) that it marks the start of a string. Is it possible to fix this problem? For example the "foreach" text should appear in yellow. Thanks. Jon.
Re: Basic question, CTRL+Wh on Gvim, Win XP
On 10/04/07, Tim Chase <[EMAIL PROTECTED]> wrote: The comma does a reverse-search of the last thing you searched for using t/T/f/F which many folks don't use (so they use it for leader), but I use regularly. Yes, have seen , used as leader before. Will look at the other usage though, as it is not something I've encountered. The forward slash does searching...something used quite regularly. I meant backslash there, should be more careful. Cheers S
Re: Basic question, CTRL+Wh on Gvim, Win XP
In general, the safest keys to use for the {lhs} (left-hand side) of mappings are the F keys. Almost everything else already has a function in Vim. Among Worth knowing. Thanks. What about when using a leader such as "," or "/" ? The comma does a reverse-search of the last thing you searched for using t/T/f/F which many folks don't use (so they use it for leader), but I use regularly. :help , :help ; The forward slash does searching...something used quite regularly. :help / I think the only key that isn't reserved (in that Vim doesn't already have meaning assigned to it) is the backslash, which is what the leader defaults to (so in a way, it is used...but only for the purpose you describe). I tend to use the default backslash as my leader (on those rare occasions I use the leader) because I know it's available and it's vim-portable. One other candidate might be the underscore, though it's a shifted key which makes it a little more difficult, it is usually in a pretty predictable place (unlike the backslash/pipe key which I find all over the keyboard depending on whose machine I'm using...makes typing DOS file-paths a pain). Just my $0.02 -tim
Re: use variable in substitute
Can I use variable in pattern of substitute() in script? let row = getline(j) " 'trallala' let rownext = getline(j+1) " 'bimbam' let row = substitute(row, "^\\\(.*\\\)$", "\\1 rownext", "g") " 'trallala bimbam' "yes" is the short answer, though you have to 1) concat it (if there's something to which it must be added...i.e. it must not be within a string) and 2) escape it if there are any metachars in it...something like let row=substitute(row, '$', ' '.escape(rownext, '\\*.'), 'g') If you use the single quotes rather than the double-quotes, you'll have less backslash escaping to do. This doesn't actually change the line in your document. You can do that, however, by doing something like :s/$/\=' '.getline(line('.')+1) This can be handily combined with a :g command to do things like :g/regexp/s/$/\=' '.getline(line('.')+1) which will find every line containing "regexp" and append a space in addition to a copy of the following line. If you just want to join the two lines, you can just use the "J" command...or if you want to join the two variables, you can just concat them: let row = row.' '.rownext but your example may have been a simplified version of things for which this wouldn't work. You can read more at :help expr :help sub-replace-\= :help J :help expr-. Just a few ideas...HTH, -tim
Re: use variable in substitute
Great! Thank you! let row = substitute(row, "^\\\(.*\\\)$", "\\1 " . rownext, "g") Yakov
CTRL+gf new tab position
Hi, I often use CTRL-gf to open the word under cursor in a new tab page. This opens a new tab for the file at tab pos 0. Is it possible to control at which position CTRL-gf opens the new tab? I tried it with an autocommand on event "TabEnter" but that also triggers when I change into a already present tab. Any suggestions? regards Ralf
Re: use variable in substitute
On 4/10/07, Horvath Adam <[EMAIL PROTECTED]> wrote: Hi, One question again for me. Can I use variable in pattern of substitute() in script? let row = getline(j) " 'trallala' let rownext = getline(j+1) " 'bimbam' let row = substitute(row, "^\\\(.*\\\)$", "\\1 rownext", "g") " let row = substitute(row, "^\\\(.*\\\)$", "\\1 " . rownext, "g") Yakov
use variable in substitute
Hi, One question again for me. Can I use variable in pattern of substitute() in script? let row = getline(j) " 'trallala' let rownext = getline(j+1) " 'bimbam' let row = substitute(row, "^\\\(.*\\\)$", "\\1 rownext", "g") " 'trallala bimbam' Thanks, b. r. Aruna
Re: Basic question, CTRL+Wh on Gvim, Win XP
On 10/04/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: In general, the safest keys to use for the {lhs} (left-hand side) of mappings are the F keys. Almost everything else already has a function in Vim. Among Worth knowing. Thanks. What about when using a leader such as "," or "/" ? "Hit any key to continue" is a lie. lol S
Re: Basic question, CTRL+Wh on Gvim, Win XP
Samuel Wright wrote: Guys, Thanks for the response! Albie, yes I was talking about split windows. not vim tabs or windows apps... Tony, thanks for reminding me of :map to check what a mapping does. Yes, it was mapped in an obscure corner of my vimrc, that will teach me to cut and paste 'useful' stuff into my vimrc without checking it out completely first. The :wincmd also worked fine, so I could conceivable remap that if I wanted... THANKS! S In general, the safest keys to use for the {lhs} (left-hand side) of mappings are the F keys. Almost everything else already has a function in Vim. Among the F keys, F1 is equivalent to ":help" and F10 is used by some OSes as a synonym of Alt-Space, but the rest you can use -- if Vim sees them. (On my Linux system, the window manager preempts Ctrl-Fn and Alt-Fn so I'm mostly limited to Fn and Shift-Fn). Best regards, Tony. -- "Hit any key to continue" is a lie.
Re: Basic question, CTRL+Wh on Gvim, Win XP
Albie Janse van Rensburg wrote: Samuel Wright wrote: Hi All, On my gvim 7 running on Win Xp none of the following work to move to another window (I'm actually using the project plugin, but I don't think that's relevant).. CTRL-W *CTRL-W_* CTRL-W CTRL-H*CTRL-W_CTRL-H* CTRL-W *CTRL-W_* *CTRL-W_h* CTRL-W hMove cursor to Nth window left of current one. Uses the cursor position to select between alternatives. If this intended behaviour for Win Xp, or have I enabled this somewhere? I have behave mswin turned off. Just checking - You do realize that in Vim-speak, a "window" is a section of the current tab, right? As in, if you open Vim and enter :split you end up with 2 Vim "windows". To switch to another Windows "windows", you will have to use ALT-Tab as for all applications. ...and in addition, to move sideways between Vim "windows" (which in MS-Windows terminology would be called "panes"), you must first have used ":vsplit" (or ":vertical split", ":vertical help", ":vertical diffsplit", etc.). When I was on XP, all those commands worked perfectly for me. Check :map (where is five separate keypresses) to see if you haven't remapped Crl-W. Even if you have, though, :wincmd h should do the same as Ctrl-W h Best regards, Tony. -- "Life would be much simpler and things would get done much faster if it weren't for other people" -- Blore
Re: Basic question, CTRL+Wh on Gvim, Win XP
Samuel Wright wrote: Hi All, On my gvim 7 running on Win Xp none of the following work to move to another window (I'm actually using the project plugin, but I don't think that's relevant).. CTRL-W *CTRL-W_* CTRL-W CTRL-H*CTRL-W_CTRL-H* CTRL-W *CTRL-W_* *CTRL-W_h* CTRL-W hMove cursor to Nth window left of current one. Uses the cursor position to select between alternatives. If this intended behaviour for Win Xp, or have I enabled this somewhere? I have behave mswin turned off. Just checking - You do realize that in Vim-speak, a "window" is a section of the current tab, right? As in, if you open Vim and enter :split you end up with 2 Vim "windows". To switch to another Windows "windows", you will have to use ALT-Tab as for all applications. -- [Maturity consists in the discovery that] there comes a critical moment where everything is reversed, after which the point becomes to understand more and more that there is something which cannot be understood. -- S. Kierkegaard
Basic question, CTRL+Wh on Gvim, Win XP
Hi All, On my gvim 7 running on Win Xp none of the following work to move to another window (I'm actually using the project plugin, but I don't think that's relevant).. CTRL-W *CTRL-W_* CTRL-W CTRL-H *CTRL-W_CTRL-H* CTRL-W*CTRL-W_* *CTRL-W_h* CTRL-W hMove cursor to Nth window left of current one. Uses the cursor position to select between alternatives. If this intended behaviour for Win Xp, or have I enabled this somewhere? I have behave mswin turned off. Thanks Sam
Re: Vim freezes system ?!
On 4/10/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: Zdenek Sekera wrote: > >> -Original Message- >> From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] >> Sent: 10 April 2007 09:10 >> To: Zdenek Sekera >> Cc: Yakov Lerner; vim@vim.org; Meino Christian Cramer; Bram Moolenaar >> Subject: Re: Vim freezes system ?! >> >> Zdenek Sekera wrote: >> [...] >>> Just to add more to the confusion, on my box (RedHat Enterprise >> Linux, >>> 512Mb Ram) I have >>> >>> maxmapdepth=1000 >>> maxmempattern=1000 >>> maxmem=257676 >>> maxmemtot=257676 >>> >>> Which tells me the last two can hardly be in kb and all over I don't >>> understand what really they mean. >>> >>> ---Zdenek >>> >>> >> According to the help, they _are_ in KB and can reach up to two million >> (i.e., >> 2 gig). I sure wonder according to what Vim sets themat startup. >> >> Why do you think they can't be in KB? The above would mean slightly >> over 256 >> meg, which sounds "reasonable" for a 512MB box (more reasonable at >> least, than >> the "249 K" which I see). > > Arrgh, I guess the batteries in my mental calculator are flat after > Easter vac :-). > But what do these numbers really mean? You are right that mine look > more acceptable than yours. Yours are really strange. > > ---Zdenek Maybe there has been an arithmetic wraparound in my case? I have 2 gig of RAM installed, which is slightly /more/ than 2 million KB. I tried it on the machine with 8GB of RAM. The 'mmt' values are 1024. By the vimhelp, these values are in KB, as Tony said. Another strange thing is: these "low" values do not seem to have any effect on vim rmemory usage. Nor when they are "correct" (like 643272 on 1.3 G ram machine), neither when they are suspicously low (like 1024 on 8G ram machine). -- Yakov "look, these numbers are suspicously low" Lerner
Re: script boolean operators
Horvath Adam wrote: Thanks, it's really straightforward, but where is it in the manual? http://vimdoc.sourceforge.net/htmldoc/usr_41.html - here I can not find. see the help topic in my post of a few minutes ago. Rather than searching vimdoc, man or google, in Vim your first resource should be the online help. To learn how it works, open Vim and enter one of the following: :help :help :help :help {subject} :help :helpgrep In addition, ":help pattern" tries to find a subject corresponding to the pattern. Hit again for more possibilities. Or set 'wildmenu' and see them all on the bottom statusline (select by and , accept by , abort by ). Or replace by and see all possible completions at once. Best regards, Tony. -- Death is only a state of mind. Only it doesn't leave you much time to think about anything else.
Re: script boolean operators
Jürgen Krämer wrote: Hi, Horvath Adam wrote: I can not find (manual, list-archiv, google) how to use boolean operators (and, or) in script. I prefer this: if i>500 and i<1000 "boolean and" is written as "&&" and "boolean or" is written as "||". So your example becomes if i>500 && i<1000. One working solution: normal G let numberofrows = line(".") normal gg let i = 1 while i<=numberofrows if i>500 if i<1000 " do something endif endif let i += 1 endwhile Any other way? normal G let numberofrows = line(".") oh, and the above two statements can also be replaced by let numberofrows = line("$") normal gg let i = 1 while i<=numberofrows if i>500 && i<1000 " do something endif let i += 1 endwhile Regards, Jürgen Best regards, Tony. -- In Lexington, Kentucky, it's illegal to carry an ice cream cone in your pocket.
Re: script boolean operators
Horvath Adam wrote: Hi, I can not find (manual, list-archiv, google) how to use boolean operators (and, or) in script. I prefer this: if i>500 and i<1000 if (i > 500) && (i < 1000) The parentheses are not really necessary but I use them for clarity. see ":help expression-syntax" One working solution: normal G let numberofrows = line(".") normal gg let i = 1 while i<=numberofrows if i>500 if i<1000 " do something endif endif if (i > 500) && (i < 1000) " do something endif let i += 1 endwhile Any other way? Thanks, Aruna or in the exact case above, let nrows = line(".") let i = 501 while i <= min([999, nrows]) " do something let i += 1 endwhile let i = 1000 Best regards, Tony. -- "Hit any key to continue" is very confusing when you have two keyboards.
Re: script boolean operators
Thanks, it's really straightforward, but where is it in the manual? http://vimdoc.sourceforge.net/htmldoc/usr_41.html - here I can not find. while i<=numberofrows if i>500 && i<1000 " do something
Re: script boolean operators
Hi, Horvath Adam wrote: > > I can not find (manual, list-archiv, google) how to use boolean > operators (and, or) in script. > > I prefer this: > if i>500 and i<1000 "boolean and" is written as "&&" and "boolean or" is written as "||". So your example becomes if i>500 && i<1000. > One working solution: > > normal G > let numberofrows = line(".") > normal gg > let i = 1 > while i<=numberofrows > if i>500 > if i<1000 > " do something > endif > endif > let i += 1 > endwhile > > Any other way? normal G let numberofrows = line(".") normal gg let i = 1 while i<=numberofrows if i>500 && i<1000 " do something endif let i += 1 endwhile Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)
Re: copy pasting HTML code into vim
Hi, me wrote: > > actually, the selected HTML code might be available from the clipboard. > E.g., both Firefox and Internet Explorer put it there in multiple > formats. The following are lists of the available formats after copying > from FF and IE, respectively: > > 49161: DataObject > 49422: text/html > 49366: HTML Format > 49776: text/_moz_htmlcontext > 49778: text/_moz_htmlinfo > 13: CF_UNICODETEXT > 1: CF_TEXT > 49171: Ole Private Data > 16: CF_LOCALE > 7: CF_OEMTEXT > > 49161: DataObject > 1: CF_TEXT > 13: CF_UNICODETEXT > 49366: HTML Format > 49330: Rich Text Format > 49171: Ole Private Data > 16: CF_LOCALE > 7: CF_OEMTEXT > > The formats starting with CF_ are pre-defined clipboard formats, the > remaining ones are registered through Windows' RegisterClipboardFormat() > function. I don't know how widely understood they are, but at least > Microsoft Word is able to render headlines and other HTML-formatting > instructions when text copied from Firefox is pasted into a document. > It seems, the clipboard object associated with "HTML Format" contains > enough information for correct rendering. > > A different point is how to access the HTML content in VIM. I doubt it > would be a good idea to always paste the HTML source when accessing the > clipboard through the + or * register. Probably a "pasteclipboard()" > function which takes an argument for determining the preferred format > would be a better way. This function function could then be used inside > a mapping whenever a VIM user wants to paste the original HTML source. sorry, I forgot to mention explicitly that this is totally Microsoft Windows-centric. But I think other OSs might also support multiple formats on the clipboard. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)
script boolean operators
Hi, I can not find (manual, list-archiv, google) how to use boolean operators (and, or) in script. I prefer this: if i>500 and i<1000 One working solution: normal G let numberofrows = line(".") normal gg let i = 1 while i<=numberofrows if i>500 if i<1000 " do something endif endif let i += 1 endwhile Any other way? Thanks, Aruna
Re: copy pasting HTML code into vim
Hi, A.J.Mechelynck wrote: > > Kamaraju S Kusumanchi wrote: > > > > Let's say I open up a webpage, select some text and paste it into vim. Then > > all I see in vim is the text I see on the browser. While this is OK most of > > the times, sometimes I wish there is a way to paste the actual HTML code > > directly into the vim. > > > > Selecting "view source of the webpage" and then copy pasting into vim will > > work. But it is very cumbersome and time consuming. So this is not an > > option for me. > > > > Currently the editor in docs.google.com does what I need, Is there any way > > the same can be achieved by vim? > > Vim cannot get from the clipboard what isn't there: when you select text in a > browser (other than in View Source), what gets put onto the clipboard is the > text, not the source; IOW, the formatting tags aren't there. actually, the selected HTML code might be available from the clipboard. E.g., both Firefox and Internet Explorer put it there in multiple formats. The following are lists of the available formats after copying from FF and IE, respectively: 49161: DataObject 49422: text/html 49366: HTML Format 49776: text/_moz_htmlcontext 49778: text/_moz_htmlinfo 13: CF_UNICODETEXT 1: CF_TEXT 49171: Ole Private Data 16: CF_LOCALE 7: CF_OEMTEXT 49161: DataObject 1: CF_TEXT 13: CF_UNICODETEXT 49366: HTML Format 49330: Rich Text Format 49171: Ole Private Data 16: CF_LOCALE 7: CF_OEMTEXT The formats starting with CF_ are pre-defined clipboard formats, the remaining ones are registered through Windows' RegisterClipboardFormat() function. I don't know how widely understood they are, but at least Microsoft Word is able to render headlines and other HTML-formatting instructions when text copied from Firefox is pasted into a document. It seems, the clipboard object associated with "HTML Format" contains enough information for correct rendering. A different point is how to access the HTML content in VIM. I doubt it would be a good idea to always paste the HTML source when accessing the clipboard through the + or * register. Probably a "pasteclipboard()" function which takes an argument for determining the preferred format would be a better way. This function function could then be used inside a mapping whenever a VIM user wants to paste the original HTML source. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)
Re: Vim freezes system ?!
Zdenek Sekera wrote: -Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: 10 April 2007 09:10 To: Zdenek Sekera Cc: Yakov Lerner; vim@vim.org; Meino Christian Cramer; Bram Moolenaar Subject: Re: Vim freezes system ?! Zdenek Sekera wrote: [...] Just to add more to the confusion, on my box (RedHat Enterprise Linux, 512Mb Ram) I have maxmapdepth=1000 maxmempattern=1000 maxmem=257676 maxmemtot=257676 Which tells me the last two can hardly be in kb and all over I don't understand what really they mean. ---Zdenek According to the help, they _are_ in KB and can reach up to two million (i.e., 2 gig). I sure wonder according to what Vim sets themat startup. Why do you think they can't be in KB? The above would mean slightly over 256 meg, which sounds "reasonable" for a 512MB box (more reasonable at least, than the "249 K" which I see). Arrgh, I guess the batteries in my mental calculator are flat after Easter vac :-). But what do these numbers really mean? You are right that mine look more acceptable than yours. Yours are really strange. ---Zdenek Maybe there has been an arithmetic wraparound in my case? I have 2 gig of RAM installed, which is slightly /more/ than 2 million KB. Best regards, Tony. -- Never be led astray onto the path of virtue.
RE: Vim freezes system ?!
> -Original Message- > From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] > Sent: 10 April 2007 09:10 > To: Zdenek Sekera > Cc: Yakov Lerner; vim@vim.org; Meino Christian Cramer; Bram Moolenaar > Subject: Re: Vim freezes system ?! > > Zdenek Sekera wrote: > [...] > > Just to add more to the confusion, on my box (RedHat Enterprise > Linux, > > 512Mb Ram) I have > > > > maxmapdepth=1000 > > maxmempattern=1000 > > maxmem=257676 > > maxmemtot=257676 > > > > Which tells me the last two can hardly be in kb and all over I don't > > understand what really they mean. > > > > ---Zdenek > > > > > > According to the help, they _are_ in KB and can reach up to two million > (i.e., > 2 gig). I sure wonder according to what Vim sets themat startup. > > Why do you think they can't be in KB? The above would mean slightly > over 256 > meg, which sounds "reasonable" for a 512MB box (more reasonable at > least, than > the "249 K" which I see). Arrgh, I guess the batteries in my mental calculator are flat after Easter vac :-). But what do these numbers really mean? You are right that mine look more acceptable than yours. Yours are really strange. ---Zdenek smime.p7s Description: S/MIME cryptographic signature
Re: Vim freezes system ?!
Zdenek Sekera wrote: [...] Just to add more to the confusion, on my box (RedHat Enterprise Linux, 512Mb Ram) I have maxmapdepth=1000 maxmempattern=1000 maxmem=257676 maxmemtot=257676 Which tells me the last two can hardly be in kb and all over I don't understand what really they mean. ---Zdenek According to the help, they _are_ in KB and can reach up to two million (i.e., 2 gig). I sure wonder according to what Vim sets themat startup. Why do you think they can't be in KB? The above would mean slightly over 256 meg, which sounds "reasonable" for a 512MB box (more reasonable at least, than the "249 K" which I see). Best regards, Tony. -- "Hit any key to continue" does _not_ mean you should hit the power switch.
***SPAM*** Re: Vim70's hignlighting -- Has been solved! thanks all! :)
Hi,all: Sorry to trouble you all to help me. I have install a complete Version of Vim7.0,and it has been solved. Thank you again. Happy vimming. yhntgbty - Original Message - From: "Zhaojun WU" <[EMAIL PROTECTED]> To: "yhntgbty" <[EMAIL PROTECTED]> Sent: Tuesday, April 10, 2007 2:42 PM Subject: Re: Vim70's hignlighting > Hi, > > That's good. :) > > Next time, try to reply or CC to "vim@vim.org" so that others will > know your problem has been solved and they will not spend time on it > any more. > > Happy vimming. > > Zhaojun > > On 4/10/07, yhntgbty <[EMAIL PROTECTED]> wrote: >> Hi, >> thanks,Zhaojun. I just install a new Ubuntu6.10, the default version of >> vim is Vim-7.0-tiny. I have install Vim70 by apt-get >> Thank you again. :) >> - Original Message - >> From: "Zhaojun WU" <[EMAIL PROTECTED]> >> To: "李长青" <[EMAIL PROTECTED]> >> Cc: >> Sent: Tuesday, April 10, 2007 2:11 PM >> Subject: Re: ***SPAM*** Re: Re: ***SPAM***_Vim70's hignlighting >> >> >> > Hi, >> > >> > Seems you are using Debian? Which package do you choose (I suppose you >> > installed "vim-tiny" not "vim")? If so, replace the "vim-tiny" with >> > "vim" via apt-get or aptitude. >> > >> > Best, >> > Zhaojun >> > >> > On 4/10/07, 李长青 <[EMAIL PROTECTED]> wrote: >> >> hi,all: >> >> thank you. >> >> I install vim70 as a new software ,not update from other >> >> version. >> >> And there is not a file named vimrc_example.vim at the >> >> path /usr/share/vim/vim70,just a file named debian.vim.And when I install >> >> vim70 completely,Thers is only one file like *.vim,and only one file >> >> named "vimrc" "vimrc.tiny". >> >> >> >> >> >> === 2007-04-10 10:02:48 您在来信中写道:=== >> >> >> >> >If you updated vim to 7.0 using apt-get, perhpas you could check if the >> >> >runtimepath also be old in your vimrc. >> >> > >> >> >for example, replaced /usr/share/vim/vim64 to /usr/share/vim/vim70 >> >> > >> >> >李长青 wrote: >> >> >> hi,all: >> >> >>I am new to Vim,I am using Vim7.0 now,and it has no Syntax even >> >> >> when I set "Syntax on",It stell has no syntax hignlighting,why? >> >> >> Please help me. On Vim6.4 ,It has syntax hignlighting, but now >> >> >> (vim7.0) it doesn't. >> >> >> >> >> >> Thanks. >> >> >> >> >> >> yhntgbty >> >> >> [EMAIL PROTECTED] >> >> >> 2007-04-10 >> >> > >> >> >> >> = = = = = = = = = = = = = = = = = = = = >> >> >> >> >> >> 致 >> >> 礼! >> >> >> >> >> >> 李长青 >> >> [EMAIL PROTECTED] >> >> 2007-04-10 >> >> >> >> >> > > > > -- > Best, > Zhaojun (Joseph) >