RE: OT: Vi in a browser...
Just getting to email now, so this is essentially a consolidated reply to all who answered... >>Speaking of which, is there any quicker way to visually select the >>entire file, analogous to ^A in other systems? >To copy the entire file to the system clipboard, you can do: > :%y+ >Rpelace y with d if you want to cut instead of copy. >Replace + with * if you want to use middle-click to paste (on X11.) That's about the shortest I could come up with, ":%d+", to do what I want, but still not quite what I was looking for. I was kindasorta expecting a normal-mode solution, like 'gg*V' or something, to avoid even toggling the shift key all that much (think "baud" vs "bps"). The only thing I really use it for is to c&p from LookOut's email to 'vim', then back again. So I ^A the entire reply, dump it into a new 'vim' window, edit it to insert a new quotelevel, etc., then want to "^A" it to get it back into LO. But it's repetitive/frequent enough to make me want to shorten the command further. Ain't "hung up" on visual mode or anything (hi Tim!), it's just that when I don't want headers at the top, I can start from the bottom ('G'), make my way to the top in visual ('1G'), then down my way past the headers to *not* grab them when putting it all back. Or v/v if I want to skip the signature. Etc. The 'vim' instance used to do the editing is going to disappear immediately after, so I'm not concerned about cut vs copy, etc. Everything goes into the "clipboard", then dumped back into LO's reply window, so a plain ':%d' won't work. In a similar vein, I was never much on "visual" vs *real* 'vi' commands, but it does come in handy to delete subroutines, etc. Eg, for the format sub sub1(){ ... } sub sub2(){ ... } all you need to do it find the initial "sub", then "V$%jj" to grab the whole thing, and delete it, copy it, cut it, etc. Go into visual, end-of-line (for the leading '{'), '%' (for the matching '}'), down a coupla lines to grab trailing whitespace, then bam!, it's gone. And it's a visual confirmation to make sure you don't go nuts and delete more than you intended. Point being that for some operations, visual mode is a lot more reassuring.
RE: OT: Vi in a browser...
>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 Speaking of which, is there any quicker way to visually select the entire file, analogous to ^A in other systems? I have to essentially do 1GVG to stick everything into the scratchpad/clipboard/whatever to dump it back into the item from whence it originally came, and that's just a pain. Well, not so much a pain as an annoying itch I can't quite reach. I was thinking something along the lines of %V but that obviously won't work. :)
RE: Why bottom-posting is prefered on Vim Mainling List?
>>Uhhh, that's not my doing, as the text gets resplit/rewrapped >>somewhere else along the line. About the only thing I could do is >>manually split it shorter than the default (whatever that is) >Reformatting the quoted blocks ("gq}" or visual+"gq" as you like best) >while you're formatting your email works quite well. Uhh, I *do*. "gqap", actually (iirr). (Learned that trick here, in fact.) That's what I mean by "manually", vs letting the mailer itself autowrap. Thing is, if I don't know what's the default max-width of v.o's messages, being "over" by just 1 char will still do the long/short/long/short/... rewraps. Point being that it's not on this end where the rewrap gets done, but somewhere on the 'vim.org' side, either translating incoming email to whatever margins, etc., it prefers, else reformatting it somewhat when sending it back out to the list. I've had private/offline correspondence with quite many people on this list, have seen my own replies echoed back, and have yet to see this wrapping issue apply to any off-list items. Given that I'm stuck with LookOut here, I have to c&p (^A^X from LO) to 'vim' (shift-), then :g/^> /s//> :g/^./s//>& gqap(per paragraph, iirr) then c&p it back to LO's "draft" before sending. Crude, but more or less effective.
RE: Why bottom-posting is prefered on Vim Mainling List?
>> >Write top-post or bottom-post makes no difference for me, the >> > problem >Since you yourself are too lazy to fix your own quoted text, may i Uhhh, that's not *my* doing, as the text gets resplit/rewrapped somewhere else along the line. About the only thing I *could* do is manually split it shorter than the default (whatever that is). Want me to show you an actual screencap of my reply as it went out from here?
RE: Why bottom-posting is prefered on Vim Mainling List?
>An explaination why top-post is easier to read: >When I am viewing an e-mail, the reply is the main part of the message and >I usually quite aware of what the original post is. So I should be able to >see the reply when I open the message. And if the message is edited down correctly, it likely will be. >If the message is bottom post, I will have to scroll down and down to find >where the author really start to say something. If the reply starts on line >1000 while the messages ends on line 2000 it will be quite difficult to >know line 1000 is the start of reply and I should read from that line. Uhhh, 1000 lines of quoted-text needs some *serious* editing. I try to only include directly-relevant sections of text; if someone needs to see all 1000 previous messages to follow the thread, he's welcome to go and get those messages. Top quoting is okay for things that don't require any brainpower, like Okay, sounds good. >I was in the mood for pizza, if you wouldn't mind. >>Yeah, I was a little hungry. Where do you want to go? >>>Anyone up for lunch? and that's it. Look at all the reply/text/reply/text/reply/text sections in just *this* email. Were you asking a technical question of multiple parts, it would be easy to follow each little "subthread" in the email. With top-posting, I'm *NOT* going to constantly scroll down then back up to make sure I addressed each and every issue. (Not intended to sound snarky or addressed to you specifically, but to The Reader in general...) Quite simply, if it's too much of a bother for you to properly format email, then it's too much of a bother for *me* to answer completely. It's that simple. Worse, you don't know which bundled-together paragraph in the top-posted reply belongs to which section in the quoted text below, and that's *if* I choose to address more than one issue in my reply. If I see that it would require replies to multiple sections of quoted text, I'm more likely than not to get frustrated with how much extra work would be required to "plan" my reply to make it clear for you to read (lacking any locational context as to what part of the reply belongs with which section in the quoted text), and simply not reply at all. >While for the top-post, I know the first line is the start of reply and I >can read the reply without any difficulty. In an active forum, threads >grown long quickly, with top-post, we focus on what the message saids and >waste no time. And if 90% of the entire message is quoted text that's never even looked at, why include it at all? Again, that's the laziness of peoples' refusal to properly edit their replies. >Write top-post or bottom-post makes no difference for me, the problem is >that I found bottom-post is harder to read since I will have to skim all >"original messages" before I could read the actual reply. Again, it's a lack of editing (ie, laziness) that creates this "problem", *NOT* bottom-quoting in general. >Well, since no one could convice another, I'll stick to the "community >rule". That'd work...
RE: repeating up/down/delete commands
>often well beyond those of the present line. I had been used >to this deleting up to 999 characters, but only up to the end >of the present line. It appears that the "set compatible" Ummm, 'D' doesn't work?
RE: weird defaults in Feisty
>I just updated to feisty on a samba server machine and a lot of the >vim defaults went crazy. For example: Pressing the Up or Down keys >in insert mode add new lines with just A or B on them, respectively. Sounds like it stopped recognising arrow keys' ANSI sequences ("[A" and "[B"). Wouldda thought the would break out of insert mode, but... >That I can live with, but check this out, if I have the following >sentence: >fREW is a silly guy >and my cursor is on the s, and I press cw, it changes to >fREW is a sill$ guy >and it works just like I had pressed cw and it replaces up the the $ >or if I press escape it only has the new text I put in, but it's just >so weird! Does anyone know where these new changes in Feisty come Uhh, sounds like what it's supposta do, no? ?? Is there a problem with actually changing the text, or just what's displayed? Dunno the setting offhand, but a slow-redraw will mark to the end of the text to be replaced, eg, if you were to change to the end of the line, you'd still see the whole line, but with a '$' where the last character would be, vs erasing all the text and just leaving the insert-cursor in its place. I find the latter disquieting, and would rather *see* what I'm replacing, but never really paid too much attention to which settings do what. I'm complacent that way... :D
RE: Vim Wiki - Tip Page Formatting Deadline
>In fact: Almost nothing was discussed longer then 3 days and >if there was no *stiff* opposition then one of the Authors >went ahead and just did it. And lots of stuff was never >discussed: Somebody just did it and the other fell in line - >plainly because it was a good idea. Hey, that's what *I* said... :D
RE: Vim Wiki - Tip Page Formatting Deadline
>>Is there any equivalent to javascript's document.lastModified? >>Can create a "serial number" based on the date of submission, then >>rearrange by fields to a sortable ID, eg 2007.05.15.23.53 for a tip >>created yesterday at 23:53. >>Don't need dots, or hyphens, or anything, as 2007051523353 would be >>fine, too. The odds of having 2 tips be submitted in the same minute >>would be remote. >I don't think so. A minute is sixty seconds, and sooner or later we'll have >two different users submitting tips less than sixty (or even thirty) seconds >away from each other. Even adding the seconds to the ID doesn't clear the >problem, it lowers the probability but doesn't make it zero. With enough >Vimmers adding tips, sooner or later there'll be a clash. Okay, so can probably have something like if exist N N++ to make sure that when "naming"(?) a tip, there's no name-collision. Gotta be *somewhere* to put in the smarts to avoid name-collisions, no? Or if each tip is a file, then a name-collision would be attempting to overwrite an existing file, and a cookie or something could make sure that doesn't happen, ie, only write the actual tip you're working on. Like I said, I have no idea about the mechanisms in use to create wikis or edit entries, etc., so I'm just flinging ideas at the wall to see what sticks, if anything. Someone more versed in wikiing might put 2+2 together and say, "Hey, we might not be able to do *that*, but along those lines, we might be able to do *this*...", and viola! (or cello, or some other stringed instrument...)
RE: regex help
>>>Well, >>>:g/^\(.\{8}\)\(.*\)\n\(\s{8}\)/s//\1\2\r\1/ >>> ^ >>>works, but I'd have to run it 12 times if there are twelve blanks >>>after the filled in line. >>Hm? Not sure why you escaped the '{'. Apparently didn't need to >>after >>the "\s". >You are right - it was a typo - I actually need to escape both of them - >:g/^\(.\{8}\)\(.*\)\n\(\s\{8}\)/s//\1\2\r\1/ >^ ^ Ah, lookit that... '[' is normally magic unless you escape it to literal text, and '{' is normally literal text unless you escape it to magic. Eerie, don't think I had occasion to put that to the test before. Hah, learn something new every day... Been using "{#}" notation in lex/js/perl so long, don't think I had occasion to actually use them in 'vim', else I would've run into that problem before.
RE: regex help
>>:g/^\(.{8}\)\(.*\)\n\(\s{8}\)/s//\1\2\r\1/ >Well, >:g/^\(.\{8}\)\(.*\)\n\(\s{8}\)/s//\1\2\r\1/ >^ >works, but I'd have to run it 12 times if there are twelve blanks >after the filled in line. Hm? Not sure why you escaped the '{'. Apparently didn't need to after the "\s". >I suppose global picks all the lines, then operates on them. Ideally, yeh. Wondered if the op for lines 3-4 would fill in the chars, then the op would also work on lines 4-5, or if it'd still think the 1st chars be blank and skip to lines 5-6 as matching the pattern. >That's a start - thanks! No worries.
RE: Identify this Vim font for me, please
>This isn't very related to Vim, but I found this font on Vim's >wikipedia webpage: >http://upload.wikimedia.org/wikipedia/commons/8/8c/Vim-%28logiciel%29-c onsole.png >Can anyone identify this font for me? It looks very good for programming. Eww. That dates back to the crappy default IBM font cooked into the BIOS for CGA monitors (typically at FFA6E in memory... *scary* I still remember that). I used to rip out that crappy font and put my own in, and recook my video boards' EPROMs with my new fonts, just so I'd never ever *ever* *EVER* have to see that ugly disgusting font even when the machine's first booting up. Yecch. That being said, it's probably listed as something with "system" in the font name. I imagine you're not using a normal peecee, else that should be listed as one of the options for monospaced fonts. Sparc box? Anyhoo, it's listed as "fixedsys" here, 'though that might vary. A bunch of other people posted their favorite monospaced fonts a while ago, and some were really crisp and easy-to-look-at. I'd seriously suggest one of those over fixedsys. I go blind trying to figure out '0' from '8', etc., when I gotta work in a fake-DOS window and that's all it has available.
RE: Vim Wiki - Tip Page Formatting Deadline
>Thinking about how a wiki works shows that keeping tip numbers >is doomed. First, there is no auto-increment id, and as you >point out, there is no reasonable way to automate fixes. Is there any equivalent to javascript's document.lastModified? Can create a "serial number" based on the date of submission, then rearrange by fields to a sortable ID, eg 2007.05.15.23.53 for a tip created yesterday at 23:53. Don't need dots, or hyphens, or anything, as 2007051523353 would be fine, too. The odds of having 2 tips be submitted in the same minute would be remote.
RE: vim 7.1 and cr/lf interpretation
>Uhhh, don't think it *should* automagically delete the ^Ms. I'm always >running into that, and in addition to an almost reflexive alt-EIFD to go >dos-mode, I *still* always have to ':s/^V^M' to get rid of 'em, and I'm I sit corrected, so before anyone yells at me :D I should point out that most if not all times I encounter that is when pigging webpages, so it's likely a bastardised version of dos/unix snippets of text, headers, inline css, js code, etc., all thrown together by the server and vomited up into my browser. So there's likely to be at least 1 line w/o a '^M', hence my having to manually kill 'em off.
RE: vim 7.1 and cr/lf interpretation
>>>"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. Uhhh, don't think it *should* automagically delete the ^Ms. I'm always running into that, and in addition to an almost reflexive alt-EIFD to go dos-mode, I *still* always have to ':s/^V^M' to get rid of 'em, and I'm using version 6.4, not even 7.x, so it's definitely been around for a while.
RE: Project specific settings
>I always uses spaces to indent my code, but a current project requires >me to use tabs. How could I make this setting only be in effect for this >one project, assuming that the project will always be a in a specific >directory. How many files to edit in that particular directory/project? If you don't want to make something a global setting in your '.vimrc' or manually ':set noet' each time you fire it up, you can add something to the beginning/end of each file in question, like (this example's for perl; do whatever's a comment in whatever you're using, whether /*C*/, //javascript, , etc.) =item vim:noet =cut to automagically set whatever options you want when firing up an edit session on that file. In this case, it's the equivalent of ":set noet" to not expandtabs to spaces. Then, you can go nuts with other options, like "ts=4", "sw=4", etc. if you want tabstops/shiftwidths every 4 chars instead of 8, etc.
RE: VimWiki - again - but with a brand new option
>>"Yeah, it's a good idea, but there are more important things I have for >>you to do..."), >Wow, you had one of those guys too? We just barely got rid of ours a few >weeks ago. He moved on to greater opportunities. Bright guy, but to >follow his lead, you'd just never get to do anything! Thankfully, I'm long out of there, so I don't have to put up with much of that. But yeah, his famous "explanation" is that I was "down there" busy doing things that "to me" seemed important, but he was "up here" , presumably because he was more in-tune with the Master Plan(tm) of what the company needed to get done. The only difference was that doing things His Way(tm), I was still taking care of the minutiae that I was *already* doing, only having to wait for his permission to do so. Just like the infamous Dilbert car2n where Pointy-Haired Boss gives him an assignment, he goes ticka-ticka-ticka on his keyboard while PHB is prattling on about something, then says "Done!", that's pretty much what I was doing there. Going Through Channels(tm), my friend there would write up the fix-request, give it to her boss, who'd sit on it a few days, then forward it to my grandboss, who'd then give it to my boss, who'd then give it to me... typically a week or more after it was first written-up. And usually, I got the heads-up and just did the fix directly, actually implementing the fix, testing it, etc., well before I'd even see the paperwork. That was the more efficient way of *not* Going Through Channels(tm). And of course, when GTCing, some things would be held up in paperwork so long, that by the time I'd see it, it would have to be done, like *that* *day*. Feh. Anyhoo, sorry for the tirade, but back to the wiki, sometimes the only way to get one done at all is to just do it yourself, screw anyone else's opinions beforehand, then "unveil" it at the end. "Use it, or not, your choice..." If it ends up with too much spam, or is an ugly format, or the site itself is unreliable, okay, *then* let the critics have at it and try to do one better. Difference is, *you've* got one, and *they* don't, so by default you had that much more to show for it. Just my 2c...
RE: VimWiki - again - but with a brand new option
>We do have a Wikia site available if we want it >(http://vim.wikia.com/wiki/Main_Page). I agree with you; it has a lot >of nice features, and may give us a bit more flexibility than the >wikibooks option. I think we should revisit this topic once we're ready >to start the "real" conversion. No offense intended to any of the involved parties, but I just want to point out that I've seen great ideas suffer "death by committee". Someone becomes a cheerleader trying to get a lot of others involved, nothing happens, then the idea just languishes and eventually dies. What I found myself doing in the past was to just *do* something, then "unveil" it to the others involved. One place where I worked, my 2 biggest contributions which had *the* highest impact on the company in general, I had to quite literally wait for him to be out sick one day so I could disregard what he was telling me (ie, refusing to give me permission to work on what he even acknowledged was a good idea, saying, "Yeah, it's a good idea, but there are more important things I have for you to do..."), just so I could get started on the proof-of-concept version of what I was proposing, then thankfully he was out sick for *another* day so I could polish it somewhat and put some finishing touches on it. Once I already *did* it, the idea took hold, and other departments also started to use it. Now, I have zero idea just how much work is involved in "making" a wiki, but if it's enough for one person to do... hey, have at it. Otherwise, if you end up waiting for a consensus as to which wiki software to use, which site to use, /ad nauseam/, it's likely not going to get done. At least that's been my experience, which is why I, to quote the old saw, "find it easier to ask forgiveness than permission".
RE: filename completion
>Let's say I want to see which files end with t. When I do > :e *t >vim shows not only files anding with t but all files >containing t, as if I did :e *t*. >How can I limit the filename completion only to files ending with t ? Hmm, would think it's by design, but I tried :e *t$ and that didn't work, so dunno. Imagine it's by design, because you *want* to be able to just hit :e ab and *not* have to specify :e ab* right? Ie, same like 4DOS, various'n'sundry Eunuchs shells, etc., all seem to do. The leading '*' should wildcard any leading chars 'til it finds the literal pattern to match, but yeah, there should be a way to force it match the last char of the filename, eg, by forcing a '$' as I tried, unsuccessfully.
RE: "[converted]"?
>>There's one file (.htm) that I edit, and every time I write it to-disk, >>it'll say "[converted]", much the way you'd see on reading a file the >>status message that lists any non-native format or other quirks of the >>file, eg, "[unix]", "[noeol]", etc. (At least that's what I recall; >>the file's at home and don't have access to it here.) >>Uhhh, "converted" from/to *what*?? >It's an encoding issue: I suspected something along those lines, but there was no "" tag listing any weirdo charset (utf8, unicode, windows1252, whatever), no non-ascii chars (that I could see), etc. Come to think of it, there were some latin quotes, so might be an errant 'æ' or something similar embedded in text only as a character itself, not a named entity. Something like that might sneak by me... > :help read-messages >where you'll read the terse blurb: > conversion from 'fileencoding' to 'encoding' done Aha. Didn't see that text anywhere when reading/writing the file, and I was purposely looking for such a thing as a clue. >indicating that the file was encoded in one way ('fileencoding') >but your vim is set to use 'encoding', so the file was converted >from 'fileencoding' to 'encoding'. Will have to look. Personally, I *hate* when people do that, instead of using, say, a portable "&entity;" for non-ascii chars. >It would be nice to have a link so that > :help converted >dropped you right there in the docs, but at least > :helpgrep converted] >found it. Kewl, tnx. Will have a look-see...
"[converted]"?
Never saw *this* before... There's one file (.htm) that I edit, and every time I write it to-disk, it'll say "[converted]", much the way you'd see on reading a file the status message that lists any non-native format or other quirks of the file, eg, "[unix]", "[noeol]", etc. (At least that's what I recall; the file's at home and don't have access to it here.) Uhhh, "converted" from/to *what*?? I explicitly set the file format to "dos" (running on w98), then write it out with changes, etc., and quit, but every time I fire up even a new session of 'vim' and read it again to edit it, I get the same "[converted]" text on writing it back out. So it seems to be writing it back to the same "converted" way it was before, enough that it always lists that text on writing the file even in a new editing session. I did ':help converted^D' but came up with nothing that seemed relevant. Any ideas?
RE: wish: collaboration of N vim instances editing same file
Odd, I got this here, but not from the vimlist... >Couldn't the 'patch' command do this? E.g., Vim#1 has made some changes to >example.c (but not saved them), and Vim#2 makes some different changes and ... >Shouldn't this be possible through the autocommands? I think you could write >this as a plugin, Yakov. Imagine it'd be possible with some script to throw together a 'vimdiff' of sorts and implement what you want, but me personally, I'd rather not ever use that. Would best be a plugin as you suggest, than as a built-in "feature". I have to reiterate that to me, such a thing just sounds too dangerous to accidentally trash a file. Much better to detect the .swp file and keep things the way they are (eg, menu choice to ignore, reload, edit-anyway, etc.). Just my 2c.
RE: blank line at end of file
>Some products will consider a file without a terminator on the final >line to have been truncated, and will report it as a potential problem >because from the product's point of view the input has terminated Now ya know why I *always* put a blank line at the end of *everything*: .htm files, .css files, .c files, .l files, plain text files, email, *everything*. There was at least one uu-/xxdecoder program that'd require an *extra* blank line at the end of a source file, else it'd crap out with an incomplete decoding. So I'd just give it 3-4 extra. :D >unexpectedly in the middle of a line. I used to have this problem at >work when people edited scripts with Notepad and then passed them to >Oracle's SQL*Plus, resulting in a complaint about truncated input on >every script. Don't take this the wrong way, but that's just *too* funny... :D
RE: wish: collaboration of N vim instances editing same file
>>I'd be seriously uncomfortable with that as a "feature". Imagine >>absentmindedly editing the same file 2x or more. Make some changes in >>one instance, make different changes in another instance, save/quit the >>first, save/quit the second, trash all the edits made in the first >>instance. >In the orininal post, I wrote about the feature where two+ instances >of vim show and merge changes made by other instances. With >such "collaboration" enabled, the 2nd instance would show and merge >changes made by 1st instance, and 1st instance would absorb, merge >and show changes made by 2nd instance. In this scenario, loss of >edits does not happen. So I don't underastand why you say you are >against it if it avoids exactly what you cited as unwanted ? >>-- Ability of N instances of vim to absorb, merge and show changes >>to the same file made by other running vim instances Because I don't trust such mechanisms. Especially if editing the same block of text/code/etc., where subtle changes in a program can be disastrous. Eg, just yesterday, I wanted to "split off" some functionality to a separate variable, so made another one called "avg" from the original "average". What if the second instance just "assumed" that I wanted to make similar changes to the original instance of "average" when I in fact wanted/needed it to be the same. There's no easy way to "absorb" or "merge" changes automagically; sometimes even the order of implementation is rather significant. Just ask anyone who uses sccs/rcs/etc., about forked code, and some of the nightmares trying to reconcile different disparate versions.
RE: wish: collaboration of N vim instances editing same file
>>I can't think of any valid reason why one lonely user - me for instance >>- would want to fire up several instances of vim to edit the same file. >It can be. For example, in LNX user can edit file in text console, >then switch to X11 and then start editor again to edit the same file, >forgetting that other instance of VIM already launched. I in this case >just do "killall vim"(or "killall -9 vim", depending on mood). I'd be seriously uncomfortable with that as a "feature". Imagine absentmindedly editing the same file 2x or more. Make some changes in one instance, make different changes in another instance, save/quit the first, save/quit the second, trash all the edits made in the first instance. Yecch. Nah, my vote's for keeping it the same.
RE: Mapping doesn't work
>I'm using GVIM on WinXP SP2: >I'm trying to map ALT-ENTER. It doesn't work (I just get enter). Uhhh, ain't alt-enter trapped by the OS, ie, to switch between window/console modes?
RE: Troubles configuring vim (multi-questions)
>Try ':help listchars' Tnx. Kinda figured there was some option to do that, but never bothered to look up what it might be. Complacency and all... Good to know, but I still just like the cursor jiggling back'n'forth between col0 and col7 when I ride the down/'j' key. It's so much easier... :D Actually, the whole 'listchars' thing gives me some ideas...
RE: Troubles configuring vim (multi-questions)
>>Otherwise, do a '0' and ride the 'j' key a the way down a >>file. If the cursor doesn't budge, how would you be able to >>tell if it was a space or multiple spaces there, or a tab >>character? >Well, if that information is truely useful and what you want to >know, you can always > :set list Displays "^I" just fine, but trashes actual indentation, at least for me (dunno if there's any magical 'vim' setting, like ":set keepindent" or something). Iow, I wanna be able to see indented text... and just see whether it's indented with spaces or tabs, not ^I^I^Iindented text...$ with everything squooshed to the left of the screen. Now, maybe if there were a "show" character in list-mode, so it'd look like > > >indented text that'd work for me, too. Worse comes to worse, I just do "/^I" and have all tabs highlighted in fiery-red, but I can't deal with too much of that, as it sunburns my retinas fairly quickly.
RE: Troubles configuring vim (multi-questions)
>By default Vim (and vi) has always put the cursor on the end of a >character that occupies multiple spaces on the screen. I don't know >why this decision was taken, unless it was to make it easier to spot >the difference between lines indented with tabs and those indented >with spaces, but the cursor has to appear somewhere and it might as That's what I imagine, and appreciate it. Otherwise, do a '0' and ride the 'j' key a the way down a file. If the cursor doesn't budge, how would you be able to tell if it was a space or multiple spaces there, or a tab character? You'd have to go down-right-left, down-right-left, down-right-left, etc., just to see if the cursor advances to position 1 (space), or skips to position 7 (tab). Personally, I'd rather exfoliate with a cheese-grater than have to do *that*...
RE: problem with shifting block
>If you know you want to operate on teh same visual block and move it in the >same direction.. you could just repeat the operation with . Otherwise, you can >reselect the visual are with gv to move it in the other direction Yeh, the tips from you, Tim. and Alan, are all gonna come in handy. I've just been so used to the "normal" way of marking blocks of text and then doing stuff like :'m,'ns/^/^I/ and doing the shift that way. Haven't done much in visual mode, and have only just recently gotten started with that. Eg, when deleting whole blocks of the same repetitive code (eg, consolidating multiple tables into just one big-ass table, and just need to delete the end-table from table N, and the begin-table for table N+1), I'll visually select the text to be deleted, note the status line that says something like "13 lines deleted", then find the next "", do a '13dd', then 'n.n.n.n.n.', etc., 'til I'm done. Only really used visual mode for block deletes/copies/moves, so this should come in handy.
RE: problem with shifting block
[...] Swt. Lotta things I didn't know about, should come in handy, tnx! Especially the ">}" thing. Man, can't tell you how many times I just eyeball code and do things like 10>> whups, make that 15>> bah, too many... 14>> Ah, better. and so on. :D
RE: problem with shifting block
>i am using visual mode and >> to indent a block of code. >the problem i am having is that once i do this, the visual mode is >gone. So, i have to re-select everything and do it again. Is there a >command to repeat the last shift ? Think I ran into this once/twice, and yeah, I vaguely recall losing the "visualness" of the block. No idea how to *keep* the block selected, but if you know how much you want to shift it, you can always just do something like 5>> to shove it over 5 shiftwidths.
RE: Silly Question
>Vowels are a problem. Unless you have an escape in your name, a, i >and o are boring letters. I know someone named Veerle and her name >is actually quite destructive, overwriting an entire line with "l". >What's the most interesting name anyone can find, and also the most >damaging? I think my friend :1,$d would win that particular contest...
RE: copy pasting HTML code into vim
>In Firefox, you can select some part of the text, right-click on it and >one of the options is "view selection source" - like "view source" but >the relevant piece of it is already selected. That's a decent way of >replacing find-next in the source view. Ooh, ooh, what he said... I'm so in the habit of just pigging the entire page and looking at the source offline later, that I never hit on this particular nicety. Yep, that works all a treat! :D As for how to feed that to 'vim', though...
RE: copy pasting HTML code into vim
>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. Wouldn't think so. That's a function of the browser (what yanks the text into the buffer to begin with), and not 'vim' (which only gets what's handed to it). Were you to put the yanked text to 'notepad', 'textpad', etc., it'd be the same thing, just the plain unadorned text. GIGO (garbage in, garbage out). Fwiw, just use shortcuts to get to the source, whether , <^S>, <^U>, whatever your particular browser needs to get there. Can quite often be done in literally just 1 keystroke, so I'm not sure why you say "this is not an option for me". Finding the section of the source you want to c&p *might* be more difficult if there be a lot of repetitive words/phrases and you have a hard time isolating the section, but a simple find-text (<^F>, etc.) should do the job fairly well. No? And don't forget, quite a lot of times what's displayed by the c/p text is incomplete, as you'd likely need the stylesheet (.css file) to make sense of different classes, etc. That's why I usually just pig the whole page and all associated files, and *then* worry about narrowing it down to the text I need.
RE: quick query about moving a selection
>>I might've just forgotten to set sw=2, but I noticed that when I was >>editing a file and didn't want nested tabs being tabbed over to pretty >>much the right side of the screen, one little '>>' would tab it over 4 >>tabs (for ts=2) instead of just 1. Thought that was odd. >You must have had shiftwidth at its default of 8. The indent used by ><< and >> is affected only by the setting of shiftwidth and doesn't >depend on the tabstop in any way. (The TYPE of whitespace added by >> >depends on the tabstop option, but the amount of indentation isn't >affected by it.) Yeah, as above, probably just forgot to set ts/sw to be equal. Most of the time I'll just stick a vim-line at the end of the file as an override, only on an as-needed basis, like that specific file that had way too many levels of nested tabs for its own good. Usually just for displaying purposes, so will shrink the tabstop and set line-numbering to make it easier to find things. Otherwise will just leave the default settings.
RE: quick query about moving a selection
>>i know with >> i can move a selection to the right by one >>indent, how can i move a selection just one space ? >Well, if you want to move by "one indent", you can > :set sw=1 ts=1 et >which will then make ">>" and "<<" indent by one space (not one >tab) or, you can I might've just forgotten to set sw=2, but I noticed that when I was editing a file and didn't want nested tabs being tabbed over to pretty much the right side of the screen, one little '>>' would tab it over 4 tabs (for ts=2) instead of just 1. Thought that was odd. Was a one-fer, so didn't look into it all that much. Just reset ts=8, '>>'ed, and rereset ts=2. Like I said, probably just forgot to set sw to match ts. Either way, that's just one of those little things to keep in mind in case anyone screws around with non-8 tabs.
RE: ok, new question on search
>cool enough, i guess i could map something to >:/impossible_to_find_text or something Or, just "zzz"... or "qwqw"... or ";;;"... etc.
RE: ok, new question on search
>>Need to keep the pattern in memory? If not, "/zzz" will do it, assuming >>you don't have "zzz" anywhere else in your file, of course. >The search register can be overwritten by setting @/ to ''. This then >clears your search "properly". >For my purposes, I have the following mapping in my vimrc: >nnoremap :set @/='' >so pressing alt-/ then clears my search. Yeah, but all those - and - stretches on the kb make my fingers hurt... :D
RE: ok, new question on search
>when i do a search like /text >it highlights all of the matches and i can use n and N to navigate. >how do i turn the highlighting off when i am done? Need to keep the pattern in memory? If not, "/zzz" will do it, assuming you don't have "zzz" anywhere else in your file, of course. Can fiddle with ":set nohls" and whatnot, but for me, it's just easier to search for nothing to turn off highlighting of the just-searched-for text. Then, of course, you'd have to ":set hls" to turn it back on again. Lotta typing, big pain, 'swhy I don't do that, and just search for gibberish instead if I want to unhighlight what I was just looking for.
RE: invoking yanked register into colon command
>after having read the user-manual. For example, I do often want to >replace a name in the text with another. What I used to do is >selecting it with mouse and type >:%s//newname/gc >Is there a way to do this with the mouse (and without retyping the name) ? >What I want is maybe something like 'invoking a yanked register in my >colon command' Me, I go to whatever I'm looking for, hit 'v', then use normal motion commands (eg, "3e") to highlight the text in question, instead of using the moose. If a single word, '*' will automagically highlight and search for the word under the cursor. >From there, once you highlighted the exact pattern you want, can just use :%s//newname/gc as it remembers what you just looked for. No need to reinsert it for the 's' command.
RE: pasting very long text at command-line
>This happened to me always by mistake and what happened today was the >worst. Forgetting that I have copied large amount of text into the >clipboard, I tried to paste it at the search prompt using ^R* and this >caused Vim to hang for a very long time and pressing ^C had no effect. >I remember that Vim used to crash when a large amount of text is pasted >this way, but I think that problem is now fixed, though I think a better Yeah, that's why last week or the week before or whenever (someone wanted to move like 90,000 lines of text to another file), I recommended saving any huge tracts of text to a separate throwaway file instead of clipboarding it. Never know what the limits of a system might be.
RE: Copying a Massive amount of text to the clipboard
>I have a 9MB XML files I am working with. Eep! >I would like to select a block of about 90,000 lines in a file and copy them >to the clipboard so they can be pasted in another file. Via 'vim', or another program/editor? >Is there anyway to say to vim: >"Start selecting on line 3, and continue selecting to 90,000" ? Me personally? Would go to the first line to be selected and mm then go to the last line to be selected and mn then :'m,'nw qwqwqw to write it out to a junkfile 'qwqwqw' (pick an equally nonsensical filename you'll remember to delete afterward). Then go to the file to incorporate the new text, go to the line where you want to read it in, and :.r qwqwqw and be done with it. No monkeying around with the clipboard wondering if the system will puke on something that big. Natch, delete 'qwqwqw' unless you want to keep it around for another insertion elsewhere.
RE: OT: Apparently I work for Bram...
>When "company" is a mandatory field, sometimes I write in "n/a" >"no company" or the like. If the computer rejected that, I could >always try "None Whatsoever, Pty.", but usually it doesn't. >Computers are too matter-of-fact for anything like irony. I usually just make up a company name, like Spacely Sprockets, Strickland Propane, Credit Dauphin, etc.
RE: mark an anchor
>If I am in line 100, now I want to search a key which will lead me to >wherever. I want to back to the place before the seach, can vim support >anchor for me to back? If you just went to one other line, eg, line 150, '' will get you back to line 100. If you searched and got to line 150, then hit 'n' and got to line 163, then another 'n' brought you to line 213, "''" would then take you back to line 163. If you want to literally mark line 100 as your "anchor", which is what I think you actually want, then mm will mark that as mark 'm'. I just use 'm' because it's the same key, and 'n' as a secondary mark, but others might use marks 'a' and 'b' ("ma" and "mb" commands). In that case 'm will bring you back to the beginning of line 100 no matter where you are. Haven't used this in a while (farther to reach the key :D ), but `m should bring you back to the exact character on line 100 should you desire.
RE: Console Text Display Problem
>It's somewhat hard to describe, but when typing the display appears to >back up or stop moving, the text color looks kind of inverted, and >characters sort of appear twice for a word or so. Backspacing and >retying the exact same thing corrects the problem, saving and >reopening the file also, it is purely a display problem, but highly >irritating as I can't detect typos or read coherently. It happens >quite frequently when typing, maybe once every couple lines. >http://dgoodwin.dangerouslyinc.com/files/vim-problem.png >This is just me typing "I've got" once. Whoa... seriously weird. Any chance there's something xtermish going on, like 'ttyslow' or something? I don't recall the exact setting ancient 'vi' had, but there was one for slow tty lines, that would wait for you to finish a line when editing before doing a screen-update. With a faster line, the display could be updated for each character typed/inserted/deleted/etc., but for slower lines, to eliminate horrendously slow redraws of the screen or even a *line* (that "inchworm effect" when inserting text at the middle of a line), there was a way to turn on a sort of "lazy update" of the screen, eg, when you'd hit so that it knew you stopped inserting text. Other'n that suggestion, I can't even guess... :\
RE: help with errorformat using %p
>I am having difficulty handling the "|" character (line 2) in the >multi-line output. Most compilers us the "^" character. I tried escaping >it i.e. %p\| but that did not work. I'm not quite sure what you mean by "handling" it, but did you try using "" instead? Would make it a literal bar instead of, eg, daisychaining commands together, a logical-or, etc.
RE: Selecting a part of a line and then copy or cut it and then paste is somewhere.
>Anyway, how can I map shift-arrow keys as is used in SELECT-MODE? >Or any other suggestion for a smarter way is also very welcome. I just use visual mode. Almost the same exact motions as arrowing around, ie, hit the start where you want to begin highlighting, then move 'til the end. v characterwise highlighting V linewise highlighting Then once highlighted, you could yank to a clipboard, use as the affected text of a 's', 'x', 'r' command, etc. Eg, if I wanted to change "yank" to "put" in the above sentence, I could do /yavesput and be done with it. Try it. Instead of 'e' to get to the end of the word, I could do "10e", '$', use the arrows, whatever I wanted to encompass the text I wanted to affect, then use whatever operators to effect those changes. 'x' or to delete, 's' to substitute, etc.
RE: trying to leave the GUI world and enter the world of VIM
>Does vim have the concept of a project of files? I like the project >drawer to the left of the editing window which shows the files and >directory structure on my hard drive. I have no idea, as I never used any such critter, but I'm sure it can be done (or *has* been done; just look for any scripts and/or ask here for specifics). Eg, a little project I was doing yesterday was with a little 'lex' script that I wanted to turn an input file to a particular form of output file, and compare that with a manually-fixed output file. So in one window was my 'fooey.lex' file. In another was a 'vimdiff' of program output and manually-fixed files. A 'go.bat' file did the compile, pause (to see if any errors/warnings), and run. I'm editing the file, do a :!go to run the batch file, then switch windows to see the diffs. 'vim' autodetects any changes and prompts for a reload. From there, how many folds, etc., tells me how close I'm getting to the target. :D Once I see *only* a fold-line of 373 lines of files, and nothing else, do I know I got a 100% match. Dunno if that qualifies as a "project", but it works for me... >Are there good syntax highlighters for HTML, CSS, JavaScript, C, Lisp? >I see there are indentation packages for C and Lisp, what about HTML, >CSS and JavaScript? If I have multiple files open with different languages >does vim know which file goes with which language by the filename >extension and use the appropriate indentation and highlighting? Built-in support and highlighting for all those files and oodles more. I've got issues with .js file support, as that seems hit-or-miss (mostly miss), but I haven't been bothered enough by it to attempt any fix. .html/.css is spot-on, from my experience with it. Yeah, each file is autodetected, and can be overrode/overrided/whatever manually if need be (eg, my .js output having a .out suffix) >Are there code completion bundles available for HTML, CSS and JavaScript? Would be nice, but I haven't looked. >Sorry for all the question. Diving into vim is a bit bewildering as it >doesn't come as complete (as far as I know) as Textmate or other GUI >editors seem to. ?!? I'm not sure what you mean by "complete", but 'vim' is practically a whole OS wrapped around a text-editor!
RE: VimTips - Google Wiki Usefulness
>It may be legalese -- some lawyers add that kind of talktalk just to stay "on >the safe side"... for them -- yet these (marked out with !) are the kind >of clauses I would hesitate long and hard (perhaps forever ;-) ) before >signing. Short of a benevolent sponsor, I seriously wonder what we should do. "You get what you pay for..." :D Kidding aside, I don't expect that to be an issue at all. They put in those phrases so that in case their company/organisation/whatever decides to pull the plug /in toto/ (eg, going out of business), they won't get sued by entities which'd claim that some "contract" mandates they continue the site in perpetuity. Simply keeping backups of the wiki text, or even html dumps of each page to be able to recreate them, would be all that's needed to rebuild a site. Don't forget that here in the 'States, we have people who'd sue the lottery for *not* winning. There's notice, whether on each ticket or elsewhere, that the lottery isn't responsible for typographic errors. Clear, plain, to-the-point, hard to *mis*understand that, right? Well, we had an incident a few years ago where the wrong numbers were published in a newspaper, people wanted to claim their winnings of the supermegajackpot, were told, "Sorry, those ain't the numbers; we gave the correct numbers but the newspaper printed the wrong ones.", yet people sued anyway for their loot. People started spending their "winnings" before they even turned in their "winning" tickets, quit their jobs, etc., now wanted the lottery to make good on the bogus numbers anyway because they themselves were idiots and jumped into the deep end of the pool w/o even checking to see if there was any water in there. Point being, they simply want to cover themselves as having the last word in management of their free wikispace, lest some nimrods decide to suuue. At least when you're paying for a service, there's an explicit/implicit contract that spells out all the terms up-front. When something's "free", what's the other party get? This "terms of use" legalese is just an attempt to spell out what the other company can do, ie, it *can* go bankrupt, switch to a for-pay hosting site, sell/transfer ownership to someone else, etc., and then make whatever changes are necessary, eg, pull the plug on those sites that don't want to pay a monthly fee if they go fee-based, pull the plug entirely if they go bankrupt, amend the terms of the contract should ownership of the site change, etc., and not have to duke it out in court with 100s of miffed users. I wouldn't/don't have that much of a problem with their terms. Ie, I don't expect them to pull the plug on a wikisite just out of spite or something.
RE: VimTips - Google Wiki Usefulness
>The automated mail account would: >- Drop any message where subject does not start with "vimtip". >- Forward vimtip messages to a Vim mailing list. >Ideally there would also be some logic to switch off if a burst >of messages occurs (abuse defence). I realise that an automatic >way of spamming a mailing list is dangerous ... any ideas? I was thinking something along the lines of 'vim' itself as far as wikiing changes, etc. Ie, the user makes some changes and submits it to the automated mailing list. The page itself isn't changed until the submission is "approved". The equivalent of a 'vimdiff' between old and new would point out typo-corrections, additions, deletions, etc., in a nice viewable way. If the submission is approved, the changes are passed along to the official wiki page, and if not, the change is discarded (sort of a reverse-undo). All the admin (one of many, I'd imagine) would have to do is look at the diffs, see if the changes make sense (ie, no added-ads, etc.), then approve it, eg, forwarding email to the wiki engine that'd make the change (I'm assuming/presuming that can all be automated somehow). Naturally, have a history as to be able to undo/rollback any changes if a spambot *does* make its way through even a password-protected email account. Very wikiish as far as anyone being able to make changes, minimal burden on the admins by simply approving/rejecting edits (it, not requiring them to actually enter said changes), in short, all the niceties of a wiki but with some protection via manual intervention.
RE: entering copied text into command mode?
>>>as a command, so I'd just 'v' the pathname to highlight it, >>>control-insert it to yank it into the "clipboard"(?), then do >>>:s@@@g >>>ie, use shift-insert to "paste" the path directly into the command. >>>is that any help, or were you referring to something different? >>Unless I'm mistaken, these are OS-specific copy/paste commands, >>correct? I don't have an 'insert' key on my keyboard, but I was hoping >>for something built into vim, where it has it's own copy/paste buffer >>that it can use in the command mode. >The clipboard is known in Vim as the + register. >Yank to the clipboard with "+y >Paste ("put") before the cursor with P -- after the cursor with p >Prefix it with "+ to use the system clipboard. What he said... I recall there's some confusion on some OSes between '+' and '*', so I can't help out with that, but in general, yeah, the vimmy way to do it would be to use registers. I'm just so used to ^X/^C/^V with other stuff that I "adapted" to using ^del/^ins/sh-ins to do similar ops in 'vim'. Have fun!
RE: tips project
>2. Convert said content into a the wiki markup language that Google >likes to use. We can do this a variety of ways. I'm partial to python, >perl, and shell tools like sed and awk. I know nothing about the tips format as they exist now, nor Goggle's "wiki markup language", but gimme a few docs pre- and post-converted manually, and I can 'lex' myself silly to give youse *exactly* what you need. I've converted a raw .xls file (*not* exported xml or anything) and converted that to html pages, that's how powerful 'lex' is. Let me know...
RE: Insert mode and arrow keys philosophy
>I suspect that the main reason behind the hjkl (which is very >unnatural for me, the arrows have a much better design with the inverted >T at least IMHO) was that the first keyboards used to develop/use vi >probably hadn't arrow keys, or they were very far at the right of the >keyboard. Pretty much so. Early dumbterminals (think ADM-3a and similar critters) didn't have arrow keys, but they *did* go so far as to have little arrow marks on the keycaps themselves, underneath the letters, on -- you guessed it -- h/j/k/l. The reason for that is similar to subdued numbers/characters on keycaps on laptops and the like, where there's no separate numeric keypad, so you hit or or whatever your laptop has, and those keys send the char in the subdued text instead of the char they normally send. Hit *control* instead, for ^H (backspace), ^J (linefeed), ^K (vertical tab), and ^L (formfeed), and you get the cursor motions left/down/up/right, respectively. If you recall the old termcaps/terminfo entries for such critters, you'd see usually the same values for cub1/kcub1, cud1/kcud1, cuu1/kcuu1, and cuf1/kcuf1, as ^H/^J/^K/^L. Only later with discrete arrow keys did you start getting ANSIish escape sequences like "\[[A"/"\[[B"/"\[[C"/"\[[D". Gawd, I feel old...
RE: Insert mode and arrow keys philosophy
>If you ask me, I advise you to feel free to use arrows in any mode. >"Arrows not working in insert mode" was the worst annoyance >of the original vi, as far as I remember. *Really*? I feel just the opposite, that allowing arrowing when still in insert was more annoying than not, because you *could* successfully arrow around to a different position on the screen, then start typing "wwwdw" or something, and end up with "dw" in the text itself, instead of popping over 3 words and deleting the errant word. I keep forgetting to turn that off in the '.vimrc', so mentally have to make a note to keep banging the key at regular intervals. :D
RE: entering copied text into command mode?
>I often find myself copy/pasting via my GUI text that I might have on >the screen, and then pasting it into the command to be performed - is >there any way to cut/paste text into the command area when I have it >highlighted with just the keyboard? I'm not quite sure what you mean, but if it's what I think it is, sure. If I want to, eg, globally delete paths from links to images and such in html source, eg, to turn into just , then I'd want to execute :[EMAIL PROTECTED]/@@g as a command, so I'd just 'v' the pathname to highlight it, control-insert it to yank it into the "clipboard"(?), then do :s@@@g ie, use shift-insert to "paste" the path directly into the command. is that any help, or were you referring to something different?
RE: :wq vs ZZ
>To boot, ZZ isn't Vim. I started using vi in 1983 and it was already there. >In fact, I have never used :wq Yeah, it's about the same for me, roughly '82 or so. Regular 'vi' on Unix SVR4 on a DEC PDP-11/45. Still got PC/VI, a port of *real* AT&T 'vi' from probably Unix System V that I still use on a regular basis on an old DOS box. DOS even grexes about unknown option -i when shelling out (ie, from 'sh -i' to get an interactive shell in Unix). 'vi' -- a *warrior's* editor...
RE: :wq vs ZZ
>>>I imagine there is a rationale for 'ZZ', but it's not readily >>'z' is already used, and the and keys are adjacent on >>Murrrcan keyboards, so you can easily just quit out of the editor in >>almost a single hand-action. >I understand the ergonomic value. Mentally it doesn't make as much sense though. Actually, to me, once I hit on the reason, it made *perfect* sense. A quick bang-bang way to quit a file, and even the placement of the keys next to each other, and *order* of hitting the keys (a natural "rolling" action from to , as if rolling/tapping your fingers in impatience (from pinky to index-finger, not the other way around)), makes it a "natural" action. That "rolling" action is the same reason why "qw" just feels natural and is easy to do, but "wq" just feels "backwards". I was quite pleased at figuring out the reasoning. :D >BTW, Murrrca---is that like this: http://www.langmaker.com/db/Amurica ? Dunno if specifically attributed to GWB, but in general, that's how locals slur words. Eg, "Baltimore, Maryland" is pretty much pronounced by the locals as "Ballmer, Merrlin", and around here, "Long Island" similar to "Lawn Guyland". I won't even touch the Brits and the way "Worcestershire" is mangled into "Woostsher" or whatever.
RE: :wq vs ZZ
>I imagine there is a rationale for 'ZZ', but it's not readily >apparent. (Something to do with C-z in DOS, or the end of the >alphabet?) 'z' is already used, and the and keys are adjacent on Murrrcan keyboards, so you can easily just quit out of the editor in almost a single hand-action. I never liked ":wq", because you gotta do depress <:> release instead of the nice, simple, easy bang-bang of depress and you're out. Releasing the key doesn't even count. :D Even ':' requires either 2 hands, or a weirdly-contorted 1-handed op.
RE: Pasting into gvim from word: ' turns into ¿
>Thanks for the feedback. Well, this is kind of over my head. I guess a better >question is why can't vi handle that character (or others)? Is this an encoding >thing? Both 'encoding' and 'fileencoding' are set to 'Latin1'. Could this be my >problem? I would figure that vi would internally convert encodings before >pasting. I think it actually *can*, only you need to tell it what charset/font to use. Probably Unicode or something more encompassing would be better.
RE: Pasting into gvim from word: ' turns into ¿
>I asked this question before, but it wasn't really resolved. I often >have to paste from Word for Windows into vim/gvim (cygwin). >Some characters don't transfer properly. Most annoyingly is that a >single quote ( ' ) turns into this: ¿ >Is there an easy way around this? Iirr, M$W uses directional squotes/dquotes, so you're not in fact getting plain ol' char 27H, but something >80H. Iirr, it folds down to ^R when 7-bitted (see that a lot in viing saved emails that people send with those weirdo characters), so that's 80H + 12H == 92H, no? Might be an option on M$W to save-as-DOS-text or something, or turn *off* "smart-quotes", or something along those lines. I try to not use M$W except at gunpoint, so can't really tell you more than that as far as M$W options, etc., but that's what I strongly suspect is happening. Helps any?
RE: How do I replace text with a new line?
>>S >> :s/^V^C/\r/ <-- ctl-V ctl-C is shorter, >> else the "\%x03" will work fine >>should do what you want. >Thanks very much. Yes that is what I needed. And the text I'm >playing with came from some serial data and has STX ETX wrapping the >real data. I was getting rid of the STX and trying to convert the >ETX to end of line. No worries. Eg, if you wanted to do everything in one shot, could do something like :g/\(^V^B\)\(.*\)\(^V^C\)/s//"\2"\r/ to bracket the text in quotes, get rid of the ^B/^C, *and* add the newline at the end. If more'n one occurrences happen in a line, then you could probably prefix it with "\{-}" for non-greedy (ie, minimal) matching, and trail the command with a 'g' to do it multiply on each line if needed. >And since I'm on a windows machine, Yakov suggested ^Q instead of ^V. Only if you got 'mswin.vim', which I killed off in a hurry before I even heard everyone's advice here to trash it. :D That's so you can use things like ^C/^X/^V (copy/cut/paste) and the ^V would trash the literal prefix for a character. As well as lobotomise 'vim' to do windowsy things, which is generally something you *don't* want. Kinda like putting a slushbox in a Ferrari... >Molon Labe... Yeh, "Come and *take* it...". Love the story...
RE: searching for a string that has many '/' characters
>I have a string that has lots of forward slashes. I need to search it >and delete it (e.g. unix path name). I could use a backslash for >everything forward slash and find it in vim. Is there a way I need not >do that? For now, I use 'grep -n' to get the line number and then delete >it. I don't actually type the string, I just use cut-and-paste! Yeh, :[EMAIL PROTECTED]/with/lots/of/[EMAIL PROTECTED]@@replace/[EMAIL PROTECTED] will do it. Also '#' instead of '@', whatever spins yer wheels. Either of those always worked for me, so never "experimented" as to what other chars (even alphabetic, numeric, etc.) will work or what's too magic.
RE: How do I replace text with a new line?
>I've got a file with some control characters and I want to replace >one of them with a new line. I've tried: >:s/\%x03/\n/ >:s/\%x03/^M^J/ >:s/\%x03/\%x0a/ In the search-for field, you can use '\n' to search for a newline and span more than one line. In the replace-with field, you need to use '\r' instead. Something about the way 'vi' variants store lines internally, that each string is null-terminated and there doesn't exist an explicit newline char, so you need to insert a return char (the '\r') in the replace-with field to tell it to split the line. S :s/^V^C/\r/ <-- ctl-V ctl-C is shorter, else the "\%x03" will work fine should do what you want. Same with ^B that you aked about earlier, no?
RE: How to maximize my vim window when I start it?
>>off maximised, but it insisted on being a resizeable window. Only >>Tony's suggestion to try the 'simalt ~x' worked, but even so, I can see >>it starting out as a "window", then jiggling a bit then filling out to >>fullsize. >I didn't suggest it. What I suggested was >if has("gui_running") > set guifont= > set lines=9 columns=9 >endif >(which worked for me on W98 and on XP, and still does on Linux with kde) in >the vimrc. Someone else suggested ":simalt ~x" which works provided that, in >your locale, the shortcut for "Maximize" in the Alt-Space menu is "x". In a >French version of Windows it would be ":simalt ~g" for instance. Okay, I just assumed you suggested it, being so chock full o' helpful hints. :D Might've been Tim, then. Either way, it worked, and I'm happy.
RE: Using (g)vim without installing it
>Is it possible to start and use vim as an old exe file or com file? (don't >know if the terminolgy is ok) >What I mean is that old windows programs for windows 95 where just exe >files, and by copy them on a pc and starting them they just work. Yeh, I getcha. And that's why God invented Portable Vim. Don't recall the site offhand, but when I wanted a copy I just goggled it and there it was. Hang on a sec... http://www.softpedia.com/get/PORTABLE-SOFTWARE/Office/Suites-editors/Win dows-Portable-Applications-GVim-Portable.shtml The site looks kind of familiar, so I'll say just follow the steps and grab a copy. >Nowadays you have to install them first before you can use them. >I recently switched jobs, and the company is fine, but they have an >IT-policy that users don't have administration rights. When I asked them to >install gvim, they said we use TextPad, company policy. It's the first >company that I ran into this, with a @[EMAIL PROTECTED] policy, but I have to >live with >it. They're idiots and assfaces. Tell them I said so, too. They'd rather have conformity over productivity. Thankfully, I installed Vim on this box with no problems, but still, certain operations were locked out (eg, the "Edit with Vim..." and such menu options when rightclicking on a file or group of files), so it's not *too* much of a setback, but once they decide to install Vista here later on in the year, I don't know if I'll be able to install/use *any* apps anymore. And quite frankly, that's when I either *get* the apps installed with IT's blessing, clandestinely use it from flash, or update the resume and find someplace else to work. It's that simple. Word of advice, along Gene's "It doesn't hurt to ask..." line of thinking, is to just make a mild stink to your boss, and on up to the most approachable Big Cheese you can, right on up to the owner of the company if he's a reasonable guy. Tell him in no uncertain terms that you have an application which really makes you more productive, but the idiots in IT (no, don't phrase it like *that*...) won't let you install it. You'd *like* to use tools you're mo$t comfortable with and mo$t productive with, to help you do your job as quickly and efficiently as possible, but you're being hamstrung by some "policy" that insists on one and only one set of archaeic tools which is effectively crippling you and slowing you down. And if they insist on being idiots and assfaces, well, you can live with it or look elsewhere for yet another job where they're not as idiotic and assfaceish. There seems to be a spate of "portable" apps that are intended to get around just this kind of limitation. I got hold of Portable Firefox and it works a treat, so definitely look into "Portable XYZ" whenever you need/want a copy of XYZ that'll work w/o needing to be installed on any particular machine. PVim is definitely out there, like PFF, so look them up, get them, and have fun! Also keeps all your preferences (bookmarks, options, tweaks, settings, etc.) all in one place, on the flash-thingy, so absolutely, you can carry around the apps from one machine to another and have everything nice and comfortable, just the way you like them. And iirr, portable apps can in fact be copied to your harddrive on another machine as well, but for safe keeping, and to shut 'em up in case they find your "contraband" on "their" machines, just keep everything on flash and make backups just in case.
RE: How to maximize my vim window when I start it?
>>1. How to setup my gvim to open to the maximal size when I start it? >How do you open gvim? If you start by clicking the icon, you may >right click the icon and find an option regarding the size when >starting in property (I'm not using win XP now so I'm not sure about >the exact option). I had a similar problem for a long time. On this machine here, for some reason, I got it to start out maximised right off (luck?), but ironically, on my 98SE laptop, I can't do *anything* to get it to start off maximised. I tried the icon in the traybar-thingy, in the "Start" menu, anyplace/everyplace I could find it, set the properties to start off maximised, but it insisted on being a resizeable window. Only Tony's suggestion to try the 'simalt ~x' worked, but even so, I can see it starting out as a "window", then jiggling a bit then filling out to fullsize. Point being, the simalt thing worked for me. Not quite as I wanted it to (ie, to start out maximised, not resize after loading up), but it still works.
RE: Mapping with Shift, Ctrl and Alt/Meta
>Using Ctrl-V, I can see that Gvim doesn't see Alt-Ctrl or >Alt-Ctrl-Shift for "normal" keys, just for function keys, >insert/delete, home/end, page-up/down an the arrow keys. >This is NOT a Windows issue. My email program (The Bat!), >for example, lets me make use of all of those combinations. >I believe it is a bug in the Gvim keyboard handling. >The tab key is a bit of an oddity. Of the eight >possibilities, Ctrl-Tab and Alt-Ctrl-Tab don't work, >although Ctrl-Shift-Tab and Alt-Ctrl-Shift-Tab do work. >[Windows always takes over Alt-Tab and Alt-Shift-Tab.] Actually, it *might* be a Windows issue. If you do a typical Control-Panel thing where you get a bunch of "pages" with the little "tabs" on top, regular tab will run through all the fields/buttons/etc. on that page, but ctl-tab will pop over to the next tab. Eg, just picking one at random, "Control Panel" --> "Folder Options", cycling through the options in "General" is done with the tab key, but getting to the "View", "File Types", etc., is done via ctl-tab. (Just tried it now, I speak the trvth. :) ) I try to never ever ever use the moose unless I'm practically forced at gunpoint, well, at least if the program/app is sucky enough to not have a keyboard way to do something, so this is kind of familiar to me. Sooo, point was that it might very well he a grabbed key-combo, even if nothing's immediately done with it.
RE: Regular Expression Question
I hope you don't mind a non-vim solution, but I used to run into this problem all the time when I wanted to match tabbing for debugging/status messages that would come to the screen. I just got so sick and tired of hopping through the code to add a tab here, remove a tab there, etc., that I'd just bunch together all the string constants in one place, at the top. Eg: const char *msg_help[] = { "usage: %s [-options] [infile [outfile]]\n", "\toptions:\n", "\t\t-h\thelp\n", "\t\t-l\tlong (detailed) output\n", (const char *)0 }; const char dbg_rdferr[] = "%s: cannot open \"%s\" for reading\n", dbg_wrferr[] = "%s: cannot open \"%s\" for writing\n", ... and have everything even visually aligned in one place. Would also let me "reuse" the same strings as needed (eg, "%d" as an input to sscanf(), "%02X" as a 2-digit output to fprintf(), etc.) without having to wonder if I mistyped something that would only break when some rarely-used piece of code would run. Then, once all your strings are in a row, just look for \n"[,;]$ and every string with the necessary newline at the end should be highlighted. Any string that's *not* highlighted (ie, would be missing the trailing newline) would, umm, would *not*, stand out. Granted, that's not a vimmy solution to your problem, but it's a little habit I got myself into, and for me at least, it made life a little easier. Any help?
RE: javascript indenting
>Has anyone been able to get good javascript indenting going with vim >(7)? The out-of-the-box one always seems to mess up, even on something >as simple as autoindenting on function open brace. Definitely, if you find out, let me know. I can't even get decent syntax highlighting going (v6.4, not 7.x; doubt it makes a difference) except for only the very first "function", and the occasional "in" and "for" which are in comments(!!). Oh, and quoted text comes out fine. Everything else is essentially monocolor.
RE: grouping problem
>I'm want to group a text that has the following text pattern (values and >number of lines vary across instances): >Used the following code but got a pattern recognition problem.: >:%s/\(\)\(What am I missing?? Newlines, no? Try (line-split for clarity) this: :%s/\(
RE: cindent weirdness
>I am having some problems with cindent. I was busy coding when suddenly >indenting stopped working. cindent is set (echo &cindent -> 1). >The odd thing is that it only stopped working on one buffer. How does >that make sense? After I closed the buffer and reopened the file it >worked again. See any error messages pop up? It may not be directly related to your problem, but when I'm editing a huge .sgm/.htm file with lots and *lots* and *LOTS* of quotes (eg, attributes for just about every tag), and I insert/delete a '"' char, it'll flash a very brief error message about stack overflow or something, and go completely mental after that. Syntax coloring/highlighting craps out, etc. What I generally do is just try to yank text from elsewhere (eg, ' morerows="1"') that's similar if not exact to what I want to insert, ie, go visual, highlight the text in question from elsewhere, ctl-ins it to yank it into the "clipboard" so that I can put it elsewhere over and over again, then get to the spot and sh-ins it into place. Yanks/puts quote chars without a problem. Should I accidentally dink with a quote char so that it *does* go mental on me, I just write it out and edit again (ie, ":w" followed by ":e!"), so that it still remembers where it was, isn't mental anymore, and I can just pick up from where I left off. Like I said, don't know if that helps any, but if you keep an eye out for any error messages that flash on the screen when that happens (there's a way to see the last message sent to the screen, but I don't immediately recall how to do that), that may be a clue as to what's happening and why you're losing indents.
RE: multiples search and replace in the same command?
>Hi, i'm trying to replace all occurrences of characaters like é, è, ê >etc ... by their corresponding htmlentities. To do that, i use the >following command: >%s/é/\é/g >The problem with that command is that i have to do that for all >characters. I was wandering if there's a way to do it with only one >command. Honestly, the way I'd do it is to just throw it at 'sed' (simple but constant multiple substitutions), or write a little 'lex' script (more onvolved, with reformatting, rearranging, whatever else needs to be done to the doc), depending on how involved it is and how often I'd need to use it. I've got DOS versions of both, which is what (still) I tend to use on Lose systems. As for 'vim', it's probably best to write a function which you could map to a single key like one of the F-keys. I'm still new at that, so couldn't tell you how to do that, but certainly someone here can tell you how to build the skeleton of the function; you'd add salt and pepper to taste. Then you'd just open up a doc, hit or something, and it's magically done in one pass. Don't have it here, but did write a few cheapo 'lex' scripts to turn 0xA0 to " ", convert and match ldquo/rdquo/lsquo/rsquo chars, ellipses, most of the common things I encounter. Gimme a yell today and I tomorrow can dig up and post the script here (if anyone else is interested) or via email directly.
RE: change case on multiple words
>I have a text with many quotations, that I want to change the case. >Currently the text of the quote is in all caps. I want to change it to >capitalize only the first letter of each word. The text I want to change >can be either a single word, multiple words on a single line, or >multiple words on multiple line, as follows: If you know the beginning/ending lines (absolute numbers, marks, etc.), you can do :'m,'ns/.*/\L&/gp marks 'm' and 'n' set previously :'m,'ns/.*/\u&/gp :10,50s/.*/\L&/gp absolute linenos 10 through 50 inclusive :10,50s/.*/\u&/gp etc. '&' is the matched pattern. "\L&" will take the matched pattern and lcase it all, then "\u&" will just ucase the initial letter of a word. So each respective pass will be WORDS TO INITCAPoriginally words to initcapafter lcasing it all Words To Initcapafter the initcap Someone here might have a more elegant way of doing it, but I've done it this way in the past for so long it's practically a macro to me. Fwiw: \L lcase everything \l lcase initial letter of each word \U ucase everything \u ucase initial letter of each word Hth.
RE: How to override $HOME on Windows NT/XP?
>I know this is a bizarre request. I would like to prevent Vim from >going to my Home directory. The reason is that my IT department has >mapped my home directory to a laggy network drive with a login script. >I can't override the Windows environment variables which set up the >home directory, because the login script overrides my settings. >I can set up the environment in a DOS box, but I like to be able to >invoke Vim by using the "edit with vim" context menu item. I got the same damned thing here at work, where everything's locked up tight and I can't touch it. "Policy", and all that... :P My own workaround for 'vim' and other critters is to just grab the usual desktop shortcuts, set the properties to what I prefer, and dump 'em into the "Send to" directory. Will be one level down from the "Edit with Vim" thingy, but at least it's a workaround. Same thing for using Firefox 1.5/2.0, Opera, Netscape 4.8, 6.x, and up, etc., instead of Exploder, so that I can pick which version for testing webpages in different browsers, and so on. If you can't override the defaults, dump 'em there and edit the prefs to your heart's content.
RE: vim.org refreshed mockup
>>Just looked at it again from the above link, and yeah, it's a white >>checkerboard pattern, 'though the "gray" matches the background of the >>viewer (M$ Photo Editor? whatever comes out-of-the-box on LoseXP), so it >>might be a transparency color/layer that just lets the background poke >>through. >Why are you looking at it outside of a browser it's a URL ?? He posted a link to a *png* file, probably a snapshot pic of the site: http://panos.solhost.org/mockups/vimorg-01.png Wherever the problem lies, whether in the background pic, the .png file, M$PE on this machine here, or elsewhere, all I'm doing is pointing out that there's potentially a problem with viewability. If it looks good to y'all, great. Might be something different here than there that's giving me checkerboards. Only thing I can suggest in looking at the pic is to stick it on its own wrapper page where the background is anything *other* than #FF, then have a look-see.
RE: vim.org refreshed mockup
>>>http://panos.solhost.org/mockups/vimorg-01.png >>Uhhh, light-gray text on a gray/white checkerboard background? >>Ouch... >I musta missed something - no checkerboard here. Looks nice! Hang on a sec... Just looked at it again from the above link, and yeah, it's a white checkerboard pattern, 'though the "gray" matches the background of the viewer (M$ Photo Editor? whatever comes out-of-the-box on LoseXP), so it might be a transparency color/layer that just lets the background poke through. If it's a .png, maybe it's something with the alpha channel being set, like the "transparency color" of GIF89A (also usually bright-white, fwiw)? No idea, no time to look in more detail. White on white wouldn't be discernable, but on a "darker" background (even light gray, as I have here; a blinding-white background fries my retinas), it shows up a *lot*. Washes out the light-gray text almost completely. If it were me, I'd just check the background graphic, if any, on the actual site. But that's just me... ;)
RE: vim.org refreshed mockup
>I made a mockup of a refreshed version of vim.org, trying to maintain >as much of the original look as possible: >http://panos.solhost.org/mockups/vimorg-01.png >vim tangofied icon by toZth Uhhh, light-gray text on a gray/white checkerboard background? Ouch... Just my 2c worth, maybe ditch the checkerboard background, as it makes even clear dark text harder to see (and makes my head hurt). Gray text simply vanishes. Other'n that, it looks nice.
RE: replace using variable
>>Hi, I have these words: >>1. I am good >>2. You sucks! >>3. Take that, moron >P.S. If you are feeling frustrated (Vim can do that to you), try writing >something more soothing, e.g.: > 1. I am happy > 2. You are beautiful! > 3. Take that, as a token of my love Heh, I thought his version was funny as all Hell. :D
RE: replace using variable
>1. I am good >2. You sucks! >3. Take that, moron >I want to change those sentences into: >1. I am good >2. You sucks! >3. Take that, moron >How do I do that using vim replace command? >All I can think is this: >:%s/\d/\d/igc Me personally? I'd do something like :s/\(\)\([0-9]*\)\(. \)/\2\3/p Ie, first field is the "", second is the index, third is the '. ' (you want to preserve the format, and not get any false hits), and replace with the new tag, and simply put back the 2nd/3rd fields.
RE: Single-File Vim?
>>>Is there a binary compiled for Windows which allows me to run Vim >>>without any of the runtime files? Long story short, I want something >>>I can keep online or on a USB key and just copy to the desktop of any >>>computer I sit at. >>I saw the entire thread so far, and while there are lots of possible >>solutions, wouldn't it just be easier to get a U3 flash-thingy, that's >>supposed to do exactly this? >>http://www.u3.com/ >>I don't have a U3 flash-thingy nor have I ever used one (no need as >>yet), but this is supposed to be what U3 is all about, ie, to let you >>install whole apps on a flash-thingy and transport them all from machine >>to machine wherever you go. >never had one in my pocket. But what I heard is bad: it leaves plenty of >stuff in the registry and you need house cleaning when removing u3. Aha, okay. Lis, never used one, don't know the details, but threw it out as a suggestion. Doesn't sound too "clean" a solution, then. >On top of this, it's proprietary and not opensource. At least, with 7-zip >sfx, it's clean by construction: when you close gvim, unless the process >was killed uncleanly, the temporary extracted version will clean itself and >disappear. Yeh, I love using .zip files for everything, too, right from the first days of 'pkzip'. Hell, got my first start in 'vi' on peecees with PC/VI, an actual port of AT&T 'vi' to DOS. DOS would even grex about a bogus '-i' option when shelling out, because it'd try to shell out with 'sh -i' (interactive). Even used *real* termcaps/terminfo entries, because I was running (from a DOS box!!) real honest-to-B'harni 'vi' on a (Televideo) TV910 and TV910+ through the serial port. Swt. Aaaah, the good ol' days... Anyhoo, yeah, I'd box up all my trusty'n'crusty utils within one or more .zip files with whole directory trees. Bring it to a new machine, unzip to disk or even a RAMdrive, run a batch file to set up the environment variables, and I'm ready to go. >I actually built many sfx this way when I looked into u3 Never looked at U3 in any detail, just heard in passing what it's about. Sounds really nice in theory, which is why I suggested it as an option. Hope you don't mind if I pass along your critique above (name/email redacted, natch; I try to respect other peoples' privacy) to another private list, as U3 was a topic about a month or so ago. Someone liked the idea of being able to put Firefox and other stuff on a flash-thingy and be able to have all his settings, bookmarks, etc., all able to be dragged from machine to machine. Don't know if he went and got a U3 thingy yet, but if this is an issue, he and others should know.
RE: Single-File Vim?
>Is there a binary compiled for Windows which allows me to run Vim >without any of the runtime files? Long story short, I want something >I can keep online or on a USB key and just copy to the desktop of any >computer I sit at. I saw the entire thread so far, and while there are lots of possible solutions, wouldn't it just be easier to get a U3 flash-thingy, that's supposed to do exactly this? http://www.u3.com/ I don't have a U3 flash-thingy nor have I ever used one (no need as yet), but this is supposed to be what U3 is all about, ie, to let you install whole apps on a flash-thingy and transport them all from machine to machine wherever you go.
RE: Copy/paste to another console
>If both programs can access a common clipboard, use it. Vim knows it as >the + register. So, for instance, to yank three lines to the clipboard: > "+3yy >and to paste the clipboard before the cursor: > "+P >etc. Kewl, I'll have to remember that, too.
RE: Copy/paste to another console
>I've a little problem, I do remote box A with console A using putty >(under MS) then using vim open file A, I do copy a line with yy in >file A, so I do remote to box B with console B using putty (under MS), >then open file B, the question how to do paste to file B in console B >without mouse (I do usually using mouse to block line then copy to >another file) If you want to do what I think you want to do, you can copy to/from the "system clipboard" or whatever it's called. I do that to reply normally from the braindead top-posting crap that's enforced on LookOut (as co. policy; can be selected via menu options) to toss into 'vim', add leading '>'s, then 'gqap' to reflow/reformat the text, then move it back to the reply window. Worx like a charm.. Anyhoo, if ^c/^x/^v (copy/cut/paste, respectively) don't float yer boat (and ^v will crash into a literal-character escape in 'vi' variants, incl 'vim'), then ^ins will be the equivalent of copy, ^del the equivalent of cut, and sh-ins the equivalent of paste. Sooo, you can highlight your line visually with 'v' and then arrow around to select however much of it you want, hit ^ins to copy it, then on the remote machine, sh-ins it to put it into the file.
RE: Latex-Spellchecker and C-s freezes Vi
>2. Every time I hit Vi freezes immediately (have to close the >window). I tried to unmap it with "map " and "map! >" and tried to map it to something different with "imap >:wi" but nothing helped. ^Q/^S (DC1/DC3) are terminal xon/xoff characters, respectively, typically used to momentarily pause output so that the recipient can "catch up". Also comes in handy to slow screen output so you could read it before it goes whizzing on by. Another ^S could be used to "restart" the screen if xon/xoff is in "toggle-mode", else just hit ^Q to restart it for sure.
RE: reopen?
>assuming a file has been changed underneath vim, and I know about it, >how can I reopen that file replacing the current file's buffer contents? In most cases when you toggle back to that window, it'll be smart enough to pop up a box and let you know that the file's been changed, and gives you 3 options, reload from disk, and 2 others (never used those, so didn't "stick" in my memory, as I only would reload), probably to ignore the changes and keep what you got, else cancel. Comes in handy when I'm vimming an error listing, delete lines as I fix the listed errors, then when I rescan/recompile/whatever, the error file gets rewritten out from under me. No prob, just bap the key when it pops up the box, and I'm back in bidniss to repeat for the next batch of fixes. Failing that, ':e' will attempt a reload, else ':e!' to force a reedit from disk.
RE: regex replace with match
>I have a large fixed width database file that I would like to delimit >with commas. For example here are 2 lines of the file: ... >***note*** Since this is a fixed width data base file, I can import >it into a database as is. I am only doing this as a learning >experience. Just as a fwiw, when I had to do something like this and needed to check my progress through the file to make sure nothing was missed (eg, lines that would fail the pattern-match and be left untouched, fields that didn't conform to certain expectations (eg, variable date-formats), I'd take a more piecemeal approach, eg, the first pass might be :g/\([0-9]*\)\( *\)\(.*\)/s//\1, ###\3/ to "format" the first field and stick a "###" flag/bookmark in there. Second pass would be something like :g/\(.*\)\(###\)\([0-9]*\)\( *\)\(.*\)/s//\1, \3, ###\4/ and so on. This way, if I were to encounter some lines that failed the pattern match and weren't processed, I could simply undo the change and modify the one-step pattern to suit. Don't know if this helps at all, but if an all-or-nothing approach is chancey, or just too long to type in one shot, I'd just throw it at a quickie 'lex' script to process, or just 'sed' my way through it (preferably as a script). With those, you can just edit the regexp that's being used and rerun it with minimal retyping should the pattern fail. Quick example how it *can* fail is back in your sample lines, the lone "14" and "2" bracketted by whitespace. Do you want to grab a variable amount of whitespace and end up with "14" and "2" exactly, or grab a fixed amount of whitespace and end up with "14" and " 2" as 2-digit fields? And if the latter, what if you don't realise there's one line in the file where that field is "102", and the pattern fails to match that line because it's expecting to eat 4 spaces, and there are only 3 between the preceeding number and the "102"? Right tool for the job, and all... ;)
RE: SORBS, etc.
>>Piqued my curiosity, asked around, got back this as a possible >>explanation: >> >> See http://www.us.sorbs.net/faq/spamdb.shtml >> >>I have *no* idea who Joey McNichols be, or why he needs a legal defense, >>etc., but it seems as though the whole SORBS thing might be on the >>up-and-up, if unpopular o those who got zinged by it. >No matter what, the ISP has to pay their way out of the blacklist. >It still seems to be a crappy way of running a spam blacklist to me. My >mail hosting provider is a small company, and probably couldn't afford >to stay in business if they had to pay $50 for every piece of spam that >some of its less-virtuous customers chose to send. Which is kind of the point. If a provider doesn't impose at least minimally-intrusive measures to prevent spamming (eg, maximum of N emails sent per hour, progressively slowing to a crawl with increasing volume, etc.), ie, things which wouldn't affect you or me no matter how prolific we are in emailing, but which would cripple spammers (eg, do I personally need to send 1000 emails in one shot?), then quite frankly, if someone *does* abuse it, the provider can't cry foul that they're blameless victims. Believe me, I wouldn't shed a single tear if pissed-off vigilantes would quite literally hunt down and kill the top 10 known spammers and set their computers on fire, so I personally am willing to "suffer" not being able to send 1000 or even 100 emails in one day (as long as they're queued up and not lost, should I want to send announcements to friends that I'm changing an email address, etc.). If a provider can't/won't put even minor inconveniences to dissuade spamming, then they deserve to be SORBSed. If SORBS would pocket their "fines", that's one thing, but as they explicitly don't want to be connected with any charities they approve of in their list, that to me seems to be on the up-and-up. Have Bram ask SORBS to include among the list of approved charities those that assist Ugandans and Ethernopians and whatnot. Let some good come out of spammers' eee-vil actions, and the providers who unwittingly abet them. To use an analogy, if I leave a loaded gun or samurai sword or something, out on my front lawn, and some idiot kid goes and hurts or even kills someone with it, can I insist that I'm blameless in the matter? Or should I instead bear some of the blame for my recklessness? The more I think about it, the more I gotta agree with SORBS, that if some provider did something to trigger being blacklisted, they *should* in fact have to pay. Maybe next time they'd look a little more closely at their clientele. If you want a waiver to send more than N emails/day (eg, for a mailing list), let the provider at least look into the content and make sure you're not hawking V1AAgrA or fake R0L3X watches or whatnot. All that being said, did your provider (the Z-thing?) explain *why* it may've gotten blacklisted in the first place? I'd look into that first. >Another thing I wanted to point out is that my mail is *never* bounced >by any other mailing list or anyone else to which I ever send mail. Kewl. Hope you don't have any more problems with it.
SORBS, etc.
Piqued my curiosity, asked around, got back this as a possible explanation: See http://www.us.sorbs.net/faq/spamdb.shtml I have *no* idea who Joey McNichols be, or why he needs a legal defense, etc., but it seems as though the whole SORBS thing might be on the up-and-up, if unpopular o those who got zinged by it. Lis, I know nothing about SORBS, etc., until today when I saw this, so I have no real opinion either way. Just posted for whatever it may be worth...
RE: use '/' to find both upper and lower case instances
>I have a need to use '/' to find something in a file, but I wish it >to ignore case. >So say I'm looking for 'foo' then I want to find all instances for >'foo' and 'FOO' Can try :set ignorecase or :set ic to do so. Former will almost always work, latter works on some variants of 'vi' but not all.
RE: Search and Replace with a Regular Expression
>>I agree with Chip and have a recommendation. Since you have been >>using Vim, Perl will be much easier to learn. >>When I first began studying programming Perl was over my head and >>seemed very difficult. >I found it incredibly easy to learn Perl. I was faced with a large >data-reformatting program written in uncommented C that needed to be >adapted to a new input format. I started to work on it but it soon >became clear that fixing the program would take a couple of weeks. >I had vague memories of a language named Perl that was good for that >sort of text processing, so at the weekend I went into London, bought >the Camel book, skimmed through it on the train home, went into work >on Monday and rewrote the entire application in Perl. Not only did it >take me less than half the time to rewrite the code as it would have >taken to fix it, but the Perl version ran three times faster than the >original C. And quite likely, a 'lex' script would be able to do the same in about half as many lines, and taken half that time to do it. :D 'lex' rules!
RE: Other European languages on a US keyboard
>Rare enough .. but besides "oeuf" is also occurs in such very common >words as "voeu" [wish] and "coeur" [heart] and it really bothers me when >I see them incorrectly spelled in web pages for instance. I spot it and >after that I tend to lose focus and not be able to take in what I'm >reading for a short while. How're they misspelled? Or, if none of the distributed keymaps is exactly what you want, you can write your own. It isn't hard. See ":help :loadkeymap" for the theory, and look at the contents of Bram's $VIMRUNTIME/keymap/accents.vim and my $VIMRUNTIME/keymap/esperanto_utf8.vim for a couple of simple examples. >Already started on this: copied accents.vim to ~/.vim/keymap/ .. >renamed it to foreign.vim and added the Spanish inverted question / >exclamation marks - an for now I have mapped to "!!" and "??". >Come to think of it, French would appear to have the most annoying >spelling system of the West European languages that I have some degree >of familiarity with. Spanish, Italian, and German seem to use fewer >non-ASCII characters. >In order to set up my foreign language keymap correctly I would really >need tables of all the characters that occur in these languages, decide >which ones are common enough to be worth adding to the keymap, and make >sure I build a scheme that's coherent before I get my fingers to >memorize it. I'll scour the Wiki's later today.. see if I can find >anything useful. If you wouldn't mind, definitely keep me in the loop on this one, as I've got something of an interest. Offhand, some contributions and questions: beta-looking SS (German) slashed 'l' (Polish) slashed 'o' (Scandinavian or thereabouts, not sure if Dutch or other) AElig/aelig/OElig/oelig (Latin, etc.) ccedil/Ccedil (how done, ",C"?) ecedil(?) (also Polish, possibly other vowels, 'though don't recall offhand) Oh, someone on the list is native Polish, so might ask him. Was it Mikolaj? Dunno anyone Dutch who'd recall the slashed-'o'. How to enter Aring (eg, Ångstrom)? "oA"?? Synonymous with "aa" (eg, "Haas" == "Hås"?) Oh, well...
RE: Other European languages on a US keyboard
>Unfortunately I am only able to type the US keyboard, so remapping the >keyboard might be a better solution than entering digraphs in the long >run but will not be painless.. And since I do not do this on a regular >basis, I am unsure whether it's really worth going to all the trouble. Would it be impractical to map, eg, <^> to whatever the code is for 'ê', ie, use prefix notation of [^'`~,], etc., as a prefix for [aeioucnAEIOUCN] as needed? Wouldn't be *all* those combinations, but, eg, would only need <,> for Ç, <~> for Ñ (and their lowercase counterparts, natch), but the rest would just be whatever accented chars you normally use, for grave, acute, circumflex, etc. I'm not sure how a non-US keyboard does such things, so I can't suggest a more "transparent" way of doing it. One other possibility would be the way my phone does multiple chars per key, eg, you'd hit '1' to get the generic '.', then '*' would cycle through different punctuation, and so on, 'til it'd get back to '.' again. Maybe hitting alt-A would get you an 'a' and put you into a loop, then multiple hits of an F-key would cycle through the 3-4 other chars and then back. Any other key would "escape" the loop. Arrange them in the order you expect their occurrence, most commonly-used ones first. Eg, if you arrange them in the order acute/grave/circumflex/ring, simply hitting would get you á. Hit F2, and it gets you à. Hit F2 again, circumflex. Again, ring. Again, acute. Lather, rinse, repeat. *Implementing* this would for now be beyond my ken, or my barbie, but I'm sure someone might have some ideas how to best do it. No?
RE: Visible Spaces
> Would you be satisfied with changing the background color for >spaces? Step 1: Ah, that's an idea. Just "/ " to search for spaces (assumes highlighting's turned on), and they'll all be highlighted. He wants to turn off highlighting, just "/qqq" or something. Else maybe tweak the font to change space to · or something. Thing is, change the font to something else, and that goes away, and he'd have to tweak the font for that as well. Eg, if he's using Lucida console 10pt, make a copy of the font, rename to something else ("Lucidaspace" or whatever), edit the font to change the space char, then when you want visispaces, just font your way to that. Want invisispaces again, change back to the normal Lucida font.
RE: s?
>Not really a request for help, but I was wondering if you guys ever use >the 's' command. All the time... >It's just a shortcut for 'cl', which I almost never need. Since I don't >assume it was put in to be complete or something, I'm intrigued by it's >enigmatic purpose. :) Comes in handy when you're replacing text that's of a different length. Eg, if you have the word "intended" and want to change it to "intending", you'd 'fe;' or '/ed' to get to the 2nd 'e', then '2sing' to get what you want. Otherwise, you'd have to do something like '2xaing', etc. In the instant case, 'cwing' would work, too, but if the text is in the middle of a word, or you're replacing characters in a filename, whatever, 's' comes in handy as a "delete this char / these chars, and replace it with as many chars as you want" command. Oh, to fix misspellings, too. Hard to give a "good" example right off, but once you start using 's', believe me, it comes in *really* handy. All those keystrokes add up, so why wear out your keyboard prematurely?
RE: laststatus=2 anomaly (was: I sometimes have to "double strike" when using gvim7 over Hummingbird Exceed)
>After taking a couple of helpful hints from Eric, and doing a bunch of >experiments, I have isolated some odd behavior to 'laststatus'. >As a reminder, this issue only shows up when I compile vim7 using GTK-1; >it does not occur when I compile with Motif or GTK-2. My system is a >Sun workstation running Solaris 8 and I use gcc 3.3.2 for compilation. >The problem is that when I compile vim7 using GTK-1, certain characters >need to be typed twice on the _search_ line. Note that it only appears >as if the search line is affected. Text entry and command entry don't >appear to be affected. >If I set laststatus to 0 or 1, the problem goes away. If I set it to 2 >again, the problem re-appears. >This doesn't always occur either; some files edit just fine. So there >is some other dependency as well it seems--but I haven't discovered that >yet. But, when it does occur, changing laststatus to 0 or 1 always >corrects the issue. >Here's a sample of what I get when I type each letter in the English >alphabet twice in a row (e.g.: aabbccddeeff...): >abbcdeffgghijjkklmmnopqqrßtuvvww×yzz > ^ > | > this is the greek Beta character (in case it > got lost in the transmission) >Notice how some characters only show up once, and the one greek >character. Aha! That "beta" is actually a German "SS", "ß" ("sz" ligature) iirr. The 'X' is a math times ("×" no?). All the other (usually) vowels have similar "compounding", eg, [aeiou] with accents of various types (try typing "a'" or "a:", ferinstance), Polish "l/" (slashed-ell, don't know the sgml entity offhand), Spanish "n~" (en-tilde, "ñ"), and so on. Try some funky combinations like "l/", "n~", etc., and see what pops up. If this is the case, then I don't *think* it's an issue with 'vim', but something with the GTK1 compile, that maybe it includes as a "bonus" some cooked keystroke editing to be able to easily get weirdo characters right from the keyboard for functions like getc(), scanf(), etc. We may be on to something now... :D
RE: Jumping to Headline in Headline
>Consider this: I'm editing the HTML: >(c)Headline >My cursor is denoted by (c). How can I most quickly jump to the start >of the "Headline" word? >Pressing w or e isn't any good, I still have to press at least three >times. Not nice, almost as bad as cursor keys. Dunno how arbitrary your input is or is likely to be (eg, what about "Fooey" or "Headline", etc., so can't be *that* specific. Rolling forward 4 chars: 4 4l Skip to closing '>' (and 'a'ppend instead of 'i'nsert): f> Skip to fixed 'H' fH Skip to 3rd word: 3w etc. Lotta ways to do the same thing...
RE: page scrolling
>Hello, >please, point me to the command, which allow to scroll page line by line, like >in mc viewer (F3) with arrow keys ^E and ^Y will move the visual window by one line. Comes in handy to adjust the screen to center a block of text.
RE: Vim version 7.0g BETA has been released
>- Win32: Dropping a shortcut on the Vim icon edited the shortcut instead > of the file it refers to (old problem). Any way to actually edit the shortcut? :D Seriously, I was curious if anyone came across this issue on any 95/98 systems: Highlight the file and simply bang on the return key (if the filetype gets associated with 'vim' instead of Exploder, etc.), and it doesn't know spaces in filenames, so something like 'c:\my documents\fooey.htm' will essentially crap out as 'vim' tries to edit c:\my documents\fooey.htm as 2 separate files. Perfectly logical, when handed the path+name via a commandline w/o encompassing quotes, but wonder if there be a workaround for this. I don't like using the moose if I can at all avoid it, so rclicking and "Edit with Vim..."ing is a less-desirable option. One more reason to never use spaces in file-/pathnames... Well, except for .mp3s and such. Ain't gonna manually edit *those*...
RE: Quick peak at files
Hmm, you've piqued my interest... -Original Message- From: Russell Bateman [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 10:07 AM To: Suresh Govindachar Cc: 'ymc014'; vim@vim.org Subject: Re: Quick peak at files Actually, a spell checker would not catch this mistake which, from a spell checker's point of view, is one of mere usage, not spelling, "peak" being a word for the top of a mountain. Any spell checker would have let it pass without commentary. And since both words are nouns, even Microsoft Word would have failed to note that it might be an error. Suresh Govindachar wrote: >ymc014 wrote: > > > Just a clarification, peak or peek? People (like me)looking > > for a tip like this might missed it. > > Sorry about the spelling mistake. Unlike for vimscripts, > vim.org does not allow authors to make corrections to vimtips. > > > I myself think it's peek but that's just me. > > Why do you think it is just you? Me too, now! > > > By the way thank you for this tip. > > You are welcome. > > --Suresh > > > >