can't diffsplit
I have two files which I'd like to compare via diffsplit in an existing vim session - trying to do so by issuing ':diffsplit filename' when the other one is already in the window gets me the error: E97: Cannot create diffs I can properly open the diff in a separate instance via 'vimdiff', as well as ':diffsplit' - is there something wrong with my existing session? thanks! -lev
Re: can't diffsplit
On May 31, 2007, at 3:02 PM, A.J.Mechelynck wrote: Lev Lvovsky wrote: I have two files which I'd like to compare via diffsplit in an existing vim session - trying to do so by issuing ':diffsplit filename' when the other one is already in the window gets me the error: E97: Cannot create diffs I can properly open the diff in a separate instance via 'vimdiff', as well as ':diffsplit' - is there something wrong with my existing session? thanks! -lev II. To diff two files already being edited: 1. make one file current 2. :diffthis 3. make the other file current 4. :diffthis 5. (Optional) Rearrange the windows (using ^W commands) to place them side-by-side. Great. this solved the error that I was getting... thanks! -lev
.gz files not unzipping
I'm having a problem with help files which are gzipped not decompressing. I get the error message 'can't find tag pattern' after which the gz binary appears on screen. Does anyone know why this is? thanks! -lev
fold acting strangely
I'm experiencing a problem when folding visual blocks - if I have a section folded directly above another section that I want to fold, they end up merging once I fold the second section, sometimes they even add unfolded text to the fold - am I doing something wrong? thanks! -lev
Re: fold acting strangely
On Apr 4, 2007, at 9:13 AM, Tim Chase wrote: The visual indicator of the fold-column can help you prevent overlapping sections, which in turn, should help you avoid the behavior you see. Very cool - I didn't have a good idea of what was going on with folding until I turned this on - thanks! -lev
need help with xml.vim plugin
I'm hoping someone can help me with this problem, as it would be really nice to get the XML plugin working. I've downloaded the plugin described here: http://www.vim.org/scripts/script.php?script_id=301 I've put the file both in my local ftplugin, and plugin directory, and set ':ftplugin type on', however I'm still unable to do any of the navigation between tags, or autocompletion that the plugin promises. I can load up the help file, however it seems like that's the only part that's actually working. Any bit of help would be appreciated - I'm thinking it's a local config issue (perhaps it's being overridden by the original xml.vim that gets installed with vim?), but I'm not entirely sure. thanks in advance! -lev
Re: need help with xml.vim plugin
From: [EMAIL PROTECTED] Subject:Re: need help with xml.vim plugin Date: March 9, 2007 1:00:00 PM PST To: [EMAIL PROTECTED] On Mar 9, 2007, at 12:36 PM, A.J.Mechelynck wrote: :ftplugin type on should get you E492: Not an editor command: ftplugin type on. It ought to be :filetype plugin on. sorry, meant the latter. Where exactly did you drop the script? xml plugins are sourced in the following order (on Unix): $HOME/.vim/ftplugin/xml.vim $VIM/vimfiles/ftplugin/xml.vim $VIMRUNTIME/ftplugin/xml.vim $VIM/vimfiles/after/ftplugin/xml.vim $HOME/.vim/after/ftplugin/xml.vim $HOME/.vim/ftplugin/xml.vim If your script is meant to /replace/ the default script, it should include, near the start, if exists(b:did_ftplugin) | finish | endif let b:did_ftplugin = 1 it does indeed contain that and be located in an early directory. If it is meant to / supplement/ the default script without replacing it, it should not include the above lines, and it that case it should be in an after- directory. it looks like since I didn't have the filtype plugin on in my .vimrc, it didn't detect that I was editing a xml file, nor did I 'source' the xml.vim once I had the filetype plugin turned on. problem solved! I would figure that with all of the XML/HTML file editing that is done with vim, that there would be a kitchen sink editor plugin with some features other than the ones in xml.vim... is there something that I'm not aware of out there, complete with Schema readers and such? thank you for your help!!! -lev
Re: pulling text to the right?
On Feb 27, 2007, at 6:57 AM, Charles E Campbell Jr wrote: Lev Lvovsky wrote: I'm sure there's a fancy word for this, but is there any way to pull text to the right? suppose I have the following: COL1 INT, COL2 INT, COL3 INT, I'd like to get COL3 aligned to COL1 and COL2, but to do that, I need to put the cursor behind COL3, hit space several times, and then align INT with the other INTs. Can I put my cursor to the right of COL3, and pull it over to INT on the right? It sounds like you're interested in aligning text. For that may I suggest looking into Align.vim (and AlignMaps.vim, which come together). To do the alignment, assuming that you're using spaces as delimiters: All's I have to say in RE to Align.vim is: Wow. thanks Charles! -lev
visual selection Q's
I've a couple of visual selection questions: 1. with blockwise, is there any way when using 'p' after yanking, that it would add as many lines below the one I'm pasting to, as I'm pasting? Currently a blockwise yank and subsequent paste simply replaces that a block of the same size in the pasted area - can I have it add lines like visual paste does? 2. how do I do regular expression searches in a blockwise visual selection? specifically, if i'm looking to change something at the end of the block, say for example, replace all trailing whitespace with a ',' I can't do the following: :','s/ *$/,/ because it'll act on the whole line outside of the block thanks for any advice! -lev
pulling text to the right?
I'm sure there's a fancy word for this, but is there any way to pull text to the right? suppose I have the following: COL1 INT, COL2 INT, COL3 INT, I'd like to get COL3 aligned to COL1 and COL2, but to do that, I need to put the cursor behind COL3, hit space several times, and then align INT with the other INTs. Can I put my cursor to the right of COL3, and pull it over to INT on the right? thanks! -lev
moving buffer changes to new file?
I often times rename a file that I'm working on after I realize (or am told ;) that renaming it is in order. Is there any way I can take the changes to that new file from the buffer along with the new name? thanks! -lev
Re: entering copied text into command mode?
Hi Gene - sorry for the delay in replying - On Feb 16, 2007, at 8:11 AM, Gene Kwiecinski wrote: I often find myself copy/pasting via my GUI text that I might have on the screen, and then pasting it into the command to be performed - is there any way to cut/paste text into the command area when I have it highlighted with just the keyboard? I'm not quite sure what you mean, but if it's what I think it is, sure. If I want to, eg, globally delete paths from links to images and such in html source, eg, to turn img src=big_honking_pile_of_hooey_files/image.jpg into just img src=image.jpg , then I'd want to execute :[EMAIL PROTECTED]/@@g as a command, so I'd just 'v' the pathname to highlight it, control-insert it to yank it into the clipboard(?), then do :s@sh-ins@@g ie, use shift-insert to paste the path directly into the command. is that any help, or were you referring to something different? Unless I'm mistaken, these are OS-specific copy/paste commands, correct? I don't have an 'insert' key on my keyboard, but I was hoping for something built into vim, where it has it's own copy/paste buffer that it can use in the command mode. thanks! -lev
Re: entering copied text into command mode?
On Feb 21, 2007, at 4:15 PM, A.J.Mechelynck wrote: [snip very useful advice] See the other replies in this thread for details. blargh! I only saw the one reply from Gene (sent to me directly), and completely missed the long thread actually going on in my vim folder - reading up on that now. thanks for the help, this is exactly what I was looking for! -lev
entering copied text into command mode?
I often find myself copy/pasting via my GUI text that I might have on the screen, and then pasting it into the command to be performed - is there any way to cut/paste text into the command area when I have it highlighted with just the keyboard? thanks! -lev
[OT?] copying on a mac
Hello, I'm almost positive that this is OT, but if someone point me in the right direction, that would be great - I'm finding (through the help of vim actually), that text highlighted and copied from Terminal (or even X11 xterm) on OS X ends up with an extra space at the end of a line where there was only a new line - this happens when I'm ssh'd into a UNIX machine (pasting into vim while with a highlighted search of / *$/). If anyone has any suggestions on how to fix/modify this behavior, it would be greatly appreciated! -lev
xml files
I'm looking for a simple XML plugin that'll do highlighting of XML documents I've tried both of the following plugins: http://www.vim.org/scripts/script.php?script_id=1397 http://www.vim.org/scripts/script.php?script_id=301 And am unable to get even block navigation (%) working. Does the XML file need a DTD, or? Any help would be appreciated! thanks! -lev
anything similar to emacs patch mode?
I know I've asked this before, however I might not have explained my question well enough. Can vim do something like what's described here: http://atrey.karlin.mff.cuni.cz/~pavel/patch-mode.html This is apparently a built-in ability of emacs now, it would be super- sweet if I could find something in vim that did this. thanks! -lev
Re: anything similar to emacs patch mode?
On Dec 11, 2006, at 10:07 AM, Yakov Lerner wrote: You get syntax coloring when editing patches/diffs. Regarding jumping by chunks and file boundaries -- it's fairly easy to to map some your 4 keys to these jumps: Just map your 4 favourite keys to ?^@@@?cr /^@@@/cr ?^\*?cr /^\*/cr that's it. And publish it as a Patch mode for vim. The feature that I'm looking for specifically is being able to edit a patch, and have vim do the line numbering math for me. Also the splitting or combining of hunks. thanks Yakov! -lev
Re: anything similar to emacs patch mode?
On Dec 11, 2006, at 11:19 AM, Yakov Lerner wrote: On 12/11/06, Lev Lvovsky [EMAIL PROTECTED] wrote: The feature that I'm looking for specifically is being able to edit a patch, and have vim do the line numbering math for me. Also the splitting or combining of hunks. Isn't it easier to use vimdiff, and edit left and/or right file, then produce the diff ? I mean, having the diff plus the file, you can apply the patch and produce the 2nd file, and then use vimdiff. This particular functionality, though apparently part of emacs diff mode, allows editing of a unified patch file, which can refer to more than just two different files. Moreover the patch itself does not need the actual source files to be edited. In addition with the two files present that a particular hunk refers to can be opened in addition to the patch file (three windows), and yanks/inserts can be done, all the while changing the patch automatically. I really think this is optimal to editing the raw diff. I guess I should have specified that its a unified patch on more than only two files thanks! -lev
aligning text to a certain column
how can I align text under and after the cursor position to a specific column number? and probably just as important, how can I find out which column number a cursor is at ;)? thanks! -lev
highlighting tabs
Can anyone suggest the best way to be able to highlight tabs (versus softtabs) selectively? meaning, at the push of a button I can have that feature turned on, and pressing it again turns it off - all the while not messing with my search buffer? thanks! -lev
Re: highlighting tabs
On Dec 1, 2006, at 4:53 PM, Yakov Lerner wrote: On 12/2/06, Lev Lvovsky [EMAIL PROTECTED] wrote: Can anyone suggest the best way to be able to highlight tabs (versus softtabs) selectively? meaning, at the push of a button I can have that feature turned on, and pressing it again turns it off - all the while not messing with my search buffer? :exe set listchars=tab:\xbb\xb7,trail:\xb7 or set listchars=tab:»·,trail:· :set list map f2 :set list!cr Yakov perfect, thank you! without looking a gift horse in the mouth, any way I can add color to that? thanks! -lev
clearing out an appended-to register
So I just discovered the wonders of being able to append to named registers - how though, do I then clear them out once I'm done with their contents? thanks! -lev
Re: clearing out an appended-to register
On Nov 9, 2006, at 9:45 AM, Tim Chase wrote: It's helpful to understand that the uppercase and lowercase registers are exactly the same place of storage. Uppercase just instructs Vim to append rather than overwrite any preexisting contents. :help :let-register :help quote_alpha :help quote Ah, that helps a lot, I figured they'd be different. thanks! -lev
path is changing mysteriously...
For some reason, with the many buffers that I have open, the path that a particular file takes, is instead of the initial directory where I started from (which is what I want), the directory that the file resides in. Trying :cd, or :lcd only temporarily changes it, and in a few seconds it changes back to the directory that the file actually resides in - what's going on? thanks! -lev
search visual block
Is it possible to search for a string by selecting that string in visual mode? Meaning, if I highlight something, and then want to search for that thing which is highlighted in the rest of the doc? otherwise, is there a way to copy that string so that I can later put it into the :/ command? thanks! -lev
Re: search visual block
On Oct 17, 2006, at 4:36 PM, David Thompson wrote: Why go to the trouble of highlighting it? Have you discovered the * key? Just press the * key while in normal mode and vim searches for the word under the cursor. I have indeed, very useful, however this is for multiple words separated by spaces. -lev
cursor moves back with ESC
Hello, I've never actually figured out why upon after typing in insert mode, the cursor moves back one character to the left after pressing escape. What's the reason behind this, and is there any way to turn it off? thanks! -lev
Re: cursor moves back with ESC
On Oct 16, 2006, at 10:31 AM, Charles E Campbell Jr wrote: Seems a reasonable choice, to me. Any choice would be arbitrary. Now, to turn it off: don't use insert. Use append. if you mean 'a' as opposed to 'i' for the modes, it still does the same thing in my version. thanks, -lev
Re: cursor moves back with ESC
On Oct 16, 2006, at 4:33 PM, Peter Hodge wrote: You can also try: inoremap ESC ESCl which will work a little quicker in a terminal Vim. works great, thanks! -lev
automatically appending options to vimrc?
for the lazy, is there any way to automatically append vim options to the ~/.vimrc file? thanks :) -lev
Re: automatically appending options to vimrc?
cool, thanks for the help guys! -lev On Aug 28, 2006, at 11:31 AM, Tim Chase wrote: for the lazy, is there any way to automatically append vim options to the ~/.vimrc file? I presume that there are select options that you want to preserve. You could do something like this *untested* scriptlet (be sure to back up your vimrc beforehand...perhaps your whole computer...I take no responsibility if it crashes, burns, kicks your dog, eats your dinner, wrecks your car, elopes with your daughter, or steals your spouse) :redir @a :sil! set ts? sw? et? :redir END :let @a=substitute(@a, '\n', ' ', 'g') :new :put='set '[EMAIL PROTECTED] :w! $HOME/.vimrc :q! The 2nd line allows you to specify which options interest you. You may not care to save most options. It then carte-blanche dumps the options at the end of your vimrc. Whether this is what you want, YMMV. It doesn't try to scan through your vimrc for pre-existing settings as such, and change them...thus you'll end up with accruing cruft in your vimrc every time you use it. It should be fairly wrappable in a script/function/mapping to allow you to reuse it as needed. Just an idea... :) -tim
Re: window split from tag?
On Aug 24, 2006, at 12:49 PM, Charles E Campbell Jr wrote: Does this only work horizontally? Seems that there is limited ctrl-w vertical functionality. :vert sta word does a vertical split. You may define a mapping to do that in your .vimrc if you wish. ahh, perfect! the vert was what I was looking for! thanks, -lev
reopen?
assuming a file has been changed underneath vim, and I know about it, how can I reopen that file replacing the current file's buffer contents? thank you! -lev
previous buffer?
In regards to moving around buffers, is there any way to move between the last two buffers that were worked on? Meaning, if I have 10 files in buffers, and I'm working on buffer 5, switch to buffer 8, how can I switch back to buffer 5 without knowing its number (but knowing it was the last buffer I was editing)? thanks! -lev
window split from tag?
When following a tag through to the file where it's defined, is there any way to get vim to keep the existing window open, and simply open (vertically and/or horizontally) a new window as opposed to replacing the existing one? Also, somewhat related - I'm using the TagList plugin, and I'd like to have all windows but the tag list (which I'd like to keep narrow) at a specific width - rtfm pointers appreciated ;) thanks! -lev
Re: window split from tag?
On Aug 8, 2006, at 1:04 PM, Charles E Campbell Jr wrote: Lev Lvovsky wrote: When following a tag through to the file where it's defined, is there any way to get vim to keep the existing window open, and simply open (vertically and/or horizontally) a new window as opposed to replacing the existing one? With cursor atop the word: ctrl-w ] From command line: :sta word Does this only work horizontally? Seems that there is limited ctrl-w vertical functionality. thanks, -lev
buffer history
can vim keep track of each file's undo history, so that when switching between two or more files, the undo history is reloaded, or does one need to write the history to a file before switching? thanks! -lev
Re: can vim do this?
Thanks everyone for your help on this! The advice below seems to be all that I need. I forgot to ask one last thing - if I'm searching for something in a text file, can I have vim select every existing string that matches up to what I've typed at that point? Meaning, if the first two characters of what I'm looking for are va, all va gets highlighted as I type, then when I add ria to that, all varia strings get highlighted. thanks! -lev On Aug 3, 2006, at 7:25 PM, Benji Fisher wrote: This has been requested before, but it is not implemented and I do not expect that it will be added any time soon. The problem is how to define a region, when lines can be added, removed, or deleted at will. If you have a satisfactory answer to this question, you can fake a region-undo as follows. Delete the region to be changed; undo levels, or however many you choose; yank the same region; redo levels; paste. If you have a simple description of what constitutes a region, you could define a mapping or menu item to do this conveniently.
Re: can vim do this?
Thanks Tim - is that to say that this functionality doesn't exist in vim? -lev On Aug 4, 2006, at 10:47 AM, Tim Chase wrote: :help incsearch :help hls Using 'incsearch' doesn't highlight them all as you type, just the current match. However, with 'hls' set, once you hit enter, it will highlight all the items it found...not quite the behavior you described, but close. -tim
Re: can vim do this?
On Aug 4, 2006, at 10:56 AM, Tim Chase wrote: Thanks Tim - is that to say that this functionality doesn't exist in vim? It doesn't exist exactly as you describe. You can highlight all hits of the thing actually searched for (:set hls), and you can highlight the current word incrementally as you type the search (:set incsearch), but I don't think there's any native method by which it will highlight all hits incrementally. cool - just tried the method you suggested, seems to be a good approximation of the functionality (it doesn't highlight the rest of them until -enter-). thanks! -lev
can vim do this?
I recently started work at a company where the predominant text editor happens to be emacs. I've been using vim for a while now, though only recently started getting into the more advanced functionality beyond simple editing (highlighting, folding, tags etc...). Watching one of my co-workers with emacs is pretty fun, as he does things fairly quickly - I asked him what his most common emacs actions were, to see how I could do them in vim: * autocomplete - say that I've declared a constant variable in Perl named MY_CONSTANT, later, to have the editor fill it in, I type in MY_, and some other key-stroke, and CONSTANT gets typed in for you * goto when compiling - when compiling with make for example, and there is a problem in the code identified by a line, can vim somehow know to go to that line? this would be especially useful with 'make' * rectangular cut/pastes - if I have a column (multi-row) of text that I'd like to paste on several lines, can I do this without a regex? * ctags variable name references - assuming I'm using ctags, how can I replace the name of a variable throughout my code base? * regional undo - can I select a region, and perform an undo for all of the changes only in that region? * cvs/diff mode - what support does vim offer for these two apps, internal to the editor. I'll be glad to RTFM for all of these things, however I don't know where to look them up - any pointers would be appreciated! thanks, -lev