Re: renaming unnamed buffer at creation
Yakov Lerner wrote: Now that my attempt to write unnamed buffer under name /tmp/N failed, I want to autoname empty buffer. My first attempt does not work. Autoevent is ot invoked. Hello! The autocmd system is always invoked based on the buffer name. Thus it appears none of the autocmds will fire, including BufWriteCmd, BufReadCmd, CursorHold, etc. The only alternative that I can think of is to use maps, for example, try to catch a newline in insert mode. Regards, Chip Campbell
Re: using counter prefix in a map/command
Rodolfo Borges wrote: I did the following command to open man pages inside Vim: nmap K :Man C-RC-WCR command! -bar -nargs=1 DoMan %!/usr/bin/man -P cat args command! -bar -nargs=1 Man \ new \| DoMan args \| %s/.^H//g \| set filetype=man \| goto 1 \| set buftype=nofile It works nice, but I want also to be able to specify the man section, mas many C commands are also bash or shell commands, like exit, stat, and so on. I'm sure it's written in the extensive online documentation, but my lazyless is greater then my shame to ask it here. :) You could also use the manpageview plugin: http://vim.sourceforge.net/scripts/script.php?script_id=489 which accepts a section argument: :Man 3 printf Regards, Chip Campbell
Re: Search all text files in a directory for text
Bram Moolenaar wrote: Charles E Campbell wrote: Sigh -- I'm not sure what to do about this one. Turns out that: com! ... -complete=dir Explore ... causes the E77 with Too many file names. Simply removing the -complete=dir from the command fixes things. You have -nargs=? which means only 0 or 1 arguments are allowed. Perhaps you want to use -nargs=* . Yes -- that works! I don't mind having Explore ignore any extra strings. Who knows, maybe I'll find a use for it... Regards, Chip Campbell
Re: using counter prefix in a map/command
Yakov Lerner wrote: On 8/21/06, Rodolfo Borges [EMAIL PROTECTED] wrote: I did the following command to open man pages inside Vim: nmap K :Man C-RC-WCR command! -bar -nargs=1 DoMan %!/usr/bin/man -P cat args command! -bar -nargs=1 Man \ new \| DoMan args \| %s/.^H//g \| set filetype=man \| goto 1 \| set buftype=nofile It works nice, but I want also to be able to specify the man section, Your question is not exactly clear. If you want to invoke K or :Man with count like 3K :3Man ... where you want to use count as section number, then look into :help count (this count will be 0 if not supplied). If you ask something else, please clarify your question. Hello! The following tip provides some examples of how to use count... http://vim.sourceforge.net/tips/tip.php?tip_id=895 , Maps, Commands, and Functions - some examples of their interplay Regards, Chip Campbell
Re: How to insert text via script/function call ?
Meino Christian Cramer wrote: No, sorry...I was simply searching for a function call like printf( This is my text! ) Hi Tony, this works so far...with an unwanted sideeffekt: Instead of This is my text! in my buffer I get This is my text!Esc in my text. Have you tried put ='This is my text!' yet? Regards, Chip Campbell
Re: regex replace with match
striker wrote: I have a large fixed width database file that I would like to delimit with commas. For example here are 2 lines of the file: 210044012123540759F181012004103C14 29847.3741091 4280 5070 42789 28529 2769 2449 3320 2948 05121 210044012112140906F091012004101J 2 11048.495609 5559 9973 5180 9974 5680 94572 5451 06148 length of field1 = 8 length of field2 = 2 length of field3 = 3 and so on through 35 fields. I was going to use a simple regex replacement like::%s/\(.\{8}\)\ (.\{2}\)\(.\{3}\)/\1,\2,\3,/g This does work when only replacing a small number of fields. I get 2 errors when I source a file with the command for all 35 fields. The errors are: E51: Too many \( E476: Invalid command Two questions because of all of this: 1) What is the limit of \( that can be used? 2) Is there a better way of delimiting the file? Using the vis.vim plugin (available from http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs as Visual Block Commands): Position cursor, line 1, on a delimiting column. ctrl-v$:B s/ /,/ Repeat with other columns. Regards, Chip Campbell
Re: Search all text files in a directory for text
Gary Johnson wrote: On 2006-08-18, Charles E Campbell Jr [EMAIL PROTECTED] wrote: Gary Johnson wrote: Thanks. That removes the error and gives me a list of files, but included in that list are non-*.c names such as INSTALL Makefile README.txt :Explore **/*.c doesn't give a list of just *.c files. Instead, it opens a browser listing of every directory with *.c files in it. The cursor will be on the first such .c file; you may edit it if you wish. If its not the one you want, shift-down will move the cursor to the next .c file, repeat at will. One may go back with shiftup . Directory displays will change as necessary. OH! Got it. I found another problem, though. Following my previous example and proceeding from $ vim -N -u NONE I execute the following commands and the cursor moves to the file indicated. +-+-+ | Command | Resulting | | | Cursor Location | +=+=+ | :Explore **/*.c | arabic.c| | | | | :Nexplore | auto/pathdef.c | | :Nexplore | buffer.c| | :Nexplore | charset.c | | :Nexplore | diff.c | | | | | :Pexplore | diff.c | | :Pexplore | diff.c | | :Pexplore | auto/pathdef.c | | :Pexplore | arabic.c| +-+-+ So there seems to be a pointer traversing an internal list of files that is moved by the :Nexplore and :Pexplore commands. The :Nexplore and :Pexplore commands both control this pointer correctly, but only the :Nexplore command updates the cursor location correctly, unless the directory is changed. I'm seeing the cursor move to the next/previous matching file for both :Nexplore and :Pexplore. I do see one odd behavior, however: :Nex doesn't move the cursor, instead a vim error gets issued: E163: There is only one file to edit. :Nexp (and longer) works. There are two commands that also begin with :Ne... (:NetUserPass and :NetrwSettings) which I assume are causing this behavior. Perhaps its a vim bug? Regards, Chip Campbell
Re: The Vim Outliner: \n does not work
Meino Christian Cramer wrote: Hi, I have downloaded The Vim Outliner (tvo) version 122 (1.22?) and I am using it with vim 7.066 on a Gentoo Linux (2.6.17.11 vanilla kernel). ...snip... My question: When using the \x (x := [1-9at]) commands from above, they do simply nothing. I check with :map wheter there is anoter maplocalleader defined but it ios not. Furthermore, the commands are listed. I am sure, the bug is sitting in front of my monitor, but what I am doing wrong here ??? ..snip.. May I suggest that the best way to get plugins debugged is to contact their author. Usually the authors put their email in the documentation or sometimes in a comment in near the beginning of the plugin/... file. Regards, Chip Campbell
Re: Running a Set of Commands from a File
Mike Blonder wrote: I have saved a file called 'commands.' This file has all of the commands (g /foobar/,/goobar/ d, etc) I need to edit some very large files. I want to 'run' this commands file from within each of the large files that I need to edit. 1) do I have to chmod 'commands' as an executable? No. 2) can I invoke the file from within VIM?, if yes, then what is the syntax? :so commands 3) would it be better to run it from the shell? (Linux/SuSE) Not if its composed of vim commands. Please be aware that the sourcing of commands is done in command mode; if you have normal mode commands, you'll want to be looking into how to use :normal (:help :normal). Also, check out :help -S , a command line option to vim that allows the sourcing of files. Regards, Chip Campbell
Re: Search and replace as per format
Srinivas Rao. M wrote: Hi Vimmers, I am tasked to replace the pattern log(module_name, LOG_LEVEL_DEBUG, The Value of status=%d message, status); to log(module_name, LOG_LEVEL_DEBUG, %s:The Value of status=%d message,__FUNCTION__, status); This pattern is appearing in hundreds of source files. Does anybody have a quicker way/script to do this task ?. I know it is possible through macro substitution by writing another macro on top of this, But again it is not a cleaner way.. Are those linebreaks really in there? I doubt it as one of them is in the middle of a string. OK, assuming they're not there, that its just a mailer thinking its smarter than you... :%g/log(module_name,/s/The Value of status=%d message,status/LOG_LEVEL_DEBUG, %s:The Value of status=%d message,__FUNCTION__,status); That'll do the trick for one file; then, of course, you'll want to save it: :w OK, now let's see how to automate this: qa :%g/log(module_name,/s/The Value of status=%d message,status/LOG_LEVEL_DEBUG, %s:The Value of status=%d message,__FUNCTION__,status); :w :n q That will store the command sequence into a register (I picked register a). To use it: vim PatternForHundredsOfSourceFiles qa :%g/log(module_name,/s/The Value of status=%d message,status/LOG_LEVEL_DEBUG, %s:The Value of status=%d message,__FUNCTION__,status); :w :n [EMAIL PROTECTED] Assuming you don't have 10,000 of these, eventually vim will report an error. A PatternForHundredsOfSourceFiles might be *.c */*.c */*/*.c (etc.) Regards, Chip Campbell
Re: Vim BOF session
I'd still like to see Vince Negri's ideas (ownsyntax, conceal) included. Regards, Chip Campbell
Re: Problem with 'lisp' and commented sexps
Yang wrote: There seems to be an 'undocumented feature' when editing Lisp files with the 'lisp' option set. I can no longer % between matching s-expressions []{}() if they are in comments and on newlines, e.g. in: ;; myfold {{{ (blah blah) ;; }}} ;; (blah ;; blah) I can't jump between the {} or the second (). Is this a bug? Its definitely controlled by the lisp option: (I put your example into yank.lsp) vim -u NONE -N yang.lsp (% key works on all {} and ()) :syn on (% key works on all {} and ()) :set lisp (problems you mentioned appear) Because of the -u NONE, the matchit plugin doesn't enter into this. The syntax file has no explicit interaction with matchit or %, so it appears to be an undocumented vim feature. Regards, Chip Campbell
Re: Syntax question regarding \%[
Yakov Lerner wrote: Even better would be use syn keyword: syn keyword Error int inte integ intege integer inter interv interva interval On the other hand, both of your 'syn match'es use same group, so why 2nd match taking over would be a problem anyway ? Probably syn keyword Error inte[ger] inte[rval] would work just as well as Yakov's; however, his question seems to me to be pertinent! Regards, Chip Campbell
Re: Modify flag
Yakov Lerner wrote: On 9/2/06, Shashi Kumar [EMAIL PROTECTED] wrote: How can I disable automatic setting of the modified flag or auto save option? I have set some option with which I think VIM is automatically saving the file thus changing the timestamp of the file. This poses a problem when I open header files especially when the target I need to build has a lot of source files. The problem occurs even when I open the file using gview. I use VIM on Windows XP and my _vimrc and _gvimrc are attached. Do you set 'auwowrite' (aw) option, and/or 'autowriteall'(awa) option ? Then just unset them. If you don't set those two options, then see if they are set: :verbose set aw :verbose set awa which will tell you both what they're set to and where they were last set (if set). Regards, Chip Campbell
Re: Specifying vim options in the files being edited
Russell Bateman wrote: You can put these modelines at the top of your file or the bottom. Also, they can go on other lines, but I think there's a limit there and yet another setting to change how tolerant Vim is in looking for them, but as this approach suits me, I haven't experimented a lot to find any more out. I think the limit may actually allow by default for the first two lines, so your own example would work fine. In fact, I think I once tried line 2 of my C file and it worked, but I can't guarantee it. ..snip.. There's a setting, modelines, that vim uses. By default, its 5, but you can change it in your .vimrc, for example. Within modelines lines of either the beginning or the end of the file, vim will search for modelines. :he 'modelines' :he modelines Regards, Chip Campbell
Re: Counts for mapping
Tom Carr wrote: Let's say I have the following mapping: nnoremap = 3l Now if I type =, it moves 3 characters to the right, as expected. Now if I type 1=, it moves 13 characters to the right instead of 3. Now if I type 3=, it moves 33 characters to the right instead of 9. It works correctly just as expected fpo your example. What do you mean by properly ? Do you mean, use counter '3' if no counter ig given, otherwise use the given counter ? Or you mean, move by count*3 ? Yes, it should move count*3. If there's no count specified it should move 3, as I explained in the examples. I think it'd be more accurate to say that you _want_ the cursor to move count*3 spaces to the right; the behavior is correct according to the documentation. OK, enough of being pedantic (although it is helpful to read the dox and understand 'em). May I point out that the following tip, http://vim.sourceforge.net/tips/tip.php?tip_id=895 helps with solving this problem; in particular, the example on using a map (\gg), a count, a command, and a function. In particular, here's a solution: map = :RightShiftcr com! -count=1 RightShift call RightShifter(count) fun! RightShifter(cnt) exe norm! .(3*a:cnt).l endfun The = map invokes a command. The command accepts an optional count (default=1). Any count preceding the map will get passed along, too. The command passes the count along to the RightShifter function. The function does the requested multiply by 3 and does the shift using exe and norm! . Regards, Chip Campbell
Re: Counts for mapping
Tom Carr wrote: In particular, here's a solution: map = :RightShiftcr com! -count=1 RightShift call RightShifter(count) fun! RightShifter(cnt) exe norm! .(3*a:cnt).l endfun That's an interesting hack, but there are a few problems with this solution: * This only works correctly on the first line of the buffer. If I type 5= it will execute :.,.+4RightShift which adds the current line into the count. * In visual mode with :behave xterm it always moves 3 regardless of the count. * In visual mode with :behave mswin it loses the visual mode. Sorry -- misunderstood your first point. Looks like the count passed to the function does get added in. Compensating for it: map silent = :RightShiftcr com! -count=1 RightShift call RightShifter(count) fun! RightShifter(cnt) let cnt= a:cnt - a:firstline + 1 exe norm! .(3*cnt).l endfun Regards, Chip Campbell
Re: Counts for mapping
Tom Carr wrote: In particular, here's a solution: map = :RightShiftcr com! -count=1 RightShift call RightShifter(count) fun! RightShifter(cnt) exe norm! .(3*a:cnt).l endfun That's an interesting hack, but there are a few problems with this solution: * This only works correctly on the first line of the buffer. If I type 5= it will execute :.,.+4RightShift which adds the current line into the count. * In visual mode with :behave xterm it always moves 3 regardless of the count. * In visual mode with :behave mswin it loses the visual mode. These problems are due to out-of-scope use. You'd asked how to make a nnoremap do something; these problems are all using the command mode to which nnoremap doesn't apply. The command I provided is not intended to take an address range; it takes a count. Address range-using commands and count-using commands are mutually exclusive, as the documentation states (:help command , then /Range handling). Regards, Chip Campbell
Re: Vim7: Turn syntax off while diffing
Yakov Lerner wrote: On 9/10/06, Yakov Lerner [EMAIL PROTECTED] wrote: On 9/10/06, Sven Brueggemann [EMAIL PROTECTED] wrote: Hello, Vim 7 combines syntax colouring and diff colouring when diffing. This often makes the diffs hard to read. Is there a way to automagically turn syntax colouring off when diffing? put this into your ~/.vunrc: if diff | syntax off | endif s/vunrc/vimrc/ Aww -- I like that invention! Now what else could we use a .vunrc file for? :) Regards, Chip Campbell
Re: Perltidy,VIM for C/C++ visual block cleanup
Gundala Viswanath wrote: Thanks Yakov, gg=G :help = But it seems to me that works on Global basis strictly. How can we localize the cleanup within a visual block? Moreoever how can we customize the indentation, bracing, etc? Since with Perl this customization is captured within .perltidyrc. To select a region using visual block: V (move) = Second -- an external tool that does C beautification is called cb. Used to be on all Unix boxes, but I see that its apparently not on Linux. I have my own C beautifier (ccb -- for Chip's C Beautifier) available at my website: see http://mysite.verizon.net/astronaut/src/index.html No guarantees, warranties, etc, and its use at your own risk. Use ccb ? to get help. Also, you'll need to compile it... Regards, Chip Campbell
Re: How does vim recognize file type?
Andrea Spadaccini wrote: I am using tablatex.vim, ftplugin for LaTeX files, and I have a main latex file and several included .tex files. Well, vim loads the plugin (and the syntax file) when I'm editing the main file, while it doesn't when I'm editing the included files. How can I tell vim that I'm editing a .tex file? And how do I make vim recognize .tex files without me setting the filetype? Vim recognizes file types using two files: (assuming 7.0) vim70/filetype.vim vim70/scripts.vim The filetype.vim file recognizes filetypes based on the files' extension (ie. .c is a C file, .lsp is a Lisp file, etc). The scripts.vim file recognizes filetypes based on the files' contents (ie. the first line is /bin/ksh, so its a shell file, etc). If you wish to customize this process to recognize personal extensions as some filetype or to recognize file contents as indicating some filetype, make a personal (wherever)/.vim/filetype.vim -or- (wherever)/.vim/scripts.vim with appropriate recognition code. Look at the vim70 versions for ideas about how to accomplish this. Caveat: *don't* change the distributed vim70/filetype.vim or vim70/scripts.vim. If you do, your emendations will no longer be working and you'll make yourself a lot of irritating work trying to find out why. Regards, Chip Campbell
Re: cusor movement
Tim Chase wrote: is it possible to tell vim(7) *not* to jump to the next line when using object motion (w,b..) such as vim behaves when using l or h ? Please give specific example of what you type in normal mode involving w or b that jumps to the next line, please. When I use w or yw vim does not jump to the next line. If I understand the OP correctly, given the following text this is line one this is line two with the cursor on the l of line #1, pressing w goes to the o in one. Pressing w a second time jumps to the t in this on the 2nd line as observed here...if it's not happening for you, the difference between your settings, Yakov, and our settings is the answer to the OP's question. However, if you are on the e in one, and press ell to go right, it does not end up on the t in this on the 2nd line. It sounds like the OP wants the behavior of w (and its kin) to mimic the behavior of ell, such that it doesn't jump to the next line. I run with a fairly stock vimrc, as I suspect the OP does. Do you have any funky settings in your vimrc, Yakov, that might trigger this behavior for you and not for us? I wouldn't know how to easily do what the OP asked; the opposite, that of making vim change lines with h or l *is* possible (see :help 'ww' ). I'm sure that some smart mapping could do the trick. As an example: (untested) nnoremap b :let curline= line(.)barexe norm! bbarif curline != line(.)|exe norm! w|endif Should be easy to re-write for handling w. Regards, Chip Campbell
Re: vim | replacement question
Nikolaos A. Patsopoulos wrote: Another replacement question: how can I replace all occurrence of a pattern except a given one, e.g. the first or third? the code for all occurrences I use is: :%s/a.\{-}//g Thanks in advance, I see that others have given the answer to the specific question you asked, so I won't repeat that. However, a related capability is to use the c flag (for confirm): :%s/a.\{-}//gc Regards, Chip Campbell
Re: Making Autocmd matches buffer's first line
Yakov Lerner wrote: On 9/20/06, Fabien Meghazi [EMAIL PROTECTED] wrote: But I would like these autocmd's to match those files without .py extensions. My question is : Is it possible to make an autocmd pattern's to match something in the first line's buffer with a regexp eg: ( ^#\!.+python or something like that ) instead of the filename ? We typically do it as follows: :au BufReadPost * if getline(1) =~ 'pattern' | do something | endif Also, one is supposed to put such things in .vim/scripts.vim (or vimfiles\scripts.vim if you're a Windozer) See :help new-filetype-scripts . Regards, Chip Campbell
Re: SR
Eric Leenman wrote: I have a file where I deleted all lines that don't contain a certain pattern For example I want to delete all lines that don't contain XXX and YYY. :g/PATTERN/cmd executes the given command on all lines containing the PATTERN. :v/PATTERN/cmd executes the given command on all lines _not_ containing the PATTERN. You can use LogiPat to set up patterns with boolean logic involved: :echo LogiPat('XXXYYY') which yields: \%(.*XXX.*\.*YYY.*\) The \%( and trailing ) are not needed in this case, but the pattern will, nonetheless, work. You can get LogiPat from either http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs -- LogiPat http:vim.sourceforge.net/scripts/script.php?script_id=1290 So if you want to delete all patterns not having XXX and YYY, then :v/\%(.*XXX.*\.*YYY.*\)/d would do the trick. Regards, Chip Campbell
Re: LogiPat Problem
Bill McCarthy wrote: Hello Vim List, Trying out LogiPat (by Charles Campbell) today, I ran into a problem. I tried to find lines that contain abc or def but didn't contain both. Hello! Looks like you ran into a bug. I've loaded LogiPat v3 onto my website which handles :LP (abc|def)!(abcdef)) correctly. Regards, Chip Campbell
Re: Piping messages from ex commands into a new tab
Tom Carr wrote: I'm trying to pipe messages from ex commands (e.g. :map , :version) into a new tab. I've found http://vim.sourceforge.net/tips/tip.php?tip_id=95, but I was hoping for a better way. Ideally I would type something like :tabmesages :map and it would show :map in a new tab, without printing it to the screen, without waiting for additional keypresses, and without using up registers. There's Decho.vim, which is intended to support debugging but can certainly do this. Where to get it: http://vim.sourceforge.net/scripts/script.php?script_id=120 -or- http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs , see DrC's Vim Debugger How to use: :DechoTabOn then subsequently :Decho strings such as: :Decho here is :Decho a message :Decho or three. will show up in the new tab. Regards, Chip Campbell
Re: Piping messages from ex commands into a new tab
Tom Carr wrote: I'm trying to pipe messages from ex commands (e.g. :map , :version) into a new tab. I've found http://vim.sourceforge.net/tips/tip.php?tip_id=95, but I was hoping for a better way. Ideally I would type something like :tabmesages :map and it would show :map in a new tab, without printing it to the screen, without waiting for additional keypresses, and without using up registers. Also with the Decho plugin: :Dredir map will then put the output of the map command into the new tab. Regards, Chip Campbell
Re: --enable-gui argument... no GUI support
Akbar wrote: I have the same problem. Installing vim 7.0 source in Suse 10.1, I always get --enable-gui argument... no GUI support I have xorg-x11-devel installed. I have installed libgnome-devel. No luck. Any idea? I suspect that you do the following after unpacking the vim 7.0 source files: make su (as root) make install exit Normally that procedure puts the vim executable in /usr/local/bin . Note that you did not remove any previous versions of vim -- they're probably still there. So, do the following: echo $PATH Does your path as shown by the preceding command to the shell perhaps show /usr/bin or /etc preceding /usr/local/bin? Try whence vim and, if I'm right, you'll find that the vim you compiled and installed isn't the one being executed. The solution: either remove the older copies of vim or, preferably, change the PATH so /usr/local/bin precedes /usr/bin, /bin/, or wherever the older vim was found. Regards, Chip Campbell
Re: copy a word without moving cursor
Osho GG wrote: I am already putting this segment in much larger map that does other things on a contents. However, the way I currently do it has a disadvantage that the cursor moves and then it moves back and then the screen flashes - all for nothing really. ayaw or ayiw doesn't work for me because it changes cursor position. So, I want a simple way to find the word at the current cursor position. Its not 100% clear what you want; does :echo expand(cword) illustrate something like what you want? Regards, Chip Campbell
Re: vim backspace
cga2000 wrote: I don't suppose there's any way I can save the current interactively- modified colorscheme to a file? Perhaps http://vim.sourceforge.net/scripts/script.php?script_id=1081 will be helpful for what you want to do. Interactively adjust the colorscheme using hicolors' colorscheme editor, then save it. Regards, Chip Campbell
Re: copy a word without moving cursor
Osho GG wrote: Hi All, I know this mustbe pretty simple but I can't figure this out. I want to copy a word into a buffer without moving the cursor. Currently I do something like *ayw^O:nohCR to get this effect. But, this seems like such a round about way to do this. Is there a simpler way to achieve this? :let @a= expand(cword) Regards, Chip Campbell
Re: Setting up netrw
Suresh Govindachar wrote: Close ... From inside gvim, I tried both of the following: :Nread scp://111.11.11.111/home/suresh/examples/mcf/vmul/manager/manager_vmul.c and :sf scp://111.11.11.111/home/suresh/examples/mcf/vmul/manager/manager_vmul.c But the system command they each resulted in was: c:/opt/putty/pscp.exe -l user -pw password -q -batch '111.11.11.111:home/suresh/examples/mcf/vmul/manager/manager_vmul.c' VID62.tmp.c The preceding system command doesn't work. Two changes need to be made to make it work: 1) Remove the single quotes '' [unknown host with ''] 2) Add a / after the : in :home/suresh [file does not exist without /] I downloaded all sources and built gvim yesterday. Try using the latest netrw, which is currently up to v107b. Its been a bit smarter about quoting; and its quoting can be overridden by specifying g:netrw_shq in one's .vimrc. Regards, Chip Campbell
Re: Setting up netrw
Suresh Govindachar wrote: The version of netrw in the vim sources, on vim.org and on your web-site all differ. Since netrw is part of the vim runtime- sources, could you please coordinate your releases with Bram? They are already quite coordinated. Development version appears at my website, an interim release appears at vim.sf.net, and the interim release is also sent on to Bram. Also, there is a note on your web-site about needing to update vimball. Is vimball part of vim runtime-sources? Yes, although it, too, undergoes the same development process. If you would prefer people use netrw under vimfiles/ rather than under the main vim directory, please have Bram remove netrw from the runtime-distribution. I have no such preference. However, the runtime-distribution release will interfere with the development release. This problem will be addressed whenever the next vim 7.1 appears. If you don't wish to use the development version of netrw (or vimball), then feel free not to.
Re: vim | editing pdf files with vim
Nikolaos A. Patsopoulos wrote:, is there a way to edit pdf files with vim? If not pdf as is, then eps or postscript? I tried with either format but the text kept been converted to sthl ike ASCII code. For purposes of visualization, using netrw's browser and, with the cursor on the pdf file, pressing x will (usually) bring up a tool to visualize the pdf file. For editing (as in changing file contents), I'm afraid I don't know. Regards, Chip Campbell
Re: bugs in vim scripting highlighting
Mikolaj Machowski wrote: Noticed two bugs in vim script highlighting: 1. xnoremap and snoremap are not fully recognized. Compare highlighting of those three lines: inoremap buffer silent expr C-C SIDCtrlC() xnoremap buffer silent expr C-C SIDCtrlC() snoremap buffer silent expr C-C SIDCtrlC() Arguments of xnoremap and snoremap aren't highlighted 2. Function element addButton is highlighted as error: function! forms#form.addButton(fname, flabel, fvalue, hotkey, listener) But it works (as in forms.vim). the same apply to call call. Problem 1 has been addressed in the latest syntax/vim.vim -- please try it out. I think problem 2 was addressed previously. syntax/vim.vim is now up to v7.0-55, and you can get it from http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax You can then select vim.vim syntax. Regards, Chip Campbell
Re: Problem in dos runtime on Vim FTP
A.J.Mechelynck wrote: Bill McCarthy wrote: On Tue 10-Oct-06 9:26pm -0600, A.J.Mechelynck wrote: Bill McCarthy wrote: Since yesterday, 4 files in the dos/autoload directory cannot be downloaded - it doesn't appear to matter which FTP client is used. The four problem files are: netrw.vim tar.vim vimball.vim zip.vim The URL for the directory of these files is: ftp://ftp.home.vim.org/pub/vim/runtime/dos/autoload Those files have been recently updated.(snip) (snip) We-e-ell, that's strange. Something must have gone wrong on the FTP servers. I updated my runtime files a few hours ago from the rsync server; but from a long directory listing, I notice that the four files above (which are dated 14-Aug-2006) plus netrwSettings.vim (dated 9-Oct-2006) have permissions -rwr-- : i.e., they are apparently readable by everyone except members of the owning group (which is a weird set of permissions). I guess the maintainer of the files, or the owner of the servers, should run chmod 644 on them. (IIUC, the maintainer of all those files is Dr. Chip so I add him on the Cc: list.) (snip) Just so you know; I don't have the access to put files on ftp.home.vim.org. I generally send updates to Bram and somehow they magically appear there later! You can always go to my website and get the developmental versions thereof (http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs). Regards, Chip Campbell
Re: Vim7: Spell checking not working with ft=mail
[EMAIL PROTECTED] wrote: On Thu, Oct 12, 2006 at 02:40:48PM -0500, Tom Purl wrote: A lot of filetypes have special provisions where they turn spell-checking off in certain areas that you don't want to spell-check. I read about that; however, mail.vim doesn't seem to do that (I could be wrong here). I think that the mail filetype turns off spell checking if what you're text is after an arrow (, , etc.). Is that what you're doing? No, I wasn't quoting anything... Well, syntax/mail.vim *does* have a lot of NoSpell cluster referrals in it. What part of the email message are you referring to? Basically, mail.vim does spell checking only in the letter portion, not the headers (or Subject: ...), etc. Regards, Chip Campbell
Re: bugs in vim scripting highlighting
Hari Krishna Dara wrote: I faced a problem, though it is with netrw, not with vim syntax file. I tried to open the download link from Vim, and got the below error: Error detected while processing function netrw#NetRead: line 275: http://mysite.verizon.net/astronaut/vim/syntax/vim.vim.gz; E212: Can't open file for writing VIG3A4.tmp.gz [+][Not edited] --No lines in buffer-- Error detected while processing function netrw#NetRead..SNR115_NetGetFile: line 42: E37: No write since last change (add ! to override) http://mysite.verizon.net/astronaut/vim/syntax/vim.vim.gz; [+][Not edited] --No lines in buffer-- Error detected while processing function gzip#read: line 31: Error: Could not read uncompressed file VIJ3A7.tmp.gz [Not edited] --No lines in buffer-- I got an empty buffer, and when I reloaded the buffer, it worked fine. I am on windows. In addition to the various fixes concerning tmp files and windows, another similar problem has been solved; apparently, having autowrite on caused trouble. The latest netrw now bypasses that option, too. (v107c). Its currently available at my website: http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs , see Network Oriented Reading, Writing, and Browsing. Regards, Chip Campbell
Re: VimL and Exuberant tags - Suggestions please
hdrtag (available at http://mysite.verizon.net/astronaut/src) creates tags for *.vim files. Currently, it supports tags for syntax, match, region, c luster, keyword, function, command, and maps. Regards, Chip Campbell
Re: netrw for new extension
Hari Krishna Dara wrote: Netrw comes with a few supported formats, and the format is deduced by the extension of the file, which is fair, but is there anyway to configure netrw such that it will recognize new extensions as one of the supported filetypes? E.g., there are several archives that are compatible/same as zip archives, except for extra metadata attached them. The jar, ear, war, and the Flex archives (forgot what the extension is), they are all zip archives, so I want netrw to treat them that way. Are you talking about using netrw's map for the x key? If so, look for :help netrw_filehandler for a discussion about how to write your own. Regards, Chip Campbell
Re: netrw for new extension
Hari Krishna Dara wrote: Netrw comes with a few supported formats, and the format is deduced by the extension of the file, which is fair, but is there anyway to configure netrw such that it will recognize new extensions as one of the supported filetypes? E.g., there are several archives that are compatible/same as zip archives, except for extra metadata attached them. The jar, ear, war, and the Flex archives (forgot what the extension is), they are all zip archives, so I want netrw to treat them that way. If, on the other hand, you're not really talking about netrw, but about the zip plugin -- presumably just include in your .vimrc a line such as: au BufReadCmd *.jar,*.ear,*.warcall zip#Browse(expand(amatch)) Regards, Chip Campbell
Re: cursor moves back with ESC
Lev Lvovsky wrote: I've never actually figured out why upon after typing in insert mode, the cursor moves back one character to the left after pressing escape. What's the reason behind this, and is there any way to turn it off? To best understand this, one needs to use console vim. There, the cursor cannot be between characters; it must lie on a character. So, the insert puts a character before the character the cursor is on; when done, the cursor lies on the last inserted character. Now, try gvim. Gvim lets the cursor lie between characters, but when done, the character again lies on the last inserted character. Seems a reasonable choice, to me. Any choice would be arbitrary. Now, to turn it off: don't use insert. Use append. Regards, Chip Campbell
Re: split vertically at a tag
Kamaraju Kusumanchi wrote: If I do ctrl-W ctrl-] in normal mode, vim splits the current window horizontally. Is there any way to achieve the same functionality but with window being split vertically instead of horizontally? Here's another solution: nmap silent F9 :exe 'vert sta '.expand(cword)cr Regards, Chip Campbell
Re: Match something that not in the pattern
Peng Yu wrote: Hi, I have the following file segments. I want to concatenate all the lines with their next lines, except that it ends with }}. I want to use the pattern \(}}\)[EMAIL PROTECTED]. It seems not working. Would you please help me to figure out how to match the lineend without }}? This problem is one that LogiPat can help with! (see http://vim.sourceforge.net/scripts/script.php?script_id=1290 or http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs, see LogiPat) First, let's construct a pattern that matches all lines that don't end with }}: :echo LogiPat('!}}$') ^\%(\%(}}$\)[EMAIL PROTECTED])*$ Now, that has a bit more than is necessary, but it does work. I'm not sure what you want with that trailing '^' -- was that supposed to mean beginning-of-line? It isn't necessary if that's the case. So, to do what you ask with LogiPat's result: :g/^\%(\%(}}$\)[EMAIL PROTECTED])*$/j Regards, Chip Campbell
Re: Problems with
Max Dyckhoff wrote: Re-including the list. I only have about 30 maps, and none of them start with . The only thing that I can see which might be affecting anything are these two: ,,b :%s/\(^\t*\):/\1/ecr:%s/\(^\t*\) /\1: /ecr:let @/=cr ,,B :%s/\(^\t*\):/\1/ecr:let @/=cr Now ,, is the localleader for vo_base, the vimoutliner plugin. This is in a C file, so it looks like the mappings have leaked over from a different buffer in a different tab. I recently saved a session, quit and sourced that session; perhaps something exploded then? HAH. I just realised that the mapping in vo_base.vim ISN'T buffer. I shall make them buffer and see if that fixes it :) Still, why would trigger ,,? And yes, I know that is shift-, :) Did you ever try :verbose map and see what popped up? Also, IMHO, plugins should not be setting the localleader; that's inherently a user's choice as to what s/he prefers. In other words, the map should be map LocalLeaderb ... map LocalLeaderB ... Regards, Chip Campbell
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: 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: 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
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: chasing symlink
Yakov Lerner wrote: Let's say I edit file x (vim x) which is a symlink, x-y. (Linux). How can I make a script that opens y instead of x in the buffer (chases the symlinks and opens it) I guess I don't understand exactly what you're doing here. Let me explain: echo junk1 file1 ln -s file1 file2 vim file2 This shows file1's contents; ie. junk1. So, I'm editing the target of the symlink file, not the symlink file itself. In fact, I'm not sure how to edit that symlink file, but I don't think that's what you're asking for. Regards, Chip Campbell
Re: Terminating search in function
Meino Christian Cramer wrote: I wrote this snippet: fun! Ffunchdr() let date = strftime( %F ) put='/*-*/' put='/**' put=' * desc' put=' *' put=' *' put=' *' put=' * Created: ' . date . ' put=' *' put=' * parameter: put=' * parameter: put=' * parameter: put=' * parameter: put=' * parameter: put=' *' put=' * result 0 - Success, -1 - Failure' put=' *' put=' */' ?desc endfun command! Funchdr :call Ffunchdr() This should give nme the header comment for function definitions in C. My problem seems to be the ?desc command at the end. It /should/ move the cursor onto the desc keyword right in the beginning of the comment block. (snip) I suggest using the search() function: call search(desc,bW) Regards, Chip Campbell
Re: Inline script execution
Daryl Lee wrote: I am working my way through the :help scripting explanation (usr_41.txt) and I have a question about the :@ command. I ran the sample given in the explanation, where the simple example is: :let i = 1 :while i 5 : echo count is i : let i += 1 :endwhile And the expected output is count is 1 count is 2 count is 3 count is 4 What I got was :^I:let i = 1 :^I:while i 5 : ^I: echo count is i count is 1 : ^I: let i += 1 : ^I:endwhile count is 2 count is 3 count is 4 Obviously, something is causing the commands to be echoed. I tried copying the lines into a separate buffer and deleting the colons, but that didn't fix the problem. Is there something that should be set and isn't? Hello, Bram! I thought I'd try to bring this to your attention, as I'm not at all sure that you sift through the vim mailing group as assiduously as you do the vim-dev mailing group. This example comes from usr_41.txt, lines 44-66. I get the same output as does Daryl Lee (vim 7.0 patches 1-153). Seems that either the documentation needs changing, the example needs a tweak (because the code snippet does work when saved as a file and then sourced), or something perhaps is wrong with :@ . Regards, Chip Campbell
Re: how to make 7.0 behave like 6.4
longraider wrote: The set autoindent smartindent is the solution, thanks a lot. You know, vim 7.0 hasn't changed the autoindent/smartindent area (except possibly for bug fixes) from v6.4 insofar as I am aware. And I do use autoindent (and cindent). So the question in my mind is: why did this change for you when you upgraded? One way that may have occurred is if you edited the system files and put settings and customizations in there. If that's what you in fact did, then I suggest that its Much Better (tm) to use $HOME/.vimrc and $HOME/.vim/ instead for such things. You won't lose your customizations that way when you upgrade. Regards, Chip Campbell
Re: Reduce cursor size
Billy Patton wrote: In gvim the mouse cursor dissapears when I begin typing. Can this be done in vim? This property is more a function of the xterm/console you're using rather than of vim. Here's an example of how to change color with an xterm (blue on insert, yellow else): if v:version = 700 let t_SI=\esc]12;blue\x7 let t_EI=\esc]12;yellow\x7 endif I don't think you can change cursor size, but I'm willing for someone to show how to do it. I looked over a list of ansi escape sequences I found on the web but saw nothing to change the cursor size. Regards, Chip Campbell
Re: ':Explore' higlight the results
[EMAIL PROTECTED] wrote: Hello Vimmers, I've seen recently in the mailing list an interesting post/question about searching for a list of fies containing a pattern. The answer was that we could use :Explore or :vimgrep. For me, the first solution seems the best. I have a friend of mine that is using emacs, which has the same option as :Explore. However, the files matching the pattern are highlighted. Is it possible to do the same with :Explore? I checked the :help :Explore but couldn't find it. I've uploaded v107g of netrw.vim which supports this to my website: http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs see Network Oriented Reading, Writing, and Browsing First, remove all previous versions of netrw from both your personal directories and from the system directory where netrw was installed (under Linux, that's often /usr/local/vim/share/vim/vim70/[plugin|autoload|doc]/netrw*). You'll also need to remove all previous versions of vimball. You can get the latest vimball from my website, too (see Vimball Archiver). Install it first: cd /usr/local/vim/share/vim/vim70 mv [wherever]/vimball.tar.gz . gunzip vimball.tar tar xvf vimball.tar Then you may install netrw: vim netrw.vba.gz :so % :q should do it. Regards, Chip Campbell
Re: Getting out of netrw
Jean-Rene David wrote: Say I open vim7's new super duper file explorer netrw to browse some local directory. Say then I decide I don't want to open any new file and just want to go back to what I was doing. What would be the standard way to do that? I can use C-O to eventually land up where I was but I need to backtrack all the motion commands I did in the netrw buffer. You can use the jumplist to get a listing of locations where you've been: :ju The left hand column is a count that you can use to precede c-o. For example: jump line col file/line 3 10 some text 2 700 another line 1 1154 23 end. and 3c-o will jump to entry #3. Regards, Chip Campbell
Re: Getting out of netrw
Marius Roets wrote: On 11/3/06, Jean-Rene David [EMAIL PROTECTED] wrote: I thought of using :q but that closes vim if only one window is open. Am I missing something obvious? Then F2 opens explorer in a new tab, and leaderq closes the tab, and you should be back where you were before pressing F2. Or you could use :Texplore to open a netrw-browser in a new tab! Regards, Chip Campbell
Re: vim.org refreshed mockup
Panos Laganakos wrote: I made a mockup of a refreshed version of vim.org, trying to maintain as much of the original look as possible: http://panos.solhost.org/mockups/vimorg-01.png vim tangofied icon by toZth Well, I don't see any checkerboard pattern, but I do find dark grey text on a dark blue background a bit difficult. Seems like something isn't being specified in the display. Regards, Chip Campbell
Re: Search all text files in a directory for text
Chuck Mason wrote: Sorry to bring this up again. Was there every any solution to this? Do I just need the latest netrw? I was trying to get :Explore **/pattern working But as I do see the Match n of N in the lower right, the cursor never moves in the browse buffer (with S-Down/S-Up) and occasionally I get errors: Error detected while processing function netrw#Explore: line 165: E121: Undefined variable: w:netrw_longlist E15: Invalid expression: w:netrw_longlist == 0 || w:netrw_longlist == 1 I'm using vim7.0 (2006 may 7), and tried this with -N -u NONE. Maybe someone here knows how to get this working? netrw is up to v107g (Nov 03, 2006). I suggest upgrading! You'll also need an up-to-date version of vimball to extract netrw, which is also available at: http://vim.sourceforge.net/scripts/script.php?script_id=1502 -or- http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs see Vimball Archiver Also, to make these new plugins work, you first need to completely remove all older vestiges of netrw and vimball from your runtimepath. Under Linux, that usually means cd /usr/local/share/vim/vim70 /bin/rm plugin/netrw*.vim plugin/vimball*.vim /bin/rm autolaod/netrw*.vim autoload/vimball*.vim Under Windows, check your runtimepath to determine where your vim 7.0's runtime directories are: vim :echo rtp :q should give you a clue. Regards, Chip Campbell
Re: vim.org refreshed mockup
Richard Querin wrote: On 11/7/06, Brian McKee [EMAIL PROTECTED] wrote: It's IE that adds the dark blue I think Brian Yeah. Just checked. It shows a blue background instead of white in IE6. I assume it's just a .png support problem. No, its not IE6; I'm using Mozilla 1.7.12. Gene K also had problems with the background, in his case some sort of checkerboard pattern showed. My background is normally dark blue; I believe that the png doesn't specify the background properly. Chip
Re: vim.org refreshed mockup
Dave Land wrote: According to the tool, the contrast between the grey text and the white background is too low, as is the contrast between the green navigation text and its pale yellow background. I don't think that he specifies the background; instead, its whatever your browser has for a default. So, I'm sure that if you fiddle with your background that perhaps the contrast could be improved. Regards, Chip Campbell
Re: clearing out an appended-to register
Lev Lvovsky wrote: So I just discovered the wonders of being able to append to named registers - how though, do I then clear them out once I'm done with their contents? Let's assume you're wishing to clear register A: :let @a= will empty it out. Regards, Chip Campbell
Re: When {rhs} contains a space
A.J.Mechelynck wrote: Charles E Campbell Jr wrote: (and :nohls will clear the highlighting). Alternatively, :set list will show ~s at the end of lines containing spaces, too. :set list will replace tabs by ^I (two screen cells) unless 'listchars' has been set to include a tab: suboption, e.g. with :set list listchars+=tab:\ \ which also ends in a space. Sorry 'bout that: try set listchars=tab:-,trail:~,eol:$ set list *that* will show trailing spaces as ~s. Regards, Chip Campbell
Re: Setting Up Debugging
Tom Purl wrote: I'm having a problem with netrw, but before I can properly troubleshoot it, I need to fix debugging. What I would basically like to do is use Vim normally (without having a bunch of debug messages pop up) while all of the messages are written to a file. Here's what I have in my ~/.vimrc: let verbosefile = /tmp/vim_debug.out set viminfo='50,1000,s100 :verbose set viminfo? I copied this set of commands a couple of months ago to help troubleshoot a different problem. Shouldn't these commands still work, or am I missing something? I suggest using the Dfunc/Decho/Dret debugging system already part of netrw. Once you have the plugin installed, vim netrw.vim :DechoOn :wq The latest version of netrw uses DechoTabOn, which means that debugging output will go to a separate tab. You can save the resulting output to a file whenever you wish, and the display won't be affected (other than seeing the presence of two tabs). You can get the Decho plugin from: http://vim.sourceforge.net/scripts/script.php?script_id=120 -or- http://mysite.verizon.net/astronaut/vim/index.html#DECHO (this latter one is always the most up-to-date) You'll need an up-to-date version of vimball to extract plugins that I've generated since August 1, 2006: http://vim.sourceforge.net/scripts/script.php?script_id=1502 -or- http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs see Vimball Archiver (the most up-to-date version is here) You'll need to completely remove all older vestiges of vimball from your runtimepath. Under Linux, that usually means cd /usr/local/share/vim/vim70 /bin/rm plugin/vimball*.vim autoload/vimball*.vim Under Windows, check your runtimepath to determine where your vim 7.0's runtime directories are: vim :echo rtp :q should give you a clue. Regards, Chip Campbell
Re: using vimball or netrw
J A G P R E E T wrote: Hi There, I work on windows OS and want to access(read/write) to remote server(UNIX). From the vim site I came to know this is possible, but how to use it is outa my mind. I check the two plugins netrw and vimball; I'm not getting much understanding regarding these two plugins and not much help available for these two. Can I get much detailed document to get more understanding on the same. To get an up-to-date version of netrw, you'll also need to get an up-to-date version of vimball. So: 1) Get an up-to-date version of vimball: http://vim.sourceforge.net/scripts/script.php?script_id=1502 -or- http://mysite.verizon.net/astronaut/vim/index.html#VimBall (the mysite.verizon.net one will be the more recent version) 2) Remove the old vimball plugin and install the new one: Linux: cd /usr/local/share/vim/vim70 /bin/rm plugin/vimball*.vim autoload/vimball*.vim doc/pi_vimball.txt mv (wherever it was downloaded)/vimball.tar.gz . gunzip vimball.tar.gz tar -xvf vimball.tar Windows: Under Windows, check your runtimepath to determine where your vim 7.0's runtime directories are: vim :echo rtp :q The first directory is likely your personal plugins directory, the second one is your vim system directory. cd (to your vim system directory) del plugin\vimballPlugin.vim del autoload\vimball.vim del doc\pi_vimball.txt ren (wherever)\vimball.tar.gz vimball.tar.gz gunzip vimball.tar.gz tar -xvf vimball.tar 3) Remove system version of netrw: Linux: cd /usr/local/share/vim/vim70 /bin/rm plugin/netrw*.vim autoload/netrw*.vim doc/pi_netrw.txt Windows: cd (to your vim system directory) del plugin\netrwPlugin.vim del autoload\netrw.vim del doc\pi_netrw.txt 4) Install an up-to-date version of netrw: vim netrw.vba.gz :so % :q Subsequently, whenever you wish to update netrw, all you'll need to do is to a) obtain a newer netrw b) perform step #4 Now, as to documentation: :help vimball and :help netrw have 129 lines and 1928 lines of help, respectively. Using vimball is particularly simple; see step #4 above. Using netrw is reasonably simple: vim scp://somehost/path/to/file.ext would invoke netrw to do the work via scp. Netrw supports a number of protocols, including scp, rcp, ftp, etc. I suggest reading :help netrw-start . Regards, Chip Campbell
Re: autocmd and netrw
Ilya Hegai wrote: Hello, I have such line in my .gvimrc autocmd BufEnter * :lcd %:p:h (this is vim tip: http://vim.sourceforge.net/tips/tip.php?tip_id=101) but when I work with remote files via netrw it produces warning every time, 'cause scp copies remote files to /tmp dir Is there any way to determine whether file is opening via netrw to disable that autocmd? * Check into :set acd , although this may not work if your vim doesn't support it. * I believe that BufEnter autocmds fire before BufRead and FileRead events, so when your autocmd fires, netrw's remote file handling events haven't fired yet. So you need a smarter event; perhaps something like (untested): au BufEnter * :if expand(afile) !~ '^\a\+://' | :lcd %:p:h | endif Regards, Chip Campbell
Re: Trouble with syntax highlighting in gvim70
Dudley Fox wrote: Tony, I actually did have it as a colorscheme originally, but I was still calling it from _vimrc. Which lead to the same problem. I checked on my older machine, still using gvim6x, and it has the highlight commands directly in the _vimrc file. Obviously something changed between 6 and 7, because when I ran scriptnames in gvim6x it was calling _vimrc first as in gvim70, but I never saw a call to syncolor.vim. The way one should call a colorscheme: vim/colors/NewColorScheme.vim and, in your .vimrc: colors NewColorScheme Is that how you were doing it? Regards, Chip Campbell
Re: search and replace multiple lines
mark wrote: I want too change the order of three lines globally (there are thousands of entries that need reordering) and don't seem to be able to get my head around how to do it with vi. I want to change the order off these three 1=red 2=blue 3=orange into 3=orange 2=blue 1=red Is this a case of reverse ordering lines? If so: go to the 1=red line, type ma go to the 3=orange line, type \fr where you've previously defined \fr as: nno silent Leaderfr :set lzcr'aOescma'':'a+1,.g/^/m 'acrkdd:set lz!cr Regards, Chip Campbell
Re: Commenting out TeX-text line by line in V-mode
Meino Christian Cramer wrote: From: Charles E Campbell Jr [EMAIL PROTECTED] Subject: Re: Commenting out TeX-text line by line in V-mode Date: Thu, 16 Nov 2006 13:34:16 -0500 How about :[range]g/\S/s/^/%/ which means: over the selected range (which may be the visual range), on all lines that have some non-white-space character on them, insert a leading %. OK, here's a more detailed explanation: :[range] over the selected lines, which with visual selection will appear as ',' . Those are marks set by the visual selection. g/pattern/cmd for any lines which match the given pattern, in this case \S , do the specified cmd. So, the cmd is performed for any line that has a non-whitespace character in it. Thus, empty lines and lines with just whitespace (tabs and spaces) will not match. Now, the aforementioned cmd is s/^/%/ Substitute a % at the beginning of the current line. What you asked for was to do something (comment out lines) given a condition (that the line must not be empty). So the :g/pattern/cmd allows one to do a command (s/^/%/) only when the line matched a pattern (that implied that the line was not empty). Regards, Chip Campbell
Re: yank and put 'over' instead of 'insert'
Troy Piggins wrote: I use 'R' replace mode when doing, for example, ascii art etc because it allows me to change characters without affecting the layout of the rest of the window/page. But if I want to yank a section using visual or visual block, is there a way to put 'p' that block in without affecting the layout? The way I've been doing it, the rest gets pushed along. The DrawIt plugin supports this sort of thing. Here's the procedure: visual-block select some region and save into register a (ctrl-v move ay) move cursor (upper left hand corner based) : \pa or, move cursor and click shift-leftmouse Actually, DrawIt supports \pa ... \pz for all 26 marks, and that's a space-transparent put. If you want the spaces to be used, use \ra ... \rz. To get an up-to-date version of DrawIt, you'll also need to get an up-to-date version of vimball. So: 1) Get an up-to-date version of vimball: http://vim.sourceforge.net/scripts/script.php?script_id=1502 -or- http://mysite.verizon.net/astronaut/vim/index.html#VimBall (the mysite.verizon.net one will be the more recent version) 2) Remove the old vimball plugin and install the new one: Linux: cd /usr/local/share/vim/vim70 /bin/rm plugin/vimball*.vim autoload/vimball*.vim doc/pi_vimball.txt mv (wherever it was downloaded)/vimball.tar.gz . gunzip vimball.tar.gz tar -xvf vimball.tar Windows: Under Windows, check your runtimepath to determine where your vim 7.0's runtime directories are: vim :echo rtp :q The first directory is likely your personal plugins directory, the second one is your vim system directory. cd (to your vim system directory) del plugin\vimballPlugin.vim del autoload\vimball.vim del doc\pi_vimball.txt ren (wherever)\vimball.tar.gz vimball.tar.gz gunzip vimball.tar.gz tar -xvf vimball.tar 3) Get DrawIt: http://vim.sourceforge.net/scripts/script.php?script_id=40 http://mysite.verizon.net/astronaut/vim/index.html#DRAWIT 4) Install an up-to-date version of Drawit: vim DrawIt.vba.gz :so % :q Steps 12 are all about updating vimball; in the future, whenever 7.1 comes out, that complication will no longer be necessary. Regards, Chip Campbell
Re: Commenting out TeX-text line by line in V-mode
A.J.Mechelynck wrote: It should be possible (though less obvious) to do it with only a substitute. Let's try: :','s/^.*\S.*$/# \0 i.e. prepend a hash sign and a space wherever we find start-of-line, zero or more of anything, one nonblank, zero or more of anything, end-of-line (in the range, here shown as a Visual area). OK, here's another possible but less obvious method, even a bit shorter: :','s/^.*\S\^/%/ This one uses a concat, and depends on having the last concat be the one used for substitution. What it means: :',' over the visually selected range s substitute the pattern that begins with something but has a non-whitespace character, AND matches the beginning-of-line with a % in the place of the last concat (ie. the beginning-of-line). Regards, Chip Campbell
Re: Search and delete
Krzysztof MaJ wrote: VitaM, how to search in the file based on some regex and when it's matched delete the whole line automatically? :g/pattern/d will delete all lines containing the pattern. You may also specify a range: :5,.g/pattern/d I suggest reading up on :help :g because there's more you can do with that command. Regards, Chip Campbell
Re: I look for make all windows (almost) equally high only. I would not equally wide.
KLEIN Stéphane wrote: I look for make all windows (almost) equally high only. I would not equally wide. There is this feature ? I would not CTRL-W_= because this command make equally high and wide. Here's what I did to find out: :he windows /equal OK, so here's where to look further: :help 'ea' :help 'eadirection' Regards, Chip Campbell
Re: suggestions for ssh under windows
Charles E Campbell Jr wrote: I have a netrw user using WinXP who wants to use ssh; currently, he doesn't have such an executable. I tend to use cygwin, but that's like asking one to build a home instead of new cabinets for the kitchen. So, where can he get ssh for WinXP? I'm likely to put a synopsis of any answers in netrw's help. Hello! Thank you for your suggestions -- as I mentioned, I'll be including a synopsis in netrw's help. Looks like there're four solutions: putty, openssh, gnuwin32, and including a couple of files from cygwin (although for that last case I'm not sure how one would get just the two without downloading the entire distribution). It'll be netrw-problem #8 (:help netrw-P8). Regards, Chip Campbell
Re: Matching JUST the nth occurence of a text in a line
Peter Hodge wrote: Try: /^.\{-}home.\{-}\zshome for your reference: \{-} makes the '.' match as little as possible \zs makes the search match begin at this point in the pattern To generalize to the n-th occurrence: (put the qty of skipped matches in N) /^.\{-}\%(home.\{-1,}\)\{N}\zshome So, for the 2nd home: let N=1. Regards, Chip Campbell
Re: Inverse Folding?
Vigil wrote: Because I often want to concentrate on a small section of code in a large script, and because my terminal window is large, I wondered if it was possible to select some text and have all other text, ie. the surrounding text, fade out in colour, or use a darker colour or something, so that when I flick away to read another tab and flick back, I don't have to manually search out the small block of code again. I did a search on vim.org to see if anyone had already done this, but came across a tip that lead me to manually fold away the code that I don't want to see, ie. the code above, and the code below, the subject code. Now I'm wondering if it is possible to select a block of text and issue a fold command that folds away everything BUT the selected text. I have the following in my .vimrc: nnoremap silent space:exe 'silent! normal! '.((foldclosed('.')0)? 'zMzx' : 'zc')cr This map is useful for when you have syntax or marker based folding enabled. Just go someplace, and while in normal mode use the space bar. Now, if your file isn't already supporting a bunch of folds, then you'll want to manually fold code above and below as you have been doing. To simplify the process: vnoremap silent space:fobar1,'-1fobar'+1,$focr With these two maps you have a solution! Just visually select the region of interest, then hit your space bar twice. Plus, each map by itself is useful. Regards, Chip Campbell
Re: Matching JUST the nth occurence of a text in a line
[EMAIL PROTECTED] wrote: I am puzzled by a slightly more complicated version: how to match a '%' character following the 2nd occurrence of home? /^.\{-}\%(home.\{-1,}\)\{N}home.\{-}\zs% where N is 1 for the 2nd occurrence (N is 2 for the third occurrence, etc). This pattern matches up to and including the 2nd home, extends past a minimal amount of anything up to but not including a %, whereupon the pattern matching starts. Regards, Chip Campbell
Re: if \xe4==\xe4 failes,why?
mbbill wrote: I met a very strange problem recently, that is when I set the following options: set encoding=utf-8 set ignorecase then the expression: if \xe4==\xe4 fails. I test it using: if \xe4==\xe4 echo test endif but I got nothing output, why ? Try set encoding=utf-8 if \xe4 == \xe4 redraw! echo equal! else redraw! echo not equal endif Looks like your message is doing an unwanted disappearing act. Regards, Chip Campbell
Re: if \xe4==\xe4 failes,why?
A.J.Mechelynck wrote: Charles E Campbell Jr wrote: mbbill wrote: I met a very strange problem recently, that is when I set the following options: set encoding=utf-8 set ignorecase then the expression: if \xe4==\xe4 fails. I test it using: if \xe4==\xe4 echo test endif but I got nothing output, why ? Try set encoding=utf-8 if \xe4 == \xe4 redraw! echo equal! else redraw! echo not equal endif Looks like your message is doing an unwanted disappearing act. Regards, Chip Campbell It's not as simple as that, Dr. Chip: I get 0 (zero) as reply to :echo (\xe4 == \xe4) when 'encoding' is UTF-8. However, the byte 0xE4 by itself is not a valid character in UTF-8. I also get 1 (one) in reply to :echo (ä == \xc3\xa4) where ä (a-umlaut) is Unicode codepoint U+00E4, represented in UTF-8 by the two bytes 0xC3 0xA4. That's peculiar; I get (when I source the script): equal! 1 with the following emendation to the script: set encoding=utf-8 if \xe4 == \xe4 redraw! echo equal! else redraw! echo not equal endif echo (\xe4 == \xe4) But, without those redraws, I get no message. Regards, Chip Campbell
Re: Matching JUST the nth occurence of a text in a line
[EMAIL PROTECTED] wrote: On Fri, Dec 01, 2006 at 10:34:14AM -0500, Charles E Campbell Jr wrote: [EMAIL PROTECTED] wrote: I am puzzled by a slightly more complicated version: how to match a '%' character following the 2nd occurrence of home? /^.\{-}\%(home.\{-1,}\)\{N}home.\{-}\zs% This pattern doesn't work. Try it on this line: home home home home home home% home It should match nothing on that line, because the '%' doesn't follow the 2nd occurrence as desired. But it *does* work! You didn't specify avoiding the % if matches to the home pattern intervened. Try :set hls and the following two lines: home % home home home home home% home home home %home home home% home and you'll only see %s match after the 2nd home, exactly as specified. Now, if you change the requirement, a different regex is needed. Regards, Chip Campbell
Re: :Nread errors
striker wrote: My OS is Mac OS X 10.4.8, so yes, it is Unix/Linux based. After I sent my original e-mail, I did think to check where $VIMRUNTIME was located. I removed all instances of anything vim* related. I then attempted the :Nread command and got what I expected... E492: Not an editor command: Nread... I then :so % the vimball and checked the runtime location for any netrw files. None were there. Is there a way to make direct the installation where to install? Is there a way to see where the source is installing? or a manual installation? Do you have an up-to-date vimball? There's the same sort of issue with vimball as netrw; you'll need to remove all vestiges of the vim 7.0 vimball before installing the new one. However, vimball comes as a gzipped tarball so as to avoid requiring vimball to install vimball. You can get the latest version from my website (http://mysite.verizon.net/astronaut/index.html#VimBall). You may install vimball in your distribution directories or in your $HOME/.vim/ directories. Then vim netrw.vba.gz :so % :q should install netrw in your $HOME/.vim/ directories. After performing the steps above, you can cd $HOME/.vim ls */netrw*.* and you should see a number of netrw plugin components. vim . should open netrw and show v107l (if you've gotten the latest netrw from my website). Regards, Chip Campbell
Re: Manpageviewer problem
Guido Van Hoecke wrote: Hi, I recently started using Dr.Chips Manpageviewer http://vim.sourceforge.net/scripts/script.php?script_id=489 http://mysite.verizon.net/astronaut/vim/vbafiles/manpageview.vba.gz There's one problem, though. It has problems to display certain characters (in vim as well as gvim, on ubuntu 6.10) and displays their hex code, such as: 80, 8098, 89 ... Is this something about my setup? There's no problem with viewing the affected man pages in a gnome-terminal, nor with the default man.vim man page viewer. I already mentionned this problem in another thread, but it probably got lost in it. Any help would be appreciated. I like this Manpageviewer, a.o. for its optimised use of screen real estate. But this little display hickup is a nuisance. Please try some of the suggestions mentioned with g:manpageview_options (see :help manpageview_options ). Regards, Chip Campbell
Re: regexp substitution problem
Bram Kuijper wrote: I am quite new to vim and just started to use regular expressions to replace certain amounts of text. For example, in the following piece of text I would like to keep only the first column and delete the rest: optimal_value_viability | real| default 0.0 number_generations| integer | default 0 output_per_number_generations | integer | default 0 number_trait_loci | integer | default 0 number_pref_loci | integer | default 0 number_viability_loci | integer | default 0 random_seed | bigint | default 0 so I execute the following regexp as a vim command: :%s/\s+\|.*// however, to my surprise all text is gone, instead of just anything besides the first column. (comments about perl deleted) Let's look at what you've asked vim to do: :% -- range, all lines s/ -- substitute \s+ -- a single whitespace character followed by a + sign \| -- OR (as in regexp OR regexp ) .* -- anything // -- replace with nothing So, your first pattern \s+ , doesn't match any line at all, and hence is wasted effort. Your second pattern, .* , says to greedily match any character, and so matches the entirety of all lines. The replace with nothing seems to be understood. OK, presumably this isn't what you had in mind! Vim doesn't accept Perl regexps, it accepts Vim regexps. I suggest reading :help regexp . So, let's construct a pattern that will do what I think you want: :%s/^\s*.\{-}|\s*// which says: any amount of whitespaces, followed by a minimal amount of anything up to a |, followed by any amount of whitespace, replace it with nothing. Since whitespace is clearly matched by ., in fact :%s/^.\{-}|\s*// will also do the trick. That said; if I were doing this, I'd use visual-blocks: move cursor to upper left hand corner ctrl-v move cursor to bottom right hand corner of region to be removed x Regards, Chip Campbell
Re: regexp substitution problem
Bram Kuijper wrote: I am quite new to vim and just started to use regular expressions to replace certain amounts of text. For example, in the following piece of text I ... Whoops! Looks like I removed the first column, but you wanted to keep just the first column. Try :%s/\s*|.*$// which matches any amount of whitespace followed by a bar, followed by anything to end-of-line. Replace with nothing. Regards, Chip Campbell
Re: grep and regular expression
Dan Mergens wrote: Vim does not use strict regular expressions and grep does not use regular expressions for pattern matching. I find this comment about Vim curious. Do you perhaps mean that Vim does not use Perl's regular expressions? Grep also uses regular expressions, BTW, although not the same set as Vim or Perl uses. Regards, Chip Campbell
Re: grep and regular expression
Dan Mergens wrote: I would have to defer to the regular expression experts, but VIM does not use the standard regular expressions that work on the command line, in say, Linux. Specifically, in the example cited, '/s' was used for whitespace matching, which is not available in standard regular expressions (c.f. GNU regular expression implementation). Regular expression From Wikipedia, the free encyclopedia Jump to: navigation http://en.wikipedia.org/wiki/Regular_expression#column-one, search http://en.wikipedia.org/wiki/Regular_expression#searchInput In computing http://en.wikipedia.org/wiki/Computing, a *regular expression* (abbreviated as *regexp* or *regex*, with plural forms *regexps*, *regexes*, or *regexen*) is a string http://en.wikipedia.org/wiki/String_%28computer_science%29 that describes or matches a set http://en.wikipedia.org/wiki/Set of strings, according to certain syntax http://en.wikipedia.org/wiki/Syntax rules. Regular expressions are used by many text editors http://en.wikipedia.org/wiki/Text_editor and utilities to search and manipulate bodies of text based on certain patterns. Many programming languages support regular expressions for string manipulation. For example, Perl http://en.wikipedia.org/wiki/Perl and Tcl http://en.wikipedia.org/wiki/Tcl have a powerful regular expression engine built directly into their syntax. The set of utilities (including the editor sed http://en.wikipedia.org/wiki/Sed and the filter grep http://en.wikipedia.org/wiki/Grep) provided by Unix http://en.wikipedia.org/wiki/Unix distributions were the first to popularize the concept of regular expressions. OK: the term regular expression is somewhat loose; there is no strict regular expression. As Wikipedia mentions, sed and grep were the first to come up with the concept, and Vim is an extended version of their concept. Perl, tcl, bash/ksh/zsh/etc, all have their own variants. None of these are the defining authority, BTW. Vim and Perl's regular expressions are amongst the most powerful, although they differ from one another. Regards, Chip Campbell
Re: Remember where I left off
Jason Morehouse wrote: I recall at one point, Vim would remember where I left off in a file, and place me back there when I started. I don't think it's worked since I switch to 7, and don't recall the vimrc setting. Any ideas? Check out tip Restore cursor to file position in previous editing session at http://vim.sourceforge.net/tips/tip.php?tip_id=80 Regards, Chip Campbell
Re: Using vim to as a pager for manual pages.
Zvi Har'El wrote: I am using Linux in a UTF-8 locale, and I have a problem with using less as a pager for manual pages: I cannot search for options, since they use a dash instead of a minus sign, and I don't have an easy way to type the hyphen (I have put some xterm definitions for various dashes in .Xdefaults, using ctrl-minus, alt-minus, etc, but I always forget which is which :'( ). I thought I could use vim's less.sh as a replacement for less, but it has a problem with the vt100 escape sequences which are used in the man page for emboldening and underlining. Is there a vim macro file which can be used instead of less.vim, or in addition to it, which can handle escape sequences, and not show the raw data? Have you tried manpageview.vim? Manpageview is available at: * from vim.sf.net: http://vim.sourceforge.net/scripts/script.php?script_id=489 * latest version from my website: http://mysite.verizon.net/astronaut/vim/index.html#MANPAGEVIEW You'll need the new vimball plugin to extract it, too. You can get vimball from either * http://vim.sourceforge.net/scripts/script.php?script_id=1502 * http://mysite.verizon.net/astronaut/vim/index.html#VimBall Regards, Chip Campbell
Re: Questions about syntax highlight script.
[EMAIL PROTECTED] wrote: Hi vimmers, I've got some question when writing my syntax highlight script. Q1. The language requires a ^M character as a keyword. The ^M character is by default highlighted but I want to highlight it to some other color, at least it should be different from ^L and ^N... It seems impossible to match the ^M by :syn match Testgroup ^M (Note the ^M is obtained by press C-K, release, then press C-M, release, then press Enter) and :hi def link Testgroup Number does not highlight it as desired. It seems always highlighted to some other color. Looks like you've got a problem; the SpecialKey highlighting (see :he hl-SpecialKey) currently can't be overridden with syntax highlighting. It does appear that the :match (and friends :2match and :3match) can override the SpecialKey highlighting for a specific control character. This problem is mentioned in :help todo , line#1482 (using vim 7.0's help). As an example for how to use :3match: :3match Testgroup /\%x0d/ Q2. The string for the script language can be as long as 50-100 lines, when I write a :syn region for string, it works but sometimes when I go page down and page up, the lines of the string are highlighted as Normal instead of String, seems that the context are not concerned. Any work around? :help syn-sync Q3. The first occurence of colon and the following occurences in a line have different meanings. So, if there are text: :::; I want to highlight the first colon as GroupA, and highlight all following occurences of colon in the same line as GroupB. Is that possible? Sure! Here's an example summarizing the above: syn clear syn sync fromstart syn region Colons matchgroup=FirstColon start=':' end='$' contains=MoreColons syn match MoreColons ':' contained hi link Ctrlm Red hi link FirstColon Magenta hi link MoreColons Yellow 3match Ctrlm /\%x0d/ Regards, Chip Campbell
Re: g?vim and bizarre font request.
Hugh Sasse wrote: I am interested in exploring Lisp before too long. However, I have a physical problem with the parentheses. You may find rainbow.vim helpful; see http://mysite.verizon.net/astronaut/vim/index.html#RAINBOW It colorizes brackets [] {} () based on nesting level. Regards, Chip Campbell
Re: g?vim and bizarre font request.
Hugh Sasse wrote: I am interested in exploring Lisp before too long. However, I have a physical problem with the parentheses. My nystagmus means that just outside the subitizing range my time to count parentheses increases dramatically. According to wikipedia it should increase at roughly 100ms below 4 and 250 milliseconds for every item above 4. So this code from Wikipedia: (defun factorial (n) (if (= n 1) 1 (* n (factorial (- n 1) should mean it takes about 650ms for someone to see there are 5 close parentheses at the end. You can also simply try putting :let g:lisp_rainbow= 1 in your .vimrc . The lisp highlighting syntax file (syntax/lisp.vim) already supports colorizing ()s based on nesting level. Regards, Chip Campbell
Re: dictionary fun makes gvim crash
Kim Schulz wrote: Hi I get gvim to crash every time I try the following: let mynumbers = {0:'zero',1:'one',2:'two',3:'three',4:'four', 5:'five',6:'six',7:'seven',8:'eight',9:'nine'} function mynumbers.convert(number) dict return join(map(split(a:number,'\zs'), 'get(self, v:val,unknown)')) endfunction echo mynumbers.convert(12345) cannot get the same code to crash in the console version of vim. another weird thing is that if I call this function (in console vim) and uses the argument 123123123123 then it returns as if approx. half of the digits are unknown. is it Vim's number-string conversion mechanism that fails or? As for the first problem, I don't see it with gvim (using Fedora Core 5, gvim 7.0.1-178,huge). As for the second, I doubt that the number 123123123123 fits inside the number of bits in a long integer on your machine. Is your machine a 32-bit machine? Regards, Chip Campbell
Re: g?vim and bizarre font request.
Hugh Sasse wrote: On Thu, 4 Jan 2007, Charles E Campbell Jr wrote: Hugh Sasse wrote: I am interested in exploring Lisp before too long. However, I have a physical problem with the parentheses. You may find rainbow.vim helpful; see http://mysite.verizon.net/astronaut/vim/index.html#RAINBOW that looks interesting. Done the vimball bit then I try to install rainbow.vba (having gunzipped it); vim rainbow.vba gives: ***vimball*** Source this file to extract it! (:so %) Error detected while processing BufEnter Auto commands for *.vba: E119: Not enough arguments for function: vimball#ShowMesg Press ENTER or type command to continue So I try to extract it anyway: Vimball Archive extracted after/syntax/c/rainbow.vim: 100 lines wrote /home/hgs/.vim/after/syntax/c/rainbow.vim Press ENTER or type command to continue So that means it only applies to C files out of the box? Its been awhile since I wrote the rainbow stuff; I'd forgotten that I'd already included it with vim 7.0's syntax/lisp.vim. Just put let g:lisp_rainbow= 1 in your .vimrc and it'll be enabled for Lisp. I think it would be more useful it it were setup as a plugin one could use for Perl, Ruby, (your later message covers lisp), etc The rainbow highlighting needs to be attuned to the specific syntax highlighting files for each language. Its done by assigning a region which begins with ( and ends with ). To retain normal highlighting inside such syntax highlighting regions, the region must contain language-specific highlighting regions. So, Perl and Ruby would need specialized versions of rainbow.vim. I use Perl but seldom, and don't know Ruby, and yours is the first request for rainbow highlighting for those languages I've received. I don't consider myself fluent in vim internals, so maybe I've missed something with this paragraph. Your web page has: brlia href=vbafiles/RunView.vba.gzRndm/a a name=RUNVIEW/a !-- {{{2 -- table bgcolor=#005533 border=0 cellspacing=0tbodytrtdfont size=-1font color=#aaemUpdated Dec 15, 2005 (v1e)/em Yep! Definitely a mistake. Thank you for catching it! Regards, Chip Campbell
Re: HTML files don't auto indent, everything else does
thesheep wrote: For some reason the auto-indent features aren't working with HTML source files (and I want them to). I've tried these: :filetype indent on :set autoindent I've also tried all these kinds of things: :set shiftwidth=2 :set softtabstop=2 And then doing 'gg=G' to auto indent. It indents my javascript nicely, but all the HTML is just pushed hard left without any indentation. HTML syntax is highlighted OK, so I guess the filetype thing is working. My .vimrc file is pretty much emtpy: just says 'syntax on'. Syntax highlighting is separate from indenting. What does vim abc.html :echo b:did_indent show? If 0, indicates that indent/html.vim (or any indenting script) was not loaded. Unfortunately, if its 1, that means that some indenting script was loaded (just not which one). Continuing: what does :echo indentexpr show? That should be: HtmlIndentGet(v:lnum) if html indenting was loaded. Regards, Chip Campbell
Re: How to open multiple files in split windows?
Peng Yu wrote: gvim a b The above command will open a and b. But only one file will be show at one time. How to show them in to split windows? Tim already showed how to open the two files in split windows by modifying the command above. However, if one has already typed gvim a b and then wants them all in separate split windows: :sba will do the trick. This produces horizontally split windows. If you want vertically split ones: :vert sba is what you want. Regards, Chip Campbell
Re: Find and replace in visual area.
Silva, Paulo wrote: Greetings, I'm trying to do a replace in a selection. After selecting the area, with v, directional keys, v again (or not - both give the same result). Then I type :%s/\%V20/21/ and I get: E71: Invalid character after \% This works the same with any caracter that I put after the \% even with no character. Am I doing something wrong? I don't know why you're having problems with \%anything ; it sounds like something in your options (ie. settings in your .vimrc): completion (:echo cpt), magic (:echo magic), cpoptions (:echo cpo-- is l in it?), compatible (:echo cp), etc. Regards, Chip Campbell
Re: % jumping over {} in c-files in the midst of {{{ folds
Suresh Govindachar wrote: (snip) Enter following text: if(1) { /* --- {{{3 */ } Now try to jump between { using %. Bug: The { in the manual fold-markers interferes with %-jumping. [comments on using the matchit plugin] % is a feature of Vim -- I am not trying to use % in any fancy way, only in the way it is supposed to work under regular Vim. I am reporting a bug in vim (and not looking for a work-around based on a plugin). The bug is that % is not ignoring { within c-comments in a c-file. Jürgen Krämer wrote: (snip) what did lead you to the conclusion that the behaviour of % -- to not ignore matching parentheses inside comments -- is a bug? In my past experience, % always ignored { inside c-comments for c-files (turns out my cpoptions does not include %). I don't see a place in the help files where % is documented to skip comments. You can only force it to skip strings by removing % from cpoptions (see :help cpo-%). Suresh Govindachar wrote: In the steps I gave to reproduce the bug, adding the following: :set cpo-=% does not make %-jumping skip the { inside comments. So it is a bug in Vim. Jürgen Krämer wrote: IMHO ignoring comments while searching for a matching parenthesis might be considered a missing feature, but this can easily -- as Tony wrote -- be implemented by sourcing the matchit plugin. Suresh Govindachar wrote: After adding :set cpo-=% to the steps given in OP to reproduce the bug, one sees that there is a bug in Vim. - Its not a bug. Vi compatible behavior governs this, with one exception: if a % is missing from cpoptions, the %-brace matching will skip the innards of strings. Vim's documentation doesn't state anything about skipping braces/parentheses inside of comments. As Jürgen said, it may be nice to ask for a new feature supporting the skipping of braces inside comments, especially in light of the default folding pattern. However, the documentation doesn't claim that % will skip over comments but rather that vi-compatible behavior will occur, hence the behavior is not a bug. Perhaps you should ask Bram for a '{' option in cpoptions to support this idea for a new feature. C Campbell
Re: Find and replace in visual area.
Silva, Paulo wrote: Nope, that didn't helped much. But no worries, the simple replace when visual is still selected works fine. I gess I'll never know why, but then again it dosen't matter really if I can do it some other way. In that case, you may wish to consider vis.vim -- it allows you to perform command mode operations on a visual block/character/line selected region, including substitutes: ctrl-v move :B s/abc/def/g as an example. You can get the latest vis.vim from http://mysite.verizon.net/astronaut/vim/index.html#VIS or a more stable version from: http://vim.sourceforge.net/scripts/script.php?script_id=1195 Regards, Chip Campbell
Re: Reformat in visual area - vmap question
John Cordes wrote: I have *very* little experience writing 'map' commands for my .vimrc (Linux). For some years I've had the following two commands for reformatting with the par utility. reformat paragraph with no arguments: map ** {!}par^M} reformat paragraph with arguments: map *^V {!}par They both work well, but I frequently would like to run par on a visual selection. I naively tried vmap *^V {!}par but this fails with the message (when I try * 55 on a selected area) :','!}par 55 shell returned 127 I would appreciate a suggestion here. Well, I don't appear to have par on my FC5 box; so my suggestion will have been untested. However, here it is anyway: 1. Get vis.vim from: http://mysite.verizon.net/astronaut/vim/index.html#VIS or a more stable version from: http://vim.sourceforge.net/scripts/script.php?script_id=1195 2. Select your block of text ctrl-v move :B !par The vis.vim plugin provides the :B command, which allows visual blocks/character/line selected regions to be handled by ex-mode commands (such as :!par). Regards, Chip Campbell