patch: set() function
Here is a patch that adds set() function on the lines of existing get() for setting list elements by index or dict keys by name. The reason I wanted this is the lack of support to use :let for modifying the dictionary elements. E.g., the below will be an error: :let get_dict().key = 'val' The alternative is to use the new set() function as: :call set(get_dict(), 'key', 'val') The function also returns the new value. Notice that the :let syntax works to call functions on the dict, so the below is valid: :let x = get_dict().getX() Together, I think they will serve most or all of the use cases. This is my first patch for Vim, and I haven't touched c/c++ code in years, so I don't know if I screwed up on something. I can write the documentation if Bram OK's the patch. I don't know if there are any tests that need to be emended, and if so where they are. -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com set_patch.diff Description: 919171944-set_patch.diff
Re: escape() and '
On 10/25/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: '\V'.escape(substitute(regex, ', '', 'g'), '\') Uh, when did Vim's strings become objects? (Would be really nice if they were, mind you.) nikolai
Re: escape() and '
On 10/25/06, Nikolai Weibull [EMAIL PROTECTED] wrote: On 10/25/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: '\V'.escape(substitute(regex, ', '', 'g'), '\') Uh, when did Vim's strings become objects? (Would be really nice if they were, mind you.) Ahahaha, OK. Sorry. Goddam I hate the concatenation operator. It's virtually impossible to spot. '\V' . escape(...), now that I can sort of semi-read. nikolai
Re: containedin can't include clusters
On 10/25/06, Peter Hodge [EMAIL PROTECTED] wrote: --- Nikolai Weibull [EMAIL PROTECTED] wrote: I figured that it was easier to add items to a cluster using containedin= for a syntax definition I'm writing, but it seems that one can't do it that way. Is there a reason for this, or is it an oversight? Can we add this to the todo? I've never needed it before, but for this particular grammar, it made a lot of sense. Using 'syn keyword SomeKeyword foo [EMAIL PROTECTED]' does not add SomeKeyword to the cluster @SomeCluster, rather, it allows SomeKeyword be contained in all the items in @SomeCluster. Ah, of course. How silly of me. Although, it would be nice if this could be done somehow. A pair of @'s, perhaps, e.g., syn match Something containedin=@@Cluster '...'? nikolai
Re: containedin can't include clusters
On 10/25/06, Peter Hodge [EMAIL PROTECTED] wrote: --- Nikolai Weibull [EMAIL PROTECTED] wrote: On 10/25/06, Peter Hodge [EMAIL PROTECTED] wrote: --- Nikolai Weibull [EMAIL PROTECTED] wrote: I figured that it was easier to add items to a cluster using containedin= for a syntax definition I'm writing, but it seems that one can't do it that way. Is there a reason for this, or is it an oversight? Can we add this to the todo? I've never needed it before, but for this particular grammar, it made a lot of sense. Using 'syn keyword SomeKeyword foo [EMAIL PROTECTED]' does not add SomeKeyword to the cluster @SomeCluster, rather, it allows SomeKeyword be contained in all the items in @SomeCluster. Ah, of course. How silly of me. Although, it would be nice if this could be done somehow. A pair of @'s, perhaps, e.g., syn match Something containedin=@@Cluster '...'? Probably better if it was '[EMAIL PROTECTED]' rather than complicating the containedin option. If you are in the habit of spanning syntax commands across multiple lines, then it's pretty easy to make a new line to add the item to the cluster. I.e., if you have: syn match foo /foo/ contained \ [EMAIL PROTECTED] then it could be syn match foo /foo/ contained syn cluster myCluster add=foo It's not so painful. Yes, it is, because many of the foo need to be added to two clusters, and it clutters up an already rather (unavoidably) cluttered syntax definition. Addto would perhaps make more sense. nikolai
Re: patch: set() function
On Wed, 25 Oct 2006 at 9:16am, Nikolai Weibull wrote: On 10/25/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: Here is a patch that adds set() function on the lines of existing get() for setting list elements by index or dict keys by name. The reason I wanted this is the lack of support to use :let for modifying the dictionary elements. E.g., the below will be an error: :let get_dict().key = 'val' The alternative is to use the new set() function as: :call set(get_dict(), 'key', 'val') Wouldn't it be better to allow the :let syntax you describe above? It shouldn't be impossible to parse that kind of expression. - A set() function will be nice to have anyway (to balance out get()) - Adding a function is much easier (at least for me as a newbie) and the change is more isolated than changing the syntax of the :let command. This also means better likely hood of getting incorporated sooner. - The last time the :let syntax was discussed, I don't think Bram agreed to fix this issue, which indicates he is not in favor of that, and so less likelyhood to get incorporated. BTW, I noticed that I had the min args as 2 (copied from f_get) which is wrong, it should be 3. I can send another patch, again if Bram is OK with this change at all. -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: patch: set() function
Hari Krishna Dara [EMAIL PROTECTED] wrote: Nikolai Weibull wrote: Hari Krishna Dara [EMAIL PROTECTED] wrote: Here is a patch that adds set() function on the lines of existing get() for setting list elements by index or dict keys by name. [SNIP] Wouldn't it be better to allow the :let syntax you describe above? It shouldn't be impossible to parse that kind of expression. - A set() function will be nice to have anyway (to balance out get()) I worry about adding such a set() function with that name. Vim's been adding things like dictionaries/lists with Python-like syntax, and it's entirely possible that it may want to add something like Python's set() datatype in the future. Keeping the set name reserved in Vim seems wise to me.
Re: question about vim buffer write to file
Ming Lei wrote: I have a basic question about vim internal. Let me use an example to describe: Say I have a text file of 20Mbytes. I use VIM to insert 3 characters at offset 1024 bytes from the beginning of the file and then I save the file. My question is: how does VIM handle the file write and save? Does VIM rewrite the whole file back to disk/file system? Can anyone describe the procedure that VIM employs at the granularity of the system call? Vim always writes the whole file. Most systems allow overwriting halfway a file, but inserting halfway a file is rare (I can't name a system that supports this). Anyway, Vim wants to keep the original file so long as writing isn't finished, to avoid the risk that a system crash results in neither the original or the new file. -- Nobody will ever need more than 640 kB RAM. -- Bill Gates, 1983 Windows 98 requires 16 MB RAM. -- Bill Gates, 1999 Logical conclusion: Nobody will ever need Windows 98. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: patch: set() function
Hari Krishna Dara wrote: On Wed, 25 Oct 2006 at 9:16am, Nikolai Weibull wrote: On 10/25/06, Hari Krishna Dara [EMAIL PROTECTED] wrote: Here is a patch that adds set() function on the lines of existing get() for setting list elements by index or dict keys by name. The reason I wanted this is the lack of support to use :let for modifying the dictionary elements. E.g., the below will be an error: :let get_dict().key = 'val' The alternative is to use the new set() function as: :call set(get_dict(), 'key', 'val') Wouldn't it be better to allow the :let syntax you describe above? It shouldn't be impossible to parse that kind of expression. - A set() function will be nice to have anyway (to balance out get()) - Adding a function is much easier (at least for me as a newbie) and the change is more isolated than changing the syntax of the :let command. This also means better likely hood of getting incorporated sooner. - The last time the :let syntax was discussed, I don't think Bram agreed to fix this issue, which indicates he is not in favor of that, and so less likelyhood to get incorporated. BTW, I noticed that I had the min args as 2 (copied from f_get) which is wrong, it should be 3. I can send another patch, again if Bram is OK with this change at all. I would prefer the :let command to work. It's not easy to implement but would be good for consistency. The main reason get() exists is to be able to handle non-existing keys in a simple way. That argument doesn't hold for set(). The dictionary was modelled after Python, and I don't think that Python has set(). -- Corduroy pillows: They're making headlines! /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: insert-mode :map-alt-keys and 8-bit locales
A.J.Mechelynck wrote: Ilya Sher wrote: A.J.Mechelynck wrote: Alexey I. Froloff wrote: * Bram Moolenaar Bram@ [061022 17:41]: I don't want to support that, because it causes mistakes. Consider being in Insert mode and typing Esc o to open a new line or Esc n to find the next match. A timeout won't help, the two keys can be typed within ten msec. So, all plugins that imap something to Alt+Key a screwed up in all non-ascii 8-bit locales. Moreover, such maps breaks normal text entering. There is something outside your latin-1 world. Take a look around, you, 7-bit racists. - Maybe Bram Moolenaar can type at 100 keystrokes / second, I can't. Especially if one of the keys is Esc, which is far away from almost everything else. Assuming one-handed typing, (especially for Esco and Escn) which is almost always not true for vim users. Assumption that people use keyboard mappings where Esc is far away is true most of the time but not always. (Common exception is caps lock generating Esc). [snip] When I say I can't, I'm talking about me on my keyboard, where the Esc key is at top left, and the nearest keys are (²³¬) (1|) (é2@) and F1 (Between round brackets: unshifted, with Shift, and with AltGr, in that order, for a single key). I'm not assuming that _you_ cannot type 100 keystrokes per second, though I would bet that the Vimmers who can are a minority at best. ;-) I was probably not clear enough. The point is that one does not even have to type at that speed to hit pretty fast Esco if the Esc is not far away and both hands are used. ... the first condition is optional. Best regards, Tony. -- For robots (please don't mail me there): [EMAIL PROTECTED] My real email is ilya @ same domain
Re: Bold font in OS X GUI?
Peter Hodge wrote: Hello, I am having trouble with OS X GUI, none of the highlighting is in Bold. Is this a Bug, or does Bold font just not work in the OS X gui? regards, peter It may depend on your 'guifont'. Some font faces have no bold glyphs, others no italic, etc. Here, when I set 'guifont' to SUSE Sans Mono 9, all italics appear bolded; on BH LucidaTypewriter there are no italics at all, ... If your GUI flavour accepts it, try :set gui=* (without the quotes) and select the regular version of a font which has also bold italic etc. If it doesn't accept it, you'll have to find from another source which font names are valid on your system, and then find by hit-and-miss some font having regular, bold, etc. Best regards, Tony.
mapping of C-1
Hello, I'm trying to map C-1 to some command (:tabn 1cr) and unfortunately it's not working :( I'm trying on linux (where this mapping for mrxvt works) and windows... Have you any clue why it's not working? With regards, Roman Porizka
Re: Bold font in OS X GUI?
--- A.J.Mechelynck [EMAIL PROTECTED] wrote: Peter Hodge wrote: Hello, I am having trouble with OS X GUI, none of the highlighting is in Bold. Is this a Bug, or does Bold font just not work in the OS X gui? regards, peter It may depend on your 'guifont'. Some font faces have no bold glyphs, others no italic, etc. Here, when I set 'guifont' to SUSE Sans Mono 9, all italics appear bolded; on BH LucidaTypewriter there are no italics at all, ... If your GUI flavour accepts it, try :set gui=* (without the quotes) and select the regular version of a font which has also bold italic etc. If it doesn't accept it, you'll have to find from another source which font names are valid on your system, and then find by hit-and-miss some font having regular, bold, etc. I can use guifont=*, and have tried many different fonts which have bold and italic glyphs. The problem is that no matter which font I choose, Vim refuses to show text in Bold (Unless I choose a font which has only a bold glyph). I get the impression it's a shortcoming of the OS X GUI, because underlined text doesn't work either (Vim reverses the bg/fg colors instead). regards, Peter On Yahoo!7 Messenger: Share up to 1GB of files in the IM window http://au.messenger.yahoo.com
Re: Bold font in OS X GUI?
Peter Hodge [EMAIL PROTECTED] 写于 2006-10-25 14:54:16: I can use guifont=*, and have tried many different fonts which have bold and italic glyphs. The problem is that no matter which font I choose, Vim refuses to show text in Bold (Unless I choose a font which has only a bold glyph). I get the impression it's a shortcoming of the OS X GUI, because underlined text doesn't work either (Vim reverses the bg/fg colors instead). Really? Do you mean: you selected a bold font as the gui font but the gui displayed it as the corresponding regular font for that bold font? If that's true, I'd wonder how this version is compiled...Any clue for :version? I guess it's not the shortcoming of the OSX gui, but the vim need to be recompiled with different settings. -- Sincerely, Pan, Shi Zhu. ext: 2606
inserting backticks
Hi When inserting a backtick (`) I normally type `space. But sometimes nothing happens... When I enter a 2. space, I get a space. I can enter as many spaces as I want, but I get no backtick. When I type a letter, eg. d, _than_ I get `d at the current cursor position. Wnen I type a 2. ` instead of d, I get ``. And really strange is that I can't reproduce this behaviour constantly. Eg. starting with an empty Vim (no file opened) and the backtick+space works as it should. Starting an empty Vim again and it doesn't work... I've tested it with python and tex files. Sometime `space produce a backtick, but mostly not. Well I could use a mapping like this: imap `space ``C-Ox But this is IMHO a bit too hackish. I'm using gVim 7 on WinXP. The Console-Vim seems to work correctly. Is this a matter of my configuration? Or where is the ` waiting? cu boesi -- |¯|________ _.:·*´¯ | ´_ \ / _ \ / _ \ / __/ |_| |¯| | (_) )( (_) )( __/ \__ \ |¯|/\ |/__\___/__\___/_|_|||¯| |_
Re: mapping of C-1
Roman Pořízka wrote: Hello, I'm trying to map C-1 to some command (:tabn 1cr) and unfortunately it's not working :( I'm trying on linux (where this mapping for mrxvt works) and windows... Have you any clue why it's not working? With regards, Roman Porizka It's not working because it's not defined. The following Ctrl + printable key combinations are defined, and since they date back to a time when keyboards had neither F keys nor arrow keys, nor even Tab or Backspace, sometimes not even an Enter key, they are portable across all ASCII-based hardware and software flavours AFAIK: Ctrl-? 0x7F Ctrl-@ 0x00 Ctrl-A 0x01 Ctrl-B 0x02 ... Ctrl)Y 0x19 Ctrl-Z 0x1A Ctrl-[ 0x1B Ctrl-\ 0x1C Ctrl-] 0x1D Ctrl-^ 0x1E Ctrl-_ 0x1F Ctrl-a to Ctrl-z : same as Ctrl-A to Ctrl-Z A Ctrl function is also defined for most of the non-printable keys, but the keycodes are implementation-dependent (they vary from one console terminal to the other). Ctrl + other printable keys is not defined. (Programs reading their keyboard in raw mode may sometimes nevertheless identify them, but Vim uses cooked mode.) OTOH, Alt + printable key is usually defined, but in most cases it collides with symbols or letters-with-diacritics in the range 0xA0-0xFF. If you want to define portable key mappings, I recommend choosing among F2 to F9, F11, F12, and Shift-F1 to Shift-F12. If you need more, try multikey mappings and/or Ctrl-Alt-a to Ctrl-Alt-Z. Some of the latter, however, might be pre-empted by your OS and never make it to Vim. Best regards, Tony.
Re: inserting backticks
Alexander 'boesi' Bösecke wrote: Hi When inserting a backtick (`) I normally type `space. But sometimes nothing happens... When I enter a 2. space, I get a space. I can enter as many spaces as I want, but I get no backtick. When I type a letter, eg. d, _than_ I get `d at the current cursor position. Wnen I type a 2. ` instead of d, I get ``. And really strange is that I can't reproduce this behaviour constantly. Eg. starting with an empty Vim (no file opened) and the backtick+space works as it should. Starting an empty Vim again and it doesn't work... I've tested it with python and tex files. Sometime `space produce a backtick, but mostly not. Well I could use a mapping like this: imap `space ``C-Ox But this is IMHO a bit too hackish. I'm using gVim 7 on WinXP. The Console-Vim seems to work correctly. Is this a matter of my configuration? Or where is the ` waiting? cu boesi Unless you have a mapping for something starting with a backtick, it might be your OS (including the keyboard interface). Here (on Linux with Belgian keyboard) hitting AltGR+µ twice, or once followed by a space, produces a backtick; AltGr+µ followed by a vowel produces that vowel with a grave accent; when followed by anything else that key combo produces a beep. I don't have another backtick key. Best regards, Tony. PS: 2. is the German abbreviation for zweite. The English abbrev for second (as an ordinal number, not a time interval) is 2nd. -- similarly 1st, 2nd, 3rd, 4th, 5th, ... 20th, 21st, 22nd, etc.
understanding font setting in gvim for win32
I've been trying to change fonts in my win32 vim. I don't find a font directory in the vim tree, so I take it Win fonts are begin used. Right now in my _gvimrc, I have: set guifont=Lucida_Console:h10 Courier:h10 also works but other common fonts like Arial:h10 don't work. Is that because they are not mono spaced? If I find a font which I like, must I put it into Windows' Fonts directory, yes? But then I need to work out the syntax for it in _gvimrc. How do I work it out? OK, a space in Windows is probably an underscore, but is there anything else I need look out for? Many thanks in advance. Send instant messages to your online friends http://uk.messenger.yahoo.com
Re: inserting backticks
Hi Am 25.10.2006 10:32:47 schrieb A.J.Mechelynck: Unless you have a mapping for something starting with a backtick, Well according to :verb imap ` I don't have one. it might be your OS (including the keyboard interface). Hmm in other applications, like my mail program or openoffice, backtick+space works... Here (on Linux with Belgian keyboard) hitting AltGR+µ twice, or once followed by a space, produces a backtick; AltGr+µ followed by a vowel produces that vowel with a grave accent; That's the same on my system, except that ´ and ` have a separate key, ` is avaiable via Shift. when followed by anything else that key combo produces a beep. I don't have another backtick key. That's differently here, but it works the same way in gvim and openoffice: ` + any printable (non-vowel) character gives ` + the character ` + arrow keys move the cursor when I press any printable character, ` + character is entered at the current cursor position. PS: 2. is the German abbreviation for zweite. The English abbrev for second (as an ordinal number, not a time interval) is 2nd. -- similarly 1st, 2nd, 3rd, 4th, 5th, ... 20th, 21st, 22nd, etc. Oehm it's really long ago that I've been in school... cu boesi -- No matter where you are. Everyone is always connected.
Re: understanding font setting in gvim for win32
set guifont=Lucida_Console:h10 Courier:h10 also works but other common fonts like Arial:h10 don't work. Is that because they are not mono spaced? gVim's only happy with monospaced fonts. I've heard rumors of being able to coerce it to used other fonts, but the results are usually pretty ugly. :help e236 for more on that. If I find a font which I like, must I put it into Windows' Fonts directory, yes? It must be accessible like fonts in any other program in Windows which generally means putting them in the system-wide fonts directory. I don't know if Win32 offers a means for a non-priv'ed user to add fonts to the system by putting them in some magic directory in their own branch of the Documents and Settings folder. But then I need to work out the syntax for it in _gvimrc. How do I work it out? OK, a space in Windows is probably an underscore, but is there anything else I need look out for? The easiest way is to simply use :set guifont=* and pick the font you want/like. Then, simply issue :set guifont? and Vim will tell you what it wants. There are a variety of characters that need to be escaped (spaces, commas, backslashes) all described in :help guifont -tim
Re: understanding font setting in gvim for win32
Hi Am 25.10.2006 11:53:42 schrieb o1792: But then I need to work out the syntax for it in _gvimrc. How do I work it out? OK, a space in Windows is probably an underscore, but is there anything else I need look out for? You can select a font with :set guifont=*. I you want to know which font is used, just type :set guifont. cu boesi -- Ein Wunder muss heute schon ganz schoen wundervoll sein um ein Wunder zu sein, sonst wuerde man sich ja gar nicht mehr wundern .-==Prof. Dr. Harald Lesch==-.
Re: understanding font setting in gvim for win32
Cool, many thanks boesi and tim for your answers! --- Tim Chase [EMAIL PROTECTED] wrote: set guifont=Lucida_Console:h10 Courier:h10 also works but other common fonts like Arial:h10 don't work. Is that because they are not mono spaced? gVim's only happy with monospaced fonts. I've heard rumors of being able to coerce it to used other fonts, but the results are usually pretty ugly. :help e236 for more on that. If I find a font which I like, must I put it into Windows' Fonts directory, yes? It must be accessible like fonts in any other program in Windows which generally means putting them in the system-wide fonts directory. I don't know if Win32 offers a means for a non-priv'ed user to add fonts to the system by putting them in some magic directory in their own branch of the Documents and Settings folder. But then I need to work out the syntax for it in _gvimrc. How do I work it out? OK, a space in Windows is probably an underscore, but is there anything else I need look out for? The easiest way is to simply use :set guifont=* and pick the font you want/like. Then, simply issue :set guifont? and Vim will tell you what it wants. There are a variety of characters that need to be escaped (spaces, commas, backslashes) all described in :help guifont -tim Send instant messages to your online friends http://uk.messenger.yahoo.com
Re: understanding font setting in gvim for win32
Tim Chase wrote: set guifont=Lucida_Console:h10 Courier:h10 also works but other common fonts like Arial:h10 don't work. Is that because they are not mono spaced? Courier_New (a fixed-width TrueType font) is usually better-looking (if not by much) than Courier (a bitmapped font). Also, Courier_New usually has a richer repertoire of foreign-language glyphs than many other fonts. See below how to find out which fonts are acceptable to Vim and try them out. gVim's only happy with monospaced fonts. I've heard rumors of being able to coerce it to used other fonts, but the results are usually pretty ugly. :help e236 for more on that. Vim must have a fixed-width font, except the GTK2 version, which doesn't run on Windows (it's one of the flavours of GUI for X11); and even then, non-monospaced fonts are indeed pretty ugly in Vim since it uses a fixed character cell: narrow letters like i would have too much space around them, and wide letters like m might get clipped at right. If I find a font which I like, must I put it into Windows' Fonts directory, yes? It must be accessible like fonts in any other program in Windows which generally means putting them in the system-wide fonts directory. I don't know if Win32 offers a means for a non-priv'ed user to add fonts to the system by putting them in some magic directory in their own branch of the Documents and Settings folder. But then I need to work out the syntax for it in _gvimrc. How do I work it out? OK, a space in Windows is probably an underscore, but is there anything else I need look out for? The easiest way is to simply use :set guifont=* and pick the font you want/like. Then, simply issue :set guifont? and Vim will tell you what it wants. There are a variety of characters that need to be escaped (spaces, commas, backslashes) all described in :help guifont -tim Or, once you have what you like, type :set guifont=Tab (i.e., hit the tab key after the equal sign). Vim will fill-in your current setting, with escaping backslashes if and where needed. On Windows there usually aren't many for the 'guifont' option, since spaces can be replaced by underscore. You can edit the value in-place (then Enter to accept or Esc to cancel) if you're not 100% satisfied; or if you are, write the line down and copy that verbatim to your gvimrc. Best regards, Tony.
Cut'n'Paste via *p and different users
Hi, I often edit some system related files as root while haveing cat-ed related (text-) material as user on another terminal. Trying to do the following under X and with mrxvt as termulator does not work: sux root password vim a system file (and as user at another termulator-window): cat a file selecting some text (back to the rooted vim: ) *p Doing both as user works nicely. Is it possible to Cut(user)'n'Paste(root) somehow? Is this a problem of security settiongs, of permission settings or of me myself ? ;) Ah! by the way: I am running Gentoo linux (updated on a daily basis) and I am using vim via the console (mrxvt termulator) under X. Thanks a lot for any help in advance! Keep editing! mcc
Re: Binary files, noeol, and other such things.
On 10/25/06, Matthew Winn [EMAIL PROTECTED] wrote: On Tue, 24 Oct 2006 19:35:41 +0200, A.J.Mechelynck [EMAIL PROTECTED] wrote: In Algol, Pascal, and (IIUC) C, the semicolon is a statement separator. The last statement before an *end* or } doesn't need an ending semicolon; if there is one, then there is an empty statement after it. In COBOL, OTOH, every sentence (or label or data declaration or...) must end in a period followed by a space. Even the last sentence in the last paragraph in the last section (if any) in the program's PROCEDURE DIVISION must have one. The period followed by a space is not a separator, it's a terminator. Apparently the Windows engineers came from Algol, Pascal and C while the Unix people came from COBOL. Or did they? :-þ I think it's more likely that the Windows engineers came from some lazy language. I won't name one for fear of making enemies. The newline as separator idea feels like a hack for a lazy coder. If you load your entire file into memory and then just skip through it looking for newlines, replacing them with nulls and using the address of the next character as the start of a line, then hey presto: you have a nice, tidy array of lines. Except you have one extra line of zero length at the end. Oops. Instead of adding special code to ignore that one line, why not just leave out the final line terminator when writing the file so it won't cause a problem when reading it back? Far easier, and it saves you a few minutes coding time. Of course it does mean that everyone else has to cope with the fact that one line has no terminator and all the others do, but it's _their_ time that's wasted, not yours, so it doesn't matter. And so a Windows convention is born... Well, in unix, you do: printf(...\n,.); so you always have \n at end of file. Apparently windows programmers do something completely different. Maybe they do printf(\r\n.., ); maybe something even more weird. Yakov
Re: Cut'n'Paste via *p and different users
Meino Christian Cramer wrote: Hi, I often edit some system related files as root while haveing cat-ed related (text-) material as user on another terminal. Trying to do the following under X and with mrxvt as termulator does not work: sux root password vim a system file (and as user at another termulator-window): cat a file selecting some text (back to the rooted vim: ) *p Doing both as user works nicely. Is it possible to Cut(user)'n'Paste(root) somehow? Is this a problem of security settiongs, of permission settings or of me myself ? ;) Ah! by the way: I am running Gentoo linux (updated on a daily basis) and I am using vim via the console (mrxvt termulator) under X. Thanks a lot for any help in advance! Keep editing! mcc If it doesn't work via the clipboard, try the older (pre-clipboard) method, using an auxiliary file: :[range]w {filename} write lines (from) (to) :[line]r {filename} read after (line) or before line 1 if (line) == 0 User - root should work with no problem. For root - user you might need :!chmod {filename} a+r in between, to give everyone read permission. Best regards, Tony.
Re: Problems with Align.vim
Diwaker Gupta wrote: I'm using Vim 7.0.122 on Debian Unstable. I can send output of :version if needed. I've recently started having problems using Align.vim: Error detected while processing function AlignWrapperStart: line 28: E117: Unknown function: Align#AlignPush I've tried installing the script from both vim.sf.net as well as Dr. Chip's astro-page. Both of them fail with the same error. Infact, when I extract the files from the vimball using ':so %', it generates weird file names: AlignMaps.vim?[[[1 AlignPlugin.vim?[[[1 cecutil.vim?[[[1 As both places mention: you need v18 or later of the vimball plugin: * remove plugin/vimballPlugin.vim from the distribution * remove autoload/vimball.vim from the distribution * install new vimball plugin You then need to extract the files from the Align.vba.gz file. Regards, Chip Campbell
Re: Cut'n'Paste via *p and different users
From: A.J.Mechelynck [EMAIL PROTECTED] Subject: Re: Cut'n'Paste via *p and different users Date: Wed, 25 Oct 2006 14:28:23 +0200 Meino Christian Cramer wrote: Hi, I often edit some system related files as root while haveing cat-ed related (text-) material as user on another terminal. Trying to do the following under X and with mrxvt as termulator does not work: sux root password vim a system file (and as user at another termulator-window): cat a file selecting some text (back to the rooted vim: ) *p Doing both as user works nicely. Is it possible to Cut(user)'n'Paste(root) somehow? Is this a problem of security settiongs, of permission settings or of me myself ? ;) Ah! by the way: I am running Gentoo linux (updated on a daily basis) and I am using vim via the console (mrxvt termulator) under X. Thanks a lot for any help in advance! Keep editing! mcc If it doesn't work via the clipboard, try the older (pre-clipboard) method, using an auxiliary file: :[range]w {filename} write lines (from) (to) :[line]r {filename} read after (line) or before line 1 if (line) == 0 User - root should work with no problem. For root - user you might need :!chmod {filename} a+r in between, to give everyone read permission. Best regards, Tony. Hi Tony, thank you for your reply, Tony ! I know that temporary-file-trick already (it is one of two things, which I know before the other thing is how to start vim ;))) I was wondering, whether the clipboard-problem is caused by some (possible wrong) settings of my system or a normal behaviour of X/mrxvt and whether there are tricks to make the clibboard working inter-user-al :) ... it is so cool to use *p !!! Keep hacking! mcc
Re: Problems with Align.vim
On Tue, Oct 24, 2006 at 03:29:25PM -0700, Diwaker Gupta wrote: I'm using Vim 7.0.122 on Debian Unstable. I can send output of :version if needed. I've recently started having problems using Align.vim: Error detected while processing function AlignWrapperStart: line 28: E117: Unknown function: Align#AlignPush I've tried installing the script from both vim.sf.net as well as Dr. Chip's astro-page. Both of them fail with the same error. In the future, please give a link, such as http://mysite.verizon.net/astronaut/vim/vbafiles/Align.vba.gz Infact, when I extract the files from the vimball using ':so %', it generates weird file names: AlignMaps.vim?[[[1 AlignPlugin.vim?[[[1 cecutil.vim?[[[1 Any ideas? Thanks in advance, Diwaker There are a few problems here. First, it is too easy to miss the warning BE SURE TO GET THE LATEST VIMBALL PLUGIN BEFORE ATTEMPTING TO USE SCRIPTS UPLOADED ON OR AFTER AUG 1, 2006 posted on http://mysite.verizon.net/astronaut/vim/index.html . Ideally, all links to recent plugins would redirect to a page line http://mysite.verizon.net/astronaut/vim/newvimball.html?file=Align.vba.gz and this page would give links to the new version of vimball and the desired plugin. Second, the link to the new version of vimball is broken: http://mysite.verizon.net/astronaut/vim/tarfiles/vimball.vba.gz This does work: http://mysite.verizon.net/astronaut/vim/tarfiles/vimball.tar.gz The point is that the newest version cannot be extracted by the older version, so it is distributed as a tarball instead of a vimball. You can also get the new version of vimball from http://www.vim.org/scripts/script.php?script_id=1502 . The installation instructions there do not mention that the latest version should be extracted using tar. When installing vimball, do it in your $VIMRUNTIME directory. (For me, this means /usr/local/share/vim/vim70 , and I need to use su or sudo to install.) There may be an even newer version distributed with vim 7.1 or later, and you do not want this version in your personal runtime directory to be used when you upgrade. Third problem. This may have been my fault, but when I installed the vimball plugin, with $ cd /usr/local/share/vim/vim70 $ sudo tar xzf path/to/vimball.tar.gz some of the files had the wrong permissions, so I had to fix it with $ sudo chmod a+r autoload/vimball.vim doc/pi_vimball.txt plugin/vimballPlugin.vim Like you, I had some wrong files installed at this point. I cleaned up with $ cd ~/.vim $ rm -i */*[[[* HTH --Benji Fisher
Re: jumplist/mark ' problem
On Tue, Oct 24, 2006 at 07:03:37PM -0700, Hari Krishna Dara wrote: I am facing a weird problem with the '' marker not getting set. Here is what I am doing, but this may be more generic than what I do, but this scenario is the most I use: - While on an identifier, use ^W^] to jump to the id definition. - Mark the line, say, ma - move a few lines up using k, say kkk - yank the range using y'a - Try to go back to the original position using '' Instead of cursor going back to the original line, it goes to the start of the file. This behavior is really irritating, as I end up doing this sequence repeatedly and it surprises me everytime. I have a feeling that this wasn't happening in prior versions. Is there a flag that that I might have changed? I think it will work the way you want if you stay within the same file. Looking quickly, I do not see it stated explicitly, but I think all of the other maps are local to the file (or maybe buffer), like 'a to 'z . Only 'A to 'Z and '0 to '9 move between files. In particular, '' will jump to the '' mark in the current file. You can use C-O or C-T to jump back to your previous position. To reproduce: :help '' Then follow the links to :keepjumps (in the same file) or restore-position (different file) and try '' or C-O in either case. HTH --Benji Fisher
Re: Bold font in OS X GUI?
On Wed, Oct 25, 2006 at 03:58:36PM +1000, Peter Hodge wrote: Hello, I am having trouble with OS X GUI, none of the highlighting is in Bold. Is this a Bug, or does Bold font just not work in the OS X gui? regards, peter There are known problems with fonts in the OS X GUI, but it is hard to find a volunteer to work on this problem. If none of the suggestions at http://macvim.org/OSX/index.php#FAQ (item #2) then you will have to wait until someone fixes the problem. HTH --Benji Fisher
Re: inserting backticks
On Wed, Oct 25, 2006 at 12:02:51PM +0200, Alexander 'boesi' Bösecke wrote: Hi Am 25.10.2006 10:32:47 schrieb A.J.Mechelynck: Unless you have a mapping for something starting with a backtick, Well according to :verb imap ` I don't have one. Did you also try :verbose imap Space :verbose iabbrev ` and so on? I suggest typing CTRL-V before the back-tick and before the space. Just to be sure, I would also try starting vim with $ vim -u NONE If that solves the problem, then you have some mapping, abbreviation, or *something*. If it does not solve the problem, then PEBKAV (Problem Exists Between Keyboard And Vim). HTH --Benji Fisher
Re: Cut'n'Paste via *p and different users
I was wondering, whether the clipboard-problem is caused by some (possible wrong) settings of my system or a normal behaviour of X/mrxvt and whether there are tricks to make the clibboard working inter-user-al :) ... it is so cool to use *p !!! The following information is 100% untested, but my understanding is that the X server has to be authorized (via the MIT Magic Cookie) to accept connections from clients. Quoting directly from Loren M. Lang's post (found at http://groups.google.com/group/mailing.freebsd.questions/browse_thread/thread/dc2159c366eb9064/e9001ce2abaec9d3?lnk=stq=run+x+application+as+different+userrnum=4#e9001ce2abaec9d3 sorry for the long link) [begin quote]-- 3)what must i put in the .Xauthority file to make the screensaver work with having to use xhost ? When X first logs in to a user, it creates the .Xauthority file in that users home directory and fills it with a random string called a MIT-MAGIC-COOKIE. Any X client, by default, reads that file to see what the cookie is then sends it to the X server to authenticate itself. Anyone who can read that file can access the display so that file is normally only readable by the user who logged in, though root can always read it because root is god. When you run an X program as a different user, it will look in that users home directory for the .Xauthority file and so won't be able to find the right cookie unless you used the xauth command to give that user the cookie ahead of time. By setting the XAUTHORITY environment variable to some other file, it will check that file for the magic cookie instead of the current users home directory. This is useful when running a command as root that you want to access a normal users X server. This is a much more secure way to allow access to X than using xhost since you know what users are able to access X, not just which computers, which may have multiple users on them. In summary, don't touch xhost, just use: XAUTHORITY=/home/user/.Xauthority xscreensaver or you can use xauth to extract the magic cookie and then import it into the correct users .Xauthority file. As the user of the X server: xauth extract my-cookie-file $DISPLAY Saves the magic cookie to a file called my-cookie-file for the current display. Then as the user who want to access the X display: xauth merge my-cookie-file Adds the cookie stored in my-cookie file to the current users .Xauthority file. Now user B can open an X application on A's X server. Oh, and don't run xscreensaver as root EVER! Instead, if you're really paranoid about security, make a user who can access any of your files whose sole purpose is to run xscreensaver then use that user to run it. This is still not that much more secure since any user that can access an X server can essentially take it over and control your mouse and keyboard doing what ever they want, like openning an xterm on your display and running the passwd command to change your passwd. Now they just gained access to all your files as well. [end quote]-- My guess is that, as root, you want to try something like XAUTHORITY=/home/user/.Xauthority gvim file1.txt The old-school way of doing this was to tinker with xhost to allow a whole host (rather than a particular user) to connect to the X server. The aim is to allow your alternate user (root in this case) permission to connect to the X server so that it can access the clipboard(s). My understanding is that the keys found in the .Xauthority file are the way to do this...that the alternate user has to have the key. Or I could be talking bunk. YMMV :) -tim
Re: Cut'n'Paste via *p and different users
From: Tim Chase [EMAIL PROTECTED] Subject: Re: Cut'n'Paste via *p and different users Date: Wed, 25 Oct 2006 08:19:29 -0500 I was wondering, whether the clipboard-problem is caused by some (possible wrong) settings of my system or a normal behaviour of X/mrxvt and whether there are tricks to make the clibboard working inter-user-al :) ... it is so cool to use *p !!! The following information is 100% untested, but my understanding is that the X server has to be authorized (via the MIT Magic Cookie) to accept connections from clients. Quoting directly from Loren M. Lang's post (found at http://groups.google.com/group/mailing.freebsd.questions/browse_thread/thread/dc2159c366eb9064/e9001ce2abaec9d3?lnk=stq=run+x+application+as+different+userrnum=4#e9001ce2abaec9d3 sorry for the long link) snipped but never forgotten! :) My guess is that, as root, you want to try something like XAUTHORITY=/home/user/.Xauthority gvim file1.txt The old-school way of doing this was to tinker with xhost to allow a whole host (rather than a particular user) to connect to the X server. The aim is to allow your alternate user (root in this case) permission to connect to the X server so that it can access the clipboard(s). My understanding is that the keys found in the .Xauthority file are the way to do this...that the alternate user has to have the key. Or I could be talking bunk. YMMV :) -tim Hi Tim ! thanks a lot for that ! Simply: IT WORKS! Keep hacking! mcc
Re: Cut'n'Paste via *p and different users
XAUTHORITY=/home/user/.Xauthority gvim file1.txt The old-school way of doing this was to tinker with xhost to allow a whole host (rather than a particular user) to connect to the X server. The aim is to allow your alternate user (root in this case) permission to connect to the X server so that it can access the clipboard(s). My understanding is that the keys found in the .Xauthority file are the way to do this...that the alternate user has to have the key. Or I could be talking bunk. YMMV :) thanks a lot for that ! Simply: IT WORKS! Other suggestions I've heard include, rather than *being* root, to try (as user) [EMAIL PROTECTED] sudo gvim file1.txt (assuming you have sudo configured to allow you to run gvim) which for some reason should work as well. I've actually done this one, whereas my previous ramble was 100% untested. I'm glad it worked. Other ideas I've heard include creating a soft-link: [EMAIL PROTECTED] ln -s ~user/.Xauthority ~/.Xauthority which doesn't work quite as well for non-root situations unless you explicitly share your ~user/.Xauthority file permission-wise, such as [EMAIL PROTECTED] chmod ug+r ~/.Xauthority [EMAIL PROTECTED] chown :alteregos ~/.Xauthority [EMAIL PROTECTED] su -c user2 [EMAIL PROTECTED] ln -s ~user1/.Xauthority ~/.Xauthority (those permissions *might* need to be ug+rw, but I'm not sure on that) This assumes that user1 and user2 are members of hte alteregos group. However, if you log in from [xkg]dm as user2 (or startx as user2), it might try and overwrite user1's .Xauthority file, which, if permissions aren't granted, might cause grief. Not always a bad thing if only one person is logged on at a time, but if you have fast user switching (which, in the implementations I've seen, is done by running multiple X servers on multiple consoles), you might have some trouble. Just a few more ideas to play with. -tkc
Re: Problems with Align.vim
Benji Fisher wrote: There are a few problems here. First, it is too easy to miss the warning BE SURE TO GET THE LATEST VIMBALL PLUGIN BEFORE ATTEMPTING TO USE SCRIPTS UPLOADED ON OR AFTER AUG 1, 2006 posted on http://mysite.verizon.net/astronaut/vim/index.html . Ideally, all links to recent plugins would redirect to a page line... Every entry under the #VimFuncs label now has a sentence directing folks to the vimball entry, where improved directions for extracting it may be found. I've also fixed up several links and labels. Thank you for the feedback! As you may guess, I seldom download files and extract 'em from my own website... Regards, Chip Campbell
Re: navigate in command line completion
koxinga wrote: hello, I like to have a menu to navigate through the propositions available when I hit Tab so I love the option wildmenu. However, it would be even better if the navigation was two-dimensional, on several lines, like in zsh when the option zstyle ':completion:*' menu select is set. Is there a script doing that ? thanks, Pierre I didn't know about wildmenu until just now, it is *awesome*. -- Aaron The Dude abides.
saving and loading views
Hi Guys, I used to have this in .vimrc autocmd BufWinLeave * mkview autocmd BufWinEnter * silent loadview to automatically save and load folds. I have recently added it again, but it does not seem to work in Vim 7 on Win XP. Have I missed anything obvious? Thanks Sam
file name from command mode
Hi Vim guys, Any body knows how to get the current file name in command mode?! Thanx...
Re: file name from command mode
Any body knows how to get the current file name in command mode?! The common way is either to use expand('%') in an expression (there are modifiers if you need pieces such as the path, extension, etc, as detailed in :help expand() ) or control+R followed by a percent-sign to insert the current file-name as if you typed it: :help i_CTRL-R :help quote_% (which works in command-line mode) -tim
Re: saving and loading views
Samuel Wright wrote: Hi Guys, I used to have this in .vimrc autocmd BufWinLeave * mkview autocmd BufWinEnter * silent loadview to automatically save and load folds. I have recently added it again, but it does not seem to work in Vim 7 on Win XP. Have I missed anything obvious? Well, nothing pops to my mind right off, but I'd suggest ditching that silent so as to let vim forward any complaints it might have to your attention. At least until you've got things working. Regards, Chip Campbell
match real number
Hi, I'm wondering if there is any built in regex to match real number? It could make some application easier. Thanks, Peng
Re: match real number
I'm wondering if there is any built in regex to match real number? It could make some application easier. There aren't any builtin, and given that Vim doesn't have native support for floating-point math, it's not surprising. One can use something like [-+]\=[0-9]*\.\=[0-9]\+\%([eE][-+]\=[0-9]\+\)\= which should handle most of the common cases I've seen. -tim
has('unix')
Hello, for my font plug in I need to know which OS I am running on to choose an appropriate font. Now when Sun Solaris where added to the list of OS I use I run into a little problem: there is only has('unix') - but that's not good enough as Linux allows for anti alias fonts and Sun Solaris does not. Any ideas? Martin -- Martin Krischik mailto://[EMAIL PROTECTED] pgp2PEaek20E6.pgp Description: PGP signature
Re: has('unix')
for my font plug in I need to know which OS I am running on to choose an appropriate font. Now when Sun Solaris where added to the list of OS I use I run into a little problem: there is only has('unix') - but that's not good enough as Linux allows for anti alias fonts and Sun Solaris does not. Perhaps something like if has('unix') let os = system('uname') if os ~= 'Linux' do linuxy stuff here elseif os ~= 'Solaris' do solarisy stuff here endif endif would do the trick? -tim
Re: Anyway to sort scripts by last update date? (bad email address)
[EMAIL PROTECTED] wrote: The vim.sf.net has a script search feature which can sort by Rating,...snip Pan Shizhu: I got this from my attempt to email to you... This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: [EMAIL PROTECTED] SMTP error from remote mailer after MAIL FROM:[EMAIL PROTECTED] SIZE=3181: host routon.com [61.183.225.68]: 554 Your host 216.148.213.132 was found in DNS blacklist at cblplus.anti-spam.org.cn Regards, Chip Campbell
Re: inserting backticks
Hi Am 25.10.2006 15:08:23 schrieb Benji Fisher: Did you also try :verbose imap Space no mapping for space :verbose iabbrev ` I didn't try it because today I've heard about abbreviation the first time. But I have no abbreviations. and so on? What else should I try? I suggest typing CTRL-V before the back-tick and before the space. Just to be sure, I would also try starting vim with $ vim -u NONE Both don't change anything. But as I've noted earlier, console-vim doesn't have this problem - only gvim. If it does not solve the problem, then PEBKAV (Problem Exists Between Keyboard And Vim). Hmpf Can somebody at least confirm my problem? The mapping from my first mail solves it, but I'd like to know the cause... cu boesi -- Vergessen wir alles, was wir zu wissen glauben, und schaffen Platz fuer neue Erkenntnisse.
Re: has('unix')
On śro paź 25 2006, vim@vim.org wrote: Hello, for my font plug in I need to know which OS I am running on to choose an appropriate font. Now when Sun Solaris where added to the list of OS I use I run into a little problem: there is only has('unix') - but that's not good enough as Linux allows for anti alias fonts and Sun Solaris does not. Any ideas? if has('unix') let os = system('uname -a') endif Depending on value of os proceed. m.
Always bounces back
test
Need to write a language
I'm in the semiconductor industry. My job is to create data and to run regression tests on that data for the validation of physical layout rules. Skip to bottom for questions, if you don't want to read my ramblings. The current problem is tha the rules are not in a computer readable form. Many paople have a hand in writing different sections of the rules, so you can imagine that the wording is widely varied. There is no standard to wording or even the dialog used. One of the things I have been ask to do is to try and get a handle on how the rules may be written that that they are computer readable. I've been working with perl hash's and excel spread sheets. The main problem I was having was that I was trying to decreace the relationship words and increase the number of variables. This was quickly resulting in a spread sheet that was growing (number of columns) very rapidly. I assume excel has a limit to the number of columns. The idea that I have come up with is to create a language with limited descriptive words. Here is an example of a rule that might be written in a human readable form but also parsable by puter. MET1 spacing to MET1 is 45 if MET1 width is = 245 and = 100 By looking at this MET1 is a layer Spacing width = = are relationships If is a constraint #'s are #'s I want to have them write correct by construction. Is it possible, in vim/gvim to open a special version of vim so that the user can begin to type, spac , and it would complete the word? Would it also be possible to not allow a word to be type'd if that word was not in a list. Vim would have to open in edit mode and remain there for most users, until save/exit. Most of the users of this would be hard core pc users who think the only editor is word. But there are a few unix users. My questions. 1. Can vim be configured to automatically start in edit mode? 2. Can vim monitor each word that is being typed? 3. Can vim do word completion? 4. Can vim offer all possible spellings for partial word completion? If the answer to most of qeustion above is yes 5. Can I do the programming? I do perl, c, c++, csh and sh programming.
Re: getchar() trick with recursive expr map
On śro paź 25 2006, Mikolaj Machowski wrote: In Linux terminal and GTK2 versions cursor is stuck in command line and don't at its real position making inserting of text almost random. Getting stuck at command-line is normal, as it is always waiting on getchar(). I realize will not be suitable for all applications, but works well for what I am trying to achieve. I don't however understand the random part that you are mentioning. What exactly is happening? Is the position where the text is inserted random? No, just impression of randomness - user is accustomed to cursor and when doesn't see it he is lost. In heavily restricted environment like forms this is not so important. m.
Re: Need to write a language
On 10/25/06, Billy Patton [EMAIL PROTECTED] wrote: I assume excel has a limit to the number of columns. I believe the max is 65000 but that may be increased by now. Is it possible, in vim/gvim to open a special version of vim so that the user can begin to type, spac , and it would complete the word? Yes. Would it also be possible to not allow a word to be type'd if that word was not in a list. Harder, but probably. My questions. 1. Can vim be configured to automatically start in edit mode? Yes, but I forget what the setting is, you can just push it into insert mode when you enter a buffer if nothing else. 2. Can vim monitor each word that is being typed? You can remap the spacebar to trigger a function without difficulty or you can monitor every keystroke if you want something fancier. :help map.txt :help map-arguments :help autocmd :help autocmd-events 3. Can vim do word completion? Many types. :help completion 4. Can vim offer all possible spellings for partial word completion? It does by default and you can view them as a menu if you're using Vim 7. If you want to provide a list of possible words to be completed, it can be done by creating a ctags file. :help completeopt If the answer to most of qeustion above is yes 5. Can I do the programming? I do perl, c, c++, csh and sh programming. Most vim scripting is done in vimscript, which I consider to be fairly close to bash/sh. You can also do scripting in Python. I'm not sure about the perl interface.
Re: Need to write a language
--- Billy Patton [EMAIL PROTECTED] wrote: I'm in the semiconductor industry. My job is to create data and to run regression tests on that data for the validation of physical layout rules. Skip to bottom for questions, if you don't want to read my ramblings. The current problem is tha the rules are not in a computer readable form. Many paople have a hand in writing different sections of the rules, so you can imagine that the wording is widely varied. There is no standard to wording or even the dialog used. One of the things I have been ask to do is to try and get a handle on how the rules may be written that that they are computer readable. I've been working with perl hash's and excel spread sheets. The main problem I was having was that I was trying to decreace the relationship words and increase the number of variables. This was quickly resulting in a spread sheet that was growing (number of columns) very rapidly. I assume excel has a limit to the number of columns. The idea that I have come up with is to create a language with limited descriptive words. Here is an example of a rule that might be written in a human readable form but also parsable by puter. MET1 spacing to MET1 is 45 if MET1 width is = 245 and = 100 By looking at this MET1 is a layer Spacing width = = are relationships If is a constraint #'s are #'s I want to have them write correct by construction. Is it possible, in vim/gvim to open a special version of vim so that the user can begin to type, spac , and it would complete the word? Would it also be possible to not allow a word to be type'd if that word was not in a list. Vim would have to open in edit mode and remain there for most users, until save/exit. Most of the users of this would be hard core pc users who think the only editor is word. But there are a few unix users. My questions. 1. Can vim be configured to automatically start in edit mode? 2. Can vim monitor each word that is being typed? 3. Can vim do word completion? 4. Can vim offer all possible spellings for partial word completion? If the answer to most of qeustion above is yes 5. Can I do the programming? I do perl, c, c++, csh and sh programming. Hello, As well as completing words, it would be very helpful if you wrote a syntax file for your language. If your users see things in color, they can be sure they have typed the commands correctly, but if the text is *not* colored, then they will know they've got something wrong. Something else you may want to consider - Map F5 to call a perl script which examines the line under the cursor and prints a message explaining what needs to be typed next. regards, Peter On Yahoo!7 Win VIP tickets to meet R'n'B stars superstars Ne-Yo and Rihanna http://advision.webevents.yahoo.com/aunz/music/jay_z_promotion/index.htm
Re: inserting backticks
On Wed, Oct 25, 2006 at 09:29:45AM +0200, Alexander 'boesi' Bösecke wrote: Hi When inserting a backtick (`) I normally type `space. But sometimes nothing happens... When I enter a 2. space, I get a space. I can enter as many spaces as I want, but I get no backtick. When I type a letter, eg. d, _than_ I get `d at the current cursor position. Wnen I type a 2. ` instead of d, I get ``. And really strange is that I can't reproduce this behaviour constantly. Eg. starting with an empty Vim (no file opened) and the backtick+space works as it should. Starting an empty Vim again and it doesn't work... I've tested it with python and tex files. Sometime `space produce a backtick, but mostly not. Well I could use a mapping like this: imap `space ``C-Ox But this is IMHO a bit too hackish. I'm using gVim 7 on WinXP. The Console-Vim seems to work correctly. Is this a matter of my configuration? Or where is the ` waiting? On Wed, Oct 25, 2006 at 08:23:40PM +0200, Alexander 'boesi' Bösecke wrote: Hi Am 25.10.2006 15:08:23 schrieb Benji Fisher: [snip] I suggest typing CTRL-V before the back-tick and before the space. Just to be sure, I would also try starting vim with $ vim -u NONE Both don't change anything. But as I've noted earlier, console-vim doesn't have this problem - only gvim. Sorry, I did not read the original post carefully the first time. If it does not solve the problem, then PEBKAV (Problem Exists Between Keyboard And Vim). Hmpf Can somebody at least confirm my problem? The mapping from my first mail solves it, but I'd like to know the cause... I do not see any such problem using gvim on Linux. If you want someone to try to reproduce the problem, we need more information. Where did you get your copy of vim; or, if you compiled yourself, how did you do it? (In the first case, please give a link to the download site. In the second case, we need to know patch level, which compiler, what options you used to compile, etc.) If in fact PEBKAV, then it probably makes a difference what language/localization you have for WinXP. I still suspect that a mapping or abbreviation is involved. Especially since you mentioned tex: have you installed latex-suite? If so, then :set ft=tex :imap ` should show that there is a mapping defined by plugin/imaps.vim . Even with this, I cannot reproduce the problem, though. If there is no problem with console-vim, then I want to know the result of starting gvim while skipping all your startup files. I am not sure of the right syntax from an XP command line, but something like $ gvim.exe -u NONE -U NONE should do it. If you still see the problem after starting gvim this way, then I will be convinced that there is no errant mapping causing problems. (I think the -U NONE is redundant, but it does not hurt much to leave it in.) HTH --Benji Fisher
Re: Need to write a language
On Wed, Oct 25, 2006 at 06:42:15PM -0400, Karl Guertin wrote: On 10/25/06, Billy Patton [EMAIL PROTECTED] wrote: My questions. 1. Can vim be configured to automatically start in edit mode? Yes, but I forget what the setting is, you can just push it into insert mode when you enter a buffer if nothing else. Add :set insertmode :help 'insertmode' 3. Can vim do word completion? Many types. :help completion Especially read :help 'complete' :help 'dictionary' You may also find something worth borrowing in my word-completion plugin: http://vim.sourceforge.net/scripts/script.php?script_id=73 4. Can vim offer all possible spellings for partial word completion? It does by default and you can view them as a menu if you're using Vim 7. If you want to provide a list of possible words to be completed, it can be done by creating a ctags file. :help completeopt I am not sure why you suggest a tags file, unless you intend :set complete=t I was thinking of :set complete=k/path/to/babylanguage.txt If the answer to most of qeustion above is yes 5. Can I do the programming? I do perl, c, c++, csh and sh programming. Most vim scripting is done in vimscript, which I consider to be fairly close to bash/sh. You can also do scripting in Python. I'm not sure about the perl interface. I suggest looking at some of the files in $VIMRUNTIME/plugin/ to get an idea of what you can do with a vim script. Then it helps to look at the list of built-in functions, :help functions HTH --Benji Fisher
Re: getchar() trick with recursive expr map
On Wed, 25 Oct 2006 at 11:33pm, Mikolaj Machowski wrote: On ¶ro pa¼ 25 2006, Mikolaj Machowski wrote: In Linux terminal and GTK2 versions cursor is stuck in command line and don't at its real position making inserting of text almost random. Getting stuck at command-line is normal, as it is always waiting on getchar(). I realize will not be suitable for all applications, but works well for what I am trying to achieve. I don't however understand the random part that you are mentioning. What exactly is happening? Is the position where the text is inserted random? No, just impression of randomness - user is accustomed to cursor and when doesn't see it he is lost. In heavily restricted environment like forms this is not so important. m. Yes, I agree, without cursor there is not much use for general application. What would be nice is to have an option for getchar() that will not move the cursor to the bottom, that way you can at least see where the cursor is (even if that means it is not blinking). -- Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com