Re: ex editor
C.Moncrieff wrote: I guess that this email group may not be the group I need. I'm afraid you're stuck, at least as far as official vim groups go. There's this one and vim-development, primarily. See http://vim.sourceforge.net/community.php for the complete list. What I consider to be highly undesirable new features make ex (and perhaps vi/vim) extremely awkward to use on MACs and I would dearly like to be able to replace ex by a more comfortable older version eg not wiping image of recent changes on screen on exit. set nors If that doesn't do the trick, try set t_ti= t_te= (but this will only help with console vim, not gvim) undo to undo just the last change by default - not all changes since start of session. See :help 'undolevels' etc Not clear about this one! Any suggestions what to do or where to go for help would be gratefully received Seems to me that this mailing list is best for what you're inquiring about. Regards, Chip Campbell
Re: vim not opening directories
Reid Thompson wrote: I have a .vimrc. it has Use Vim settings, rather then Vi settings (much better!). This must be first, because it changes other options as a side effect. set nocompatible I've already tried invoking via [EMAIL PROTECTED]:~$ /usr/bin/vim src [EMAIL PROTECTED]:~$ /usr/bin/gvim src * make sure that your account has read-write access (if somehow its owned by root...) * In addition to set nocompatible, you should also have: (in your .vimrc) if version = 600 filetype plugin indent on endif * Check that you in fact have a .vimrc, not a .gvimrc, for this. If you use .gvimrc instead, well, it loads after the plugins would, and so the filetype plugin on won't be effecacious. * Fire up vim; check on $VIMRUNTIME -- make sure that plugin/netrw*.vim and autoload/netrw*.vim are both there and readable by you as a user. Regards, Chip Campbell
[Fwd: Re: gvim 7 highlight search string]
I believe this was meant for the vim mailing list... ---BeginMessage--- Thanks all for the replies. I have a relatively fresh install of Debian Testing. I don't believe I have manually modified any system-level configuration files. All my settings are in ~/.gvimrc and ~/.vimrc Actually this is happening on two systems. My debian testing system at home and my work machine which is running RHEL 4. I believe I compiled vim/gvim from source at work, although here at home I'm using the debian packaged one. On 6/1/07, Charles E Campbell Jr [EMAIL PROTECTED] wrote: Brian E. Lozier wrote: In the old gvim, doing a search (/something) highlights all something in red. In gvim 7, it doesn't highlight all occurrences. Is there a way to turn this back on? I suspect that you may be having problems because you made changes to files in files in your former $VIMRUNTIME (use :echo $VIMRUNTIME when running vim to see where that is). Those files should not be changed, added to, etc, unless you don't mind having to re-do all such changes when next you upgrade vim. Instead: * put settings, most customizations, etc in $HOME/.vimrc (linux) $HOME\_vimrc (windows) You can find out where your $HOME is by typing :echo $HOME when you're running vim. * Put plugins into $HOME/.vim/plugin/ (linux) $HOME\vimfiles\plugin\ (windows) * Put autoload plugins into $HOME/.vim/autoload/ (linux) $HOME\vimfiles\autoload\ (windows) * Put colorschemes into $HOME/.vim/colors/ (linux) $HOME\vimfiles\colors\ (windows) The setting in question here is: hls You'll probably should include the following in your .vimrc (_vimrc), too: set nocp if version = 600 filetype plugin indent on endif Regards, Chip Campbell ---End Message---
Re: gvim 7 highlight search string
Brian E. Lozier wrote: Thanks all for the replies. I have a relatively fresh install of Debian Testing. I don't believe I have manually modified any system-level configuration files. All my settings are in ~/.gvimrc and ~/.vimrc Actually this is happening on two systems. My debian testing system at home and my work machine which is running RHEL 4. I believe I compiled vim/gvim from source at work, although here at home I'm using the debian packaged one. Charles Campbell wrote: The setting in question here is: hls You'll probably should include the following in your .vimrc (_vimrc), too: set nocp if version = 600 filetype plugin indent on endif * do you have a $HOME/.vimrc file? (wasn't clear from your response; I wasn't referring to any manual modifications done to the new system level configuration files, but was wondering if your previous vim work depended on such manual modifications to the previous system level configuration files) * do you have (at least) the four lines mentioned above in your .vimrc file? (you'll probably want syntax on , too) * do you have set hls in your .vimrc file? * if you do have such a file, is it owned/readable by you? (some folks were having problems with $HOME/.viminfo files owned by root) * what does vim --version show? (I'm wondering here if its one of the minimal vim compiles) Regards, Chip Campbell
Re: Problems with netrw directory listing
Gary Johnson wrote: On 2007-06-03, Seth Mason [EMAIL PROTECTED] wrote: It seems like the spaces in the directory name is causing problems. If I open a file in the directory and then use ':cd %:h' everything works fine so it seems like the problem is not with vim(?). Any help or direction to go from here would be greatly appreciated. I see the problem. I believe it is a bug in autoload/netrw.vim (at line 1593 in version 109) in the definition of the c command: nnoremap buffer silent c :exe cd .b:netrw_curdircr Any spaces in b:netrw_curdir are not escaped and the directory name is not in quotes, so the cd command sees any spaces as separators. Please try netrw v110g available from my website: http://mysite.verizon.net/astronaut/vim/index.html#NETRW I've tested the fix under Linux; please try it out under XP. Regards, Chip Campbell
Re: collapsing single lines of html tag attributes via plugin??
Howard Glynn wrote: snip I wondered whether there was a plugin somewhere that was able to abbreviate or partially hide the detail so i can see the overall structure more clearly. In essence I would like to collapse huge (single) lines of tags to something like a id=xyz href=/img ... - where implies I could expand if required. I'm sure it is probably possible to craft a plugin to do this, i just have some urgent deadlines right now ;) snip Hello! Sounds like Vince Negri's conceal patch to vim would come in handy for this. Vim's current folding is on a line-by-line basis; Negri's patch can also perform concealing in lines. You can get his patch at: http://vince.negri.googlepages.com/ Here's an example, although it may conceal more than what you've requested... if has(conceal) if conc == 0 let conc= 3 endif syn clear syn region htmlTag conceal start= end= endif So this will conceal anything between ... . One neat thing; even though I've selected conceal level 3, nonetheless, when your cursor is atop a line that line will *not* be concealed. So editing may proceed, as that's what Vim's for. A more comprehensive (but not html-related) example of concealing is available at my website: see AnsiEsc.vim. This plugin will conceal ansi escape codes and perform proper colorizing of the text based on the concealed ansi codes. Vince N has a tex.vim syntax using concealment, too, somewhere... BTW, folks -- if more people than H Glynn would want this -- let Bram know! He's under the impression that its not wanted very much, which is why I presume its not in vim 7.x. Vince's patch also supports ownsyntax. Read about it at his website. Regards, Chip Campbell
Re: gvim 7 highlight search string
Brian E. Lozier wrote: In the old gvim, doing a search (/something) highlights all something in red. In gvim 7, it doesn't highlight all occurrences. Is there a way to turn this back on? I suspect that you may be having problems because you made changes to files in files in your former $VIMRUNTIME (use :echo $VIMRUNTIME when running vim to see where that is). Those files should not be changed, added to, etc, unless you don't mind having to re-do all such changes when next you upgrade vim. Instead: * put settings, most customizations, etc in $HOME/.vimrc (linux) $HOME\_vimrc (windows) You can find out where your $HOME is by typing :echo $HOME when you're running vim. * Put plugins into $HOME/.vim/plugin/ (linux) $HOME\vimfiles\plugin\ (windows) * Put autoload plugins into $HOME/.vim/autoload/ (linux) $HOME\vimfiles\autoload\ (windows) * Put colorschemes into $HOME/.vim/colors/ (linux) $HOME\vimfiles\colors\ (windows) The setting in question here is: hls You'll probably should include the following in your .vimrc (_vimrc), too: set nocp if version = 600 filetype plugin indent on endif Regards, Chip Campbell
Re: GSoC Regexp engine
Ian Young wrote: I have a couple questions to start things off. First: I couldn't see much need for 'fuzzy matching' in Vim, but some of you are probably much better acquainted with regexp use cases than I am. Would this be a useful feature to have available? As you likely know, fuzzy matching hasn't been available in Vim. One place it has been useful is in suggesting spelling corrections; I myself used agrep in the engspchk.vim plugin to support fuzzy matching. Bram already has a spelling error suggestion feature, so I have no idea if the fuzzy regex would help with it or not. What I think could be more useful would be boolean logic for regexp. My LogiPat plugin provides this capability, but undoubtedly it'd be better if somehow it could be incorporated. The resulting patterns from LogiPat seem to me to be somewhat opaque. Regards, Chip Campbell
Re: flist tree question
onesupermanone wrote: I am a newbie at using gvim. I am using gvim ver 6.4 on linux. I wanted to set up the flist tree on my machine. Dr Chip initially wrote this script. The explaination is at the following site mysite.verizon.net/astronaut/vim/index.html under title C/C++ Functions: prototypes, hints, etc. I have downloaded the flist.tar.gz file. When I untar it I see a lot of C code which I compiled and got an executable flist. Now at this point I have no idea how to incorporate it in my gvim. What do I need to do to set this up. Dr Chip was talking about a FlistTree.vim but I can't seem to find it anywhere. This seems like a cool concept that we can get a function tree. You'll find it at: http://mysite.verizon.net/astronaut/vim/index.html#FLISTTREE Enjoy! Chip Campbell
Re: A performance question (patch included)
John Beckett wrote: A.J.Mechelynck wrote: What about a different function to return, say, the number of 1K blocks (or the number of times 2^n bytes, with a parameter passed to the function) that a file uses? Yes, that's a much more general and better idea. Since there's probably not much need for this, I think that simplicity would be good. That is, have the function work in a fixed way with no options. Re Dr.Chip's LargeFile script: It occurs to me that another workaround would be to use system() to capture the output of 'ls -l file' or 'dir file' (need an option for which). Then do some funky editing to calculate the number of digits in the file length. If more than 9, treat file as large. I'm playing with a tiny utility to help the LargeFile script. Bluesky: Its code (64-bit file size) could potentially be incorporated in Vim. I'll post results in vim-dev. (I've moved this over to vim-dev) I've attached a patch to vim 7.1 which extends getfsize(); with the patch, getfsize() takes an optional second parameter which gives one the ability to specify a unitsize. In other words, getfsize(eval.c) - 478347 (after the patch) getfsize(eval.c,1000) - 479 (truncated upwards) I'll be awaiting Bram's input before making use of this in LargeFile.vim ! Regards, Chip Campbell *** src/o_eval.c2007-05-25 08:52:12.0 -0400 --- src/eval.c 2007-05-25 09:04:43.0 -0400 *** *** 7094,7100 {getcwd,0, 0, f_getcwd}, {getfontname, 0, 1, f_getfontname}, {getfperm, 1, 1, f_getfperm}, ! {getfsize, 1, 1, f_getfsize}, {getftime, 1, 1, f_getftime}, {getftype, 1, 1, f_getftype}, {getline, 1, 2, f_getline}, --- 7094,7100 {getcwd,0, 0, f_getcwd}, {getfontname, 0, 1, f_getfontname}, {getfperm, 1, 1, f_getfperm}, ! {getfsize, 1, 2, f_getfsize}, {getftime, 1, 1, f_getftime}, {getftype, 1, 1, f_getftype}, {getline, 1, 2, f_getline}, *** *** 10135,10142 { if (mch_isdir(fname)) rettv-vval.v_number = 0; ! else rettv-vval.v_number = (varnumber_T)st.st_size; } else rettv-vval.v_number = -1; --- 10135,10151 { if (mch_isdir(fname)) rettv-vval.v_number = 0; ! else if (argvars[1].v_type == VAR_UNKNOWN) rettv-vval.v_number = (varnumber_T)st.st_size; + else + { + unsigned long unitsize; + unsigned long stsize; + unitsize= get_tv_number(argvars[1]); + stsize= st.st_size/unitsize; + if(stsize*unitsize st.st_size) ++stsize; + rettv-vval.v_number = (varnumber_T) stsize; + } } else rettv-vval.v_number = -1; *** runtime/doc/o_eval.txt 2007-05-25 09:00:08.0 -0400 --- runtime/doc/eval.txt2007-05-25 09:06:19.0 -0400 *** *** 1615,1621 getcmdtype() String return the current command-line type getcwd() String the current working directory getfperm( {fname})String file permissions of file {fname} ! getfsize( {fname})Number size in bytes of file {fname} getfontname( [{name}])String name of font being used getftime( {fname})Number last modification time of file getftype( {fname})String description of type of file {fname} --- 1615,1621 getcmdtype() String return the current command-line type getcwd() String the current working directory getfperm( {fname})String file permissions of file {fname} ! getfsize( {fname} [,unitsize])Number size in bytes of file {fname} getfontname( [{name}])String name of font being used getftime( {fname})Number last modification time of file getftype( {fname})String description of type of file {fname} *** *** 2819,2827 getcwd() The result is a String, which is the name of the current working directory. ! getfsize({fname}) *getfsize()* The result is a Number, which is the size in bytes of the given file {fname}. If {fname} is a directory, 0 is returned. If the file {fname} can't be found, -1 is returned. --- 2819,2829 getcwd() The result is a String, which is the name of the current working directory. ! getfsize({fname} [,unitsize]) *getfsize()* The result is a Number, which is the size in bytes of the given file {fname}. + If unitsize is given, then the file {fname}'s size will be + returned in units of size unitsize
Re: A performance question (patch included)
A.J.Mechelynck wrote: I'm not sure what varnumber_T means: will st.stsize (the dividend) be wide enough to avoid losing bits on the left? varnumber_T is int (long if an sizeof(int) = 3). st.stsize 's size depends on whether 32bit or 64bit integers are available. So, its possible to lose bits: pick a small enough unitsize and a large enough file, st.stsize will end up not being able to fit into a varnumber_T. After all, unitsize could be 1, and getfsize() will behave no differently than it does now. However, unitsize could be 100. My patch divides st.stsize by the unitsize first; presumably in whatever arithmetic is appropriate for working with st.stsize. Regards, Chip Campbell
Re: A performance question (patch included)
A.J.Mechelynck wrote: Yes, yes, but before the division, will it be able to hold the file size? (sorry, I meant st.st_size) Will mch_stat (at line 10134, one line before the context of your patch) be able to return huge file sizes? mch_stat is variously defined, depending on o/s. Under unix, that's the fstat function. This function returns a pointer to a struct stat; the member in question is: st_size. (off_t st_size;/* total size, in bytes */) So, st_size is an off_t. Under linux, an off_t is typedef __kernel_off_toff_t So, I suspect that st_size will be sized by the o/s to handle whatever size files it can handle. Someone with a 64-bit machine, perhaps, could examine this further? BTW, I'm also under the impression that ls itself uses fstat(), so its not likely to be any more informative. Regards, Chip Campbell
Re: Netrw edit file
Eric Smith wrote: When I am in vim, I can edit a file after selecting form the explorer, however I can only :read a file if I use Nread I'm not sure what you mean by this -- :r file works normally. If the file is an url style: :r ftp://somehost/path/to/file then netrw will read the file, too. How do I :edit from within vim? Place cursor on the target file; press the cr. Regards, Chip Campbell
Re: A performance question
Robert M Robinson wrote: That brings me to my question. I have noticed that when editing large files (millions of lines), deleting a large number of lines (say, hundreds of thousands to millions) takes an unbelieveably long time in VIM--at least on my systems. This struck me as so odd, I looked you up (for the first time in all my years of use) so I could ask why! The LargeFile.vim plugin helps to speed up the editing of large files: http://vim.sourceforge.net/scripts/script.php?script_id=1506 It does so by changing a number of things: no syntax highlighting, no undo, etc. Regards, Chip Campbell
Re: A performance question
John Beckett wrote: Peter Palm wrote: http://www.vim.org/scripts/script.php?script_id=1506. Indeed, among other things, this disables the swap file for 'large' files, which should really speed up things. I was going to report the following issue to vim-dev after I got a chance to investigate it a little further, but it seems appropriate to mention it now. I did some work with a 3GB text file on Win32, using Vim 7.0 and Dr.Chip's LargeFile.vim script from Tip 1506 above. The result was really ugly. The script failed to notice that 3GB was large because the Vim function getfsize(f) returned a negative number. Sounds like the filesize is getting stored in a 32bit signed number, and overflowing. Is the negative number -1 (that would mean file can't be found)? If not, then perhaps that fact could be used to extend the LargeFile's ability to catch large files: trigger when getfsize() returns a number -1. Please let me know what getfsize() is actually returning when applied to that 3GB file. Regards, Chip Campbell
Re: can i map the number pad enter or somesuch?
shawn bright wrote: hello all, Is the enter key on the numeric keypad different than the enter key of the keyboard? i was thinking that it would be super handy to map it to gg. I have a lot of long files to mess around with. I believe the NumLock key modifies the behavior of the number pad keys. To see if your vim will respond to something from it, use insert mode and ctrl-v: i ctrl-v enter ctrl-v numberpad-enter If they're different, you should be able to use it in a mapping. Regards, Chip Campbell
Re: Vim71: undocumented change for netrw plugin.
[EMAIL PROTECTED] wrote: My point is : The following should be added to line 81 of pi_netrw.txt version 2007 May 08. :let loaded_netrwPlugin = 1 If DrChip thinks the document should not change, then the netrwPlugin might have to be changed to still recognize the loaded_netrw variable. That's an awful lot of text just to mention that there's an omission from the help! Anyway, I have no problem putting the extra documentation note in. It'll be part of the runtime archives, assuming that Bram approves, when I next give him an updated netrw. This variable's presence allows folks to get updated netrw.vim versions, placed in their personal .vim/ (vimfiles\) to take precedence over the system versions; ie. updating no longer requires removal of the system versions. Regards, Chip Campbell
Re: b (move cursor one word back) has annoying delay
Harlan Harris wrote: Hi, I'm using a freshly compiled version of Vim 7.1 on a RedHat Enterprise Linux 4 (U5) machine. In both this version of Vim, and in the factory-installed version (6.3), there is a weird behavior where the b key, which sends the cursor back a word, has an annoying delay. The w key does not have this delay. When I press w, the cursor moves to the right immediately. When I press b, however, although vi thinks the cursor has moved (biasdf puts asdf at the beginning of the previous word), the visual cursor does not immediately move. The cursor's position is only updated at the beginning of the next normal flash cycle, which is a second or two later. Until this, the visual cursor stays at the old position. Needless to say, this is really weird and annoying. And to make it even more weird, this is a problem both with the text version of vim, run under an xterm, and under gvim. I believe that this was not always a problem, and that some recently-updated RHEL library change may have caused it. (Not the U4 to U5 change, though, as the problem preceded that upgrade.) Anyway, has anyone else seen this behavior? Is there a workaround? Or a patch? The press-b-get-a-cup-of-joe thing is getting old... Sounds like you have a map beginning with the letter b; so, what happens when: :map b Do you have any such mappings? If so, vim is waiting a bit to see if the rest of the map is going to be typed. Regards, Chip Campbell
Re: Problems with netrw scp
David Rennalls wrote: Hi, I'm having some trouble getting netrw v109(vim 7.1 win WinXP) working with scp. :Nread scp://[EMAIL PROTECTED]:/etc/hosts ..results in the following errors. **warning** (netrw) unable to comply with your requestscp://[EMAIL PROTECTED]:/etc/hosts Enclosing the URL with double quotes makes no difference either. :messages NetrwMessage --No lines in buffer-- Error detected while processing function netrw#NetRead: line 91: E121: Undefined variable: b:netrw_fname E116: Invalid arguments for function s:GetTempfile(b:netrw_fname) apply correct suffix E15: Invalid expression: s:GetTempfile(b:netrw_fname) apply correct suffix line 360: E108: No such variable: b:netrw_fname I get the same error no matter what g:netrw_scp_cmd is set to. There's no command window popping up when the Nread is done so I don't think it's even attempting to run the scp executable (which is pscp in my case). Here's some pointers: * Did you know that you don't need to use :Nread? Just :r ... would be fine. * Drop the second colon from scp://[EMAIL PROTECTED]:/etc/hosts AND I suspect you want /etc/hosts, not /root/etc/hosts (/root generally acts as the home directory for root), so try using: scp://[EMAIL PROTECTED]//etc/hosts * Did you read :help netrw-pscp, :help netrw-p8 for how to set netrw up to use pscp? Regards, Chip Campbell
Re: calling normal commands from ex/a function
fREW wrote: Hey everyone, How do I have a function call Normal commands? Example: I'd like to make a function that will open a certain file, and then set the foldlevel to 1, and then go to the right window. So I have: function TodoListMode() execute :e ~/.todo.otl execute :Calendar endfunction and then after the second command I want to do: ctrlwl zM zr * may I point out that you're using execute when you don't need to. * you're already in ex mode; no need to use colons to do ex mode commands * ctrl-w_l can be performed with wincmd l . * to perform normal mode commands in a function, use norm! (the exclamation prevents any maps from interfering) So, with these points in mind: fun! TodoListMode() e ~/.todo.otl wincmd l norm! zMzr Calendar endfun Now, I confess that I didn't test this... Regards, Chip Campbell
Re: Vim 7 show current column
Gary Johnson wrote: On 2007-05-10, Brian E. Lozier [EMAIL PROTECTED] wrote: In vim 6, a line at the bottom would show the column the cursor is over, so I could see like, colymn 79 or whatever. On vim 7 (gvim, more specifically), the status line at the bottom doesn't show up. Is there a way to enable it? If you want the full status line, set laststatus=2 If you just want to see the cursor position, set ruler I don't know why it was there for you in vim 6 but not in vim 7 unless your upgrade process did more than just change the vim binaries and runtime files. Perhaps your new installation changed the system vimrc as well. Or, perhaps you did your customization in a system file such as /usr/local/vim/vim60/vimrc.example? In that case, you can expect it to be wiped out during updates. Instead, do your customization work in your .vimrc in your home directoryand these little gotchas will stop happening. If you don't know where your home directory is... vim :echo $HOME (if that doesn't show anything...) :echo $VIM :q should suffice to let you know your home is, at least from vim's viewpoint. BTW, if that's in fact what you did -- I expect vim60/vimrc.example to still be there; it's just not in vim70/ . Regards, Chip Campbell
Re: what feature is required to return to last editing position?
[EMAIL PROTECTED] wrote: When opening a file in vim, the cursor will move to the last position when the file was saved. The feature is enabled by some autocommands in vimrc_example.vim, I copied the code into my .vimrc and use it in all platform. It really does work in my WindowsXP gvim, cygwin vim, MacOSX vim, and Ubuntu Dapper vim. Recently I installed Ubuntu Feisty and the feature seems to have gone (I installed vim-gnome version 7.0.135). Since I use the same .vimrc in all platform, it is unlikely to be the fault of my .vimrc script, the problem is I do not know how to debug vim script, and I don't know why that autocommand does not work. Restore cursor to file position in previous editing session : http://vim.sourceforge.net/tips/tip.php?tip_id=80 The command therein will return your cursor to the same line and column that it was in previously. Regards, Chip Campbell
Re: is there a list-administrator ?
Toon Knapen wrote: Is there a list-administrator also listening in ? I have tried to unsubscribe a zillion times now and I'm still on this list. I would appreciate if the ml-admin could help me out here. Somewhat modified version of what Tony M sent awhile ago... Unsubscribing from the vim or vim-dev list requires the following steps: 1. Send an email to the list you want off of: [EMAIL PROTECTED] -and/or- [EMAIL PROTECTED] That email does not need any body text, but its From: line must contain your subscribed address. The From: line *must* be the same as the one from which you subscribed and are receiving list mail! 2. Wait (usually a few seconds, sometimes a few minutes, depending on how often you fetch mail from your server) for a robot autoreply to the message you sent at step 1. 3. The robot autoreply (step 2) is there to check that the message (step 1) was really from you! It will contain instructions on how to complete the unsubscription. 4. Do what the autoreply says: this usually means sending an email to an address containing a complicated pseudorandom key, and acts as verification that its really you that wants to unsubscribe, not some prankster. 5. Shortly after you complete step 4, the list mail for this list should stop coming in.
Re: question about insert mode and zz
shawn bright wrote: Hey there all, i really dig the zz function to get me in the middle of the screen. i was wondering if there were an insert mode ability to do the same thing. So if i am writing a long function and get to the bottom of the screen i can move where i am at to the middle of the screen while still in insert mode? Others have covered various sorts of maps; however, if you really like having that cursor in the middle of the screen, I suggest setting the scrolloff option. ex. set scrolloff=999 will always keep the current line in the middle of the screen. If you like some wiggle room, try ex. set scrolloff=5 Regards, Chip Campbell
Re: moving virual rectange about in virtualedit mode
Yakov Lerner wrote: I 'set ve=all' and selected a rectangle with Ctrl-V. How can I move this rectangle up/down left/right with arrows ? With DrawIt v8d, you can move a selected rectangle about with your mouse. Here's the relevant portion of the help for DrawIt: ctrl-leftmouse One may drag and move a selection with ctrl-leftmouse. First, select the region using the leftmouse. Release the mouse button, then press ctrl and the leftmouse button; while continuing to press the button, move the mouse. The selected block of text will then move along with the cursor. Here's how to get install DrawIt (when 7.1 comes out, this will become lots easier - just steps 34) 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
Re: moving virual rectange about in virtualedit mode
Gary Johnson wrote: On 2007-05-02, Charles E Campbell Jr [EMAIL PROTECTED] wrote: Yakov Lerner wrote: I 'set ve=all' and selected a rectangle with Ctrl-V. How can I move this rectangle up/down left/right with arrows ? With DrawIt v8d, you can move a selected rectangle about with your mouse. Here's the relevant portion of the help for DrawIt: ctrl-leftmouse One may drag and move a selection with ctrl-leftmouse. First, select the region using the leftmouse. Release the mouse button, then press ctrl and the leftmouse button; while continuing to press the button, move the mouse. The selected block of text will then move along with the cursor. Unfortunately, this works only for gvim, not vim. ctrl-leftmouse in an xterm opens the Main Options menu. Here's how to get install DrawIt (when 7.1 comes out, this will become lots easier - just steps 34) 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 One may need to uninstall (i.e., delete) any earlier version of DrawIt, too, specifically the file ~/.vim/plugin/DrawIt.vim. The symptoms of needing to do this include vim complaining at startup that \di has been defined twice. I use the line-drawing capability of DrawIt all the time. I haven't done much with the visual-block commands, so I thought I'd try one. I think I found a bug in the version of DrawIt from the astronaut site. I inserted the following two paragraphs of text into a buffer, started DrawIt by typing \di, left-clicked the mouse on the character in the upper left corner of the region (the 'e' in everywhere, no longer visible below), dragged the visual selection to the lower right corner, and typed \b to draw a box. Mary had a little lamb, Its fleece was white as snow, And +--+ went, The |amb was sure to go| || It f|llowed her to scho|l one day, Whic+--+le, And made the children laugh and play To see a lamb at school. Note that the two bars between the paragraphs are in columns 1 and 2 instead of 8 and 27. See DrawIt's help, lines 253-256. The visual-block commands require spaces to work in. Most of these commands are imported from Sylvain Viart's drawing.vim; I haven't tried making the holer routine obsolete yet. Regards, Chip Campbell
Re: Gvim File Explorer error
[EMAIL PROTECTED] wrote: After upgrading I now get Error detected while processing function MenuExplOpen: line4: E316: ml_get: cannot find line 9 Press ENTER or type command to continue E316: ml_get: cannot find line 9 Error detected while processing function SNR15_Highlight_Matching_Pair: line 17: E316: ml_get: cannot find line 9 My version was. ll /usr/share/vim/vim70/plugin/netrwPlugin.vim rw-r--r-- 1 root root 7713 2006-10-10 02:56 I have upgraded to, the problem exists still exists. rw-r--r-- 1 root root 7713 2007-01-31 19:23 Any idea where to start looking in the environment? my rtp=~/.vim,/var/lib/vim/addons,/usr/share/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim70,/usr/share/vim/vimfiles/after,/usr/share/vim/addons/after,/var/lib/vim/addons/after,~/.vim/after vim --version VIM - Vi IMproved 7.0 (2006 May 7, compiled Jan 31 2007 18:15:57) Included patches: 1-122 You need to upgrade vim itself; there was a patch (I'm afraid that I forget which one) which addressed the ml_get problem. Alternatively, you can try reading :help netrw-ml_get and see if the directions therein help. Regards, Chip Campbell
Re: possible bug with vim7 and the arrow keys
Viktor Kojouharov wrote: It turned out that these mappings broke the arrow keys in the terminal: inoremap expr Esc pumvisible()?\C-E:\Esc inoremap expr CR pumvisible()?\C-Y:\CR inoremap expr Down pumvisible()?\C-N:\Down inoremap expr Up pumvisible()?\C-P:\Up inoremap expr PageDown pumvisible()?\PageDown\C-P\C-N:\PageDown inoremap expr PageUp pumvisible()?\PageUp\C-P\C-N:\PageUp IMHO, if one is expecting to use vim (as opposed to gvim), mapping Esc causes trouble. That's because most terminals issue escape sequences (esc..something..) when special keys (such as the arrow keys, functions keys, etc), and that mapping of the esc key messes up the escape sequence. Besides -- how do you get out of insert mode? I realize one can use ctrl-o and norm!, but that seems painful. If you're not using normal mode or command mode, then you're missing a lot of vim. Regards, Chip Campbell
Re: open remote file in vim/gvim
ben lieb wrote: This might have been discussed before, but how can I open a file remotely in vim? Via, ftp, ssh, etc. vim ftp://host/path/to/file vim scp://host/path/to/file Both of these use the netrw plugin, BTW. Both may ask you for passwords, although one can work around that requirement (see :help netrw-listhack and :help netrw-password). Regards, Chip Campbell
Re: What plugin is the one that does the following ...
Andrew Falanga wrote: I'm doing some reading on vim.org in the documentation areas and found that the ability to browse a directory from within a buffer is actually accomplished by plugins rather than being built into the vim binary. I didn't know this. So, what plugin is it that accomplishes what is referenced here http://vimdoc.sourceforge.net/htmldoc/usr_22.html? netrw.vim Its also been updated quite a bit since the original release of vim 7.0; so here's some directions on how to update it: 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 up-to-date versions of vimball and netrw: 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) netrw: http://vim.sourceforge.net/scripts/script.php?script_id=1075 -or- http://mysite.verizon.net/astronaut/vim/index.html#NETRW 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 syntax/netrw*.vim Windows: cd (to your vim system directory) del plugin\netrwPlugin.vim del autoload\netrw.vim del doc\pi_netrw.txt del syntax\netrw.vim 4) Install an up-to-date version of netrw: vim netrw.vba.gz :so % :q Regards, Chip Campbell
Re: sh.vim - Syntax Highlighting Issues
George wrote: I'd like to get the 'sh' filetype syntax highlighting working on FreeBSD. The following (supported) constructs, for example, show as errors. Read :help sh.vim and set one of the variables mentioned there in your .vimrc. Regards, Chip Campbell
Re: Gvim File Explorer error
[EMAIL PROTECTED] wrote: Occasionally when I press ALT+W,X I get some errors in the command line E316: ml_get: cannot find line 1 Press ENTER or type command to continue E316: ml_get: cannot find line 9 E316: ml_get: cannot find line 1 Press ENTER or type command to continue E316: ml_get: cannot find line 1 Press ENTER or type command to continue E316: ml_get: cannot find line 1 Press ENTER or type command to continue And the file window does not open successfully. I have to close the resulting window and the window from which I called it. Where is the corruption happening? What can I do to sanitize it? Is there a not somewhere about this? There used to be a problem with ml_get errors, so make sure you're up-to-date... vim has patches 1-224 netrwFileHandlers v9 netrwSettings v9 netrw v108 (v109a at my website) And now for notes on how to update: 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 up-to-date versions of vimball and netrw: 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) netrw: http://vim.sourceforge.net/scripts/script.php?script_id=1075 -or- http://mysite.verizon.net/astronaut/vim/index.html#NETRW 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 syntax/netrw*.vim Windows: cd (to your vim system directory) del plugin\netrwPlugin.vim del autoload\netrw.vim del doc\pi_netrw.txt del syntax\netrw.vim 4) Install an up-to-date version of netrw: vim netrw.vba.gz :so % :q Regards, Chip Campbell
Re: question about manpageview.vim version 16
Zhaojun WU wrote: Just found that after I updated the manpageview.vim plugin (http://www.vim.org/scripts/script.php?script_id=489) to the latest one, pressing K in some codes like printf(foo), when the cursor is under the word printf, will show me an error message like: ***warning*** sorry, no manpage exist for printf(. I browsed the change log of this plugin, the author, Dr. Chip, shifted back to use cWORD instead of cword to extract current WORD under cursor. So that, the printf(, not the expected printf, will be extracted out and will get NO match at all. Instead of modifying iskeyword to pick up a few more characters with cword, manpageview now uses cWORD and a substitute: let topic= substitute(a:1,'[^-a-zA-Z().0-9_].*$','','') However, I think that the trailing '' should be 'g' instead... so I'll fix that. Chip Campbell
Re: suggestion
David Howland wrote: A.J.Mechelynck wrote: You mean if the buffer is displayed it would do nothing? No. Delete the buffer, but keep the window open. I often find myself in this situation: - Split window, two buffers open. - Open a new file, look at it, then want to close it. - i would expect to :bd to delete the current buffer, leaving the remaining two open, one for each window. But for some reason, it also removes my split. Why should deleting a buffer change how I have my splits set up? Because a window must always have a buffer to display. See Deleting a buffer without changing your window layout http://vim.sourceforge.net/tips/tip.php?tip_id=622 Regards, Chip Campbell
Re: search-related question
Hale Boyes, Kevin wrote: How do I search in a document to the next line that doesn't contain a specific string? Something along the lines of grep -v. I suggest trying the LogiPat plugin. To do what you're asking with it: :LP !string It takes Boolean logic (!=not |=or =and ()s ) plus strings and constructs a regexp that'll do it. You can get the latest LogiPat.vim from http://mysite.verizon.net/astronaut/vim/index.html#LOGIPAT or a more stable version from: http://vim.sourceforge.net/scripts/script.php?script_id=1290 Regards, Chip Campbell
Re: VIM doesn't need new features?!?!
Peter Michaux wrote: And now I see that VIM doesn't need more features... http://www.vim.org/soc/ideas.php May I suggest taking a look at: http://vim.sourceforge.net/sponsor/vote_results.php Regards, Chip Campbell
Re: Troubles configuring vim (multi-questions)
OnionKnight wrote: * Is it possible to make the cursor stay at it's position even after scrolling it out of view? Not at the current time. * At the beginning of an indented line, why does normal mode put the cursor at the end of the first tab whereas insert mode is position at the beginning of the line like I think it should? It's annoying to move around in code like that. I'm not entirely sure what you want here; does having set nosol in your .vimrc help? * Is it possible to enter insert mode for files that aren't modifiable? Obviously any changes can't be saved but the buffer shouldn't be any problems to modify. set ma noro * Is it possible to close tabs with the middle mouse button? Try mapping it; put the following into your .vimrc: nmap middlemouse :tabccr * I wanted the Home-button to act so that it first jumps to the first non-whitespace character of the current line (i.e. skip the indentation) and if Home is pressed when you're already at the first non-whitespace character or before then it should jump to the real beginning of the line, column #1. I made this function: function! HomeKey () let c = col(.) if c == 1 w else g0w if col(.) = c g0 endif endif endfunction You're getting your modes confused. If that if, for example, was executed in normal mode, it would enter insert mode and insert an f character. However, its in command mode; and that w is being executed in command mode, too (and it means write the file). Try using norm! w instead. Likewise with the g0w : norm! g0w etc. * In gvim, is it possible to have a drag-and-drop action open the dragged file into a new tab instead of a new buffer? Using the menu is just tedious, and you can't select multiple files either. Can't answer that -- I never use the mouse to drag-and-drop. Even if you set up some autocmds to do this, if you drop the same file onto vim you'll still get extra tabs unless your code sweeps through all the tabs and checks for a name match first. * I want to check a string if it begins with something but I have no clue why. I was thinking of a regexp but the only way to use matching regexps is for highlights and substition regexps seems to operate on the whole file or a selection and no way to use them on strings. Regexp's have nothing in particular to do with highlights. One can set 'hls' mode and get matches to show up, but that's like saying I want to build a cupboard but wood is always used to build houses. Substitutes act over specific ranges: :7,10s/abc/def/ will only change lines 7-10, not the whole file. By string, do you mean something with double-quotes? Just search for it: /BEGINNING_OF_STRING Regards, Chip Campbell
Re: remote-silent and stdin
[EMAIL PROTECTED] wrote: Mahesh Sivasubramanian/Lex/Lexmark 04/11/2007 10:57 AM To Yakov Lerner [EMAIL PROTECTED] cc vim@vim.org Subject Re: remote-silent and stdin Sorry I wasn't clear last time. I am trying to redirect the output of stdin to a remote client(not necessarily ls). Like if I want to do a cat file | gvim --remote-silent . Its looks like -remote-silent takes in only files as arguments. And its documented, too: --remote [+{cmd}] {file} ...*--remote* Open the file list in a remote Vim. When there is no Vim server, execute locally. There is one optional init command: +{cmd}. This must be an Ex command that can be followed by |. The rest of the command line is taken as the file list. Thus any non-file arguments must come before this. You cannot edit stdin this way |--|. The remote Vim is raised. If you don't want this use vim --remote-send C-\C-N:n filenameCR --remote-silent [+{cmd}] {file} ...*--remote-silent* As above, but don't complain if there is no server and the file is edited locally. Note the line that says You cannot edit stdin this way. Regards, Chip Campbell
Re: syntax/man.vim: manSubHeading is a bit too general?
Ian Tegebo wrote: On 4/9/07, Nikolai Weibull [EMAIL PROTECTED] wrote: The manSubHeading is defined as syn match manSubHeading ^\s\{3\}[a-z][a-z ]*[a-z]$ This will, however, match more lines than I think is intended. It will, for example, match the line \t returns are what are recorded and compared with the data git keeps where \t is a horizontal tabulation. I'm guessing that the actual regex should be ^ \{3\}[a-z][a-z ]*[a-z]$ I hope nobody minds if I take this opportunity to ask a question about vim's pattern matching. After reading |pattern| I wonder if the following is more efficient: syn match manSubHeading '^ \{3\}\l\l\?\l$' (snip) The pattern you've provided isn't matching the same thing. The current one: start the line with exactly three spaces or tabs, followed by a lower case character, followed by any number of lower case characters or spaces, up to a lower case character at the end-of-line. example: spacetabspace aaa aa Nikolai W's modifies that to start the line with exactly three spaces; the rest is the same. example: spacespacespaceaaa aa aaa Yours: start the line with exactly three spaces, followed by two or three lower case characters, which then terminates the line. example: spacespacespaceaa Do people find this to make a different for moderate file sizes, e.g. the man page for 'less' being ~2000 lines? Depends on the line lengths. Your pattern would terminate quite quickly on each line, as only 5 or 6 characters may be at the beginning of matching lines; anything more is a mismatch. The original and NW's both examine the entire line; so if every line had 1GB of characters, these two patterns would take considerably longer than yours. Regards, Chip Campbell
Re: syntax/man.vim: manSubHeading is a bit too general?
Nikolai Weibull wrote: On 4/9/07, Charles E Campbell Jr [EMAIL PROTECTED] wrote: In this case, by looking at syntax/man.vim, its: Gautam H. Mudunuri gmudunur AT informatica.com. Actually, this was actually the wrong maintainer. Gautam was the previous maintainer of this file. Nam SungHyun [EMAIL PROTECTED] maintains it now. Whoops -- yes, you're quite right. Sorry 'bout that... Chip Campbell
Re: Fwd: Perl colour coding bug
Jon Combe wrote: The following snippet of code, when saved with a .pl file extension breaks the colour coding in Vim #!/usr/bin/perl -w my $surname = ABC-DEF GHI; @split = split ( / |-|\/|\/ , $surname , -1 ); foreach ( @split ) { print $_\n; } The lines after the split (that contains a regular expression) are highlighted as if they are within a double quoted string. The colour coding is being confused by the character in the regular expression and thinks (incorrectly) that it marks the start of a string. Is it possible to fix this problem? For example the foreach text should appear in yellow. The maintainer for perl is: Nick Hibma n_hibma AT van-laarhoven.org; he's the appropriate contact for this sort of thing. I found his name in vim70/syntax/perl.vim; syntax file maintainers generally put their contact information in the syntax file they maintain. Regards, Chip Campbell
Re: How to recognize a single line via regexs
Informationen wrote: Hi, how can I identify a single line no longer than e.g. 60 characters preceded and followed by a blank line via regexs. This way I want to identify section headings. What I did was mark every blank line with %s/^$// and than chomp the CR %s/\n//g and if the text between the 's isn't longer than 60 characters put it into \section{}, and replace every with \r\r. But in larger files this takes a while. Is there a smarter solution to the problem? The following regexp will do the match: ^\n\zs.\{1,60}\ze\n$ ^ beginning of line \n newline \zs pattern really starts here (but must be precededed by the foregoing) .\{1,60} one to sixty characters \ze pattern really ends here (but must be followed by the trailing pattern) \n newline $ end-of-line Please read: :help regexp for (much) more. Regards, Chip Campbell
Re: Help on search and replace
Dudley Fox wrote: Hello Vim List, I have used vim for a while, and though no expert I am fairly comfortable with the common commands. Recently I ran into a situation where I just couldn't find a way to do a search and replace. I was hoping some of you experts could help me out. Starting text: nameTable[pattern with spaces0] = (pattern with spaces0, 12345) nameTable[pattern with spaces1] = (pattern with spaces1, 67890) nameTable[pattern with spaces2] = (pattern with spaces2, 243) nameTable[pattern with spaces3] = (pattern with spaces3, 421) nameTable[pattern with spaces4] = (pattern with spaces4, 3455) nameTable[pattern with spaces5] = (pattern with spaces5, ) Desired Text: nameTable[patternwithspaces0] = (pattern with spaces0, 12345) nameTable[patternwithspaces1] = (pattern with spaces1, 67890) nameTable[patternwithspaces2] = (pattern with spaces2, 243) nameTable[patternwithspaces3] = (pattern with spaces3, 421) nameTable[patternwithspaces4] = (pattern with spaces4, 3455) nameTable[patternwithspaces5] = (pattern with spaces5, ) Notice that the only difference is that the spaces are removed from the pattern in between the square brackets. I think I want to use \zs and \ze, but I couldn't wrap my head around the syntax. Any help would be appreciated. In addition to the various regexp solutions you've been given: if what you want done is actually contiguous linewise as shown, then vis.vim makes it fairly straightforward (http://mysite.verizon.net/astronaut/vim/index.html#VIS or http://vim.sourceforge.net/scripts/script.php?script_id=1195): select pattern with spaces0 ... pattern with spaces5 using ctrl-v and motion. :B s/ //g Regards, Chip Campbell
Re: syntax/man.vim: manSubHeading is a bit too general?
Nikolai Weibull wrote: The manSubHeading is defined as syn match manSubHeading ^\s\{3\}[a-z][a-z ]*[a-z]$ This will, however, match more lines than I think is intended. It will, for example, match the line \t returns are what are recorded and compared with the data git keeps where \t is a horizontal tabulation. I'm guessing that the actual regex should be ^ \{3\}[a-z][a-z ]*[a-z]$ but I'm not sure; I haven't been able to find a reference for the display of manual pages. Anyone have any insight into this issue? I suggest bringing up syntax highlighting issues for a specific filetype with the syntax highlighting file's maintainer. In this case, by looking at syntax/man.vim, its: Gautam H. Mudunuri gmudunur AT informatica.com. Regards, Chip Campbell
Re: VIM Delete All Except
jas01 wrote: I have a huge file where I need to delete all lines except for a few I need. I'm trying to do this in a single command. I know that: :v/Text/d will delete all lines except for ones containing 'Text.' I have no idea how to put multiple strings so the command deletes everything except for 'Text' and 'Text2' and 'Text3'. :v/Text[23]\=/d I rather expect that that answer won't be adequate, though. If you want to construct regexp's that handle boolean logic requirements, I suggest looking into LogiPat. You can get the latest LogiPat.vim from http://mysite.verizon.net/astronaut/vim/index.html#LOGIPAT or a more stable version from: http://vim.sourceforge.net/scripts/script.php?script_id=1290 Then you can do things such as search for all lines that don't contain a pattern: :LogiPat !some string search for all lines that do contain two patterns: :LogiPat one thing another thing search for all lines that have A and B but not C : :LogiPat A B !C So, to do what you're asking, and assuming that you're not literally looking for Text...: :echo LogiPat('Text Text2 Text3) which yields:\%(.*Text.*\\%(.*Text2.*\.*Text3.*\)\) so :v/\%(.*Text.*\\%(.*Text2.*\.*Text3.*\)\)/d will delete all lines that don't have Text, Text2, or Text3 in them. Regards, Chip Campbell
Re: VIM Delete All Except
Charles E Campbell Jr wrote: jas01 wrote: I have a huge file where I need to delete all lines except for a few I need. I'm trying to do this in a single command. I know that: :v/Text/d will delete all lines except for ones containing 'Text.' I have no idea how to put multiple strings so the command deletes everything except for 'Text' and 'Text2' and 'Text3'. :v/Text[23]\=/d I rather expect that that answer won't be adequate, though. If you want to construct regexp's that handle boolean logic requirements, I suggest looking into LogiPat. So, to do what you're asking, and assuming that you're not literally looking for Text...: :echo LogiPat('Text Text2 Text3) which yields:\%(.*Text.*\\%(.*Text2.*\.*Text3.*\)\) so :v/\%(.*Text.*\\%(.*Text2.*\.*Text3.*\)\)/d will delete all lines that don't have Text, Text2, or Text3 in them. Whoops -- sorry, that command will delete all lines that don't have Text, Text2 AND Text3 in them. Try :echo LogiPat(Text | Text2 | Text3) which yields: \%(.*Text.*\|\%(.*Text2.*\|.*Text3.*\)\) so :v/\%(.*Text.*\|\%(.*Text2.*\|.*Text3.*\)\)/d will do what you want. Now, LogiPat doesn't guarantee that you'll get the smallest possible regexp to do the job you want. A smaller one would be: :v/Text\|Text2\|Text3/d You'll note that LogiPat has \%(...\) and .* in its pattern which facilitates the use of additional logic. Regards, Chip Campbell
Re: How to open a BIG file quickly?
Tom Purl wrote: On Thu, April 5, 2007 2:38 am, ³Â·½ÈÙ wrote: Dear all, If I want to open one 1G bytes size file,it's really slow. Thank you in advance. Just out of curiosity, why are you trying to edit a 1 GB file with any text editor? I'm assuming that these files are flat file databases. If that's true, then why don't you just read and write to them using some sort of ODBC driver + database front end? That will give you far superior performance to a text editor. I don't know about the OP, but I've gotten several hundred megabyte files resulting from use of my in-line debugger while trying to debug an interpreter. So, its not necessarily a flat file database. FYIW, Chip Campbell
Re: bracket completion
Panos Laganakos wrote: One thing that would also be great, was if you were able to tab your way out of it, ie move to the outside of the bracket, once you're done. Now you need to either press right, to move ahead (which is not quite vim-ish), or hit escape and Shift_A, to resume editing. Only possible way I can think of, is to use a snippet system, like snippetsEmu[1] or something. Any other suggestions? Here's one: http://vim.sourceforge.net/scripts/script.php?script_id=1269 As an example of use: if` (that's a backquote) expands to if() {} (with indentation handled by cindent) and the cursor after the first (. Type whatever, hit esc. The cursor is then moved to a new line after the {. Regards, Chip Campbell
Re: completion menu colors
fREW wrote: Is there a way to change the completion menu colors? Sure - see http://vim.sourceforge.net/scripts/script.php?script_id=1081 which both displays the current colors in whatever colorscheme you're using, plus provides a colorscheme editor (just rightmouse click on a color). The colors you're interested in changing are: Pmenu PmenuSbar PmenuSel PmenuThumb . (A leftmouse click on a color jumps the associated bit of text in the help describing the highlight's purpose). To invoke: :help hicolors Regards, Chip Campbell
Re: how to create tag file in Vim for matlab .m files?
frank wang wrote: Does anyone know how to do it? The hdrtag program will do it: http://mysite.verizon.net/astronaut/src/index.html and click on hdrtag. Regards, Chip Campbell
Re: gVim and Cygwin
Waters, Bill wrote: Does anyone have experience with running gVim and using Cygwin commands (ex. indent)? I would prefer not to run vim in a Cygwin terminal, unless someone has all of the configurations needed (syntax highlighting, etc) to have that act like gVim. I generally compile both gvim and vim under cygwin, and haven't run into any problems. I haven't used indent, though. The problems I generally have had have been with Windows' paths and trying to get netrw to understand them properly, but that's not because of gvim and cygwin. If you already have cygwin, just get vim 7.0 source, and go to its source directory. gmake -f Make_cyg.mak will make gvim.exe by default. Edit Make_cyg.mak, and change GUI=yes to GUI=no, and type the same command above. That way you'll get vim.exe. Its really quite straightforward! Regards, Chip Campbell
Re: Search Replace in VIM Script
oskar wrote: I have a vim script which I want to use to search replace a part out of a given line. The fields in the line are based on field length and the field I want to change starts at position 33 and ends after 4th character. A regex search is not appropriate, as the string I am looking for may occur in another field in the same line but should not be changed here. I already tried substitute() and had a look to the normal command :s with a subset, but none of them worked for me. There are other ways, but it seems the easiest is to use a regexp in a substitute: [range]s/\%33c.\{4}/-NEW/ (pick your range, of course) Regards, Chip Campbell
Re: netrw: gracefully recovering from botched login
Marv Boyes wrote: Hello, all. This is going to seem painfully basic, I'm sure, but I haven't been able to find an answer elsewhere. I often use Vim to edit files over a network, and I have an unfortunate propensity for mis-typing my passwords on the first try. Also unfortunately, I find that the only way I can successfully log in is to close Vim altogether and re-start; netrw re-uses the incorrect password whenever I try to log in again from my original Vim session. Is there an easier way to wipe netrw's memory of the password, without having to start all over? Any guidance would be greatly appreciated, and I'm sorry if I've overlooked the solution in a FAQ, this list, or :help netrw. Many thanks in advance. :help netrw-passwd brought up a paragraph which has as its second sentence: See |netrw-uidpass| for how to change the password after one has set it. So, I suggest referrign to :he netrw-uidpass . Regards, Chip Campbell
Re: How to switch between horizontal split and vertical split?
Peng Yu wrote: Suppose I have horizontal splited window1 and window2, is there any way to change them into vertical split and vice versa? See http://vim.sourceforge.net/tips/tip.php?tip_id=862 How to toggle between all vertical and all horizontal window layout Regards, Chip Campbell
Re: Understanding regxp implementation
Nikolai Weibull wrote: On 1/1/07, Asiri Rathnayake [EMAIL PROTECTED] wrote: On Mon, 2007-03-19 at 11:55 +0100, Nikolai Weibull wrote: On 3/19/07, Asiri Rathnayake [EMAIL PROTECTED] wrote: Hi Bram, Nicolai, A 'k' would be greatly appreciated. I'm really really sorry, won't happen again... Hehe, don't take it too hard, it happens to me all the time. If I had a dime for every misspelling of my name, I'd have...more money than I do now. Perhaps this will help: / -,,, ,, || ) ' || || _' ~||---) \\ ||/\ /'\\ || \, \\ ~||---, || ||_ || || || /-|| || ~|| / || || | || || || (( || || |, / \\ \\,\ \\,/ \\ \/\\ \\ -_- --~ (a gothic/ascii version) :) Regards, Chip Campbell
Re: Netrw go up dir command
Brian Neal wrote: I just downloaded the non-Cream pre-built Vim for Windows (version 7.0.215). The go up command (-) in the Netrw plugin no longer seems to work. Neither the - command or putting the cursor over the ../ and hitting return does anything anymore. Any ideas? Thanks. Please try netrw v108l which I just put on my website: http://mysite.verizon.net/astronaut/vim/index.html#NETRW I've just tested a few basic things: browse local directory open file browse remote directory (with ftp and, for linux, scp) open file changed file and wrote file back under Linux (FC5), cygwin, and a Windows cmd.exe version of vim. Regards, Chip Campbell
Re: @=
Michael Phillips wrote: Would someone please explain the usage of @=. I am getting confuse from the help file. Since TimC gave a good explanation, I won't attempt to repeat it. However, if you're wanting to do Boolean-logic pattern matching, please check out LogiPat, available at my website: http://mysite.verizon.net/astronaut/vim/index.html#LOGIPAT or at http://vim.sourceforge.net/scripts/script.php?script_id=1290 Examples: :LogiPat abc will search for lines containing the string abc :LogiPat !abc will search for lines which don't contain the string abc :LogiPat abc|def will search for lines which contain either the string abc or the string def :LogiPat !(abc|def) will search for lines which don't contain either of the strings abc or def :LogiPat abcdef will search for lines which contain both of the strings abc and def :let pat= LogiPat('!abc') will return the regular expression which will match all lines not containing abc. The double quotes are needed to pass normal patterns to LogiPat, and differentiate such patterns from boolean logic operators. Regards, Chip Campbell
Re: visual problem
Simon Jackson wrote: I have a problem when i am in visual mode and i have text highlighted. Instead of being able to run a command, it just overwrites my selected text instead. im sure its because of something in my vimrc but i just cant pinpoint it, can anyone help? Would you please give an example of the problem? Regards, C Campbell
Re: Any way to have multiple setfiletype's?
Kevin Old wrote: After reading this, I think I should ask it a different way. I'll want to set my filetype to html so that it gets the functionality from HTML.zip, but would like to keep my mason syntax highlighting. To get this to work, each .html file I open I have to execute :set syntax=mason and I get what I want. Try placing a copy of the mason.vim syntax file in your $HOME/.vim/syntax directory; rename it to html.vim . Regards, Chip Campbell
accounts and wikis
Hello! In order to prevent spam, some sort of verification procedure seems to be necessary. Vim's website already supports accounts; would requiring one to log into a vim account before making tips or add-ons to tips help? A verification step for account privilege (apply for account - mail to user with magic cookie - user mails magic cookie back) should serve to ameliorate spam, I'd think, although it'd still be possible. Regards, Chip Campbell
Re: Searching within a delimited area
Afton Lewis wrote: How would I search for a regex within a particular area? The text document is very long, and I don't want to match all instances, just those I care about. I would probably select the text visually. With vis.vim, a plugin available 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 you may use visual mode (either line, character, or block; ie. either with V, v, or ctrl-v) to select a region, then use :S regexp and the search will only pick up items in that region. Regards, Chip Campbell
Re: Number Changes
Mike Blonder wrote: Hi. I periodically need to make changes to a script built with tab delimited values. What I need to do is, from time to time, to either add 1 to a value or to subtract 1 from the same value. Typically the script looks like: ln 1 $10 != { printf ((moodlook $10 } ln 2 $11 != { printf ((feeloil $11 } ln 3 $12 != { printf ((eyeflavor $12 } . . . Is there an alternative to manually CTRL-A'ing each line twice to change ln 1, for example, to #11 != { printf ((moodlook $11 } If these numbers are in columns (and you did say tab-delimited, so perhaps they are), then visincr.vim may be helpful. With the visincr.vim plugin: Change number in upper left hand corner to what you want it to be. ctrl-v to begin visual block mode with the upper left hand corner of column of numbers move cursor to lower right hand corner of column :I This process will change one column of numbers. You can get visincr from: http://mysite.verizon.net/astronaut/vim/index.html#VISINCR or from http://vim.sourceforge.net/scripts/script.php?script_id=670 Quick overview: :I[#] left justified incremented list :II [# [zfill]] right justified incremented list :IO [#] left justified octal incremented list :IIO [# [zfill]] right justified octal incremented list :IX [#] left justified hex. incremented lsit :IIX [# [zfill]] right justified hex. incremented lsit :IYMD [# [zfill]] year/month/day incremented list :IMDY [# [zfill]] month/day/year incremented list :IDMY [# [zfill]] day/month/year incremented list :IA [#] alphameric incremented list :ID [#] dayname incremented list :IM [#] monthname incremented list And, if your columns of numbers aren't aligned, but you'd like them to be, check out Align.vim (available at my website, too). Regards, Chip Campbell
Re: Optimum syntax file size...
Robert Hicks wrote: Is there a size limit that one should set as a ceiling for syntax file size? Engspchk uses some rather large syntax files for its dictionary. Especially if you're using keywords, syntax file size isn't likely to be a problem. Regards, Chip Campbell
Re: vim console?
John Doe wrote: How to control the vim 'console' from programs like the tetris and other games written for vim? Of course, I could look in the source, but am confused from it? Are there multiple ways to accomplish this? I don't see any other replies, so here goes: I'm not sure what you're asking. Every game has its own methods for controlling itself. Mines.vim, for example, provides both keyboard and mouse interaction. So, I suggest reading whatever help comes with the game. Regards, Chip Campbell
Re: vim console?
John Doe wrote: Oh, thank you for your reply: I wanted to know how to _program_ the vim 'console', from a script: the general direction on how to do it: I know how to obtain the number of columns and rows, but how about how to write a specific char to a specific location, also is it possible to access the Internet from a script, just as it's possible from awk, for example. Anything you can type from the command line can go into a script. Anything you type in normal mode can be typed from a command line; see :help :norm Hence anything from normal mode can also go into a script (just use norm). I'm not sure about what you mean by obtaining the number of columns and rows. How to write to a specific location: there are several ways, but one is: linewise : call setline(lnum,new line goes here) lnum is an integer writing a character to a specific column in a specific line: (replacing in line #lnum, column# colnum, with character X) lnum put line number in instead of lnum colnum| put column number in instead of colnum norm! rX Accessing the internet is possible, see :help :! and :help system() . Alternatively, you may use netrw's url format: r scp://hostname/path/to/a/file w ftp://hostname/path/to/a/file so scp://hostname/path/to/a/file Regards, Chip Campbell
Re: pulling text to the right?
Kim Schulz wrote: I just tested it to see if I could get it to work, but I have some problems. I inserted the following int foo; uint8_t bar; TIME baz; int hello=world; and then followed you instructions (used \tsp), but the result afterwards is: int foo; uint8_t bar; TIME baz; int hello=world; What I got with your example: int foo; uint8_t bar; TIMEbaz; int hello=world; So everything lined up. Of course, when I used my mouse to pick up your text, it was composed of all spaces. Does your original happen to have a mixture of tabs and spaces? Besides, this text is looking rather like a declaration set. There's a map specifically supporting that: \adec Regards, Chip Campbell
Re: Sorting a .bib file
Vincent Beffara wrote: So here is my question. I have a bibliography in a .bib file, which (just in case) is just a plain text files containing entries that each look like this : @article{key, author = {Whatshisname, J.}, title = {My paper} } (note the '@' at the beginning of the first line - folding a .bib file is trivial for instance). I would like to sort the entries according to, say, the author's last name (though by key or even by first line is ok). What would be a good way to do this ? Sure! The approach I'm suggesting uses BlockSort(), available as part of the vissort plugin. You can get the vissort plugin from my website: http://mysite.verizon.net/astronaut/vim/index.html#VISSORT Here's the relevant blurb from the help: :','BS :' 'BS nextblock endblock findtag tagpat tagsub :[range]call BlockSort(nextblock,endblock,findtag,tagpat,tagsub) :[range]call BlockSort(...) If any arguments are missing, BlockSort() will query the user for them. This function's purpose is to sort blocks of text based on tags contained within the blocks. For this particular problem, the following call will work: %call BlockSort('[EMAIL PROTECTED]','','^\s*author\s*=','^.*{\s*\(.\{-}\)\s*,.*$','\1') This assumes: each block starts, at the beginning of the line, @article This pattern is also used to separate blocks. Inside the block is a line satisfying the pattern: ^\s*author\s*= The next two items are used in a substitute operation on the line satisfying the pattern above, and are used to extract the item that the blocks are to be sorted with. Regards, Chip Campbell
Re: tips project
Tom Purl wrote: There is one thing to mention about parsing tips. Are we going to put the additional comments to the wiki? There are many useful comments but there are also many useless junk. It would be _lots_ of work to look at every comment and see if they're useful or not. What are your ideas? This is a really good question. Here's my opinion. The comments *are* a necessary part of the tip, and should be included with the import. In general, I would like to move 100% of the content from the tips on the vim.org web site to the wiki, even if some of the data doesn't fit very well into the wiki. After that, the tips information can be refactored as necessary by the community. FWIW, my script already includes all the Additional Notes comments in its output files; plus ratings. I'm not sure how one might want to do ratings in the future, though. Here's one quick idea... each tip includes ratings to change a tip's rating, click on a link for one of the three selections. The link updates a database similarly to what is done now and modifies the tip page to reflect the new rating. I bring this up because the change-rating gadget is missing from at least my script's output, and if a mechanism can be agreed upon the script could include that mechanism. Regards, Chip Campbell
Re: Help needed to : Start on the line where I left when I opened the file last time
durgaprasad jammula wrote: I just need some help on vim configuration. Let say the file is good.text. I open the file and goto 66 line and come out by typing :wq in escape mode. Now, when I open it again, my cursor is placed in line 0. I want it to be placed in line 66. I am facing this problem in my Solaris 10 x86 machine. The same thing is working fine in Linux. Can you please help me what configuration do I need to change to enable this feature. [I have tried Google search and could not get useful links]. Read http://vim.sourceforge.net/tips/tip.php?tip_id=80 , Restore cursor to file position in previous editing session. HTH, Chip Campbell
Re: Insert mode and arrow keys philosophy
Pavel Shevaev wrote: On 2/21/07, DervishD [EMAIL PROTECTED] wrote: Hi Laurent :) Unfortunately, I still have problems using 'h' :( That's my biggest problem at the moment as well, as a blind typer i can't get used to it...oh, i think i just should stop whining and exercise more ;) I think I understand the issue; one sort of expects to use a different finger for each motion. I've sort of gotten used to shifting my right hand one key to the left when I intend to move the cursor, thus I get right index finger == h right middle finger == j right ring finger == k right little finger == l Of course, that means whenever I use OtherEditors, such as with certain mail clients, I end up with jjkkllhhh#)*()* sequences :O . Regards, Chip Campbell
Re: surround.vim in AsNeeded
Bill McCarthy wrote: BTW, as an enhancement request, could AN be enhanced to look for leadermap when it fails to find charmap? That is, if I want to load the align maps: AN \abox doesn't work. I would need to type: AN leaderabox If you happen to have (as an example) let mapleader= ; in your .vimrc, did you know that :AN ;abox would load AlignMaps.vim? So you don't actually need to type leader, just the leader you're actually currently using. Regards, Chip Campbell
Re: Overview of diretories of $HOME/.vim
Kai Weber wrote: where can I find an overview of the $HOME/.vim directory hierarchie? I have not found an overview, seems I have to read all the vim documentation for :help ftplugin, :help initialization and so on. snip Hello! I have the following help file which I use; see attached. Place it in: .vim/doc Bring up vim, type: :helptags ~/.vim/doc (adjust path as needed) Regards, Chip Campbell *dotvim.txt*The .vim Directory StructureFeb 20, 2007 *.vim-after**.vim-ftplugin* *.vim-plugin* *.vim-doc* *.vim-indent* *.vim-syntax* Copyright: (c) 2004-2007 by Charles E. Campbell, Jr.*dotvim-copyright* The VIM LICENSE applies to dotvim.vim and dotvim.txt (see |copyright|) except use dotvim instead of Vim No warranty, express or implied. Use At-Your-Own-Risk. == 1. The .vim/ directory tree *.vim* *vimfiles* (see also |'runtimepath'|) The user's local plugins and whatnot are stored under: .vim/ Unix vimfiles/ PC,Mac filetype.vim|new-filetype| new filetypes triggered by filename menu.vim|menu.vim| gui menus scripts.vim |new-filetype-scripts| new filetypes triggered by file contents after/compiler/ |write-compiler-plugin| overrule a compiler plugin after/filetype.vim |43.2| overrule filetype after/ftplugin |ftplugin-overrule| overrule filetype settings after loading the global plugin after/plugin user-specified additions to pre-existing plugins after/syntax/ |mysyntaxfile-add| user-specified additions to pre-existing syntax highlighting ex. after/syntax/c.vim autoload/ |autoload| Starting with vim 7.0, scripts can be broken into an always-loaded portion in .vim/plugin and a loaded on demand portion in .vim/autoload. colors/ |:colorscheme| holds colorscheme files compiler/ |:compiler| holds compiler files doc/|write-local-help| |add-local-help| put in your own help files such as this one ftdetect/ |new-filetype| |plugin-filetype| Filetype detection scripts. Note that: set filetype=foo overrules setf foo sets filetype only when not set yet ftplugin/ |write-filetype-plugin| filetype-based plugins (ex. ftplugin/tex/tex.vim) indent/ |filetype-indent-on| |indent-expression| user-specified indenting associated with syntaxfile.vim keymap/ |mbyte-keymap| specify keymap files (multibyte related) lang/ |:menutrans| menu and messages translations plugin/ |write-plugin| |filetype-plugins| |plugin-special| files herein will be loaded automatically at every invocation of vim syntax/ |mysyntaxfile| |new-filetype| new user-specified syntaxfile.vim files spell/ |spell-load| holds dictionaries of words for spell checking systags |ft-c-omni| May be used to help complete system functions tutor/ |tutor| files for vimtutor .vim/after - vim:ts=8:tw=78:ft=help
Re: Reread the file
Bin Chen wrote: Can VIM configured to reload the opened file in a constant interval? Not easily; there's no such configuration options. However, I suspect that there may be two if not more ways to do this: * use an outside process on a multitasking o/s to ping vim using remote_send() would likely work * possibly something can be done with libcall() Regards, Chip Campbell
Re: Enabling gvim?
[EMAIL PROTECTED] wrote: I d/l'd and cofigured vim7.x (latest) as follows... ./configure --prefix=/vimpath --enable-gui Should this enable gvim? I did a make install, and cd /vimpath/bin ln -s vim gvim When I start gvim, I get E25: GUI cannot be used: Not enabled at compile time What do I need to do to use gvim? Are you using windoze, linux, or mac? For windows: what compiler are you using? For example: cygwin: make -f Make_cyg.mak M$ visual c: make -f Make_mvc.mak etc. So, it depends on what compiler you're using as to which makefile to use. You can then edit the appropriate makefile for particular options you want. Generally, though, they do come up with gui (gvim). For linux: I use configure --with-features=huge --enable-perlinterp make su make install I've not used the Mac... I suggest trying to get the compile to work as shown above first, and then try again with whatever configure options you want. Make sure that the usual way works first! Regards, Chip Campbell
Re: search command in visual mode - how to?
Sibin P. Thomas wrote: Hi all, I am stuck in one of my scripting attempts! The context : Suppose I want to delete the string bio from the following line The biosphere is huge and I want to do it in this way - /biosCR vCR //eCR dCR Now I want to do the same thing, but conditionally...basically I want to use the :if construct. I tried - :if (@0=~something) | exe /bios | exe normal v | exe //e | endif This where I am stuck; I am not able to reproduce the effect of //eCR through the :if construct. In this case I get the error e481: No range allowed and if I try - exe normal //e it just stays in visual mode doing nothing. Can anyone help me out here? This is going to play a huge part in most of my scripts! Several notes 1. exe /bios might fail. You probably should use the search() function: if search('bios') ... endif 2. bios might be part of a word (example: symbiosis) and get found when you don't want it to be. Perhaps search('\bios') would be better? 3. Why not do the search substitute directly from ex? /\bios/s/// 4. If for some odd reason you feel you absolutely must use visual mode for this, then try exe norm! v//e\crd Regards, Chip Campbell
Re: vim return code
Martin Krischik wrote: Hello, I often use little vim scripts using vim -E. Now like all executable vim will return a result code after execution. And it is often false which I don't want. Does anybody know how to influence the return value from vim -E? :q :wq :q! -- these are normal quits (:wq also writes) :cq -- quits, but Vim will return an error code HTH, Chip Campbell
Re: 7.0.188 - problem with directory browser?
Denis Perelyubskiy wrote: in version 7.0.188 (I am on windows xp, us) nothing works when I select '..' when browsing a directory. has anyone seen this? is this something peculiar to my installation, a bug, or a feature? I suspect that you need a recent version of netrw. 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 up-to-date versions of vimball and netrw: 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) netrw: http://vim.sourceforge.net/scripts/script.php?script_id=1075 -or- http://mysite.verizon.net/astronaut/vim/index.html#NETRW 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 syntax/netrw*.vim Windows: cd (to your vim system directory) del plugin\netrwPlugin.vim del autoload\netrw.vim del doc\pi_netrw.txt del syntax\netrw.vim 4) Install an up-to-date version of netrw: vim netrw.vba.gz :so % :q Regards, Chip Campbell
Re: BOF Vim 8 - EncryptLine
Matthew Winn wrote: Text editors don't do encryption and never should. How else would you ensure that you can have encrypted text _without_ the need to temporarily store a plaintext copy of the file? Pipe the text through to an external encryption tool, such as pgp. Assuming your o/s supports true pipes... Chip
for vim v8: how about keepundo ?
The idea would be to leave the undo list alone, so that when the undo table gets updated next it'll have a bigger change. Regards, Chip Campbell
Re: for vim v8: how about keepundo ?
Nikolai Weibull wrote: On 1/29/07, Charles E Campbell Jr [EMAIL PROTECTED] wrote: The idea would be to leave the undo list alone, so that when the undo table gets updated next it'll have a bigger change. What do you mean? From the very short description it sounds like your describing :undojoin. A keepundo would be more akin to the keepjumps, keepalt style of suppressing some update for the command which follows. Regards, Chip Campbell
Tip karma storms
Hello! The following is a note that I sent to Scott Johnston; perhaps people have woken up and decided in large groups that they really like my tips, :) but: For the third time since January 15, I've seen tip storms in karma rating changes. Here's the latest one (Jan 22, 2007): Karma/Raters/Downloads: dK/dR/ dD: K / R / D tip changed by 20/ 5/ 17: 96/ 33/5988 How to initialize plugins (avg_karma=2.9 R/D= 0.55%) tip changed by 20/ 5/ 15: 145/ 47/3837 A map for swapping words (avg_karma=3.1 R/D= 1.22%) tip changed by 20/ 5/ 47: 142/ 58/12779 Highlight matching brackets as one moves in normal mode (plugin)(avg_karma=2.4 R/D= 0.45%) tip changed by 40/10/ 40: 236/ 79/12849 Using vim as a man-page viewer under Unix (avg_karma=3.0 R/D= 0.61%) tip changed by 24/ 6/ 17: 74/ 22/4680 Spelling checkers for: Dutch, English, German, Hungarian, and Yiddish(avg_karma=3.4 R/D= 0.47%) tip changed by 1/ 1/ 55: 398/135/8246 Restore cursor to file position in previous editing session (avg_karma=2.9 R/D= 1.64%) tip changed by 16/ 4/ 12: 127/ 38/6674 Applying substitutes to a visual block (avg_karma=3.3 R/D= 0.57%) script changed by 2/ 2/ 1: 391/296/1776 visincr.vim (avg_karma=1.3 R/D= 16.67%) tip changed by 36/ 9/ 33: 167/ 54/6999 How to sort using visual blocks (avg_karma=3.1 R/D= 0.77%) tip changed by 24/ 6/ 9: 56/ 16/3310 Opening gvim atop a console window (avg_karma=3.5 R/D= 0.48%) tip changed by 20/ 5/ 10: 69/ 23/1488 How to overwrite a visual-block of text with another such block (avg_karma=3.0 R/D= 1.55%) This records changes in karma since last Friday. I usually get 2 or 3 tip+script karma changes a day, but the same 2 or 3 changes on weekends. I saw this last Monday and last Wednesday, too. I sent a note to Bram: - I've noticed twice now a large number of my tips have received a lot of increase in ratings. As an example: (change-in-karma/qty-raters/qty downloads/viewers : total karma/raters/viewers) tip changed by 12/ 3/ 16: 76/ 28/5971 How to initialize plugins (avg_karma=2.7 R/D= 0.47%) tip changed by 12/ 3/ 11: 125/ 42/3822 A map for swapping words (avg_karma=3.0 R/D= 1.10%) tip changed by 12/ 3/ 36: 122/ 53/12732 Highlight matching brackets as one moves in normal mode (plugin)(avg_karma=2.3 R/D= 0.42%) tip changed by 20/ 5/ 21: 196/ 69/12809 Using vim as a man-page viewer under Unix (avg_karma=2.8 R/D= 0.54%) tip changed by 16/ 4/ 11: 50/ 16/4663 Spelling checkers for: Dutch, English, German, Hungarian, and Yiddish(avg_karma=3.1 R/D= 0.34%) tip changed by 8/ 2/ 13: 111/ 34/6662 Applying substitutes to a visual block (avg_karma=3.3 R/D= 0.51%) script changed by 2/ 2/ 1: 388/293/1774 visincr.vim (avg_karma=1.3 R/D= 16.52%) tip changed by 20/ 5/ 29: 131/ 45/6966 How to sort using visual blocks (avg_karma=2.9 R/D= 0.65%) tip changed by 12/ 3/ 6: 32/ 10/3301 Opening gvim atop a console window (avg_karma=3.2 R/D= 0.30%) tip changed by 12/ 3/ 5: 49/ 18/1478 How to overwrite a visual-block of text with another such block (avg_karma=2.7 R/D= 1.22%) script changed by 4/ 1/ 68: 39/ 12/ 617 LargeFile.vim (avg_karma=3.2 R/D= 1.94%) Consider the Spelling checkers for: Dutch, English, ...: that tip has been pretty much out-of-date for several years due to improvements in Engspchk, and even more so now with vim 7.0's built-in spelling checker. I have a record of karma changes to this tip: 08/07/03 tip 19/ 7/1336: Spelling checkers for: Dutch, English, German, Hungarian, and Yiddish 11/24/03 tip 18/ 8/1601: Spelling checkers for: Dutch, English, German, Hungarian, and Yiddish 01/16/07 tip 34/ 12/ 4652: Spelling checkers for: Dutch, English, German, Hungarian, and Yiddish 01/18/07 tip 50/ 16/ 4663: Spelling checkers for: Dutch, English, German, Hungarian, and Yiddish You can see that only two people changed its rating since Aug 7, 2003, except for this week, where there was substantial increases twice in one week. I often do the check on ratings every two or three days. - I noticed this karma-increase-storm for a bunch of other tips, too. I figure either its a vandal or perhaps the tip-note cleaning process has a bug affecting karma ratings. If its a vandal, I have no idea what can be done about it, but I thought I'd pass the info along. He suggested I let you know.
Re: patch 182 and selectbuf [interferes with netrw plugin]
Denis Perelyubskiy wrote: Thanks. While I can't tell what went wrong by just eye-balling the patches, I did find that the problem results from netrwPlugin.vim. Basically, netrw registers this autocommand: au BufEnter .* silent! call s:LocalBrowse(expand(amatch)) When it is executed on a buffer switch, sometimes this amatch is emty. I've no idea why. If I remove the netrw plugin, things go back to normal. I did notice that netrw plugin changed recently... Can you give me an example? Also, what o/s are you using? The s:LocalBrowse() function checks if the name passed to it is a directory. Except for the Amiga, an empty string should be getting ignored (isdirectory() is zero). Regards, Chip Campbell
Re: Tips which have spam contained in their comments/notes:
Yongwei Wu wrote: On 1/18/07, Charles E Campbell Jr [EMAIL PROTECTED] wrote: FYI -- this is a list of my tips that still have link spam added as comments/notes: I'm sure that they're not the only ones. It is really annoying. In the worst case, there are 12 spam notes in a tip! I needed to click and wait for quite a while because of the Internet problem caused by the Taiwan earthquake. At least the spam notes in these tips are eradicated now. Thank you! It almost feels like taking a shower after one really needs one... Regards, Chip Campbell
Re: Modifying the tag stack
Alpt wrote: On Thu, Jan 18, 2007 at 08:15:37AM -0500, Ross A. Osborn: ~ On Thu, Jan 18, 2007 at 01:58:40PM +0100, Alpt wrote: ~ ~ How is it possible to push something in the tag stack without jumping? ~ ~ Would mapping the combination of CTRL-TCTRL-O do what you want? No, because the user has to always use C-T and C-] to jump back and forward. From the user point of view, jumping on [[file.c:45]] must be the same of jumping on [[TAG]]. The internal difference is that the jump on [[file.c:45]] equals to `:e +45 file.c' Hello! Perhaps something along the lines of save current user position/buffer (see :help getpos()) :exe keepjumps ta .expand(cword.) :return to saved user position buffer (but use keepjumps) (see :help setpos()) This should put the cword onto the tagstack, but the keepjumps will keep the jumplist untainted. Wrap it all up into a map/function/command, and I think you'll have your solution. Regards, Chip Campbell
Tips which have spam contained in their comments/notes:
Hello! FYI -- this is a list of my tips that still have link spam added as comments/notes: 126 139 147 150 152 167 200 411 573 588 607 622 744 862 895 I'm sure that they're not the only ones. Regards, Chip Campbell
Re: enclosing a visual block with quotes
Bram Kuijper wrote: anybody a solution to easily enclose parts of text using visual mode? 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 and use it as follows: v (move) :B s/\_.*\ze\n// That'll put double quotes around the character-oriented visual selection. Regards, Chip Campbell
Re: .vimrc from URL
A.J.Mechelynck wrote: Charles E Campbell Jr wrote: OK, with all that: vim -U NONE -c set nocp|so $HOME/.vim/plugin/netrwPlugin.vim -c so scp://HOSTNAME/.vimrc Rather than -U NONE (i.e., no gvimrc) shouldn't that be -u NORC (i.e., with small u: don't source $HOME/.vimrc but do source the global plugins)? I suggest the amended command-line below (with --cmd for early sourcing): vim -u NORC -N --cmd runtime plugin/netrwPlugin.vim --cmd source scp://HOSTNAME/.vimrc Sounds better! I'll put a note to that effect in pi_netrw.txt. Regards, Chip Campbell
Re: vim | deleting end of lines inside a pattern
Nikolaos A. Patsopoulos wrote: Hi, I would like to delete all end of lines (\n) inside a given pattern that runs through a text. The pattern is like this: PubmedArticle text1 \n text2 \n text3 \n text4 \n text5 \n text6 \n ... \n PubmedArticle Does :%s/PubmedArticle\_.\{-}\zePubmedArticle/PubmedArticle\r/g do what you want? I suggest that you read :help regexp Regards, Chip Campbell
Re: Defining settings based on file ext/type.
Ramashish Baranwal wrote: Hi, I would like to know how to define file specific settings (based on file extension/type). I would prefer modifying my .vimrc file instead of language specific .vim files. I am trying to achieve something like- if file-extension is .c or .cpp # expand tabs to spaces set sw=4 ts=4 expandtab else if filetype is Makefile # don't expand tabs to spaces noexpandtab endif Any help would be appreciated. :) Your example seems to indicate that you want to take actions based upon file specific settings, not how to define new ones. The proper way to do this: vim (home)/.vim/ftplugin/c.vim # expand tabs to spaces set sw=4 ts=4 expandtab :wq vim (home)/.vim/ftplugin/make.vim # don't expand tabs to spaces noexpandtab :wq Now, if you insist on doing something similar in your .vimrc instead of the proper way... au FileType *.c,*.cpp,*.cxx,*.h,*.hpp set sw=4 ts=4 expandtab au FileType makefile,Makefile set noexpandtab All of this is untested, BTW. Suggested reading: :help autocmd :help FileType :help ftplugin Regards, Chip Campbell
Re: grouping problem
Nikolaos A. Patsopoulos wrote: Ηι, I'm want to group a text that has the following text pattern (values and number of lines vary across instances): PMID16893921/PMID Volume164/Volume Issue7/Issue Year2006/Year ISOAbbreviationAm. J. Epidemiol./ISOAbbreviation ArticleTitleImplications of small effect sizes of individual genetic variants on the design and interpretation of genetic association studies of complex diseases./ArticleTitle MedlinePgn609-14/MedlinePgn FirstAuthorIoannidis JP Used the following code but got a pattern recognition problem.: :%s/\(PMID.*$\)\(Volume.*$\)\(Issue.*$\)\(Year.*\)\(ISO.*$\)\(ArticleTitle\_.\{-}ArticleTitle\)\(MedlinePgn.*$\)\(FirstAuthor.*$\)/\1\6\5\4\2\3\7\8\g What am I missing?? %s/\(PMID.*\)\n\+\(Volume.*\)\n\+\(Issue.*\)\n\+\(Year.*\)\n\+\(ISO.*\)\n\+\(ArticleTitle\_.\{-}ArticleTitle\)\n\+\(MedlinePgn.*\)\n\+\(FirstAuthor.*\)$/\1\r\6\r\5\r\4\r\2\r\3\r\7\r\8/ Again, suggested reading: :help regexp :help substitute (and several links therein such as |pattern| and |sub-replace-special|) Regards, Chip Campbell
garbage notes in vim.sf.net's tips section
Hello, Scott! I mentioned how there were lots of garbage notes that have been appended to nearly all tips; as an example, I gave out tip#1. I see that the garbage has been cleaned from tip#1, but tips #12-1393 also need cleaning. Seems like it needs some automation to do it, especially if the #() who obviously used a program/script to do it the first time repeats his/her vandalism. Regards, Chip 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
Re: Reformat in visual area - vmap question
John Cordes wrote: On [2007-01-09 at 10:50am] Charles E Campbell Jr [EMAIL PROTECTED] wrote: John Cordes wrote: 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 1. Get vis.vim from: 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). Thanks for the response. I usually would be using Shift-V to select the lines for formatting; I take it vis.vim wouldn't work in that case? The example given above was for visual-block; Shift-V is visual line selection. All three visual selection methods: by block (ctrl-v), by character (v), and by line (V), are supported. Regards, Chip Campbell
Re: Reformat in visual area - vmap question
Tim Chase wrote: Thanks for the response. I usually would be using Shift-V to select the lines for formatting; I take it vis.vim wouldn't work in that case? Heh, Dr. Chip answered the other half of my response. :) Normal ranges operate linewise. Dr. Chip's vis.vim plugin overcomes this limitation, and allows ranges to be treated block-wise and character-wise. So if you only need linewise, vim already does it. If you need to overcome that limitation, use vis.vim. :) Yep, vim already supports linewise, but I figured I'd include it in vis.vim for completeness (and for those whose fingers get into a pattern!). It only cost two extra lines of script (one to test if its 'V' mode, the other to pass it along to vim: ',' [command] ). 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: 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
tip comment pollution
Hello! Looks like the spammers have been adding their pollution to the tips. Our (unfortunately) hardworking tip inspectors have been getting rid of new spamtips, but the spammers have now started using the Additional Notes process. I note that many of my own tips seem to have four or more pieces of garbage appended. As an example, consider tip#1: http://vim.sourceforge.net/tips/tip.php?tip_id=1 . Can our tip inspectors also elide this form of pollution? 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