Re: vim bug description (timing issue on Linux)
Peter Knaggs wrote: On 12/10/06, A.J.Mechelynck [EMAIL PROTECTED] wrote: I can't type fast enough I noticed by looking in getchar.c at line 2695 that the timeout p_ttm is a global, which we can set (in milliseconds) using set ttimeoutlen value (see option.c). So e.g. to set it to three seconds, to give yourself more time to type in the interactive testcase, we can use: set ttimeoutlen=3000 I'm intentionally setting 'ttimeoutlen' to faster than I can hope to type, since its use is to distinguish between multibyte special keys (which the keyboard driver enters very fast into the buffer) and, for instance, multibyte mappings (whose 'timeoutlen' is intentionally slower than I type even when I type slowly): set timeout timeoutlen=5000 ttimeoutlen=250 I'm beginning to understand the concept described in :help ttimeoutlen, apparently it has something to do with defining macro sequences, e.g. if for some reason I wanted to define a macro called OK to string-replace ko with ok, I'd do something like this: :map OK :s/ko/ok/CR Then the command :map would show the mapping like this: OK:s/ko/ok/CR To execute the macro, then, I'd type Esc OK. But by default, there are no macro sequences starting with O, right? I'm wondering if there's some mistake causing vim to think there's a macro sequence associated with Esc O, which is causing vim to use the timeout, whereas pressing O separately immediately inserts a line above? Apparently, the sequence Esc O is a a little different by default in that it seems to always incur a one-second timeout, whereas the other keys which invoke insert mode don't seem to have any timeout: Esc o, Esc A, Esc i don't have any timeout. Maybe the Esc O timeout is something I just hadn't noticed before in vi, but it seems new in vim. It happens whether or not set nocompatible is used. Regards, Peter. 'ttimeoutlen' (if greater than zero and 'timeout' and 'ttimeout' are not both FALSE) is the timeout for the individual bytes of multibyte special keys entered into the buffer by your keyboard driver. Therefore it should be faster than you can type but slower than your keyboard driver or (if inputting over a slow transmission line) than your serial line. (If 'timeout' is TRUE and 'ttimeoutlen' is negative the value of 'timeoutlen' will be used.) 'timeoutlen' (if 'timeout' is TRUE) is the timeout for multibyte mappings, whose bytes you type one after another at the keyboard. Therefore it should be slower than you can type, but not too slow so if you wait for longer than the timeout whatever was already typed will be input into the buffer. I set 'ttimeoutlen' to one-quarter of a second and 'timeoutlen' to five seconds but YMMV. Best regards, Tony.
Re: vim bug description (timing issue on Linux)
Peter Knaggs wrote: On 12/10/06, A.J.Mechelynck [EMAIL PROTECTED] wrote: I can't type fast enough but (in Vim in konsole) the command :exe 'norm A^[Oj^[' (where each of the two ^[ is typed as Ctrl-V Esc) results in a lone star without the additional line below it. Note: * is 0x2A, 0010.1010, j is 0x6A, 0110.1010: only one bit difference. Don't know if relevant. Thanks for your hint on using :exe So there are a few other sequences that produce unexpected results: :exe 'norm A^[OP^[' - enters the help.txt screen :exe 'norm A^[Ok^[' - + :exe 'norm A^[Oo^[' - / :exe 'norm A^[Om^[' - - :exe 'norm A^[OA^[' - nothing :exe 'norm A^[OF^[' - nothing :exe 'norm A^[OH^[' - nothing :exe 'norm A^[OM^[' - nothing :exe 'norm A^[OQ^[' - F2 :exe 'norm A^[OR^[' - F3 :exe 'norm A^[OS^[' - F4 If you look at the output of :set termcap you'll see that xterm sends these escape sequences for keypad keys and other special keys. Set the 'timeoutlen' option to 100 to avoid these problems. Except when you are using a remote login over slow connection. -- Every exit is an entrance into something else. /// 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///
The 2007 Vim calendar
Dear Vim users, The traditional Vim calendar has been updated for 2007! This is a desktop calendar for 2007, made from one sheet of paper. After folding, one side contains a useful 12-month calendar. On the other side there is brief information about ICCF-Holland, Vim and A-A-P. English, A4: http://www.moolenaar.net/2007_en_a4.pdf English, Letter: http://www.moolenaar.net/2007_en_le.pdf Dutch, A4: http://www.moolenaar.net/2007_nl_a4.pdf Each file is in PDF and about 180 Kbyte. I'm afraid the problem with scripts on www.vim.org has not been solved yet. We are waiting for SourceForge support... Happy holidays! -- It is illegal for anyone to try and stop a child from playfully jumping over puddles of water. [real standing law in California, United States of America] /// 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///
Added conditional assignment operator
Bram, I've added the conditional assignment operator to the source code. Granted, we aren't adding features now and it isn't on the TODO list, but it was simple to add and it's pretty useful. Please set it on the shelf until we are ready for it. Thanks! *** runtime/doc/eval.txt2006/12/11 21:03:57 1.1 --- runtime/doc/eval.txt2006/12/11 21:04:31 *** *** 5633,5638 --- 5633,5648 from the {expr}. If {var-name} didn't exist yet, it is created. + :let {var-name} ?= {expr1}*:let?=* + Set internal variable {var-name} to the result of the + expression {expr1} only if {var-name} doesn't exist. + This statement: + let foo ?= bar + is equivalent to this: + if !exists(foo) + let foo = bar + endif + :let {var-name}[{idx}] = {expr1} *E689* Set a list item to the result of the expression {expr1}. {var-name} must refer to a list and {idx} *** *** 5665,5670 --- 5675,5684 Append {expr1} to the environment variable {env-name}. If the environment variable didn't exist yet this works like =. + :let ${env-name} ?= {expr1} + Set environment variable {env-name} to the result of + the expression {expr1} if {env-name} doesn't exist. + The type is always String. :let @{reg-name} = {expr1}*:let-register* *:[EMAIL PROTECTED] Write the result of the expression {expr1} in register *** src/eval.c 2006/12/08 23:24:51 1.1 --- src/eval.c 2006/12/11 20:49:52 *** *** 1717,1724 op[1] = NUL; if (expr argend) { ! if (vim_strchr((char_u *)+-., expr[-1]) != NULL) ! op[0] = expr[-1]; /* +=, -= or .= */ } expr = skipwhite(expr + 1); --- 1717,1724 op[1] = NUL; if (expr argend) { ! if (vim_strchr((char_u *)+-.?, expr[-1]) != NULL) ! op[0] = expr[-1]; /* +=, -=, .= or ?= */ } expr = skipwhite(expr + 1); *** *** 1744,1751 * Assign the typevalue tv to the variable or variables at arg_start. * Handles both var with any type and [var, var; var] with a list type. * When nextchars is not NULL it points to a string with characters that ! * must appear after the variable(s). Use +, - or . for add, subtract ! * or concatenate. * Returns OK or FAIL; */ static int --- 1744,1751 * Assign the typevalue tv to the variable or variables at arg_start. * Handles both var with any type and [var, var; var] with a list type. * When nextchars is not NULL it points to a string with characters that ! * must appear after the variable(s). Use +, -, . or ? for add, ! * subtract, concatenate or conditional assign. * Returns OK or FAIL; */ static int *** *** 2125,2131 typval_T *tv;/* value to assign to variable */ int copy; /* copy value from tv */ char_u*endchars; /* valid chars after variable name or NULL */ ! char_u*op;/* +, -, . or NULL*/ { int c1; char_u*name; --- 2125,2131 typval_T *tv;/* value to assign to variable */ int copy; /* copy value from tv */ char_u*endchars; /* valid chars after variable name or NULL */ ! char_u*op;/* +, -, ., ? or NULL*/ { int c1; char_u*name; *** *** 2158,2171 c1 = name[len]; name[len] = NUL; p = get_tv_string_chk(tv); ! if (p != NULL op != NULL *op == '.') { int mustfree = FALSE; char_u *s = vim_getenv(name, mustfree); if (s != NULL) { ! p = tofree = concat_str(s, p); if (mustfree) vim_free(s); } --- 2158,2174 c1 = name[len]; name[len] = NUL; p = get_tv_string_chk(tv); ! if (p != NULL op != NULL (*op == '.' || *op == '?')) { int mustfree = FALSE; char_u *s = vim_getenv(name, mustfree); if (s != NULL) { ! if (*op == '?') ! p = NULL; !
Re: Added conditional assignment operator
Dave Eggum wrote: I've added the conditional assignment operator to the source code. Granted, we aren't adding features now and it isn't on the TODO list, but it was simple to add and it's pretty useful. Please set it on the shelf until we are ready for it. Thanks! Thanks. I'll let people play with this and put it in the todo list somewhere. Bug fixing goes first! -- Men may not be seen publicly in any kind of strapless gown. [real standing law in Florida, United States of America] /// 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///
some ideas
(1) When tab-completing on Vim :cmdline, start with the dir of the current file being edited, instead of the $PWD (use ./ for that). (2) When pasting, arrange spaces and separators automagically: Exemple: ('[x]' means the cursor is over char 'x', the brackets are not part of the text) red, [b]lue, green dW red, [g]reen $ red, gree[n] p red, green, blu[e] (3) A mode (to be used by /usr/bin/view) with less-like interface. I currently use :so=999 for easier scrolling. (4) About that generic syntax highlighting that uses just # for comments, and ' for strings: Don't hightlight the # unless on the first column, and don't hightlight strings at all. Best regards, -- Rodolfo Borges
Re: some ideas
On 12/11/06, Rodolfo Borges [EMAIL PROTECTED] wrote: (1) When tab-completing on Vim :cmdline, start with the dir of the current file being edited, instead of the $PWD (use ./ for that). :h autochdir (2) When pasting, arrange spaces and separators automagically: This is a special case that fits your needs, and no one else. Try writing a plugin to do this - it wouldn't be that hard. (3) A mode (to be used by /usr/bin/view) with less-like interface. I currently use :so=999 for easier scrolling. :h less (4) About that generic syntax highlighting that uses just # for comments, and ' for strings: Don't hightlight the # unless on the first column, and don't hightlight strings at all. Easy to do, why not do it yourself?
Re: some ideas
On 12/12/06, Aaron Griffin [EMAIL PROTECTED] wrote: On 12/11/06, Rodolfo Borges [EMAIL PROTECTED] wrote: (1) When tab-completing on Vim :cmdline, start with the dir of the current file being edited, instead of the $PWD (use ./ for that). :h autochdir And if you don't like how 'autochdir' works, here's a set of mappings you may want to consider: nnoremap Leaderc :cd %:p:hCR:pwdCR nnoremap LeaderC :lcd %:p:hCR:pwdCR nnoremap Leadere :e C-R=expand('%:p:h')CR/C-Z nnoremap LeaderE :e C-Z nikolai
Re: some ideas
Rodolfo Borges wrote: (1) When tab-completing on Vim :cmdline, start with the dir of the current file being edited, instead of the $PWD (use ./ for that). No prefix on a text filename means the current dir, also in sh and COMMAND.COM (principle of least surprise). But you can have the current dir be always the dir of the current file, as follows: - Method I: :set autochdir - Method II::autocmd BufRead,BufNewFile,BufFilePost * \ lcd %:p:h (2) When pasting, arrange spaces and separators automagically: Exemple: ('[x]' means the cursor is over char 'x', the brackets are not part of the text) red, [b]lue, green dW red, [g]reen $ red, gree[n] p red, green, blu[e] This works for comma-separated options and for Lists. For strings with any separator it would be possible to write a function in vimscript and assign it to a mapping. (You may want to tackle it as an exercise.) (3) A mode (to be used by /usr/bin/view) with less-like interface. I currently use :so=999 for easier scrolling. I think there's a script somewhere which transforms Vim into a less-like pager. Also a manpage reader frontend. Have you searched vim-online now that its scripts section has come back? (4) About that generic syntax highlighting that uses just # for comments, and ' for strings: Don't hightlight the # unless on the first column, and don't hightlight strings at all. With strings highlighting, I know if I forget to close a string by mistake. But this is the best first example to use for writing your own syntax script: simple enough to give even a beginner a good chance of success, and you formulated it so you'll be motivated. Go ahead. Best regards, Best regards, Tony.