RE: Is there a xml formatter?
Op woensdag 30 mei 2007, schreef wangxu: I want to have this function: formatting my xml file automatically. or,indent xml element and attributes. is there any plugin like this? thanks! Well, if you're on a unix machine with xmllint installed, you could do the following: setlocal equalprg=xmllint\ --format\ - and then use gg=G to reformat the entire document. I don't have much luck with that technique. If xmllint believes the xml isn't quite valid then it screws it up with error messages and such. I wrote this little function to do it for me. Works well enough. Basically, I either run the command :FormatSGML Or, visually select some rows and run the command. function! Format_SGML() range Add a new line to the bottom of the mark to be removed later call cursor(a:lastline,1) put ='' silent! exec ma z Add a new line above the mark to be removed later call cursor(a:firstline,1) put! = '' silent! exec ma y Put each tag on a newline exec line('y).','.line('z).'s/\s*/\r/ge' Reformat using Vim's indenter call cursor(line('y),1) exec 'normal! '.(line('z)-line('y)+1).'==' Delete the additional lines added silent! exe norm! 'ydd'zdd endfunction command! -range=% -nargs=0 FormatSGML line1,line2call Format_SGML() At least you have some additional options now. HTH, Dave
Re: mouse-wheel scrolling with vertically split windows
What happens if you start vim using: Gvim -u NONE -U NONE And try again? If it doesn't happen sounds like possibly a plugin issue (or compability mode). But from a code perspective I don't think a plugin could affect Vim in this way. Dave - Original Message - From: Waters, Bill [EMAIL PROTECTED] Sent: 05/14/2007 02:51 PM EST To: David Fishburn [EMAIL PROTECTED]; vim@vim.org Subject: RE: mouse-wheel scrolling with vertically split windows It happens every time for me. I just have to open a file and then do a :vsplit. It really shows up and is annoying with using the taglist plugin. Do you know of a command for the Edit-Global Settings-Toggle Right Scroll Bar option? -Original Message- From: David Fishburn [mailto:[EMAIL PROTECTED] Sent: Monday, May 14, 2007 2:42 PM To: Waters, Bill Subject: RE: mouse-wheel scrolling with vertically split windows -Original Message- From: Waters, Bill [mailto:[EMAIL PROTECTED] Sent: Monday, May 14, 2007 3:23 PM To: vim@vim.org Subject: mouse-wheel scrolling with vertically split windows (I am using gVim 7.1 in Windows XP.) If I do a :vsplit, I end up with a scroll bar on the right for the right window and a scroll bar on the left for the left window. When I use my mouse wheel to scroll, the left window scrolls, regardless of which window is selected. If I do a Edit-Global Settings-Toggle Right Scroll Bar, the right scroll bar disappears. But I am able to mouse-wheel scrolling based on which window is selected. Is there a way to keep both scroll bars, and be able to mouse-wheel scroll based on which window is selected? Unfortunately, this has been reported since the betas of 7.0. Many of us on Windows are running into this, but I cannot reliably come up with a series of steps to reproduce the issue to hand over to Bram. Can you reliably reproduce this so that it will happen on other peoples machines? Dave
Re: mouse-wheel scrolling with vertically split windows
Yes, with gvim 7.1 on WinXP SP2 I get the same behaviour. gvim -u NONE -U NONE some_file :vsp C-W C-W Use the wheel to scroll. Only the left window will scroll. Whoa, I was just trying this again when I discovered if you hold down the CTRL key you get different behaviour. CTRL-wheel scroll will do the right side window. Crap, now I restarted Vim and it will scroll both windows again as it should. So after it not doing it 5 restarts in a row, once I held down the CTRL button and scrolled (which worked). Now everytime I restart Vim it works flawlessly. Walter, what happens when you try the same thing? Dave - Original Message - From: Waters, Bill [EMAIL PROTECTED] Sent: 05/14/2007 05:56 PM EST To: David Fishburn; vim vim@vim.org Subject: RE: mouse-wheel scrolling with vertically split windows What happens if you start vim using: Gvim -u NONE -U NONE Same results. I start gvim, do a :vsplit, and the mouse wheel will only scroll the left window, even when the right window is selected. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, May 14, 2007 5:45 PM To: Waters, Bill; vim Subject: Re: mouse-wheel scrolling with vertically split windows What happens if you start vim using: Gvim -u NONE -U NONE And try again? If it doesn't happen sounds like possibly a plugin issue (or compability mode). But from a code perspective I don't think a plugin could affect Vim in this way. Dave - Original Message - From: Waters, Bill [EMAIL PROTECTED] Sent: 05/14/2007 02:51 PM EST To: David Fishburn [EMAIL PROTECTED]; vim@vim.org Subject: RE: mouse-wheel scrolling with vertically split windows It happens every time for me. I just have to open a file and then do a :vsplit. It really shows up and is annoying with using the taglist plugin. Do you know of a command for the Edit-Global Settings-Toggle Right Scroll Bar option? -Original Message- From: David Fishburn [mailto:[EMAIL PROTECTED] Sent: Monday, May 14, 2007 2:42 PM To: Waters, Bill Subject: RE: mouse-wheel scrolling with vertically split windows -Original Message- From: Waters, Bill [mailto:[EMAIL PROTECTED] Sent: Monday, May 14, 2007 3:23 PM To: vim@vim.org Subject: mouse-wheel scrolling with vertically split windows (I am using gVim 7.1 in Windows XP.) If I do a :vsplit, I end up with a scroll bar on the right for the right window and a scroll bar on the left for the left window. When I use my mouse wheel to scroll, the left window scrolls, regardless of which window is selected. If I do a Edit-Global Settings-Toggle Right Scroll Bar, the right scroll bar disappears. But I am able to mouse-wheel scrolling based on which window is selected. Is there a way to keep both scroll bars, and be able to mouse-wheel scroll based on which window is selected? Unfortunately, this has been reported since the betas of 7.0. Many of us on Windows are running into this, but I cannot reliably come up with a series of steps to reproduce the issue to hand over to Bram. Can you reliably reproduce this so that it will happen on other peoples machines? Dave
RE: Vim OLE and C# - Solution
-Original Message- From: David Fishburn [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 1:12 PM To: vim@vim.org Subject: Vim OLE and C# I have the following VB code: Dim Vim As Object Set Vim = CreateObject(Vim.Application) Vim.SendKeys ESC:e I want to do the samething in C# (of which my skills are quite weak). I have the following: object Vim; Vim = Activator.CreateInstance(Type.GetTypeFromProgID(Vim.Application)); Vim.SendKeys(ESC:e ); Most of that was grabbed from Google. Compiler error: Error 3 'object' does not contain a definition for 'SendKeys'... I am assuming I must strongly type the object, so I tried: Vim.Application Vim; Error 3 The type or namespace name 'Vim' could not be found (are you missing a using directive or an assembly reference?) ... Any suggestions? Once I get this working I will get it added under this section in the Vim help: :h ole-activation Bram, I managed to get this working. If you could update ole-activation section of the help, it might help others. Add a reference to VIM in your project. You need to select VIM Ole Interface from the COM tab. Add using Vim; to the top of the file. Then the following code works. Vim.Vim vimobj = new Vim.Vim(); vimobj.SendKeys(:enew\n); Dave
RE: delete buffer questions
-Original Message- From: alebo [mailto:[EMAIL PROTECTED] Sent: Monday, April 09, 2007 2:51 PM To: [EMAIL PROTECTED] Subject: delete buffer questions I need som things explained about the automatic delete buffers 1-9. When I delete rows using dd the deleted text is put in the default buffer, using dd again will put it in 1 and so on. But if I use another kind of deletion like dw, I couldnt fetch it from the buffers 1-9, only from the first unnamed buffer. Why is this so and which kind of delete operations are supported in the delete buffers? You might want to try my plugin: YankRing.vim : Maintains a history of previous yanks and deletes http://www.vim.org/scripts/script.php?script_id=1234 Vim already maintains a list of numbered registers containing the last 9 deletes. These previous deletes can be referenced using [register]p, so 1p will paste the last delete, 2p the 2nd last delete. For more information see |quote_number|. Vim does not provide any mechanism to reference previous yanked text. In Emacs this feature is called the kill ring. The yankring plugin allows the user to configure the number of yanked and deleted text. A split window can be used to choose which element(s) from the yankring you wish to paste. Alternately after text has been pasted (using p), it can be replaced with a previous value from the yankring with a single key stroke. A tutorial is included to take you through the various features of the plugin. After you have installed the plugin just run: :h yankring.txt :h yankring-tutorial ... Pressing F11 (default key) will bring up the list of all recent yanks and deletes. From there you can choose which one you need to paste. HTH, Dave
Setting font in console vim
Vim 7 WinXP I can set the font in gvim using: Set guifont= But how do I do the same with console vim? Help, helpgrep and searching this list hasn't found me an aswer. TIA, Dave
Vim OLE and C#
I have the following VB code: Dim Vim As Object Set Vim = CreateObject(Vim.Application) Vim.SendKeys ESC:e I want to do the samething in C# (of which my skills are quite weak). I have the following: object Vim; Vim = Activator.CreateInstance(Type.GetTypeFromProgID(Vim.Application)); Vim.SendKeys(ESC:e ); Most of that was grabbed from Google. Compiler error: Error 3 'object' does not contain a definition for 'SendKeys' ... I am assuming I must strongly type the object, so I tried: Vim.Application Vim; Error 3 The type or namespace name 'Vim' could not be found (are you missing a using directive or an assembly reference?)... Any suggestions? Once I get this working I will get it added under this section in the Vim help: :h ole-activation Thanks, Dave
RE: bracket completion
-Original Message- From: Karl Guertin [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 03, 2007 6:42 AM To: vim@vim.org Subject: Re: bracket completion On 3/31/07, Greg Fitzgerald [EMAIL PROTECTED] wrote: Anyone know of a way to achieve bracket completion? I've been sitting on a plugin that does this for a month or so. The main difference between my plugin and the rest of the options here is that I do the completion without breaking history or repeat. Freshly uploaded to vim.org: http://www.vim.org/scripts/script.php?script_id=1849 This plugin was pared down from a larger script that included a set of less reusable mappings, so let me know if there's a problem. Thanks for the script Karl. Not a problem, but a suggestion. Could you make an option to ignore the autoclose if there is a following character. If I am typing a line: If ( -- here I want the autoclose. If I have this line: If (something_is_already_here) ^ And I place my cursor on the i in something I do not want to add the closing brace since generally if I am inserting that the closing brace will be placed at the end of the line (or something). Just a preference, which is why I was hoping it could be an option. So only complete when the ([[ is the last item on the line (as I am typing). Thanks, Dave
RE: Reannouncing vimplugin: A vim plugin for Eclipse
-Original Message- From: Sebastian Menge [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 1:12 PM To: David Fishburn Cc: vim@vim.org Subject: RE: Reannouncing vimplugin: A vim plugin for Eclipse Am Freitag, den 30.03.2007, 12:24 -0400 schrieb David Fishburn: The README indicates: The only external dependency is a functional gvim compiled with netbeans support. But your email says: Microsoft users have to use the cygwin version of vim. Can you confirm which is required. Why would the cygwin version of Vim be required it is just talks to it over a protocol? I have cygwin installed, but I have never actually compiled an actual cygwin version of Vim, I just use the standard win32 version which I compile myself. for the netbeans-prototype you need gvim. It fires up an external gvim and talks with it via a socket. I havent tested that under windows. I followed these directions: http://vimplugin.svn.sourceforge.net/svnroot/vimplugin/branches/vimclient/do c/README Which implemented the gvim via the NetBeans interface. for the UI-integration (simple textbased vim inside eclipse) you need cygwin. Is there separate instructions for how to setup the integrated one? Thanks, Dave
RE: Reannouncing vimplugin: A vim plugin for Eclipse
-Original Message- From: Sebastian Menge [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 11:49 AM To: vim@vim.org; vim-dev@vim.org Subject: Reannouncing vimplugin: A vim plugin for Eclipse Hi all After a long time of no activity we restarted the work on a small plugin to embed vim into the Eclipse IDE. See http://vimplugin.sf.net and http://sf.net/vimplugin for details. If you are familiar with eclipse, there is an update site http://vimplugin.sf.net/update with the latest build. Microsoft users have to use the cygwin version of vim. We also have a prototype of an eclipse-plugin that talks to a gvim that acts as netbeans server (:help netbeans). More detailed info on that can be found here: http://vimplugin.svn.sourceforge.net/svnroot/vimplugin/branche s/vimclient/doc/README Both projects are standard eclipse projects that can be checked out anonymously via subversion (you need subclipse then): http://vimplugin.svn.sourceforge.net/svnroot/vimplugin/trunk/vimplugin http://vimplugin.svn.sourceforge.net/svnroot/vimplugin/branche s/vimclient This time we'll keep an better eye on community building: So please try it out and give some feedback. On http://sf.net/projects/vimplugin you can find forums and of course mailinglists. Sebastian, fantastic I have been wanting this for sometime. I was writing up an email indicating I need some more direction, but I see that was provided in the README via SVN. I will try this out (I don't use Eclipse that often, but I do use it for Perl, PHP and Java especially when I need an integrated debugger. The README indicates: The only external dependency is a functional gvim compiled with netbeans support. But your email says: Microsoft users have to use the cygwin version of vim. Can you confirm which is required. Why would the cygwin version of Vim be required it is just talks to it over a protocol? I have cygwin installed, but I have never actually compiled an actual cygwin version of Vim, I just use the standard win32 version which I compile myself. Thanks, Dave
Building gvim creates invalid executable
This has been happening for a little while (at least a month). I have been routinely building Vim on Win XP SP2 for a couple of years now. Now when I build it and try to run it I get: C:\OpenSrc\vim7\srcgvim.exe The system cannot execute the specified program. Unforutunately, the error message does not give me much to go on. Running gvimd yields: C:\OpenSrc\vim7\srcgvimd.exe The system cannot execute the specified program. So that doesn't help either. I can build and successfully run the console versions: VIM - Vi IMproved version 7.0.224 :ver VIM - Vi IMproved 7.0 (2006 May 7, compiled Mar 30 2007 19:57:56) MS-Windows 32 bit console version Included patches: 1-224 Compiled by [EMAIL PROTECTED] ... I grabbed the last part of the build of gvim.exe, it might shed some light: if_cscope.c netbeans.c Generating Code... cl -c /W3 /nologo -D_MT -MT -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT _CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_XPM_W32 -DWINVER=0x0400 -D_WIN32_WINNT=0 x0400 /Fo.\ObjGOLY/ /Ox -DNDEBUG -DFEAT_OLE -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DD YNAMIC_GETTEXT -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\python24.d ll\ -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\perl58.dll\ -DFEAT_BIG /Zi /Fd.\ObjGOLY/ if_ole.cpp if_ole.cpp cl -c /W3 /nologo -D_MT -MT -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT _CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_XPM_W32 -DWINVER=0x0400 -D_WIN32_WINNT=0 x0400 /Fo.\ObjGOLY/ /Ox -DNDEBUG -DFEAT_OLE -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DD YNAMIC_GETTEXT -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\python24.d ll\ -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\perl58.dll\ -DFEAT_BIG /Zi /Fd.\ObjGOLY/ version.c version.c link /RELEASE /nologo /subsystem:windows /incremental:no /nodefaultlib:l ibc -out:gvim.exe .\ObjGOLY\buffer.obj .\ObjGOLY\charset.obj .\ObjGOLY\diff.ob j .\ObjGOLY\digraph.obj .\ObjGOLY\edit.obj .\ObjGOLY\eval.obj .\ObjGOLY\ex_c mds.obj .\ObjGOLY\ex_cmds2.obj .\ObjGOLY\ex_docmd.obj .\ObjGOLY\ex_eval.obj .\ObjGOLY\ex_getln.obj .\ObjGOLY\fileio.obj .\ObjGOLY\fold.obj .\ObjGOLY\getc har.obj .\ObjGOLY\hardcopy.obj .\ObjGOLY\hashtab.obj .\ObjGOLY\main.obj .\Ob jGOLY\mark.obj .\ObjGOLY\mbyte.obj .\ObjGOLY\memfile.obj .\ObjGOLY\memline.ob j .\ObjGOLY\menu.obj .\ObjGOLY\message.obj .\ObjGOLY\misc1.obj .\ObjGOLY\mis c2.obj .\ObjGOLY\move.obj .\ObjGOLY\normal.obj .\ObjGOLY\ops.obj .\ObjGOLY\o ption.obj .\ObjGOLY\os_mswin.obj .\ObjGOLY\os_win32.obj .\ObjGOLY\pathdef.obj .\ObjGOLY\popupmnu.obj .\ObjGOLY\quickfix.obj .\ObjGOLY\regexp.obj .\ObjGOL Y\screen.obj .\ObjGOLY\search.obj .\ObjGOLY\spell.obj .\ObjGOLY\syntax.obj . \ObjGOLY\tag.obj .\ObjGOLY\term.obj .\ObjGOLY\ui.obj .\ObjGOLY\undo.obj .\Ob jGOLY\window.obj .\ObjGOLY\vim.res .\ObjGOLY\gui.obj .\ObjGOLY\gui_beval.obj .\ObjGOLY\gui_w32.obj .\ObjGOLY\os_w32exe.obj .\ObjGOLY\if_ole.obj .\ObjGOLY\ if_perl.obj .\ObjGOLY\if_perlsfio.obj .\ObjGOLY\if_python.obj .\ObjGOLY/if_c scope.obj .\ObjGOLY/netbeans.obj .\ObjGOLY/xpm_w32.obj .\ObjGOLY\version.obj ad vapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib oldnames.lib ke rnel32.lib gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell3 2.lib /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib user32.lib /node faultlib:python24.libWSock32.lib C:\download\OpenSrc\vim\XPM_support_for_Net beans\xpm-4.2.0\lib\libXpm.lib /PDB:gvim.pdb -debug cl /nologo -DNDEBUG vimrun.c vimrun.c cl /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib ole32.li b advapi32.lib uuid.lib dosinst.c if exist install.exe del install.exe ren dosinst.exe install.exe cl /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib uninstal.c cd xxd nmake /NOLOGO -f Make_mvc.mak cl /nologo -DWIN32 xxd.c xxd.c cd .. cd GvimExt nmake /NOLOGO -f Makefile cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -DWIN32 -D_WI N32 -W3 -D_WIN32_IE=0x0400 -DWINVER=0x0400 -DFEAT_GETTEXT -D_MT -D_DLL -MD gvim ext.cpp gvimext.cpp Rc /r -DWIN32 -D_WIN32 -DWINVER=0x0400 gvimext.rc link /INCREMENTAL:NO /NOLOGO -dll -def:gvimext.def -base:0x1C00 -ou t:gvimext.dll gvimext.obj gvimext.res ole32.lib uuid.lib oleaut32.lib kernel32.l ib ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspo ol.lib shell32.lib comctl32.lib gvimext.def(4) : warning LNK4017: DESCRIPTION statement not supported for the ta rget platform; ignored Creating library gvimext.lib and object gvimext.exp cd .. Any suggestions? TIA, Dave
RE: gVim and Cygwin
-Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Friday, March 30, 2007 6:42 PM To: Charles E Campbell Jr Cc: Waters, Bill; vim@vim.org Subject: Re: gVim and Cygwin Charles E Campbell Jr wrote: 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 Make_cyg.mak uses Cygwin tools to (cross-) compile a native-Windows Vim or gvim which doesn't need Cygwin to run and doesn't understand the POSIX paths of cygwin. It won't interface easily with Cygwin bash (or any other Cygwin program for that matter). To compile a Unix-like Vim for Cygwin you must use the top-level Makefile or the src/Makefile which will invoke a configure step. If configure finds the necessary headers and libraries it may compile a GUI version of Vim, which will need Cygwin to run, and X11 to display a GUI. Hmm, based on your response and Gary's (libncurses-devel) and this post: http://www.cygwin.com/ml/cygwin/2003-06/msg00886.html I ran the following: cd /c/OpenSrc/vim7/src ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --libexecdir='$(sbindir)' \ --localstatedir=/var \ --datadir='$(prefix)/share' \ --enable-multibyte \ --without-x \ --enable-gui=no This results in: ./configure: line 3: $'\r': command not found auto/configure: line 11: $'\r': command not found auto/configure: line 19: syntax error near unexpected token `elif' auto/configure: line 19: `elif test -n ${BASH_VERSION+set} (set -o posix) 'dev/null 21; then ./configure: line 6: $'\r': command not found ./configure: line 11: syntax error: unexpected end of file I have never tried this before, I am wondering if it is related to dos line endings? I pulled the source from a win32 SVN client. It is the same directory I compile for win32 from. Any suggestions? Thanks, Dave
Re: Matchit with PL/SQL
(Had to top post) I am the author of ftplugin/sql.vim which defines b:match_words. It was set this way so that the following will not match. begin end if I didn't realize plsql allowed your case. I think this could be addressed by saying the end cannot be followed by the known end statements like: End if End case Could you put together a conslusive list of plsql keywords that begin with end and I can update the script. I will probably make it an option that can be set (with on as the default) in case this breaks other dbs syntax. Dave - Original Message - From: [EMAIL PROTECTED] Sent: 03/21/2007 01:35 PM To: vim@vim.org Subject: Matchit with PL/SQL Hello. I have just discovered the matchit plugin and have been using it to navigate some Oracle PL/SQL scripts. My issue is as follows. If I have a script containing: create or replace procedure foo as begin null ; end ; then by placing the cursor on the word begin and hitting % the cursor jumps to the word end. Great, thats what I want. But if the script is create or replace procedure foo as begin null ; end foo ; i.e. it names the procedure after the closing end, then the above navigation doesnt work. Im loathe to change b:match_words as it looks a bit hairy, but if someone has already addressed this, or can suggest a workaround, Id be grateful. Thanks.
RE: replace upper-case with lower-case
-Original Message- From: Bin Chen [mailto:[EMAIL PROTECTED] Sent: Thursday, March 08, 2007 9:44 PM To: vim@vim.org Subject: replace upper-case with lower-case I want to replace below scheme within one command, that is left the capitalization the same but replace the word. SS-SS ss-ss For all the people that responded on this thread, you may want to look at this script which I think is great: KeepCase - Match mixed case while substituting /*{{{*/ Author: Michael Geddes http://www.vim.org/scripts/script.php?script_id=6 Usage: Using KeepCase or KeepCaseSameLen defined here, do a substitution like this: %s/\u\old_word\/\=KeepCaseSameLen(submatch(0), 'new_word')/g * KeepCase( original_word , new_word ) returns the new word maintaining case simply uses heuristics to work out some different common situations given NewWord Word -- Newword WORD-- NEWWORD word-- newword WoRd-- NewWord woRd-- newWord HTH, Dave
RE: How to paste without replace the content in buffer
-Original Message- From: Peng Yu [mailto:[EMAIL PROTECTED] Sent: Saturday, March 10, 2007 10:38 PM To: vim@vim.org Subject: How to paste without replace the content in buffer Hi, Suppose I want to replace string1 with string2 in a file from vim. 1. Highlight string1 (in visual mode) and then type y. 2. Highlight string2 (in visual mode) and then type p. However, the problem with the above procedure is that string2, instead of string1, is in buffer. That is if I highlight string3 and then type p, string3 will be replaced with string2 instead of string1. I'm wondering if there is any way to avoid change the content in the buffer? You might want to consider using one of my plugins: YankRing.vim : Maintains a history of previous yanks and deletes http://www.vim.org/scripts/script.php?script_id=1234 Vim already maintains a list of numbered registers containing the last 9 deletes. These previous deletes can be referenced using [register]p, so 1p will paste the last delete, 2p the 2nd last delete. For more information see |quote_number|. Vim does not provide any mechanism to reference previous yanked text. In Emacs this feature is called the kill ring. The yankring plugin allows the user to configure the number of yanked and deleted text. A split window can be used to choose which element(s) from the yankring you wish to paste. Alternately after text has been pasted (using p), it can be replaced with a previous value from the yankring with a single key stroke. A tutorial is included to take you through the various features of the plugin. After you have installed the plugin just run: :h yankring.txt :h yankring-tutorial The yankring can be interacted with in two ways: a GUI or via maps. ... More details and features to go with it. Have a look at the webpage for more details. HTH, Dave
RE: Help needed to : Start on the line where I left when I opened the file last time
Read http://vim.sourceforge.net/tips/tip.php?tip_id=80 , Restore cursor to file position in previous editing session. This tip does most of what I want thanks to the additional notes section. I have realized, this only returns us to the row we were on. Does anyone know if it is also possible to return the the row and column position? I am not sure if the column position is also stored within the viminfo file. TIA, Dave
RE: :wq vs ZZ
I wonder why some people use :wq instead of ZZ. Maybe they just don't know about ZZ? Obviously that's not the case with Bram. I added the following to my vimrc: Exit VIM, but prompt if any changes to save nnoremap ZX :conf qaCR I routinely have many files open at the sametime (hidden is set). So when I close Vim, I press ZX. Vim will prompt me for each and every buffer that was modified if I want to save. I like the prompt since I can decide quickly whether I want the file saved or not and not have to issue any further commands to find the next modified buffer. HTH, Dave
Using :g on folds
Vim 7 WinXP SP2 I have a file with folding enabled. What I would like to do is use something like this: :v/dave/d But I only want this to operate on folds. I can do this manually by moving to the fold and pressing V (linewise visual mode) followed by x to delete it. That deletes all lines within the fold. Not sure how to structure my command to do this operating over the entire file and just on folded contents. TIA, Dave
RE: Substitute tabs for specific column locations
-Original Message- From: Tim Chase [mailto:[EMAIL PROTECTED] Sent: Sunday, January 21, 2007 11:08 PM To: David Fishburn Cc: vim@vim.org Subject: Re: Substitute tabs for specific column locations So for each row, replace the tab with an appropriate number of spaces to ensure that column 2 (no matter the length of column 1) will always start in column 20. The same for column 3, but starting at column 25. This is my poor man's formatting utility. I can change the input in anyway I want (additional tabs or newline characters, strings and so on). I just cannot line it up appropriately before my plugin gets it to display it on the screen. I was hoping I could do 1 substitute command that would do something like this: s/\(.\{-}\)\t\(.\{-}\)\t\(.\{-}\)\t\n/\1\%20c\2\%25c\3\r/g You have to tweak the spacing yourself, manually-ish. Vim7 provides a repeat() function that, in earlier versions, you'd have to recreate yourself. Thus, you can do something like this one-liner (broken into several lines to make the parts more obvious) :%s/^\([^\t]*\)\t\([^\t]*\)\t\([^\t]*\)/\= matchstr(submatch(1).repeat(' ', 20), '^.\{20}'). matchstr(submatch(2).repeat(' ', 25), '^.\{25}'). submatch(3) As usual Tim, bang on. I realized this technique would not work for me since we are limited to the use of only 9 back references. I could do this in a loop, but I took a different approach and let the Perl code that generated the block in the first place take care of the formatting. Turned out pretty easy and fast using that approach. Thanks for the help. Dave
Substitute tabs for specific column locations
Vim 7 WinXP SP2 I have a string in this format: \nr1c1\tr1c2\tr1c3\t\nr2c1\tr2c2\tr2c3\t\nr3c1\tr3c2\tr3c3\t\n r1 = row 1 c1 = column 1 I also have this information and requirement: c1 should display at column 1 c2 should display at column 20 c3 should display at column 25 So for each row, replace the tab with an appropriate number of spaces to ensure that column 2 (no matter the length of column 1) will always start in column 20. The same for column 3, but starting at column 25. This is my poor man's formatting utility. I can change the input in anyway I want (additional tabs or newline characters, strings and so on). I just cannot line it up appropriately before my plugin gets it to display it on the screen. I was hoping I could do 1 substitute command that would do something like this: s/\(.\{-}\)\t\(.\{-}\)\t\(.\{-}\)\t\n/\1\%20c\2\%25c\3\r/g In other words, replace the tabs with a specified column position. But looking at the help the \%##c is only used for matching, not the replacement part (a simple test confirmed). c1, c2, c3 data can all be different lengths for each row, so I can just added a preset number of spaced. Does anyone have any suggested approaches? TIA, Dave
Returning perl hashes
Vim 7 WinXP SP2 Is it possible to return a Perl hash as a Vim List or Dictionary? I am pretty new to Perl but need it's features for my extension. I need to return rows and columns of data which is perfect for a Vim List or Dictionary. Thanks, Dave
Perl plugin example
I just searched through the help and didn't find anything to get me started. I have written many Vim plugins using VimL, but in this case I need to write one using Perl. I also want to use Perl's DBI interface. Does anyone have a perl/vim plugin that I can use as a template to get me started? TIA, Dave
RE: Wrapping a selection in tags
I'd like to: 1. Select some text 2. Hit a key sequence such as ;t 3. Be prompted for a tag (I'll input something like 'b' or 'h1') 4. The text selection will be wrapped in -- say -- btext selection/b I created a tip for this: Tip #346: Wrap text in HTML/XML tags after prompting for the tag name http://www.vim.org/tips/tip.php?tip_id=346 With some refinements at the bottom (plus a pile of SPAM!!). HTH, Dave
RE: Enclosing current line in HTML tags
What's the quickest way to enclose the current line the cursor is on in, say, li/li tags? Wow, 2 emails in the same day. I created a tip for this: Tip #346: Wrap text in HTML/XML tags after prompting for the tag name http://www.vim.org/tips/tip.php?tip_id=346 With some refinements at the bottom (plus a pile of SPAM!!). What I did was if the visually selected text spanned more than 1 line I added: something Akj lkjaf kjdsflj fjalf js Akj lkjaf kjdsflj fjalf js /something But if the visually selected text is 1 line then I do: Akj lkjaf somethingkjdsflj/something fjalf js HTH, Dave
Pasteboard - Perl clipboard
Calvin Waterbury asked on Sunday, October 01, 2006 3:04 PM for a pasteboard feature. This is a feature that automatically captures clipboard content to a text file that has been designated as the Pasteboard. Perhaps an example would clarify. If I had this feature implimented in VIM I would do the following: - Open a text ed window - Set it to be the Pasteboard - Switch to whatever window I want to capture (webpage text like a recipe, another text file, etc.) --- [1]Select the first text item --- [2]Copy to clipboard --- [3]Repeat [1] and [2] until done. - Go back to the Pasteboard window and I would see all of my captures neatly separated by whatever separator (a line of hyphens, equal signs, etc.) I had set in the Options. - Turn off the Pasteboard - Save the file. [Tony: OP is asking about copying to a VIM buffer stuff fed to the MS Windows clipboard _not_ from other VIM buffers but from non-vim applications.] One way to implement this feature is by using VIM's support for perl and the Win32::Clipboard module. I was just looking at this possibility. It would go well with the YankRing plugin: http://www.vim.org/scripts/script.php?script_id=1234 If someone wrote a very simple example of a Perl Vim plugin that monitors the clipboard I could probably integrate that with the YankRing history. Would this also work for the X11 clipboard? Dave
RE: dbext omni-completion issue
I am trying to get the (magnificent, by the way) dbext plugin to give me context-sensitive omni-completion for table/stored procedure names. Thank you for the praise. This plugin contains functions/mappings/commands to enable Vim to access several databases. Currently Mysql, PostgreSQL, Ingres, Oracle, Sybase Adaptive Server Anywhere, Sybase Adaptive Server Enterprise, Microsoft SQL Server, DB2, Interbase and SQLite are supported. For those of you interested in reading more about dbext: http://www.vim.org/scripts/script.php?script_id=356 It doesn't unfortunately get very far, and when it tries to generate the dictionary files, I get an error: dbext: Incorrect syntax near '|' Msg 102, Level 15, State 1, Server VANRENSBURGA, Line 2 Followed by: dbext:Failed to create table dictionary I am using a local MS SQL Server 2005 database. Other functionality, such as executing sql statements work fine. I have two default configurations set up in my vimrc, for local (development, on localhost) and a live database (also sql server). Thank you for reporting the issue. I have corrected the problem (and tested it) and have uploaded a new version 4.20 to the website. Enjoy. Dave
RE: Upcase every keyword while editing
-Original Message- From: Thomas Michael Engelke [mailto:[EMAIL PROTECTED] Sent: Thursday, November 16, 2006 10:42 AM To: vim-Mailingliste Subject: Upcase every keyword while editing Hello! I am looking for a way to mimic a functionality I've seen in the editor ED4Win (http://www.softasitgets.com/). What I want to do is to automagically upcase every written word that is considered a keyword. I program in Progress 4GL and use the syntax file from the gvim standard distribution. Theoretically, in my understanding of the problem, I would need to write a function to check the word before the cursor against the keywords list and map this one to something. Usually, I leave the boundaries of a keyword by using either space, tab, :, ,, enter or .. So I would have to map this function to every of those keys in insert mode. That is exactly why I wrote: SrchRplcHiGrp - Search and replace based on a syntax highlight group http://www.vim.org/script.php?script_id=848 Put your cursor on the word highlighted the colour that you want uppercased. :SRChooseHiGrp Or :SRChooseHiGrp! Visually select the range you want (or ggVG for whole file): :','SRHiGrp The defaults selected will uppercase the words. I wrote it mainly since I work with SQL and like the keywords uppercased. But you can do anything with Vim's regex to the matches. HTH, Dave
RE: about fonts : from ubuntu to windows
-Original Message- From: John Degen [mailto:[EMAIL PROTECTED] Sent: Friday, October 27, 2006 9:25 AM To: victor NOAGBODJI; vim@vim.org Subject: Re: about fonts : from ubuntu to windows - Original Message From: victor NOAGBODJI [EMAIL PROTECTED] To: vim@vim.org Sent: Friday, October 27, 2006 2:06:56 PM Subject: about fonts : from ubuntu to windows Hello all, I'm quite a newbie to Vim. I've been using it under ubuntu dapper. With moria color plugin, the font was nice, easy to read. I think it's the default system font of ubuntu or something... Now under windows xp. It's bold, hard to read. It's the default system font. Now how can I change that to a nice clean, easy to read font? thanks I like Bitstream Vera Sans Mono (use :set guifont=Bitstream_Vera_Sans_Mono:h14:cANSI) you can download the font at http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html I add the following to my vimrc file: Change default FONT Set personal font, here is a review of different ones: http://www.kuro5hin.org/story/2004/12/6/11739/5249 Bitstream Vera Fonts, downloaded from: http://www.gnome.org/fonts/ if has('win32') if filereadable(expand('$SystemRoot').'/fonts/Vera.ttf') For normal 11 point font set guifont=Bitstream_Vera_Sans_Mono:h11:cANSI For bold 11 point font set guifont=Bitstream_Vera_Sans_Mono:h11:b:cANSI elseif filereadable(expand('$SystemRoot').'/fonts/Raize.fon') Raize (12 pt bold) set guifont=Raize:h12:b:cANSI endif endif Since I have many machines I use my same installation of Vim on, not all of them have the fonts I want. This will only set the font if it exists on the machine, plus a second favourite (Raize). Does anyone know how to do the same thing in Ubuntu (or *nix in general)? I am not sure where the fonts get stored on a *nix system. Dave
RE: search visual block
-Original Message- From: Lev Lvovsky [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 17, 2006 5:04 PM To: vim@vim.org Subject: 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? I know you have had lots of different reponses on this thread. This is what I keep in my vimrc, which doesn't use a function. Simply highlight the text and hit * or #, just like you would for a given work in normal mode. Courtesy of Michael Naumann, Jürgen Krämer Visually select text, then search for it if version = 602 Here are two enhanced versions of these mappings which use VIM 6.2's getregtype() function to determine whether the unnamed register contains a characterwise, linewise or blockwise selection. After the search has been executed, the register *and* its type can then be restored with setreg(). vnoremap silent * :C-U \let old_reg=getreg('')bar \let old_regmode=getregtype('')cr \gvy/C-RC-R=substitute(substitute( \escape(@, '\\/.*$^~[]' ), \n$, , ), \\n, '\\_[[:return:]]', g)crcr \:call setreg('', old_reg, old_regmode)cr vnoremap silent # :C-U \let old_reg=getreg('')bar \let old_regmode=getregtype('')cr \gvy?C-RC-R=substitute(substitute( \escape(@, '\\/.*$^~[]' ), \n$, , ), \\n, '\\_[[:return:]]', g)crcr \:call setreg('', old_reg, old_regmode)cr else If you use both VIM 6.2 and older versions these mappings should be defined depending on the current version. vnoremap silent * :C-Ulet old_reg=@cr \gvy/C-RC-R=substitute(substitute( \escape(@, '\\/.*$^~[]' ), \n$, , ), \\n, '\\_[[:return:]]', g)crcr \:let @=old_regcr vnoremap silent # :C-Ulet old_reg=@cr \gvy?C-RC-R=substitute(substitute( \escape(@, '\\/.*$^~[]' ), \n$, , ), \\n, '\\_[[:return:]]', g)crcr \:let @=old_regcr endif
RE: VimL and Exuberant tags - Suggestions please
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nikolai Weibull Sent: Friday, October 13, 2006 2:48 PM To: Martin Krischik Cc: vim-dev; vim@vim.org Subject: Re: VimL and Exuberant tags - Suggestions please On 10/13/06, Nikolai Weibull [EMAIL PROTECTED] wrote: On 10/13/06, Martin Krischik [EMAIL PROTECTED] wrote: The ctags Patch list list [1] not been worked on for ages. I wonder why no one has taken over development/forked this project yet. It seems obvious that the current maintainer has given up interest. Hm, I take that back. It seems like development hasn't stopped completely, as the last update was done in May, 2006. It was mentioned earlier on this list that the lead developer had stopped working on exuberant-ctags. Maybe he's back? Darren was dealing with some life problems which prevented him from continuing with the development. When the idea of forking the project popped up, he was completely against it. So he called for maintainers and we are just now moving forward with volunteers to get things moving again. At least now there are many contributors instead of just Darren and patches submitted by the field. As mentioned, I have taken over the maintenance of the Vim piece of ctags. Dave
RE: VimL and Exuberant tags - Suggestions please
-Original Message- From: Peter Hodge [mailto:[EMAIL PROTECTED] Sent: Thursday, October 12, 2006 11:24 PM To: David Fishburn; vim@vim.org Subject: Re: VimL and Exuberant tags - Suggestions please Hello David, Can I suggest support for these commands: :set/setlocal/setglobal :syntax :highlight (and maybe :HiLink because it is so commonly used) Some examples: set foldmethod=syntax setlocal formatoptions+=roq setglobal completeopt-=preview I can see why we might want to track settings, it is often useful to see where a particular script is changing Vim options. This can also work for: let foldmethod='syntax' let l:foldmethod='syntax' let g:foldmethod='syntax' syntax keyword phpFunction ... syn match phpIdentifier ... syn region phpRegion ... sy cluster phpClTop ... syntax clear phpMethods highlight String ... hi clear Constant ... hi link Number ... hi! link Number ... hi def link Function ... HiLink Number ... These ones I am not certain of the value. If I open a syntax file, there are somethimes hundreds of these lines. This would merely identify a syn is there, but there is no real name associated with the item. So the tag isn't particularily meaningful. These are all pretty straightforward to find. Also, for dictionary functions would it make sense to mark them twice, since they get a new 'name' if the dictionary is copied to a new variable? For example: let foo = { } function! foo.func1() dict endfunction let bar = foo There is now a function called 'bar.func1()', so maybe func1 should be tagged as: Dictionary Functions foo.bar /^function! foo.bar() dict/ .bar /^function! foo.bar() dict/ I have fixed it to return: foo.func1 as a function tag. Let bar = foo, if made outside of a function tags bar as a variable. I will not attempt to figure out what time of variable it is. Seem my previous response to Tony. I wouldn't mind if mappings could be tagged as well. I was thinking on this topic too. nnoremap silent Leaderyr :YRSearchCR nnoremap silent F11 :YRShowCR From maps I guess they have a name, in the above case it would be: Leaderyr F11 So these could be tagged. I know I often open my vimrc and try to find these mappings. Is there or will there be any way to toggle options for the way ctags scans vim files? You can override this yourself already using the taglist.vim plugin. 'a', augroup, autocommand groups 'f', function, function definitions 'v', variable, variable definitions The current version of ctags tags the above, you can override this and only capture functions and variables if you like. I have added another: 'c', command, user-defined commands And will consider adding more (like maps). These options can be turned on or off by default. Currently they are all on. To override it you provide additional information on the ctags command line. To do this via the taglist plugin you can do something like this in your vimrc: let g:tlist_vim_settings = 'vim;a:augroup;c:command;f:function;v:variable' Dave
RE: VimL and Exuberant tags - Suggestions please
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nikolai Weibull Sent: Friday, October 13, 2006 2:48 PM To: Martin Krischik Cc: vim-dev; vim@vim.org Subject: Re: VimL and Exuberant tags - Suggestions please On 10/13/06, Nikolai Weibull [EMAIL PROTECTED] wrote: On 10/13/06, Martin Krischik [EMAIL PROTECTED] wrote: The ctags Patch list list [1] not been worked on for ages. I wonder why no one has taken over development/forked this project yet. It seems obvious that the current maintainer has given up interest. Hm, I take that back. It seems like development hasn't stopped completely, as the last update was done in May, 2006. It was mentioned earlier on this list that the lead developer had stopped working on exuberant-ctags. Maybe he's back? Darren was dealing with some life problems which prevented him from continuing with the development. When the idea of forking the project popped up, he was completely against it. So he called for maintainers and we are just now moving forward with volunteers to get things moving again. At least now there are many contributors instead of just Darren and patches submitted by the field. As mentioned, I have taken over the maintenance of the Vim piece of ctags. Dave
VimL and Exuberant tags - Suggestions please
I have taken over maintenance of the VimL exuberant tags component. For the vim plugin writers, are there any outstanding bugs or new feature requests you have for ctags.exe? Hari just mentioned Vim7 introduces some additional syntax items to function names: function mydict.len() dict endfunction function autoloadFunc#subdirname#Funcname() endfunction Support for this has been added to the next version of ctags (possibly 5.7). I noticed a bug in variables which shows up in Vim7, since we introduced the for/endfo construct. Ctags starts generating variable tags for tags that are within functions after encountering an endfo since the short form for a endfunction is endf. - Also fixed in the next version. These are the items ctags currently flags: augroup, autocommand groups function, function definitions variable, variable definitions Does it make sense to also identify autocommands? Or possibly only autocommands if they are outside of an augroup? When variables are identified we strip off the scope: let s:ignoreNextCursorMovedI = 0 == ignoreNextCursorMovedI Should the scope be left on == s:ignoreNextCursorMovedI Instead of simply grouping everything under variables, should we distinguish between different types? let forms#form = { \ 'title': 'Address Entry Form', \ 'fields': [], \ 'defaultbutton': 'ok', \ 'fieldMap': {}, \ 'hotkeyMap': {}, \ } Right now this is identified as a variable, should we identify it as a Dictionary by adding another kind of tag? What about identifying commands: command! -nargs=+ Select :call s:DB_execSql(select . q-args) What about [ion]maps (though we cannot give them a name really, but at least identifying where they are in the source? We could also pick up local variables (have this off by default) and produce something like this: function! s:DB_runCmd(cmd, sql) let l:display_cmd_line = 'blah' let display_shell = 'blah' endf Local variables s:DB_runCmd.display_cmd_line s:DB_runCmd.display_shell I am open to suggestions. If you have suggestions, please provide code snippets so I have examples to work from. We can add these tags and leave them on or off by default, so having that information is useful as well. At this point the sky is the limit, we can hash out details as we move forward. Somethings might not be worth the effort. TIA, Dave
RE: ctags for new Vim scripting features
-Original Message- From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 11, 2006 9:18 PM To: vim@vim.org Subject: ctags for new Vim scripting features Is anyone working or planning to work on enhancing exuberant ctags to recognize the dict and autoloaded functions ? Does this require modifying the code, or just some regex patterns? Exuberant tags has been under going some significant changes in the last couple of months. It has been moved to SVN and developers are being added to the project. Each of us volunteer for various components. I maintain two of the modules (sql.c and jscript.c). I am not sure if any one has volunteered for vim.c. I could probably take it on if there are no other volunteers. I have not noticed anything lacking in it to date (minus any new 7.x features). What language elements are you referring to? That would allow me to create a test case. Dave
RE: Forms highlighting
I gave the demo a whirl. When you enter the State field the omni completion pops up. You cannot hit escape to get out of this. In fact you must choose something, even if you didn't want to. Entering the Country field. If you cursor is on U, press C. I wanted to just type Canada, but of course C in normal mode changes to end of line. So this wiped out the rest of the line. It seems when the is gone, things get messed up. You can't actually type anything. So I restarted the form. When to USA hit cw, typed in Canaada. Realized my mistake, but my cursor on the a and hit x. Since I was in visual mode this left me with xada. Now use the left and right keys to reposition yourself. Very funky behaviour ending up with the existing characters being repeated many times. Actually it does this with h,l as well. That is all I had a chance to try this morning. Dave
Stack trace - omni completion
Vim 7.0 patches 1-106 WinXP SP2 In an attempt to debug one of my scripts, I added some debug statements in my VimL. When I did that, Vim will crash and produce the stack trace listed below. I can reproduce this every time, and I know the person who reported the problem (with my script) also gets the crash. I fired up gvimd.exe (which I compiled) and grabbed the stack trace. If you need more information, just let me know. :ver VIM - Vi IMproved 7.0 (2006 May 7, compiled Sep 14 2006 14:00:05) MS-Windows 32 bit GUI version with OLE support Included patches: 1-106 Compiled by [EMAIL PROTECTED] Big version with GUI. Features included (+) or not (-): +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +folding -footer +gettext/dyn -hangul_input +iconv/dyn +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse +mouseshape +multi_byte +multi_lang -mzscheme +netbeans_intg +ole -osfiletype +path_extra +perl/dyn -postscript +printer -profile +python/dyn +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl -tgetent -termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -xfontset -xim -xterm_save +xpm_w32 system vimrc file: $VIM\vimrc user vimrc file: $HOME\_vimrc 2nd user vimrc file: $VIM\_vimrc user exrc file: $HOME\_exrc 2nd user exrc file: $VIM\_exrc system gvimrc file: $VIM\gvimrc user gvimrc file: $HOME\_gvimrc 2nd user gvimrc file: $VIM\_gvimrc system menu file: $VIMRUNTIME\menu.vim Compilation: cl -c /W3 /nologo -D_MT -MT -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG -DFEAT_XPM_W32 -DWINVER=0x0400 - D_WIN32_WINNT=0x0400 /Fo.\ObjGOLY/ /Ox -DNDEBUG -DFEAT_OLE -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMI C_PYTHON_DLL=\python24.dll\ -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\perl58.dll\ -DFEAT_BIG /Zi /Fd.\ObjGOLY/ Linking: link /RELEASE /nologo /subsystem:windows /incremental:no /nodefaultlib:libc advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.li b oldnames.lib kernel32.lib gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:i386 /nodefaultlib libcmt.lib oleaut3 2.lib user32.lib /nodefaultlib:python24.libWSock32.lib C:\download\OpenSrc\vim\XPM_support_for_Netbeans\xpm-4.2.0\lib\libXpm.lib /PDB:.\ObjGO LY/gvim.pdb -debug AppName: gvimd.exe AppVer: 7.0.262.0 ModName: gvimd.exe ModVer: 7.0.262.0Offset: 00072f23 gvimd.exe!AppendToRedobuffLit(unsigned char * str=0x01938acc, int len=-1) Line 546 + 0x9 C gvimd.exe!ins_compl_prep(int c=67) Line 3410 + 0xe C gvimd.exe!edit(int cmdchar=105, int startln=0, long count=1) Line 773 + 0x12 C gvimd.exe!invoke_edit(cmdarg_S * cap=0x001268ac, int repl=0, int cmd=105, int startln=0) Line 8713 + 0x14 C gvimd.exe!nv_edit(cmdarg_S * cap=0x001268ac) Line 8686 + 0x14 C gvimd.exe!normal_cmd(oparg_S * oap=0x00126900, int toplevel=0) Line 1137 + 0x10 C gvimd.exe!exec_normal_cmd(unsigned char * cmd=0x0176e180, int remap=-1, int silent=0) Line 9029 + 0xbC gvimd.exe!ex_normal(exarg * eap=0x00126a14) Line 8932 + 0x2c C gvimd.exe!do_one_cmd(unsigned char * * cmdlinep=0x00126e90, int sourcing=1, condstack * cstack=0x00126b1c, unsigned char * (int, void *, int)* getline=0x00437530, void * cookie=0x0012784c) Line 2613 + 0x16 C gvimd.exe!do_cmdline(unsigned char * cmdline=0x0176e1d0, unsigned char * (int, void *, int)* getline=0x00437530, void * cookie=0x0012784c, int flags=3) Line 1099 + 0x1f C gvimd.exe!ex_execute(exarg * eap=0x00126f38) Line 18186 + 0x19 C gvimd.exe!do_one_cmd(unsigned char * * cmdlinep=0x001273b4, int sourcing=1, condstack * cstack=0x00127040, unsigned char * (int, void *, int)* getline=0x00437530, void * cookie=0x0012784c) Line 2613 + 0x16 C gvimd.exe!do_cmdline(unsigned char * cmdline=0x, unsigned char * (int, void *, int)* getline=0x00437530, void * cookie=0x0012784c, int flags=7) Line 1099 + 0x1f C gvimd.exe!call_user_func(ufunc * fp=0x012d68a0, int argcount=2, typval_T * argvars=0x00127d80, typval_T * rettv=0x00127e7c, long firstline=1, long lastline=1, dictvar_S * selfdict=0x) Line 19853 + 0x15C gvimd.exe!call_func(unsigned char * name=0x01713d60, int len=26, typval_T * rettv=0x00127e7c, int argcount=2, typval_T * argvars=0x00127d80, long
RE: Detecting when in omnicomplete
-Original Message- From: Karl Guertin [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 26, 2006 4:10 PM To: [EMAIL PROTECTED] Cc: VIM Help Subject: Re: Detecting when in omnicomplete On 9/26/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: If you have a look at ftplugin/sql.vim it does this. sql.vim does have different functionality based on whether the popup menu is visible or not, but I don't see where it distinguishes between omnicomplete and keyword completion. E.g. if you hit C-nC-Right on windows, you still attempt to drill down instead of doing C-Right. That is right, since C-Right does not actually do anything when the completion window is open, I assume you wanted to perform the drill down and show the column list for the table highlighted in the current table list. I am not sure if it is possible to determine why the popup window is displaying (C-XC-O vs C-XC-N). Dave
RE: Uppercase keywords
-Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Monday, October 02, 2006 7:44 AM To: Marius Roets Cc: vim@vim.org Subject: Re: Uppercase keywords Marius Roets wrote: Hi Vimmers, I have a big a (3000+ lines) source code file. The syntax highlighting works perfectly, so all keywords are highlighted correctly. Is there any way that I can use this fact to convert all keywords to uppercase, or do I have to do them all one by one? Thanks Marius I think it should be possible to write a function or command to put the cursor on each word in turn, determine if it is a keyword, and depending on the result, do either nothing or normal gUaw (without the quotes). You may want to do this within a visual highlighted area (i.e., from mark ` to mark ` ) or as a command accepting a range (like the :s command). Right you are Tony, that is exactly how I wrote it. SrchRplcHiGrp.vim - Search and Replace based on a highlight group http://www.vim.org/script.php?script_id=848 Basic usage: Place your cursor on the highlighted text. :SRChooseHiGrp It tells you what it found: SRHiGrp - Group ID: 268 Name: vimLet Or: :SRChooseHiGrp! SRHiGrp - Group ID: 49 Name: Statement Add the ! if you want the base color. Then you can visually select the region you want, the plugin supports all 3 visual modes (characterwise, linewise and blockwise). Then run: :','SRHiGrp It asks you for 2 pieces of information: 1. What to match (via a regex) default is current word - '\(\w\+\\)' 2. What to do with the match. The default is to UPPERCASE the match - '\U\1' You can also use this plugin to just search for highlight groups using the SRSeach command. :h SRHiGrp Enjoy, and please rate it if you find it helpful. Feedback is always welcome. Dave finds - '\(\w\+\\)'
BUG: inputdialog() does not resize on Mac
Running this command: echo inputdialog(Choose # of database type:\n1. None\n2. ASA\n3. MYSQL\n4. SQLSERVER\n5. DB2,1,-1) On Windows and Linux will correctly size the inputdialog box so that the entire text is displayed. On the Mac platform the inputdialog does not size appropriately and will cut off lines 3-5. :ver Here is the output of version, VIM - Vi IMproved 7.0 (2006 May 7, compiled Sep 27 2006 15:36:56) MacOS X (unix) version Included patches: 1-110 Compiled by [EMAIL PROTECTED] Normal version with Carbon GUI. Features included (+) or not (-): -arabic +autocmd -balloon_eval +browse +builtin_terms +byte_offset +cindent -clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv -cscope +cursorshape dialog_con_gui ++diff +digraphs -dnd -ebcdic -emacs_tags +eval ex_extra +extra_search +-farsi +file_in_path +find_in_path +folding -footer +fork() -gettext -hangul_input -iconv +insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse -mouseshape -mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm +mouse_xterm -multi_byte +multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile -python +quickfix +reltime -rightleft -ruby +scrollbind -signs smartindent +-sniff +statusline -sun_workshop +syntax +tag_binary tag_old_static +-tag_any_white -tcl +terminfo +termresponse textobjects +title -toolbar ++user_commands +vertsplit virtualedit +visual +visualextra +viminfo ++vreplace +wildignore wildmenu +windows +writebackup -X11 -xfontset +-xim -xsmp -xterm_clipboard -xterm_save system vimrc file: $VIM/vimrc user vimrc file: $HOME/.vimrc user exrc file: $HOME/.exrc system gvimrc file: $VIM/gvimrc user gvimrc file: $HOME/.gvimrc system menu file: $VIMRUNTIME/menu.vim fall-back for $VIM: /Applications/Vim.app/Contents/Resources/vim Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MAC -fno-common -fpascal-strings -Wall -Wno-unknown-pragmas -mdynamic-no-pic -pipe -I. -Iproto -DMACOS_X_UNIX -no-cpp-precomp -I/Deve loper/Headers/FlatCarbon -O -fno-strength-reduce -Wall Linking: gcc -L/usr/local/lib -o Vim -framework Carbon -lncurses Dave
Re: Detecting when in omnicomplete
If you have a look at ftplugin/sql.vim it does this. I override the ctrl-left|right keys. When pumvisible() is false I want to do the default Vim behaviour. When it is true I want to perform special SQL actions. I was only able to do this via a mapping which called a function. But that does keept it neat and tidy. HTH, Dave - Original Message - From: Karl Guertin [EMAIL PROTECTED] Sent: 09/26/2006 11:50 AM To: VIM Help vim@vim.org Subject: Detecting when in omnicomplete I'm playing around with keybindings and omnicompletion and I'd like a special set of keybindings when pumvisible() and it's an omnicomplete match. I can mostly do this by setting a buffer variable in all my mappings that would cause me to enter/exit omnicomplete, but I keep missing edge cases. Is there a better way to detect which completion mode vim is in?
ANN: dbext.vim 4.0 released
What is it? --- dbext.vim : Provides database access to most databases. http://www.vim.org/scripts/script.php?script_id=356 This plugin contains functions/mappings/commands to enable Vim to access several databases. Currently Mysql, PostgreSQL, Ingres, Oracle, Sybase Adaptive Server Anywhere, Sybase Adaptive Server Enterprise, Microsoft SQL Server, DB2 and Interbase are supported. It abstracts database access, so the same Vim commands will produce the same output regardless of the database you use. What is new in 4.0? - dbext.vim now requires Vim7. - dbext.vim no longer has dependencies on other plugins by utilizing the new Vim7 features (Lists and Dictionaries). - When using the DBCompleteTable, DBCompleteProcedure, DBCompleteView commands errors are displayed instead of silently ignored. This makes them more useful with the sqlComplete plugin (see |sql.txt|). - Added new option, dbext_default_MYSQL_version, for MySQL to indicate the version you using. - You can optionally define a function, DBextPostResult, in your .vimrc, this function will be called each time the result window is updated. This function can be used to do anything, for example, syntax highlighting the result set in the result window. Bug Fixes - Added version support with MySQL to control what SQL is sent for version 4 and 5 servers. After installing the plugin you can use: :h dbext.txt :h dbext-tutorial.txt David Fishburn
RE: Single-File Vim?
-Original Message- From: Dmitriy Yamkovoy [mailto:[EMAIL PROTECTED] Sent: Friday, September 22, 2006 4:06 PM To: Vim List Subject: Single-File Vim? Hi all, Is there a binary compiled for Windows which allows me to run Vim without any of the runtime files? Long story short, I want something I can keep online or on a USB key and just copy to the desktop of any computer I sit at. We had a large discussion on this topic probably six months back. A number of us do this (on the Windows platforms). We each had various options on how we do it. I personally: 1. Copied my Vim directory to my USB key. 2. Run a batch file whenever I want to use Vim directly from the USB key. The batch file is simple. It puts the k:\Vim\vim70 in the $PATH (assuming k: is the USB key). No setting of $VIM or $VIMRUNTIME is required. Here is my batch file if anyone is interested. @echo off @rem You can have Windows automatically run a batch file when you open @rem a new command prompt by: @rem HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun @rem and set it to run a BAT script of your choice when it @rem starts up. @rem @rem I don't like this option and prefer to setup a shortcut to run: @rem %SYSTEMROOT%\system32\cmd.exe /F:ON /K c:\vim\tools\setupVim.bat @rem The /F:ON enables file/directory completion using CTRL-F. This @rem is useful if you do not have any rights on the machine to modify: @rem HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar @rem and set it to hex 9 (TAB) @rem Determine which drive letter we are executing this from: @rem % 0 = the cmdline used to launch the cmd file. @rem for /f %%i in ('echo %0') do @echo curr_dir=%%~di @rem From HELP FOR (when typed from a cmd.exe prompt) @rem You can now use the following optional syntax: @rem % ~I - expands %I removing any surrounding quotes () @rem % ~fI- expands %I to a fully qualified path name @rem % ~dI- expands %I to a drive letter only @rem @rem This will set BLAH = the current directory of the batch file @remset BLAH=%~dp0 @for /f %%i in (%0) do @SET cmd_driveletter=%%~di @SET driveletter=%cmd_driveletter @echo. @echo Executing %0 from this drive: %cmd_driveletter% @echo. @IF %1. NEQ . SET driveletter=%1: @IF NOT EXIST %driveletter%\ SET driveletter=%cmd_driveletter% :SETPATH @echo. @echo. Check if Vim is already in the PATH @echo. @echo on @for %%P in (%PATH%) do @IF EXIST %%P\gvim.exe GOTO ALLREADYINPATH @echo off @echo. @echo.Not already in PATH, adding it @echo. @goto ADDTOPATH @echo. @echo. Check if Vim is already in the PATH @echo. @echo on %driveletter%\Vim\Tools\which.exe gvim.exe @echo off @IF %errorlevel% EQU 0 GOTO ALLREADYINPATH :ADDTOPATH @echo. @echo. Setup path to include $VIM and other standard utilities @echo. @echo on SET PATH=%driveletter%\vim\tools;%driveletter%\Vim\Vim70;%driveletter%\util;%dri veletter%\util\unix_tools;%PATH% @echo off @goto END :ALLREADYINPATH @echo. @echo. Vim is already in the PATH @echo. @goto END :END
Taglist and html vs php vs javascript
Vim 7.0.106 When I edit an HTML file and open the taglist plugin it correctly checks for Javascript tags. When I edit a PHP file, the taglist plugin gets only the PHP tags, when most PHP pages would also have HTML and Javascript embedded within it. Does anyone know if this is a feature of ctags, the taglist plugin, or a filetype plugin that sets all of this up? Or of course how to enable this. If someone had that off the top of their heads that would be great, save me having to dig into it. Thanks, Dave
RE: Taglist and html vs php vs javascript
-Original Message- From: David Fishburn [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 9:56 AM To: vim@vim.org Subject: Taglist and html vs php vs javascript Vim 7.0.106 When I edit an HTML file and open the taglist plugin it correctly checks for Javascript tags. When I edit a PHP file, the taglist plugin gets only the PHP tags, when most PHP pages would also have HTML and Javascript embedded within it. Does anyone know if this is a feature of ctags, the taglist plugin, or a filetype plugin that sets all of this up? Or of course how to enable this. If someone had that off the top of their heads that would be great, save me having to dig into it. Damn, how emabarrasing. It already does this, I just should have paid more attention and choose a more revealing file. Sorry. Dave
RE: previous buffer?
-Original Message- From: Lev Lvovsky [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 12:51 PM To: vim@vim.org Subject: 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)? :h alternate-file CTRL-^ HTH, Dave
RE: Open each file in newtab (without using -p)
-Original Message- From: Groleo Marius [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 12:11 PM To: vim@vim.org Subject: Open each file in newtab (without using -p) I can't find any reference to the $subject, nor on web nor in :help. Basically, I'm searching for a method to open a new file in its own tab. Opening a new file might mean :e or a CTRL-] :tab new c:\temp\whatever.txt HTH, Dave
RE: Allow only one instance of vim on Windows
-Original Message- From: Stelian Iancu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 22, 2006 3:59 AM To: vim@vim.org Subject: Allow only one instance of vim on Windows Hello there, I've been using vim on and off for about 5 years now but now I've decided to switch entirely to vim. Up until now I've used UltraEdit and this one can be configured that every file that I open with it is opened in another tab of the existing instance. Can vim 7.x be configured to behave the same? Depends on how you work within windows to launch files, which will dictate how easy this is. For example, on windows I always work from command prompts. When I want to edit a file I type: vimt.cmd filename Vimt.cmd does the following: @rem Default the instance name to GVIM - Vims default @set vim_instance=GVIM @rem Override it if necessary if %2. NEQ . set vim_instance=%2 @echo on @echo %0 start gvim.exe --servername %vim_instance% --remote-tab-silent %1 That will do what you want. HTH, Dave
RE: [viminfo] Vim can't remeber position
-Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Sunday, August 20, 2006 10:15 AM To: Lu Tan Hoa Cc: vim@vim.org Subject: Re: [viminfo] Vim can't remeber position Lu Tan Hoa wrote: Dear vim-list, I compile Vim-7.0 from source with default config. $ vim --version | grep viminfo +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace I also put viminfo variable in ~/.vimrc as: set viminfo='20,50,s10,h,r/mnt/usb But, when I open an old file, cursor always goto the first line Do I miss something in configuration step Thanks and regards, I recommend adding the line runtime vimrc_example.vim near the top of your vimrc. But if you don't want to, you can still copy the autocommand found near line 70 of $VIMRUNTIME/vimrc_example.vim, as follows: When editing a file, always jump to the last known cursor position. Don't do it when the position is invalid or when inside an event handler (happens when dropping a file on gvim). autocmd BufReadPost * \ if line('\) 0 line('\) = line($) | \ exe normal g`\ | \ endif This has been further enhanced and documented here: http://vim.sourceforge.net/tips/tip.php?tip_id=80 HTH, Dave
RE: Vim and cscope - E623: Could not spawn cscope process
Glad it is all working. Just posting this to the forum in case other users run into the same issue. -Original Message- From: Sibin P. Thomas [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 09, 2006 1:04 AM To: David Fishburn Subject: RE: Vim and cscope Hey thanks a lot Dave, it's working finally :) I guess the only thing I had missed out earlier was the .exe in the command :se csprg=D:\cscope\bin\cscope. I now made it :se csprg=D:\cscope\bin\cscope.exe and Voila it works!!. Once again thanks a million for all the help (u have no idea how many days I spent over this; initially googling and later changing cscope source code!) Regards, Sibin -Original Message- From: David Fishburn [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 08, 2006 9:55 PM To: Sibin P. Thomas Subject: RE: Vim and cscope This is what I have in my vimrc if has(cscope) Most often I find I need to recursively look at data You cannot use (reports an error opening subdirs): cscope -R *.sql You must use: cscope -R But that only gets C/CPP files. I have to do this: find -name *.sql cscope.files or dir /s/b *.sql cscope.files cscope -b (create the cscope database) cscope -C (queries this with case insensitivity) To open the same options in Vim: cs add cscope.out . -C (for case insensitivity) For help on cscope and Vim: :cs :h cs let cscopeprg = expand('$VIM\Tools\cscope.exe') If 'csto' is set to zero, cscope database(s) are searched first, followed by tag file(s) if cscope did not return any matches. set cscopetagorder=0 set cscopetag set nocscopeverbose determines how many components of a file's path to display set cscopepathcomp=3 Use the quickfix window for the cscope query set cscopequickfix=s-,c-,d-,i-,t-,e- add any database in current directory if filereadable(cscope.out) cscope -C (queries this with case insensitivity) exec 'cs add '.expand('%:p:h').'\cscope.out ' else add database pointed to by environment elseif $CSCOPE_DB != cs add $CSCOPE_DB endif set csverb endif -Original Message- From: Sibin P. Thomas [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 08, 2006 2:25 AM To: [EMAIL PROTECTED] Subject: RE: Vim and cscope This is my vimrc file and this is what I did 1. run cscope -R in the directory c:\path. This directory contains my project. 2. open a file C:\path\sub_directory\sub_dir_level2\file.c 3. give the command :cs add c:\path\cscope.out This is when I get the error E623: Could not spawn cscope process Just tell me where I am going wrong? I have the exact same setup as yours i.e. Vim 7 and 6.3. Winxp sp2 Cscope 16.0a Regards, Sibin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 08, 2006 10:39 AM To: Sibin P. Thomas Subject: Re: Vim and cscope I just tried it again. Vim 7 and 6.3. Winxp sp2 Cscope 16.0a (I think). Sorry, can't think of anything else. Unless you have more than 1 cscope in your path and it is getting the wrong one first. What Vim cscope options did you set? - Original Message - From: Sibin P. Thomas [EMAIL PROTECTED] Sent: 08/07/2006 09:11 PM To: David Fishburn [EMAIL PROTECTED] Subject: RE: Vim and cscope I had checked all this before using the last resort of asking help in the mailing list. Just for the record the :echo has('cscope') returns 1 and there is a +cscope in the version info(in both the versions I have tried). Also I researched the problem and went through the cscope source code (of version 15.4) and *I think* that the problem lies in the function spawnvp() which MSDN states that is not supported anymore (we should use the function _spawnvp() now). I must state that the I don't have any conclusive evidence to prove that spawnvp() is the culprit. I tried changing the source and recompiling but was going in circles hence the SOS. I was hoping someone would have come across this problem already and solved it already :) Regards, Sibin -Original Message- From: David Fishburn [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 08, 2006 12:12 AM To: Sibin P. Thomas Subject: RE: Vim and cscope What is returned with this: :echo has('cscope') Or browse the output of :ver. Dave -Original Message- From: Sibin P. Thomas [mailto:[EMAIL PROTECTED] Sent: Monday, August 07, 2006 12:50 AM To: [EMAIL PROTECTED] Subject: RE: Vim and cscope Hi Dave, I was initially using the cscope version 15.4 then I downloaded the version u pointed me to (version 16.0a), both
RE: Saveing of a recorded macro
-Original Message- From: Meino Christian Cramer [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 08, 2006 6:27 AM To: vim@vim.org Subject: Saveing of a recorded macro Hi, is it possible and if true then how() endif to save a recorded macro to a file ? I have done this in the past as follows: 1. Record your macro into the a register 2. Open your vimrc 3. Create a new line with: autocmd FileType sql let @a=' 4. Pressing (in insert mode) C-Ra, this will paste your recorded macro into your vimrc, then add a final single quote. 5. The problem with step 4 is newlines and escapes are lost. So to fix this, you can: - For each newline (or carriage return you want in your macro) erase the new line and then (still in insert mode) press C-VC-M (that is control V followed by control M). - For each escape you need in your macro, add a C-VC-[ 6. So you will end up with something like this: autocmd FileType sql let @a='/sys^Mcwbob^[nn.^M' This means, each time I edit a file with a filetype of sql, the a register will automatically have your macro recorded, so you can re-execute the macro (in normal mode) pressing @a. 7. This macro does: autocmd FileType sql let @a='/sys^Mcwbob^[nn.^M' - /sys^M - find sys (and the user had to have pressed enter) - cwbob^[ - change word to bob and press escape to get out of insert mode - Skip one find - .^M - repeat my last cw command 8. Obviously you are going to make lots of mistakes as you do this. It is very easy to test you macro, fix it, and test again. - You can move your cursor to after the first single quote. - Press v (to start linewise visual mode) - Move your cursor to the end of your macro - Press ay - which yanks your visually selected text into the a register - Re-execute the macro pressing @a Hope that helps you. It is a bit figity, but it works and does what you need. Other people may have suggestions on how to replace the newline (or carriage returns) with the ^M and add the escapes where necessary. Dave
RE: netrw v103b - No longer can browse directories
On Tue 1-Aug-06 1:52am -0600, Hugo Ahlenius wrote: I just upgraded netrw to netrw 103b from Charles Campbell's web-site. Now it seems like opening a directory by just trying to edit it doesn't work, like it used to: :e c:\ I am having a similar issue, but I am using 102 from the main Vim website: http://www.vim.org/scripts/script.php?script_id=1075 ... If so, either remove it (all 6 files) or make the following change to $vim\plugin\netrwPlugin.vim: Replace (right after the Load Once line): if exists(g:loaded_netrw) finish endif with: if exists(g:loaded_netrwPlugin) finish endif let g:loaded_netrwPlugin = 1 I don't like modifying files in the $VIM directory. I tried this and it still did not fix the problem on my machine (I still cannot browse the files in my directory). I also get this: :pwd C:\ :e . C:\ Illegal file name Dave
RE: Vim and cscope
-Original Message- From: Sibin P. Thomas [mailto:[EMAIL PROTECTED] Sent: Monday, July 31, 2006 6:25 AM ... I tried integrating Cscope 15.4 with Vim7.0 on WinXP (I have installed cygwin too); but whenever I try to use cscope in Vim I get the following error - E623: Could not spawn cscope process. Sounds like you are using the cscope from the open source project. You need a special version of cscope that is integrated with Vim. :h cscope-info Will point you to different downloads locations. Since you are on win32, you need to download it from: http://iamphet.nm.ru/cscope/index.html :h cscope-win32 HTH, Dave
RE: a question about 'diff' setting
-Original Message- From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] Sent: Thursday, June 29, 2006 2:53 PM To: vim@vim.org Subject: a question about 'diff' setting ... Can anyone explain why and what I should do to avoid this (other than remembering to run :diffoff before closing, or doing a :bufdo diffoff later). I keep this in my vimrc: if v:version = 602 command! -bar -bang Nodiff wincmd l bar onlybang bar set nodiff noscrollbind scrollopt-=hor wrap foldcolumn=0 virtualedit= else command! -bar Nodiff exe 'wincmd l' bar only bar set nodiff noscrollbind wrap foldcolumn=0 scrollopt-=hor virtualedit= bar let g:diff_msg_shown = 0 endif I think Gary Johnson came up with it initially. Try that to see if it works. The command! lines are on 1 line only. Dave
dbext.vim 3.5 released
What is it? --- dbext.vim : Provides database access to most databases. http://www.vim.org/scripts/script.php?script_id=356 This plugin contains functions/mappings/commands to enable Vim to access several databases. Currently Mysql, PostgreSQL, Ingres, Oracle, Sybase Adaptive Server Anywhere, Sybase Adaptive Server Enterprise, Microsoft SQL Server, DB2 and Interbase are supported. It abstracts database access, so the same Vim commands will produce the same output regardless of the database you are connected to. What is new in 3.50? - g:dbext_default_inputdialog_cancel_support = 0 will prevent inputdialog from providing a cancel option. This works around a Vim7 bug. dbext will automatically detect this and set the option the first time it is encountered. - Changed the order of some of the text in the dialog boxes to make them more readable when using the console version of Vim. - dbext can parse SQL statements and prompt the user to replace variables with values prior to sending the statement to the database to be executed. This is useful for testing SQL which is embedded in your code without having to manually replace variables and string concatentation. A new identifier (the until flag) allows you to specify the beginning of a string and what to prompt for until a finishing string. This makes it more flexible for you to configure what you would like prompting for when looking for variables. Bug Fixes - DBPromptForBufferParameters can report E180: Invalid complete value: -1 if running the console version of Vim. dbext will detect this problem and automatically set g:dbext_default_inputdialog_cancel_support = 0 to work around this Vim7 bug. After installing the plugin you can use: :h dbext.txt :h dbext-tutorial.txt David Fishburn
RE: Inability to map C-N when completion popup is visible
-Original Message- From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] Sent: Thursday, June 15, 2006 8:23 PM To: vim@vim.org Subject: Inability to map C-N when completion popup is visible I am trying to map C-N and C-P to behave differently when pumvisible() returns true, but Vim seems to completely ignore this. E.g., if I create this unconditional map (a much simpler one than what I wanted): inoremap C-N C-C pressing ^N normally stops insertmode, but when popup is visible, Vim never executes the map. This may be true for C-P also, but the same is not true for, say Up. inoremap Up C-C Using the above map, pressing Up arrow always stops insert mode, whether popup is visible or not. Is this a bug? I tested by starting with -u NONE option to avoid any other interferences. I had a lot of problems trying to get this to work as well. In the end I was unable to map it without making a function call. autoload/sqlcomplete.vim does the following: if has('win32') imap buffer c-right C-R=sqlcomplete#DrillIntoTable()CR imap buffer c-left C-R=sqlcomplete#DrillOutOfColumns()CR endif function! sqlcomplete#DrillIntoTable() If the omni popup window is visible if pumvisible() call sqlcomplete#Map('column') C-Y, makes the currently highlighted entry active and trigger the omni popup to be redisplayed call feedkeys(\C-Y\C-X\C-O) else if has('win32') If the popup is not visible, simple perform the normal C-Right behaviour exec normal! \C-Right endif endif return endfunction In this case, if the popup window is not visible I want to perform the standard C-Right so the user does not loose any functionality due to the mapping. For the lurkers, this is for Vim7 since pumvisible() and feedkeys() are Vim7 functions. HTH, Dave
RE: omni completion, calling different types
-Original Message- From: Silent1 [mailto:[EMAIL PROTECTED] Sent: Monday, June 12, 2006 1:39 PM To: vim@vim.org Subject: omni completion, calling different types I'm using the omni completion so far on my php scripts and i'm wondering if there are ways i can call different sets of data with different key strokes. ctrl-x+ctrl+o will bring up everything and display everything and will open up a preview window that has info if a function is called with parameters. How do i get the menu that comes up to display the parameters as well? They come up in the preview window just fine just wondering if i can see them in the drop down menu. This is up to the plugin developer. The sqlcomplete.vim plugin has been designed to work with other completion plugins. Since most programming languages today have some form of access to a database you still need to be able program SQL. So regardless whether you are programming in PHP, Ruby, JSP, VimL you can do the following: :e file.php :set ft=sql :set ft=php Now the SQL completion is active and can be used in conjunction with the PHP completion plugin. It is triggered (while in insert mode) using C-C followed by a key. The key is what allows you to filter what is displayed in popup window. The key can be many things: t - table list p - procedure list v - view list a - all syntax items k - keywords (for the SQL syntax language) And so on. Perhaps Mikolaj could extend the PHP completion plugin in the same manner. Dave
ANN: SQLComplete.vim update to version 5.0
Announcing an update to the sqlcomplete.vim script which is included in Vim7. If you are using dbext.vim 3.0 and taking advantage of the table and column completion capabilities the update to version 5.0 of the script makes it a bit smarter when determine if you are entering partial column names or tables names along with owner/creator features. Read on for more details if you are not already using it. Enjoy. Dave http://www.vim.org/scripts/script.php?script_id=1572 SQLComplete.vim : SQLComplete is a SQL code completion system using the omnifunc framework description SQLComplete.vim is a plugin which uses the new Vim7 OMNI completion features (intellisense code completion). SQLComplete.vim version 4.0 is included in the Vim 7.0 release. What does it do: --- Completion for the SQL language includes statements, functions, keywords, operators and database options which it draws from the current SQL syntax file in use. Vim ships with 9 different SQL syntax files (Oracle, Informix, MySQL, SQL Anywhere, ...). It will also dynamically complete tables, procedures, views and column lists with data pulled directly from within a database. It does this in conjunction with the dbext.vim vimscript #356. For detailed instructions and a tutorial see |omni-sql-completion|. Existing instructions can be found within Vim7 using :h sql.txt :h sql-completion This plugin is new to Vim7. Improvements to the script will be uploaded here, and supplied to Bram for inclusion into future versions of Vim7. install details Copy sqlcomplete.vim to: .vim/autoload/sqlcomplete.vim (Unix) vimfiles\autoload\sqlcomplete.vim (Windows) For documentation: :h sql.txt
RE: Inputdialog() broken in Vim7
-Original Message- From: Yegappan Lakshmanan [mailto:[EMAIL PROTECTED] Sent: Thursday, June 08, 2006 12:16 PM To: David Fishburn Cc: vim@vim.org Subject: Re: Inputdialog() broken in Vim7 Hi David, On 6/8/06, David Fishburn [EMAIL PROTECTED] wrote: Vim 7 and 7.1-17 on WinXP SP2 This should affect all Vim platforms, not just Windows. Could someone please confirm this is a bug. If you run this command from a GUI enabled vim: :echo inputdialog('hello:', 10, -1) You get a dialog box displayed which says hello, with a default value of 10. Pressing OK, returns 10, pressing cancel returns -1. If you run the same command from a console Vim, you get: E180: Invalid complete value: -1 :h E180 Completion behavior *:command-completion* *E179* *E180* *E181* By default, the arguments of user defined commands do not undergo completion. This of course is not a user defined command. This also works fine under vim 6.3. I am not sure if this has been reported before. This is a regression caused by the change to the input() function to accept a user-specified completion. When inputdialog() function is used in a non-GUI Vim, the input() function is used internally. So that means it will be fixed as some point and I shouldn't have to change the code in my plugin right? Thanks, Dave
RE: Updated PHP syntax file
-Original Message- From: Peter Hodge [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 07, 2006 9:38 PM To: vim@vim.org Subject: Updated PHP syntax file Hello all, I have recently been given the go-ahead to take over maintenance of the PHP syntax file ( http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/2 006-May/002857.html ), and have added several modifications, but I'm unable to host the file on my own web server. Stefano mentioned I should email the updated file to Bram, should I also add it to vim.org/scripts/ as a syntax script? (So that I can include a URL in the file for people to find updates.) Yes, adding the file to vim.org as a syntax script is the right way of doing this. Have a look for other syntax scripts to get the idea. You can start with one of mine: http://www.vim.org/scripts/script.php?script_id=498 HTH, Dave
RE: Script dbext.vim no longer working with Vim 7.x?
-Original Message- From: Matthias Pitzl [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 06, 2006 8:37 AM To: vim@vim.org Subject: Script dbext.vim no longer working with Vim 7.x? Hello! I just installed the dbext.vim script as it's features really sound nice to me. Unfortunately i fail yet at the database connection dialogs. When running the :DBPromptForBufferParameters command i get following error messages: -- Please choose # of database type: 0. None 1. ASA 2. ASE 3. DB2 4. INGRES 5. INTERBASE 6. MYSQL 7. ORA 8. PGSQL 9. SQLSRV 10. SQLITE Error detected while processing function SNR8_DB_execFuncWCheck..SNR8_DB_resetBufferParameters..SN R8_DB_promptForParameters..SNR8_DB_getInput: line2: E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 Connection parameters have been defaulted Please choose # of database type: 0. None 1. ASA 2. ASE 3. DB2 4. INGRES 5. INTERBASE 6. MYSQL 7. ORA 8. PGSQL 9. SQLSRV 10. SQLITE Error detected while processing function SNR8_DB_execFuncWCheck..SNR8_DB_promptForParameters..SNR 8_DB_getInput: line2: E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 E180: Invalid complete value: -1 -- Does anyone of you know what's wrong here or if this nice sounding plugin just doesn't work with Vim 7.x yet? I thought I had already fixed this issue. It should be part of the dbext.vim 3.0 release. What version did you install? Did you also install the dependent script files from Hari? They are listed in the same page: Dbext.vim 3.0 - http://www.vim.org/scripts/script.php?script_id=356 Hari Krishna Dara's two plugins: multvals.vim (3.5.1) - http://www.vim.org/script.php?script_id=171 genutils.vim (1.10.1) - http://www.vim.org/script.php?script_id=197 Thanks, Dave
RE: HTML editing with vim: where to start ?
-Original Message- From: Mikolaj Machowski [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 6:57 AM To: vim@vim.org Subject: Re: HTML editing with vim: where to start ? Dnia wtorek, 16 maja 2006 18:37, A.J.Mechelynck napisał: Ivan Vecerina wrote: [...] For example, here are a few simple things I need to do all the time: [...] - get vim to automatically close/complete the innermost previously opened tag. [...] see the closeag.vim plugin, http://vim.sourceforge.net/scripts/script.php?script_id=13 For base needs this is not needed. Closetag is now part of completion scripts for HTML. Since Ivan mentioned he is using PHP with his HTML, closetag will be very useful for him. I keep the following in my vimrc: CloseTag options: http://vim.sourceforge.net/script.php?script_id=13 closetag.vim Functions and mappings to close open HTML/XML tags This uses C-_ to close an open tag above if filereadable(expand('$VIM/vimfiles/scripts/closetag.vim')) let g:closetag_html_style=1 autocmd Filetype html,xml,xsl,sql,ant,sqlunit,mhtml,php source $VIM/vimfiles/scripts/closetag.vim endif HTH, Dave
RE: About CursorHoldI , pumvisible()
-Original Message- From: ice_2001cn [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 4:48 AM To: vim@vim.org Subject: About CursorHoldI , pumvisible() au! CursorHoldI *.cpp nested call PreviewWord() func! PreviewWord() if pumvisible() call confirm('pumvisible') return endif call confirm(''+pumvisible()) endf I found, while I use c-xc-u for a cpp code completion, The code shown above allways show a message 0 why? Hmm, where I can't specifically comment on your problem, I can show you some code I wrote that does work in this situation for the sqlcomplete.vim plugin. imap buffer c-right C-R=sqlcomplete#DrillIntoTable()CR function! sqlcomplete#DrillIntoTable() If the omni popup window is visible if pumvisible() call sqlcomplete#Map('column') C-Y, makes the currently highlighted entry active and trigger the omni popup to be redisplayed call feedkeys(\C-Y\C-X\C-O) else if has('win32') If the popup is not visible, simple perform the normal C-Right behaviour exec normal! \C-Right endif endif return endfunction I would suggest trying something other than i_CTRL-X_CTRL-U to see if the behaviour is any different. HTH, Dave
ANN: dbext.vim 3.0 released
What is it? --- dbext.vim : Provides database access to most databases. http://www.vim.org/scripts/script.php?script_id=356 This plugin contains functions/mappings/commands to enable Vim to access several databases. Currently Mysql, PostgreSQL, Ingres, Oracle, Sybase Adaptive Server Anywhere, Sybase Adaptive Server Enterprise, Microsoft SQL Server, DB2 and Interbase are supported. It abstracts database access, so the same Vim commands will produce the same output regardless of the database you are connected to. What is new in 3.00? The new autoload/sqlcomplete.vim plugin which shipped with Vim 7.0 utiliizes the features of the dbext.vim 3.0 plugin to provide dynamic table / procedure / view / column completion while editing SQL code. To take advantage of the new 7.0 omni completion to it's fullest you need this update to the dbext.vim plugin. New Features - dbext supports a history of previous commands. The DBHistory command will display a numbered list of previous SQL statements. Pressing enter or double clicking on one of the items will execute the statement. The number of items in the list is configurable via your vimrc. The history items are stored in a file, dbext_sql_history.txt. The location of the file can also be controlled. - The 'refresh' feature added in version 2.30 has been updated to take advantage of the history feature. - The PHP parser has improved and can handle single or double quoted strings, string concatenation and host variables. It will correctly strip the quotes, join the concatenated strings and prompt the user for host variables before executing the SQL statement. - Updated documentation for Vim 7 SQL code completion. - Table, procedure and view dictionaries include the owner name of the object. This is on by default, but can be controlled via a new global option, dbext_default_dict_show_owner. This has not been enabled for all databases it depends on whether the database supports this feature. The autoload\sqlcomplete.vim plugin takes advantage of this feature. - Added support for stored procedures / functions in MySQL 5. Bug Fixes - Updated the PHP parser to work with a more varied string quotes and string concatenation. - The extra feature did not add a leading space for MySQL. Using the tabbed output required updates to the parsing of the output generated by MySQL. - Miscellaneous documentation updates. As usual, I would like any and all feedback from those who try it. Don't be shy! Both plugins provide help and tutorials to help you learn how to take advantage these plugins. After installing the plugins you can use: :h dbext.txt :h dbext-tutorial.txt :h sql.txt :h sql-completion-tutorial David Fishburn
RE: lookupfile.vim (WAS Re: fast file opening / find file as you type)
-Original Message- From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] Sent: Thursday, May 11, 2006 10:06 PM To: Benjamin Reitzammer Cc: Benjamin Reitzammer; vim@vim.org Subject: lookupfile.vim (WAS Re: fast file opening / find file as you type) ... I tried it, it didn't work as expected so I read the instructions!! Can you tell me what happened? I forgot to recognize the dependency on genutils, but I hope you have it installed, so I wonder whatelse the problem could be. Did you have the window open and were you able to start typing the pattern? With my regular huge tags file, it takes forever to find matches, but if you create a specialized tags file, it is very fast. Anyway since I didn't do this: find . -print | sort | awk '{printf %s\t%s\t1\n, $0, $0;}' filenametag Did it not work even after that? If the tagfile isn't specified, what about generating the contents for the completion window from the globpath using either $PATH or path? In my case, path is the default of '.,,', but I set it using: :let path=substitute($PATH, ';', ',', 'g') Then I hit F5. What do you think? Are you talking about running globpath()? This is possible, but won't recognize path entries with ** etc.. I will try this out and see how it works out. Bit of a non-specific bug report, sorry. When I press F5, the little window opens. Except it will always be empty since I don't have any tag files. I was hoping for some configuration items. 1. Check if any tags are available 2. If not, check if path is useful 3. If not, use $PATH (convert format where appropriate). Or allow me to specify this from within my vimrc. Are you talking about running globpath()? This is possible, but won't recognize path entries with ** etc.. I will try this out and see how it works out. I thought this changed in Vim7. Thanks, Dave
RE: lookupfile.vim (WAS Re: fast file opening / find file as you type)
-Original Message- From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] Sent: Thursday, May 11, 2006 10:06 PM To: Benjamin Reitzammer Cc: Benjamin Reitzammer; vim@vim.org Subject: lookupfile.vim (WAS Re: fast file opening / find file as you type) Actually, I started with the below idea, and created a plugin that works more or less like what the OP wanted. It uses the Vim completion mechanism to bringup a popup dialog with matching filenames. Works best when you have a dedicated tags file the way I originaly proposed (see the script header). Can anyone try the attached plugin and give me feedback? You know me Hari, I can't refuse your plugins. I tried it, it didn't work as expected so I read the instructions!! Anyway since I didn't do this: find . -print | sort | awk '{printf %s\t%s\t1\n, $0, $0;}' filenametag If the tagfile isn't specified, what about generating the contents for the completion window from the globpath using either $PATH or path? In my case, path is the default of '.,,', but I set it using: :let path=substitute($PATH, ';', ',', 'g') Then I hit F5. What do you think? Dave
RE: perlcomplete.vim -- anyone working on this?
-Original Message- From: Kevin Old [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 09, 2006 3:46 PM To: vim@vim.org Subject: perlcomplete.vim -- anyone working on this? Hello, I was shocked that there wasn't a perlcomplete.vim in the source and would like to create one or help someone who's writing one. Well, in the interim you can use the syntaxcomplete omni completion plugin. See :h ft-syntax-omni This will complete any of Vim's 481 currently shipping syntax files. Easy to enable and as long as Vim can syntax colour your code, this plugin will provide completion using those items. You can automate this by placing the following in your vimrc (after any :filetype command): if has(autocmd) exists(+omnifunc) autocmd Filetype * \ if omnifunc == | \ setlocal omnifunc=syntaxcomplete#Complete | \ endif endif Have fun. Dave
RE: Vim 7 - a little graphical introduction
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of 4mir Salihefendic Sent: Tuesday, May 09, 2006 1:08 PM To: vim@vim.org Subject: Vim 7 - a little graphical introduction I just did a little blog post highlighting the new stuff in Vim 7. I did this with a little twist - there is animation of the new features. The link: http://amix.dk/index.py/permanentLink?id=130 Could be useful if you are trying to hype vim 7 to friends ;-) Those are nice. Maybe you should add one for the new Tab support. Dave
RE: 70f - Scroll wheel scrolls wrong window
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, May 01, 2006 6:14 PM To: David Fishburn Cc: vim@vim.org Subject: Re: 70f - Scroll wheel scrolls wrong window David Fishburn wrote: Though I cannot reproduce it, this has been happening to me throughout the betas. 70f WinXP SP2 I have the Taglist window open (though I don't believe it is related). So my window is split vertically. My cursor is in normal mode in the right hand pane. If I scroll the mouse wheel, the window in the left hand pane scrolls. I hit escape, click, ... tried everything and just cannot get it to scroll the window my cursor is in. Any ideas or things to check for to track it down? It works fine for me, the window with the cursor (not the mouse pointer) is scrolled. I didn't try with the taglist window, only with an ordinary file and one vertical split. Perhaps it is related to the taglist plugin? Under normal circumstances you are right it works fine. But occassionally it gets into this state. I had to reboot yesterday, but I am in this state again now. If I close the taglist window, and then :vert sp, I get the same behaviour. So it does not appear to be taglist related (I just usually have it open). Is there any settings I should check for? The only way I can scroll the right pane is with cursor keys or dragging the slider. Using the mouse wheel only ever scrolls the left pane regardless of where the cursor is. Dave
70f - Scroll wheel scrolls wrong window
Though I cannot reproduce it, this has been happening to me throughout the betas. 70f WinXP SP2 I have the Taglist window open (though I don't believe it is related). So my window is split vertically. My cursor is in normal mode in the right hand pane. If I scroll the mouse wheel, the window in the left hand pane scrolls. I hit escape, click, ... tried everything and just cannot get it to scroll the window my cursor is in. Any ideas or things to check for to track it down? Thanks, Dave
RE: Vim70f crash - omnicompletion
-Original Message- From: Benji Fisher [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 12:48 PM To: vim@vim.org Subject: Re: Vim70f crash - omnicompletion On Wed, Apr 26, 2006 at 11:18:35AM -0400, David Fishburn wrote: I am using vim70f on WinXP SP2. function! sqlcomplete#DrillIntoTable() if pumvisible() exec normal! i\C-Y call sqlcomplete#Map('column') call feedkeys(\C-X\C-O) endif return Endfunction imap buffer c-right C-R=sqlcomplete#DrillIntoTable()CR When the omni popup is visible, to get the current selected item you must press C-Y while in insert mode (and the list visible). I am trying to issue a C-Y from within my function. All attempts so far have failed. My latest attempt is this line: exec normal! i\C-Y As soon as the above line executes Vim crashes. So Bram, this is 2 things: 1. A bug report. 2. A question, how can I issue a C-Y from within a function executing during an imap? 1. I can confirm the crash, slightly simplified: fun! DIT() if pumvisible() execute normal! i\C-Y endif return endfun imap c-right C-R=DIT()CR With the completion menu open, I type C-RightC-XC-O and gvim crashes. I get the same thing typing C-R=DIT()CR instead of using the mapping. 2. I think that what you want is something more along these lines: fun! DIT2() if pumvisible() return \C-Y else return endif endfun imap F4 C-R=DIT2()CR That will not work for me. exec normal! i\C-Y Since the user can navigate through the entries in the list before pressing C-Right, I need to get the currently selected item before I redisplay the popup with different values (based on what was highlighted). call sqlcomplete#Map('column') call feedkeys(\C-X\C-O) So after a issue a C-Y on behalf of the user, I setup the SQL completion plugin for the next step and trigger omni again using the new feedkeys() function. According to the docs feedkeys() will executes the keys once the function completes. So as I was typing this up I just realized I can code this as follows: function! sqlcomplete#DrillIntoTable() if pumvisible() call sqlcomplete#Map('column') call feedkeys(\C-Y\C-X\C-O) else exec normal! \C-Right endif return Endfunction Since I technically do not need to hit the C-Y prior to calling into sqlcomplete#Map. So the code works as is, and avoids the crash. But for future developers, I could see a need to be able to retrieve the currently selected item in the popup, so the question stands although it is moved way down my priority list. Thanks for the response Benji, and leading me in the right direction. Dave
Feedkeys() function is not highlighted
Simple bug report. When editing a .vim file and using the new feedkeys() function with vim70f, the syntax highlighter flags it as an error. Looks like it hasn't been added to the list of known functions yet. call feedkeys(\C-X\C-O) Dave
RE: Making * search for strings
-Original Message- From: Suresh Govindachar [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 1:00 AM To: vim@vim.org Subject: Making * search for strings Hello, By default, * searches for words: /\stuff_below_cursor\ but I would like it to search for strings: /stuff_below_cursor One way is to use the following map * yiw:let @/[EMAIL PROTECTED]cr Is there a better way? (/yiw didn't work.) I have the following in my vimrc: Courtesy of Michael Naumann, Jürgen Krämer Visually select text, then search for it if version = 602 Here are two enhanced versions of these mappings which use VIM 6.2's getregtype() function to determine whether the unnamed register contains a characterwise, linewise or blockwise selection. After the search has been executed, the register *and* its type can then be restored with setreg(). vnoremap silent * :C-U \let old_reg=getreg('')bar \let old_regmode=getregtype('')cr \gvy/C-RC-R=substitute(substitute( \escape(@, '\\/.*$^~[]' ), \n$, , ), \\n, '\\_[[:return:]]', g)crcr \:call setreg('', old_reg, old_regmode)cr vnoremap silent # :C-U \let old_reg=getreg('')bar \let old_regmode=getregtype('')cr \gvy?C-RC-R=substitute(substitute( \escape(@, '\\/.*$^~[]' ), \n$, , ), \\n, '\\_[[:return:]]', g)crcr \:call setreg('', old_reg, old_regmode)cr endif Basically, using visual mode, select whatever text you like and press * (or # for reverse). These use the same keys as *,# in normal mode, so they are very easy to remember. I use these maps all the time, very useful. HTH, Dave
Vim GUI repositioning itself - Windows / extended monitors
Vim70F I use WinXP SP2. Windows has the ability to Extend your monitor on to another monitor. So, my laptop is plugged into an external monitor at work. I then extend the screen to fill the secondary monitor which gives me 1 logical monitor that is 2 screens wide. This seems to be a new behaviour / annoyance of Vim7. Start Vim. gvim -u NONE -U NONE --noplugin readme.txt Move it to the extended monitor (nicely centered). :set nocp :set columns+=30 At this point, Vim will reposition itself to be in the main screens area, so it will move from 1 monitor to the other. I then have to drag it back again (or use a mapping). I originally thought this was a taglist.vim problem but Yegappan helped me track it down to this. The same thing will happen if I put Vim close to the right edge of my monitor and issue the :set columns+=30, Vim will shift itself to stay within the main monitor. Many other programs seem to be extended monitor aware. For example, if I move Vim to the extended screen and double click on the title bar, it maximizes correctly to fill the entire extended monitor. It does not maximize across both monitors. Anyone have any ideas on this one, or someway to turn of this new change in Vim7? TIA, Dave
Using pumvisible() - vim70f
I want to write a conditional imap that will only be active when the OMNI completion popup window is active. I can't quite get this to work. I have tried a few combinations of imaps: imap buffer c-right C-R=pumvisible()?\ltC-Y\ltC-\\ltC-O:call sqlcomplete#Map('column')\ltCR\ltC-X\ltC-O\ltCR:CR imap buffer c-right C-R=pumvisible()?\ltC-YC-\C-O:call sqlcomplete#Map('column')CRC-XC-O:CR imap buffer c-right if pumvisible()|C-YC-\C-O:call sqlcomplete#Map('column')CRC-XC-O|endif I can't use the if since that starts adding literal characters. I found a post by Georg Dahn which indicated he was using the \lt, not sure why, but I tried it as well. Net result, nothing is working so far, the above either do nothing or result in unexpected behaviour. The imap I use (which works exactly as I want) when the popup is visible is: imap buffer c-right C-YC-\C-O:call sqlcomplete#Map('column')CRC-XC-O Thanks in advance for any suggestions. Dave
Re: In-Time insertion of vertical text
You can do this in Vim. Go to the cursor position where you want it shifted. Press Ctrl-V (blockwise visual mode). Move the cursor down a few lines. So now you have a visual block 1 character wide and 3 lines down. Press I (that is a capital I) to start insert mode. Type as much as you want. Press escape. What ever you typed on the first line will be repated on each line and will shift the text right. I use this to add and remove comments all the time. HTH, Dave Sorry for the top post, no choice. - Original Message - From: Meino Christian Cramer [EMAIL PROTECTED] Sent: 04/21/2006 10:10 PM To: vim@vim.org Subject: In-Time insertion of vertical text Hi, (sorry for that cryptical subject...English isn't my mother's tongue... :) There is one feature of certain editors (for example Emacs with cua.el loaded) I would die for: With Emacs+cua.el it is possible to mark a rectangular shape of text. Then, when text is entered and that rectangle is still highlighted the other text of that file jumps letter by letter to the right to make room for the newly entered text. This happens on by-character basis. (This is NO critc and NO looks how bad vim is compared to Emacs. I only need to describe the opposite to explain what I mean... !!! :) With vim I can mark a rectangle in block-visual mode, then enter text with I which appears in one line only, press ESC and then -- after a short pause -- is copied into all marked colomns. Especially when it comes to handling of text based tables this live insertion feature is a good help. Is there anything like that in vim or is there any script available to do so ? Keep hacking! mcc
RE: Building Vim7 with Visual Studio 8
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 1:38 PM To: David Fishburn Cc: vim@vim.org Subject: Re: Building Vim7 with Visual Studio 8 David Fishburn wrote: Has anyone attempted to build Vim using Visual Studio 8? Yes, George Reilly has tried various configurations. New machine, trying to reduce the # of compilers I have to install. This could be a configuration issue. [...] Perl requested (version 58) - root dir is C:\Programs\perl Perl DLL will be loaded dynamically [...] -DDYNAMIC_PYTHON_DLL=\python24.dll\ -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMI C_PERL_DLL=\perl58.dll\ -DFEAT_BIG /Zi /Fd.\ObjGOLY/ /I C:\Programs\perl\Lib\Core if_perl.c if_perl.c if_perl.xs(158) : error C2061: syntax error : identifier '__attribute__' if_perl.xs(158) : error C2059: syntax error : ';' Your problem appears to be with Perl, not with Vim. You may have a Perl for Unix and building Vim with MSVC doesn't work then. Hmm, just the standard ActiveState install: c:\programs\perl\binperl -v This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 25 registered patches, see perl -V for more detail) Copyright 1987-2006, Larry Wall Binary build 817 [257965] provided by ActiveState http://www.ActiveState.com Built Mar 20 2006 17:54:25 When I removed the Perl piece I did successfully build and compile Vim. So maybe the Perl code has to be updated for Visual Studio 8. Dave
syntax omnicomplete and case sensitivity
-Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Einspanjer Sent: Sunday, April 09, 2006 9:45 PM To: vim@vim.org Subject: Re: Getting omnicomplete to work with my SQL dialect syntax? David.Fishburn at sybase.com writes: In the meantime, for what you are attempting to do the syntaxcomplete plugin should fit your needs. Just :source $VIMRUNTIME/autoload/syntaxcomplete.vim. Please pass any feedback you have along. I just got around to trying that, but it specifically tests to make sure that omnifunc hasn't already been set so that didn't work. Instead, I just explicitly setlocal omnifunc=syntaxcomplete#Complete and syntaxcomplete.vim was autoloaded properly and everything was fine (mostly :) The only thing I would like is if possible, could the syntaxcomplete function detect the case of the string it is completing and use a complimentary case? I know it might be a can of worms, but if I complete EXTRACT_ and it completes as extract_value it feels a bit odd. Otherwise, it is working quite well, thanks for some fantastic work there. :) The 2.0 version of syntaxcomplete.vim will allow the user to choose whether it should ignorecase when filtering objects. By default, if ignorecase is set, so will the syntaxcomplete plugin. You can override this by: let g:omni_syntax_ignorecase = 0 So working in your case above: I complete EXTRACT_ In this case, it will not find any matches since extract_value is of the wrong case. I am not sure really how to go about matching case effectively, since you could have had extract_value, Extract_value, Extract_Value and so on. Dave