exists(*Foo!garbage) = 1 ?
Hi, If there is a function called Foo(), then it looks like exists('*Foo\W.*') evaluates to 1. For example :fun Foo : return 1 :endfun :echo exists('*Foo!asdf') prints 1 This happens not just for functions, but variables etc. also. For variables, I can work around this by using has_key(g:, varname) instead of exists('g:'.varname). Thank you, Srinath
Re: exists(*Foo!garbage) = 1 ?
Srinath Avadhanula wrote: If there is a function called Foo(), then it looks like exists('*Foo\W.*') evaluates to 1. For example :fun Foo : return 1 :endfun :echo exists('*Foo!asdf') prints 1 This happens not just for functions, but variables etc. also. For variables, I can work around this by using has_key(g:, varname) instead of exists('g:'.varname). Right, extra text after the function name was ignored. It's easy to change, see the patch below. Would there be scripts that depended on the text being ignored? Hmm, if someone has been using exists('function()') then that worked, but won't work after the patch. I think I better not change this just before a release. --- eval.c 27 Apr 2006 21:47:33 - 1.171 +++ eval.c 29 Apr 2006 11:26:22 - @@ -19098,18 +19098,19 @@ function_exists(name) char_u *name; { -char_u *p = name; +char_u *nm = name; +char_u *p; intn = FALSE; -p = trans_function_name(p, FALSE, TFN_INT|TFN_QUIET, NULL); -if (p != NULL) +p = trans_function_name(nm, FALSE, TFN_INT|TFN_QUIET, NULL); +if (p != NULL *skipwhite(nm) == NUL) { if (builtin_function(p)) n = (find_internal_func(p) = 0); else n = (find_func(p) != NULL); - vim_free(p); } +vim_free(p); return n; } -- It is illegal to rob a bank and then shoot at the bank teller with a water pistol. [real standing law in Louisana, 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///
Re: functions that take much time in load_dummy_buffer() [vimgrep]
On 4/29/06, Bram Moolenaar [EMAIL PROTECTED] wrote: Yakov Lerner wrote: I identified which functions are slow and which are fast out of functions called (load_dummy_buffer() + wipe_dummy_buffer()) pair. As I wrote earlier this pair of functions is what slows down vimgrep, not the search. The loop of 1000x (load_dummy_buffer() + wipe_dummy_buffer(= )) takes 30 seconds per 1000 pairs on my machine (800 MHZ). These tests are on empty files, so data size is not a problem. No regexp searching is performed. Results: check_need_swap() - 50% major contributor to slowdown ml_open()- 30% 2nd contributor setfname() - 19% surprise, surprise The rest of functions are blazingly fast, take 1% of time. Fast functions (negligible overhead) include: - wipe_dummy_buffer() - buf_copy_options() - buflist_new() - aucmd_prepbuf() - aucmd_restbuf() I don't have real results for readfile() because I tested on empty files. But on empty file readfile() works fast. If creating the swap file takes so much time, something strange is happening. Are you on a network filesystem perhaps? What system is this anyway? Cygwin. But why swapfile is needed for read-only grepping ? Is it possible not to create swapfile for dummy buf ? To set readonly and nonmodifiable maybe, for dummy buffer ? Testing with empty files may give a wrong impression. Try something like: :vimgrep notaword $VIMRUNTIME/**/*.vim The .vim files are relatively small. The remove the regexp code from the picture (search can easily be benchmarked separately from file loading), I used artificial temporary patch which allows to run N times, see attached patch and script. I tried doing a bit of profiling, but it gets confused by the loops and reports bogus results. Instead of profiling, I commented out lines in load_dummy_buffer() and rerun timing. This is how I saw how different parts affect executiorn time. Yakov y Description: Binary data patch Description: Binary data
spell function -- suggestion to do: error rate of a file
Hello Vim-Dev, Is there any way how to count bad words in a file which is spelled? Or any function which can show an 'error rate' of a file? For example, the number of bad words per ten words, or a percentage of bad words in a file. I snooped the spell.txt help file thorough and found nothing :( That would be cool to make an automatic dictionary selection function then. Using simple comparison of the error rates with some limit would make possible to select a proper .spl file, and a region. With a parameter, which defines the most used spell regions (e.g. en_gb, hu, cs, sk), could be frequent spell checking in different languages made a lot of friendly. I'm personally using 3-4 different languages per day (e-mails, work,...), and using the spell function of Vim 7 for a week I realised this inconvenience. Any suggestion how to make it solved without implementing a new feature? Best regards, Milan -- * Milan Berta * Institute of Physics * Academy of Sciences of the Czech Republic * Na Slovance 2 * CZ-182 21 Prague 8 * Czech Republic * * mailto: [EMAIL PROTECTED] * phone: +420 266 052 650, +420 266 052 748 * fax:+420 286 890 416 * URL:http://www.fzu.cz/
Install Fails on Windows
Hello Vim Developers, Compiling with MVC or Ming, the exe files are copied from c:\vim\vim70f\src to c:\vim\vim70f (the usual place). But running install produces the following: [c:\vim\vim70f]install This program sets up the installation of Vim 7.0f04 BETA ERROR: Cannot find filetype.vim in C:\vim\vim70f It looks like you did not unpack the runtime archive. You must unpack the runtime archive vim70frt.zip before installing. The problem is that unzipping the archive places filetype.vim in c:\vim\vim70f\runtime (it would have been placed in the same directory as the exe files in all release versions of Vim - in this case in c:\vim\vim70f\). Doesn't dosinst.c need to reflect this new placement? -- Best regards, Bill
Re: spell function -- suggestion to do: error rate of a file
On 4/29/06, Milan Berta [EMAIL PROTECTED] wrote: Is there any way how to count bad words in a file which is spelled? Or any function which can show an 'error rate' of a file? The script that does what you want is below, and also attached. Press F5 to activate. This is sample output: Total words: 93 Bad words: 21 Semi-bad words: 0 Bad words ratio: 18.42% Yakov countspell.vim -- count number of misspelled words, and ratio of bad/good words. map F5 :call CountMisspell()cr func! CountMisspell() let save_cursor = getpos('.') norm gg set spell let total = 0 let bad = 0 let good = 0 let warn = 0 let flags='Wc' while search('\i\+', flags) let flags = 'W' let total += 1 let word = expand('cword') let list = spellbadword(word) if list[1] == '' let good += 1 elseif list[1] == 'bad' let bad += 1 else rare, local, caps let warn += 1 endif endwh echo Total words: . good echo Bad words:. bad echo Semi-bad words: . warn if bad != 0 let ratio = (1 * bad) / total let ratio = printf(%03d, ratio) let ratio = substitute(ratio, '\d\d$', '.', '') else let ratio='0.00' endif echo Bad words ratio: . ratio . '%' call setpos('.', save_cursor ) endfu --- countspell.vim Description: Binary data
Re: Install Fails on Windows
Bill McCarthy wrote: Compiling with MVC or Ming, the exe files are copied from c:\vim\vim70f\src to c:\vim\vim70f (the usual place). But running install produces the following: [c:\vim\vim70f]install This program sets up the installation of Vim 7.0f04 BETA ERROR: Cannot find filetype.vim in C:\vim\vim70f It looks like you did not unpack the runtime archive. You must unpack the runtime archive vim70frt.zip before installing. The problem is that unzipping the archive places filetype.vim in c:\vim\vim70f\runtime (it would have been placed in the same directory as the exe files in all release versions of Vim - in this case in c:\vim\vim70f\). Doesn't dosinst.c need to reflect this new placement? There are two setups, the Unix one and the MS-Windows one. If you use the Unix setup you need to do make install. Thus uses the files in the ../runtime directory that were unpacked from the Unix tar archive. If you use the MS-Windows setup you should unpack the vim70xxrt.zip file, which puts the runtime files below the src directory, without a runtime directory. Then you can use the install.exe. -- SIGIRO -- irony detected (iron core dumped) /// 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: vim70f, spell.txt help-file -- 'trie' at line 1569
Milan Berta wrote: I'm not sure, but I read somewhere that also pity mistakes in the help-files should be reported. Here we go: There is a misspelled word in spell.txt help-file at line 1569. IMHO, there should be 'tree' instead of 'trie'. That's actually correct. A trie is a special kind of tree to store data. http://en.wikipedia.org/wiki/Trie -- FROG: How you English say: I one more time, mac, I unclog my nose towards you, sons of a window-dresser, so, you think you could out-clever us French fellows with your silly knees-bent creeping about advancing behaviour. (blows a raspberry) I wave my private parts at your aunties, you brightly-coloured, mealy-templed, cranberry-smelling, electric donkey-bottom biters. Monty Python and the Holy Grail PYTHON (MONTY) PICTURES LTD /// 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: Install Fails on Windows
Bram Moolenaar wrote: Bill McCarthy wrote: Compiling with MVC or Ming, the exe files are copied from c:\vim\vim70f\src to c:\vim\vim70f (the usual place). But running install produces the following: [c:\vim\vim70f]install This program sets up the installation of Vim 7.0f04 BETA ERROR: Cannot find filetype.vim in C:\vim\vim70f It looks like you did not unpack the runtime archive. You must unpack the runtime archive vim70frt.zip before installing. The problem is that unzipping the archive places filetype.vim in c:\vim\vim70f\runtime (it would have been placed in the same directory as the exe files in all release versions of Vim - in this case in c:\vim\vim70f\). Doesn't dosinst.c need to reflect this new placement? There are two setups, the Unix one and the MS-Windows one. There is a third! Building on Windows using unix sources. After the build, there is a src/../runtime directory. After the build, one needs to move the *.exe files from src/ one level up and move everything inside runtime/ one level up. After these two moves, install.exe works fine -- it knows it is on Windows. If you use the Unix setup you need to do make install. Thus uses the files in the ../runtime directory that were unpacked from the Unix tar archive. If you use the MS-Windows setup you should unpack the vim70xxrt.zip file, which puts the runtime files below the src directory, without a runtime directory. Then you can use the install.exe.
the dash and the '.' repeat command
Are there any peculiarities associated with the '-' dash character in vim? I was experimenting with the '.' repeat command and I typed the following: +++ !!! followed by an esc and a '.' .. vaguely hoping to obtain this: +++ !!! +++ !!! .. in order to eventually create a table of two columns and n rows with minimal effort/typing. Instead I got this: ++---+ !! ++---+ !!¬¬¬!! iow the spaces on the second line of what I originally entered are replaced by the 'NOT' character - not present on the US keyboard. also the last of my exclamation points appears to have been removed from what I originally typed and now four of them appear on the second of the two lines added by the '.' command naturally, I could use shift-V followed by a number of 'yp's to obtain what I am looking for but I was just curious where this NOT ('¬' - 0xac) character comes into the picture - and whether there is more to it than the above triviality. Thanks. cga
Re: modify a text file
Hi Tim, somehow my email was partially deleted... ?? cat file | vim - What stands the - for? Then, clean up the stuff we don't want 1,/received/d $?^\s*For subscribe options?,$d to strip off the header and footer. this worked out nicely My first-pass solution will end up with duplicate results if more than one of your keywords appear in the same block but on diff. lines: :let @a='' :g/red\|relativistic/?^\s*astro-ph?,/^\s*astro-ph/-y A :%d :put a :1d :wq name_of_output.txt this is the content of foo.vim? On separated lines? I also tried with CTRL + V + ENTER at the end of each line, but the result was the same... cat input.txt | vim -s foo.vim - when I run it I end up with an empty file... ? I'm sorry I couldn't come up with a clean way to snag just the unique paragraphs easily without having an instance show up as its own result-block. I was saying in my deleted email that in any case it's a nice lesson... When I think that people here think I know vim... what a shame! Anyways, it's at least one sorta-solution to what you describe. -tim
Re: How to customize the default display of Vim?
On 4/29/06, Chen Long [EMAIL PROTECTED] wrote: Dear all, I am new to Vim. Could any one tell me how to customize the default display of Vim? Say colorscheme, width and height of the screen, vertical line spacing etc? What are those commands I should put them in .vimrc? For colorscheme: :set color=NAME For width and height: :set lines=N :set columns=N Vertical line spacing: I don't think there is such option. Yakov
Re: Disable scratch buffer
On 4/29/06, Eric Crahen [EMAIL PROTECTED] wrote: For some reason I get an empty hidden buffer that does show up when I list buffers. Must be some plugin doing this. To find which plugin is doing this, do :scriptnames and look into your ~/.vim/plugin directory. Also, try to start 'vim -u NONE -U NONE' to make sure that without plugins this does not happen. Yakov Its the same one you'd get when you open vim w/ no filenames. I'll poke around andd if there is a setting causing that On 4/28/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 4/28/06, Eric Crahen [EMAIL PROTECTED] wrote: When I start vim from the command line and provide a filename, how can I prevent a default scratch buffer from also being opened? Vim does not create scratch buffer when you invoke it from command line with filename. You can verify it for yourself using vim command :ls! which lists all existing buffers. Yakov -- - Eric
RE: Disable scratch buffer
-Original Message- From: Tim Chase [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 5:03 PM When I start vim from the command line and provide a filename, how can I prevent a default scratch buffer from also being opened? I'm not sure exactly what you mean by a default scratch buffer. If you supply a filename on the command line bash$ vi file.txt you only have one buffer: :ls 1 %a file.txtline 1 If you don't supply a file name, Vim will create an empty buffer for you bash$ vi :ls 1 %a [No File] line 1 However, if you don't supply a filename, and you *don't* want to have the empty buffer, there's nothing for vim to do. The snarky answer would be vim -c q :) There is if you set up vim to restore the last session. But even in this case vim will create a scratch buffer in addition to the buffers you last edited. To prevent this from happening I start vim with the following command: gvim +bd -- JP
RE: omni + case
| -- but is there any (easy) way to make the preview list all the | alternative capitalizations of a specific keyword? I would like | FunctionName, functionName and functionname etc to |show up in the menu... |:set ignorecase |should do it. Should it? I had it already set, and it doesn't do what I need. I tried with ignorecase off, and that may be more like what I want (but still not really...). I would like to start tying 'func' and then pressing the omni key and it would list FunctionName, functionName and functionname. :) /Hugo
getlatestvimscripts
Hi, I just tried the new GLVS script in Vim 7.0f, I am getting an error: SNR27_GetLatestVimScripts: Line 125: E486: Pattern not found: ^- Everything was already current Am I doing something wrong... ? (this is on WinXP) /Hugo -- Hugo Ahlenius fraxinus (@) oxel.net http://www.oxel.net
repeat movement
Is there a way to repeat the last cursor movement? Dot (.) repeats last edit, is there an analog for motion, so that, for example, if I press zj to move down a fold I can just hit some other key to repeat that? I am that lazy. Thanks, David S.
Re: ` visual selection -- inconsistent?
On Sat, Apr 29, 2006 at 12:03:12AM -0600, Eric Arnold wrote: :set selection=exclusive Use this text: 123456 2abcde 3abcde 4abcde 5abcde Go to line 4, col 2. Hit ^V or (^Q whichever works). Type kkll until you've highlighted abc abc abc Type ESC For me, now the cursor is on c, and ` and ` go to a and c. Now start at line 2, col 2 and highlight the same 3x3 square, and type ESC. Now the cursor is on d, and ` and ` go to a and d. If it doesn't do this, try starting at the other corners. Sometimes I *think* I've had it work differently, but I can't remember exactly what the conditions were. I tried your experiment. I notice that, when I start at the upper-left corner, the cursor is on a d when three lines of abc are selected. When I start at the lower-left corner, the cursor is on the c when three lines of abc are selected. In other words, when I start at the lower-left corner, I do not see a difference between setting 'selection' to inclusive or exclusive. The ` mark seems to be set on the top line of the Visual selection, and the ` mark at the bottom. The two of them are set at the two corners where I started and ended the selection. This disagrees with what you described when starting at the lower left. It is also odd in the following situation: after C-VhhhEsc the point where I entered Visual mode is ` , but if I then do gvjjEsc then the same point is ` . I think this is inconsistent with the docs: ' ` To the first character of the last selected Visual area in the current buffer. {not in Vi}. I read this as saying that ` should always refer to the upper-left corner (and ` should always refer to the lower-right). HTH --Benji Fisher
Re: the dash and the '.' repeat command
On Sat, Apr 29, 2006 at 02:42:36AM -0400, cga2000 wrote: Are there any peculiarities associated with the '-' dash character in vim? I was experimenting with the '.' repeat command and I typed the following: +++ !!! followed by an esc and a '.' .. vaguely hoping to obtain this: +++ !!! +++ !!! .. in order to eventually create a table of two columns and n rows with minimal effort/typing. Instead I got this: ++---+ !! ++---+ !!¬¬¬!! iow the spaces on the second line of what I originally entered are replaced by the 'NOT' character - not present on the US keyboard. also the last of my exclamation points appears to have been removed from what I originally typed and now four of them appear on the second of the two lines added by the '.' command naturally, I could use shift-V followed by a number of 'yp's to obtain what I am looking for but I was just curious where this NOT ('¬' - 0xac) character comes into the picture - and whether there is more to it than the above triviality. Thanks. cga The part about the removed ! and the doubled one at the end is probably because you entered Insert mode with i (insert) and ended with Esc after typing the last ! (before going to a new line). Try the same experiment with an extra CR before leaving Insert mode. Turning spaces into 'NOT' characters looks like a bug. It is reminiscent of some problems I saw in earlier snapshots of vim 7.0, but I cannot reproduce it with vim 7.0f. What version are you using. HTH --Benji Fisher
Re: modify a text file
cat file | vim - What stands the - for? It is a standard *nix convention of accepting stdin as the source for the file (in this case, the output of cat). That way, we never actually bung with the original file. If you don't care if it gets hosed in the process, you can just do vim file.txt Then, clean up the stuff we don't want 1,/received/d $?^\s*For subscribe options?,$d to strip off the header and footer. this worked out nicely Glad to hear... My first-pass solution will end up with duplicate results if more than one of your keywords appear in the same block but on diff. lines: :let @a='' :g/red\|relativistic/?^\s*astro-ph?,/^\s*astro-ph/-y A :%d :put a :1d :wq name_of_output.txt this is the content of foo.vim? On separated lines? I also tried with CTRL + V + ENTER at the end of each line, but the result was the same... foo.vim consists of all 8 lines...first the two that worked out nicely to strip the header and footer, followed by the 6 lines in question here. In the foo.vim file, you'd omit the leading colons (I don't think there's any harm in having them in there, but their absense makes it easier to read), and there's no need for extra ^M entries in the file with ^V, as the newlines are already in the file cat input.txt | vim -s foo.vim - when I run it I end up with an empty file... ? Well, you should be able to trace through it by entering each of the commands individually instead of sourcing the file to see where things are going funky. Places matters could go awry: Prob: the :g command isn't finding anything Check: do :echo @a after the :g command to ensure that you've got some data Prob: @a has data, but it's not getting pasted Check: that you're doing the :put Prob: No file named name_of_output.txt is being created Check: that you have write permissions in the intended target Check: that the file name_of_output.txt doesn't already exist Check: that you're actually looking at the contents of the output file (name_of_output.txt) rather than the input file Just a few more ideas... I was saying in my deleted email that in any case it's a nice lesson... When I think that people here think I know vim... what a shame! Well, we all have our peculiar areas of specialty. When it comes to things like plugins, syntax-highlighting nuances, i18n/encoding stuff, and indentation, I leave that to the folks on the list that are far more well-versed than myself. I'm more of an ex regexp sorta guy, doing some crazy stuff there, but otherwise, just using pretty stock unadorned vim. -tim
Re: Unifying more- and hit-enter- prompts
Suresh Govindachar wrote: To get out of the more-prompt, one can hit q or esc. But since the hit-enter-prompt allows entering a command (and does not disallow normal mode commands!), hitting q or esc at the hit-enter-prompt will not only get one out, but will have the side-effect of being treated as normal mode commands (q will start the record command, and esc will error or do whatever the user has nmap'ped esc to do). So to get out of the prompt, one needs to see if it is a more-prompt or a hit-enter-prompt and do different things. In contrast, hitting : at either prompt does the same thing. Please consider providing as much of a unified response as possible at both prompts. How about the more-prompt treating any keystroke that does not start with space, d, j, b, u, k or q as a command to respond to? And the more-prompt responding to enter as quit, and/or the hit-enter-prompt responding to q as enter? Then one could hit many more keystrokes at either prompt and be assured of the same response. Too many people are used to the current behavior. Changing how command keys are interpreted, especially at the hit-enter prompt, will cause mistakes. The one key that could be used for quit is escape, but unfortunately it's also the start of special keys and can't be detected reliably or only with a delay. In the future we might want to have a bit more functionality at the more-prompt, allowing an (arbitrary) set of letters to be interpreted as commands would block that. A consistent quit for both prompts is using CTRL-C. -- Close your shells, or I'll kill -9 you Tomorrow I'll quota you Remember the disks'll always be full And then while I'm away I'll write ~ everyday And I'll send-pr all my buggings to you. [ CVS log Beatles style for FreeBSD ports/INDEX, Satoshi Asami ] /// 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: the dash and the '.' repeat command
cga (?) wrote: Are there any peculiarities associated with the '-' dash character in vim? I was experimenting with the '.' repeat command and I typed the following: +++ !!! followed by an esc and a '.' .. vaguely hoping to obtain this: +++ !!! +++ !!! .. in order to eventually create a table of two columns and n rows with minimal effort/typing. Instead I got this: ++---+ !! ++---+ !!¬¬¬!! iow the spaces on the second line of what I originally entered are replaced by the 'NOT' character - not present on the US keyboard. also the last of my exclamation points appears to have been removed from what I originally typed and now four of them appear on the second of the two lines added by the '.' command naturally, I could use shift-V followed by a number of 'yp's to obtain what I am looking for but I was just curious where this NOT ('¬' - 0xac) character comes into the picture - and whether there is more to it than the above triviality. Weird. I can't reproduce it. What version of Vim? What system? Console or GUI? What is 'encoding' set to? -- Biting someone with your natural teeth is simple assault, while biting someone with your false teeth is aggravated assault. [real standing law in Louisana, 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///
Are these cinoptions possible?
Thanks for all the help so far, one question on formatting. I've read the help on cinoptions and I can't figure this one out. I like my Java like this: // WANTED public void testNullConstructor() throws Throwable { try { new ParameterTypeMatcher((Type[])null); fail(); } catch(IllegalArgumentException e) {} } I can't seem to get the indenting logic to not count the throws indent when figuring out the indent for the next line. The closest I can get is this: // UNWANTED public void testNullConstructor() throws Throwable { try { new ParameterTypeMatcher((Type[])null); fail(); } catch(IllegalArgumentException e) {} } Is it possible to set the cinoptions so that I can == a range and indent it as I'd like? -- - Eric
Mapping C-[ ?
Is it possible to map CTRL-[ ? That generates the ESC code, :map C-[ something :map will show that C-[ was converted to Esc Esc something I tried to do some other flavors of the map command but no dice. -- - Eric
Re: Mapping C-[ ?
According to my favorite ASCII table control-[ has always been ESCAPE. What is it that you're looking for? On 4/29/06, Eric Crahen [EMAIL PROTECTED] wrote: Is it possible to map CTRL-[ ? That generates the ESC code, :map C-[ something :map will show that C-[ was converted to Esc Esc something I tried to do some other flavors of the map command but no dice. -- - Eric
Re: Mapping C-[ ?
On 4/29/06, Eric Crahen [EMAIL PROTECTED] wrote: Is it possible to map CTRL-[ ? That generates the ESC code, In X11, you can use xmodmap to have Esc and Ctrl-[ send different things, I think. But this is platform-dependent thing. Under xterm, you can customize xterm resources to do it. Maybe you can customize windows keyboard driver to do it windows, I don't know. It's very platform-dependent. With OS-independent things only, it's impossible to map Ctrl-[ differently than Esc. Keyboard driver sends same character to vim. Aka decimal 27, hex 1b, octal 033. Yakov
Re: Mapping C-[ ?
KeyTweak on Windows has a pretty good interface. On 4/29/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 4/29/06, Eric Crahen [EMAIL PROTECTED] wrote: Is it possible to map CTRL-[ ? That generates the ESC code, In X11, you can use xmodmap to have Esc and Ctrl-[ send different things, I think. But this is platform-dependent thing. Under xterm, you can customize xterm resources to do it. Maybe you can customize windows keyboard driver to do it windows, I don't know. It's very platform-dependent. With OS-independent things only, it's impossible to map Ctrl-[ differently than Esc. Keyboard driver sends same character to vim. Aka decimal 27, hex 1b, octal 033. Yakov
Re: Mapping C-[ ?
As a curiosity, are there any platforms where the GUI gets/can get the scancodes? On 4/29/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 4/29/06, Eric Crahen [EMAIL PROTECTED] wrote: Is it possible to map CTRL-[ ? That generates the ESC code, In X11, you can use xmodmap to have Esc and Ctrl-[ send different things, I think. But this is platform-dependent thing. Under xterm, you can customize xterm resources to do it. Maybe you can customize windows keyboard driver to do it windows, I don't know. It's very platform-dependent. With OS-independent things only, it's impossible to map Ctrl-[ differently than Esc. Keyboard driver sends same character to vim. Aka decimal 27, hex 1b, octal 033. Yakov
Re: Mapping C-[ ?
It just depends on how the GUI is getting the information. gnome-terminal has no problem mapping the CTRL-[ differently from ESC, for instance. On 4/29/06, Eric Arnold [EMAIL PROTECTED] wrote: As a curiosity, are there any platforms where the GUI gets/can get the scancodes? On 4/29/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 4/29/06, Eric Crahen [EMAIL PROTECTED] wrote: Is it possible to map CTRL-[ ? That generates the ESC code, In X11, you can use xmodmap to have Esc and Ctrl-[ send different things, I think. But this is platform-dependent thing. Under xterm, you can customize xterm resources to do it. Maybe you can customize windows keyboard driver to do it windows, I don't know. It's very platform-dependent. With OS-independent things only, it's impossible to map Ctrl-[ differently than Esc. Keyboard driver sends same character to vim. Aka decimal 27, hex 1b, octal 033. Yakov -- - Eric
Re: Are these cinoptions possible?
I tried to indent your piece of code using vim, and obtained the indentation you like. So what's the difference between your and my configuration ? :filetype -- filetype detection:ON plugin:ON indent:ON :set filetype? -- filetype=java :set indentexpr? -- indentexpr=GetJavaIndent() If your configuration is different, try : :filetype plugin indent on and re-open your file. You should have the indent mode you like. I like my Java like this: // WANTED public void testNullConstructor() throws Throwable { try { new ParameterTypeMatcher((Type[])null); fail(); } catch(IllegalArgumentException e) {} } I can't seem to get the indenting logic to not count the throws indent when figuring out the indent for the next line. The closest I can get is this: // UNWANTED public void testNullConstructor() throws Throwable { try { new ParameterTypeMatcher((Type[])null); fail(); } catch(IllegalArgumentException e) {} } Is it possible to set the cinoptions so that I can == a range and indent it as I'd like? -- - Eric
Re: Are these cinoptions possible?
Hmm that works, I guess its the set cinoptions=:0g0 thing I'd set later on for just generic files. On 4/29/06, Jean-Emmanuel Reynaud [EMAIL PROTECTED] wrote: I tried to indent your piece of code using vim, and obtained the indentation you like. So what's the difference between your and my configuration ? :filetype -- filetype detection:ON plugin:ON indent:ON :set filetype? -- filetype=java :set indentexpr? -- indentexpr=GetJavaIndent() If your configuration is different, try : :filetype plugin indent on and re-open your file. You should have the indent mode you like. I like my Java like this: // WANTED public void testNullConstructor() throws Throwable { try { new ParameterTypeMatcher((Type[])null); fail(); } catch(IllegalArgumentException e) {} } I can't seem to get the indenting logic to not count the throws indent when figuring out the indent for the next line. The closest I can get is this: // UNWANTED public void testNullConstructor() throws Throwable { try { new ParameterTypeMatcher((Type[])null); fail(); } catch(IllegalArgumentException e) {} } Is it possible to set the cinoptions so that I can == a range and indent it as I'd like? -- - Eric -- - Eric
Re: How to customize the default display of Vim?
Thank you. I tried them. Only the command for colorscheme doesn't work. After I start Vim, I can change the color scheme by typing :colorscheme darkblue But if I put it into .vimrc. It doesn't work. Long On Apr 29, 2006, at 2:47 AM, Yakov Lerner wrote: On 4/29/06, Chen Long [EMAIL PROTECTED] wrote: Dear all, I am new to Vim. Could any one tell me how to customize the default display of Vim? Say colorscheme, width and height of the screen, vertical line spacing etc? What are those commands I should put them in .vimrc? For colorscheme: :set color=NAME For width and height: :set lines=N :set columns=N Vertical line spacing: I don't think there is such option. Yakov
how to configure the View rule for Vim-Latex?
When I open .tex file using Vim. (I have installed Vim-latex). It says that No View rule defined for target pdf Please specify a rule in $VIMRUNTIME/ftplugin/tex/texrc :help Tex_ViewRule_format What should I do? by the way, I am using Mac OS 10.4. Thanks, Long
Folding comments
Is there any way I could use folding to do this: 1. Fold all lines in a file that contain only comments. 2. Optionally delete all the lines that have previously been folded. I have a feeling I am looking for something less sophisticated than the fold feature where I could remove all lines that contain a given pattern - say, # or /* in col. 1, from a buffer and I am not sure folding is the feature I should be looking at. An example of possible use: I would find this useful when trying to prune some configuration file that has some ten lines of comments for every entry so that I can have more or less the entire configuration file fit on one screen instead of fifteen or twenty. A more general definition of this need/problem might be to 'remove all lines that match a certain pattern from the buffer - and optionally from the file itself'. Thanks. cga
synIDattr() doesn't show highlight group of misspelled word
To see the highlight group of the highlighted char/word, I use the mapping below. I picked it somewhere from tips. It works for syntax and for match highlights. But it shows no highlight group when on misspelled (red) word, althoug highlight is visible on screen. Why ? fu! ShowSyntaxGroup() echo hi . synIDattr(synID(line(.),col(.),1),name) \ . ' trans' . synIDattr(synID(line(.),col(.),0),name) \ . lo . synIDattr(synIDtrans(synID(line(.),col(.),1)),name) . endfu map f2 :call ShowSyntaxGroup()cr Yakov
Re: ` visual selection -- inconsistent?
On 4/29/06, Benji Fisher [EMAIL PROTECTED] wrote: On Sat, Apr 29, 2006 at 12:03:12AM -0600, Eric Arnold wrote: :set selection=exclusive Use this text: 123456 2abcde 3abcde 4abcde 5abcde Go to line 4, col 2. Hit ^V or (^Q whichever works). Type kkll until you've highlighted abc abc abc Type ESC For me, now the cursor is on c, and ` and ` go to a and c. Now start at line 2, col 2 and highlight the same 3x3 square, and type ESC. Now the cursor is on d, and ` and ` go to a and d. If it doesn't do this, try starting at the other corners. Sometimes I *think* I've had it work differently, but I can't remember exactly what the conditions were. I tried your experiment. I notice that, when I start at the upper-left corner, the cursor is on a d when three lines of abc are selected. When I start at the lower-left corner, the cursor is on the c when three lines of abc are selected. In other words, when I start at the lower-left corner, I do not see a difference between setting 'selection' to inclusive or exclusive. Yes, it seems that this is where the exclusive rule isn't being exclusive. --- The ` mark seems to be set on the top line of the Visual selection, and the ` mark at the bottom. The two of them are set at the two corners where I started and ended the selection. This disagrees with what you described when starting at the lower left. It is also odd I'm not sure I understand. For me, if I start at L4, C2, and drag the selection rectangle to L2, C4, and hit ESC, then ` is at L4, C2 and ` is at L2, C4. Anyway, what I was stressing was whether it was on the c or d of the ending line/corner, meaning column 4 vs column 5. in the following situation: after C-VhhhEsc the point where I entered Visual mode is ` , but if I then do gvjjEsc then the same point is ` . I think this is inconsistent with the docs: ' ` To the first character of the last selected Visual area in the current buffer. {not in Vi}. I read this as saying that ` should always refer to the upper-left corner (and ` should always refer to the lower-right). HTH --Benji Fisher I dunno. I can't tell any difference between `` and '' for visual block mode.
Re: Folding comments
Have you seen the fold-expr section? EXPR*fold-expr* The folds are automatically defined by their foldlevel, like with the indent method. The value of the 'foldexpr' option is evaluated to get the foldlevel of a line. Examples: This will create a fold for all consecutive lines that start with a Tab: :set foldexpr=getline(v:lnum)[0]==\\\t\ It seems like you could adapt this to the comment style in your files. You could use the foldlevel() sorta like: let foldexpr = 'getline(v:lnum)[0]==#' Fold all comments beginning with # g/.*/ if foldlevel(line(.)) 0 | s/$/ !!!/ | endif Do something for each line that is folded Change s/$/!!!/ todelete if you want to delete the folded lines. On 4/29/06, cga2000 [EMAIL PROTECTED] wrote: Is there any way I could use folding to do this: 1. Fold all lines in a file that contain only comments. 2. Optionally delete all the lines that have previously been folded. I have a feeling I am looking for something less sophisticated than the fold feature where I could remove all lines that contain a given pattern - say, # or /* in col. 1, from a buffer and I am not sure folding is the feature I should be looking at. An example of possible use: I would find this useful when trying to prune some configuration file that has some ten lines of comments for every entry so that I can have more or less the entire configuration file fit on one screen instead of fifteen or twenty. A more general definition of this need/problem might be to 'remove all lines that match a certain pattern from the buffer - and optionally from the file itself'. Thanks. cga
Re: Svn and patches
PS: While downloading the sources from svn for the very first time involves the checkout (co) command: c:\opt\svn\svn-win32-1.3.1\bin\svn.exe co https://svn.sourceforge.net/svnroot/vim/vim7 making the local copy up-to-date with the latest release involves the update (up) command: c:\opt\svn\svn-win32-1.3.1\bin\svn.exe up vim7 Note the differing arguments to the co and the up commands. (If I remember correctly, cvs's checkout, in contrast to svn's, can be used for both checking out and for subsequent updating.) --Suresh Original_Message From: Suresh Govindachar [EMAIL PROTECTED] To: 'Zdenek Sekera' [EMAIL PROTECTED], Date: Fri, 28 Apr 2006 02:11:42 -0700 Subject: Re: Svn and patches Zdenek asked for some how-to for those of us who never used svn before? I am no expert either, but this is what I did on Windows XP: Download the following from http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 svn-win32-1.3.1.zip svn-win32-1.3.1_pl.zip svn-win32-1.3.1_dev.zip svn-win32-1.3.1_javahl.zip svn-win32-1.3.1_pdb.zip svn-win32-1.3.1_py.zip and extract into, say, c:\opt\svn. Then, mkdir raw\vim cd raw\vim c:\opt\svn\svn-win32-1.3.1\bin\svn.exe co https://svn.sourceforge.net/svnroot/vim/vim7 You may or may not get a fews lines of messages about the server's certificate ending with the question: (R)eject, accept (t)emporarily or accept (p)ermanently? t I would answer t. Once everything is downloaded, xcopy /e /q /i vim7 vim7x Notice no /h flag above. Then compile inside vim7x. xcopy /e /q /i /h vim7x c:\opt\vim\vim70f cd c:\opt\vim\vim70f\src move gvim.exe .. move vimrun.exe .. Free book on svn: http://svnbook.org/ Earlier version of this free book is available for sale but is supposedly full of bugs and outdated. --Suresh
Re: modify a text file
On Sat, 29 Apr 2006, Vim Visual wrote: [snip] I solved it like this: :1,/received/d :$?^\s*For subscribe options?,$d :let @a='' :g/hole\|relativistic\|LISA\|black\|supermassive\|intermediate/?^\s*astro-ph?,/^\s*astro-ph/-y A :%d :put a :1d :%s!^\s*astro-ph/\(\d\+\)!a href=http://xxx.lanl.gov/pdf/astro-ph/\1;/a :w! /tmp/2.html :q and using the cat /tmp/1.html | vim -s foo_arXiv.vim - [snip] For what it's worth, here's a search regex that will search for words in blocks delimited by #begin# and #end# on its own line: (all on one line) /^#begin#\%( \%(\n\(#end#\_$\)[EMAIL PROTECTED])*word0 \\%([EMAIL PROTECTED])*word1 \\%([EMAIL PROTECTED])*word2 \)\_.\{-}\_^\1$ For example, if word0 = foo word1 = bar word2 = xxx then the regex will match == #begin# On one foofine day, a regex found itself in the local bar... There were many regexxxes there to begin and end with. #end# == You can add on as many words as you need according to the \ format above. After you are satisfied with the search, you can do something like :let @a = '' :g//.,/#end#/y A to yank all the blocks. There was also discussion on this mailing list earlier (between Yakov and I) on how to search for words in a paragraph. Assuming a paragraph is delimited by blank lines ^\s*$, we have this search regex instead: (all on one line) /^\s*\%( \%(\n\%(\s*\_$\)[EMAIL PROTECTED])*word0 \\%(\n\%(\s*\_$\)[EMAIL PROTECTED])*word1 \\%(\n\%(\s*\_$\)[EMAIL PROTECTED])*word2 \)\_.\{-}\ze\_^\s*$ HTH :) -- Gerald