Re: how to replace ESC to some other key?
[EMAIL PROTECTED] wrote: "Yakov Lerner" <[EMAIL PROTECTED]> 写于 2007-04-04 22:22:43: On 4/4/07, wangxu <[EMAIL PROTECTED]> wrote: ESC is so far from the center of the keyboard. Can I replace this key to Caps Lock,for example? I heard some people use Tab as a substitute for Esc. Weird. But it's easier to do in platform-independent way. Yakov It's not weird IMO, Tab key is rarely required inside Vim, thanks to the powerful auto-indent feature of Vim (you don't need the tab key even when editing Makefile!), I never feel a need to use key in vim during the last 3 years. I use the Tab key in Vim constantly, not only to insert hard tabs but also for 'wildmenu' completion. I don't feel Esc is "too far away" but maybe it comes (see below) from my early piano lessons (which did not, however, make a pianist out of me). Personaly, I think it is easier to train my fingers to reach the so-called-far-away-ESC-key. (Imagine that the piano players often need to reach keys in the piano much farther than ESC, and they do that precisely.) -- Sincerely, Pan, Shi Zhu. ext: 2606 Best regards, Tony. -- Keep America beautiful. Swallow your beer cans.
Re: bracket completion
2007/4/3, Charles E Campbell Jr <[EMAIL PROTECTED]>: Here's one: http://vim.sourceforge.net/scripts/script.php?script_id=1269 It is very useful, thank you.
Re: Vim memory leak
Max Dyckhoff wrote: Thanks Tony, A.J.Mechelynck wrote: Keeping things around is one thing, keeping them in memory is another. By using ":set hidden" you _tell_ Vim to keep in memory the _whole data_ of every single buffer you visited during the current session, which IMHO is a little overdoing it. By setting 'nohidden' (and 'autowriteall' if, like me, you want to be able to close a window without a cry for unsaved data) you'll keep in memory only the data of the buffers currently displayed in a window, and a few bits of info (such as last cursor location etc.) for other buffers. The data itself would be where it belongs -- on disk, from where it can be reloaded in a twinkling of an eye if you happen to re-edit some file you've already edited in the current session. Or is all your "large code base" on diskettes? I agree that it's a little extreme keeping it all around, but I like having the undo buffers for files I've closed recently kept around. This is either because I accidentally close the last tab containing that file, or because I have marks set in files which I use regularly. marks are remembered in the viminfo file (see ":help viminfo") even when the file is not in memory, indeed even when Vim is not running. For the undo history it's not as simple. I should note that the memory use of vim does still grow constantly (and apparently unboundedly) even without opening new buffers, with '-u NONE', 'nohidden', and 'history=1'. I'm not sure if the code base is actually large, but 8,000 source files certainly seems pretty hefty to me. And thankfully no, our it isn't on diskettes :) Max Thankfully indeed! Best regards, Tony. -- "I don't think so," said René Descartes. Just then, he vanished.
Re: how to replace ESC to some other key?
but in this situation,is there any way to auto-indent *.py? [EMAIL PROTECTED] wrote: > "Yakov Lerner" <[EMAIL PROTECTED]> 写于 2007-04-04 22:22:43: > >> On 4/4/07, wangxu <[EMAIL PROTECTED]> wrote: >> >>> ESC is so far from the center of the keyboard. >>> Can I replace this key to Caps Lock,for example? >>> >> I heard some people use Tab as a substitute for Esc. Weird. >> But it's easier to do in platform-independent way. >> >> Yakov >> > > It's not weird IMO, Tab key is rarely required inside Vim, thanks to the > powerful auto-indent feature of Vim (you don't need the tab key even when > editing Makefile!), I never feel a need to use key in vim during the > last 3 years. > > Personaly, I think it is easier to train my fingers to reach the > so-called-far-away-ESC-key. (Imagine that the piano players often need to > reach keys in the piano much farther than ESC, and they do that precisely.) > > -- > Sincerely, Pan, Shi Zhu. ext: 2606
Re: how to replace ESC to some other key?
"Yakov Lerner" <[EMAIL PROTECTED]> 写于 2007-04-04 22:22:43: > On 4/4/07, wangxu <[EMAIL PROTECTED]> wrote: > > ESC is so far from the center of the keyboard. > > Can I replace this key to Caps Lock,for example? > > I heard some people use Tab as a substitute for Esc. Weird. > But it's easier to do in platform-independent way. > > Yakov It's not weird IMO, Tab key is rarely required inside Vim, thanks to the powerful auto-indent feature of Vim (you don't need the tab key even when editing Makefile!), I never feel a need to use key in vim during the last 3 years. Personaly, I think it is easier to train my fingers to reach the so-called-far-away-ESC-key. (Imagine that the piano players often need to reach keys in the piano much farther than ESC, and they do that precisely.) -- Sincerely, Pan, Shi Zhu. ext: 2606
Python crash
This crashes my vim: function! PyCrash() python << EOF import sys sys.path.append("c:\\python23\\lib") from threading import Thread import vim def f(): vim.command("copen") t = Thread(target=f) t.start() EOF endfunc "" crash! call PyCrash() Does anyone know why? I mean, granted vim.command might not be thread-safe but it most certainly shouldn't crash. Chuck
Re: :args -> buffer list mapping issue
Chuck Mason wrote: A coworker (who is not on VIM Mailing List) has asked me to forward this issue here. Is this already known about or what do we do to submit a bug? I have verified that it happens on my build of vim. His repro steps are below. My :version is VIM - Vi IMproved 7.0 (2006 May 7, compiled May 7 2006 16:23:43) MS-Windows 32 bit GUI version with OLE support 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_ime/dyn +multi_lang -mzscheme +netbeans_intg +ole -osfiletype +path_extra +perl/dyn -postscript +printer -profile +python/dyn +quickfix +reltime +rightleft +ruby/dyn +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white +tcl/dyn -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.\ObjGOLYTR/ /Ox -DNDEBUG -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl83.dll\" -DDYNAMIC_TCL_VER=\"8.3\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python24.dll\" -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl58.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=18 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby18.dll\" -DFEAT_BIG /Zi /Fd.\ObjGOLYTR/ Linking: link /RELEASE /nologo /subsystem:windows /incremental:no /nodefaultlib:libc advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib oldnames.lib kernel32.lib gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib user32.lib /nodefaultlib:python24.lib e:\tcl\lib\tclstub83.lib WSock32.lib e:\xpm\lib\libXpm.lib /PDB:.\ObjGOLYTR/gvim.pdb -debug-- INSERT -- <<< Chuck _ From: Boris Kazanskii Sent: Wednesday, April 04, 2007 2:43 PM To: Chuck Mason Subject: :args -> buffer list mapping issue :args allows to insert directory browser buffers into the buffer list, which cause :bn, :bufdo and friends to fail To reproduce: - Open vim (win32) - :args D:\Program\ Files\Vim\**\co*.* (or whatever matches your configuration) - :bfirst - do a couple of :bn, this will never ever get over the first directory browser buffer (D:\Program\ Files\Vim\vim70\colors\ in this case) - :bufdo echo expand("%") will also stop after it encounters the first directory browser - :bd/:bw are unable to delete these "bad" directory buffers - the only way to get rid of these is to do :1,1000bd - Even without :args, a netrw buffer gets into the buffer list (but as an unlisted nofile buffer). This is normal. - bw does get rid of it if you postfix the buffer number as seen in the output of ":ls!". No need to wipe out everything. I suppose :bd would make it unlisted. - Which version of netrw are you (or Mr. Kazanskii) using? I do NOT experience the bug with the following: $VIMRUNTIME/plugin/netrwPlugin dated Jan 05, 2007 $VIMRUNTIME/autoload/netrw.vim version 108 dated Mar 21, 2007 $VIMRUNTIME/autoload/netrwFileHandlers.vim version 9 dated May 30, 2006 $VIMRUNTIME/autoload/netrwSettings.vim version 9b ASTRO-ONLY dated Jan 05, 2007. These are (AFAIK) the latest versions from the ftp.vim.org site. If you don't update your vim runtime files, don't be surprised if bugs in them don't disappear as by magic. What I experience with the above versions when trying to reproduce the failure by following Mr. Kazanskii steps is that Vim loads the "colors" directory in answer to the ":args" command, then the "compiler" directory in answer to ":bfirst", and then cycles through all non-directory files as I enter ":bn" repeatedly. No error. ":ls!" shows that both directories are still in the buffer list, but as "unlisted" buffers, one at the
Folding in vim helpfiles
After looking at foldutil.vim and AutoFold.vim I'm not sure what the best way is going to be for exploiting the outline format of helpfiles to automatically create folds. Has anyone done this before? Ideally, I'd like to use this with the foldlist.vim plugin to have something like a left-side nav-bar while reading helpfiles. -- Ian Tegebo
RE: Vim memory leak
Thanks Tony, A.J.Mechelynck wrote: > Keeping things around is one thing, keeping them in memory is another. By > using ":set hidden" you _tell_ Vim to keep in memory the _whole data_ of every > single buffer you visited during the current session, which IMHO is a little > overdoing it. By setting 'nohidden' (and 'autowriteall' if, like me, you want > to be able to close a window without a cry for unsaved data) you'll keep in > memory only the data of the buffers currently displayed in a window, and a few > bits of info (such as last cursor location etc.) for other buffers. The data > itself would be where it belongs -- on disk, from where it can be reloaded in > a twinkling of an eye if you happen to re-edit some file you've already edited > in the current session. Or is all your "large code base" on diskettes I agree that it's a little extreme keeping it all around, but I like having the undo buffers for files I've closed recently kept around. This is either because I accidentally close the last tab containing that file, or because I have marks set in files which I use regularly. I should note that the memory use of vim does still grow constantly (and apparently unboundedly) even without opening new buffers, with '-u NONE', 'nohidden', and 'history=1'. I'm not sure if the code base is actually large, but 8,000 source files certainly seems pretty hefty to me. And thankfully no, our it isn't on diskettes :) Max
Re: Vim memory leak
Max Dyckhoff wrote: [...] I do have 'hidden' set, because I like to keep things around. :ls! shows that I currently have about 550 buffers open. I know this seems like a lot, but we do have a large code base! [...] Keeping things around is one thing, keeping them in memory is another. By using ":set hidden" you _tell_ Vim to keep in memory the _whole data_ of every single buffer you visited during the current session, which IMHO is a little overdoing it. By setting 'nohidden' (and 'autowriteall' if, like me, you want to be able to close a window without a cry for unsaved data) you'll keep in memory only the data of the buffers currently displayed in a window, and a few bits of info (such as last cursor location etc.) for other buffers. The data itself would be where it belongs -- on disk, from where it can be reloaded in a twinkling of an eye if you happen to re-edit some file you've already edited in the current session. Or is all your "large code base" on diskettes? Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 162. You go outside and look for a brightness knob to turn down the sun.
Re: using command gf or map to other key for matlab function
On 2007-04-04, frank wang <[EMAIL PROTECTED]> wrote: > Hi, > > I am a lot of matlab function files. the function name is the same as > file name without the file extension .m. In the Vim, if I use command > gf trying to find the file under the cursor, it could not find it > since it missed the extension .m. Could someone help me to create a > map to solve this problem? You don't even need a map to solve this one. Just put this setting in your .vimrc or _vimrc: set suffixesadd+=.m See :help suffixesadd Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA
Re: bracket completion
On 4/4/07, Waters, Bill <[EMAIL PROTECTED]> wrote: Can someone provide an example of how to enable this for a certain language? I assume that it is a condition around the "remap" in your vimrc?? The easiest way to do language-specific customizations is to create .vim in your ~/.vim/after/ftplugin/ directory. This file is sourced after everything else so the settings in this file override previously set values. e.g. cat 'set expandtab' >> ~/.vim/after/ftplugin/python.vim ensures that spaces are inserted in your python files rather than tabs.
Re: OT: Reply-To munging [was: [SOLVED] Need advice on pattern matching using match()]
Jean-Rene David wrote: > * Michael Klier [2007.04.04 17:30]: > > I am sure this has been questioned before but why is the > > "Reply-To:" header field not set via the mailing-list? > > Short answer: because it makes it more difficult > to reply to the author without making it easier to > reply to the list. > > Long answer: > http://www.unicom.com/pw/reply-to-harmful.html > > -- > JR > $ grep reply .muttrc > folder-hook . bind index r reply > folder-hook .*-L$ bind index r list-reply Thanks for the clarification (especially the link), these are reasonable arguments. -- Michael Klier signature.asc Description: Digital signature
:args -> buffer list mapping issue
A coworker (who is not on VIM Mailing List) has asked me to forward this issue here. Is this already known about or what do we do to submit a bug? I have verified that it happens on my build of vim. His repro steps are below. My :version is >>> VIM - Vi IMproved 7.0 (2006 May 7, compiled May 7 2006 16:23:43) MS-Windows 32 bit GUI version with OLE support 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_ime/dyn +multi_lang -mzscheme +netbeans_intg +ole -osfiletype +path_extra +perl/dyn -postscript +printer -profile +python/dyn +quickfix +reltime +rightleft +ruby/dyn +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white +tcl/dyn -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.\ObjGOLYTR/ /Ox -DNDEBUG -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl83.dll\" -DDYNAMIC_TCL_VER=\"8.3\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python24.dll\" -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl58.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=18 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby18.dll\" -DFEAT_BIG /Zi /Fd.\ObjGOLYTR/ Linking: link /RELEASE /nologo /subsystem:windows /incremental:no /nodefaultlib:libc advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib oldnames.lib kernel32.lib gdi32.lib version.lib winspool.lib comctl32.lib advapi32.lib shell32.lib /machine:i386 /nodefaultlib libcmt.lib oleaut32.lib user32.lib /nodefaultlib:python24.lib e:\tcl\lib\tclstub83.lib WSock32.lib e:\xpm\lib\libXpm.lib /PDB:.\ObjGOLYTR/gvim.pdb -debug-- INSERT -- <<< Chuck _ From: Boris Kazanskii Sent: Wednesday, April 04, 2007 2:43 PM To: Chuck Mason Subject: :args -> buffer list mapping issue :args allows to insert directory browser buffers into the buffer list, which cause :bn, :bufdo and friends to fail To reproduce: - Open vim (win32) - :args D:\Program\ Files\Vim\**\co*.* (or whatever matches your configuration) - :bfirst - do a couple of :bn, this will never ever get over the first directory browser buffer (D:\Program\ Files\Vim\vim70\colors\ in this case) - :bufdo echo expand("%") will also stop after it encounters the first directory browser - :bd/:bw are unable to delete these "bad" directory buffers - the only way to get rid of these is to do :1,1000bd
RE: bracket completion
> I'll just add a statement enabling this for certain languages Can someone provide an example of how to enable this for a certain language? I assume that it is a condition around the "remap" in your vimrc?? -Original Message- From: Waters, Bill Sent: Monday, April 02, 2007 1:42 PM To: Greg Fitzgerald; A.J.Mechelynck Cc: vim@vim.org Subject: RE: bracket completion Can you provide and example of how to do this? Thanks, Bill > > > >:inoremap { {} > >:inoremap [ [] > >:inoremap ( () > > > > I'll just add a statment enabling this for certain languages. This has > also giving me a couple new ideas to play with. Thanks again. :) > > --Greg
RE: Vim memory leak
On 4/4/07, Yakov Lerner <[EMAIL PROTECTED]> wrote: > On 4/4/07, Max Dyckhoff <[EMAIL PROTECTED]> wrote: >> I do have 'hidden' set, because I like to keep things around. >> :ls! shows that I currently have about 550 buffers open. we do >> have a large code base! > > Then get another 1-2 GB of RAM. It's not called "memory leak" > when program allocates memory according to its functionality. > > Yakov I know perfectly well what a memory leak is; it isn't allocating memory according to its functionality, it is forgetting to free it according to its requirements. I was just debating whether allocation of an extra 100Kb was necessary if I created a few new splits for an existing buffer and then closed them. If someone provided the answer "this memory is kept around for reason X", then it wouldn't be a memory leak. I currently have 4GB of RAM in this machine, but that can get eaten up surprisingly fast when you're doing what I do. I don't think 32-bit XP can address any more than that, can it? Max
Re: OT: Reply-To munging [was: [SOLVED] Need advice on pattern matching using match()]
* Michael Klier [2007.04.04 17:30]: > I am sure this has been questioned before but why is the > "Reply-To:" header field not set via the mailing-list? Short answer: because it makes it more difficult to reply to the author without making it easier to reply to the list. Long answer: http://www.unicom.com/pw/reply-to-harmful.html -- JR $ grep reply .muttrc folder-hook . bind index r reply folder-hook .*-L$ bind index r list-reply
using command gf or map to other key for matlab function
Hi, I am a lot of matlab function files. the function name is the same as file name without the file extension .m. In the Vim, if I use command gf trying to find the file under the cursor, it could not find it since it missed the extension .m. Could someone help me to create a map to solve this problem? Thanks Frank
RE: Executing vimfunctions in background
Mr. Yikihiro Nakadaira supplied the following to the list a couple months ago. In Vim7 feedkeys() can be used. autocmd CursorHold * call Timer() function! Timer() echo strftime("%c") let K_IGNORE = "\x80\xFD\x35" " internal key code that is ignored call feedkeys(K_IGNORE) endfunction ... this pretty much simulates a timed event when you leave the keyboard and let vim run. Between this and CursorMoved perhaps you can accomplish what you want -dan On Wed, 4 Apr 2007, Chuck Mason wrote: > > Doc states, "Not re-triggered until the user has pressed a key (i.e. > doesn't fire every 'updatetime' ms if you leave Vim to make some coffee. > :)" > > So this isn't going to work. How do I put in a feature request for an > autocmd that is trigged every 'repeattime' repeatedly? > > Chuck > > > -Original Message- > From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 04, 2007 1:42 PM > To: Chuck Mason > Cc: Yakov Lerner; vim@vim.org > Subject: Re: Executing vimfunctions in background > > Chuck Mason wrote: > > Well, that sample 'myFunc' was just that- a sample. Imagine now, that > it > > doesn't depend on cursor location but on a daemon running on your > > system. > > > > Chuck > > There are also the CursorHold and CursorHoldI autocommands (q.v.), which > are > triggered _once_ when the keyboard has been idle for 'updatetime' > milliseconds > (4000 by default). > > > Best regards, > Tony. > -- > "The National Association of Theater Concessionaires reported that in > 1986, 60% of all candy sold in movie theaters was sold to Roger Ebert." > -- D. Letterman >
Re: bracket completion
Greg Fitzgerald wrote: [...] I did some more termcap tests as well as on other systems, this time FreeBSD. Still the same issue. So i'm starting to wondering if it's really termcap if 3 linux boxes, openbsd, and freebsd are having the same problem. Although if i am in console with term set to linux it does go away. Hm. It may just be a badly set 'term' option (it ought to match $TERM), or a 'ttybuiltin' set to true instead or false, or vice-versa. This might mean a bad line (or even a missing line) in your vimc. You might also try using konsole where, if all else fails, you can set your "session type" to "Linux console", which ought to give you the same keyboard interface as in /dev/tty (the non-X text console). (konsole is the terminal application which comes with kde) Best regards, Tony. -- Syntactic sugar causes cancer of the semicolon. -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
Re: [SOLVED] Need advice on pattern matching using match()
Tim Chase wrote: > > if match(getline(1,20),"^ \{0,1}\(=\{2,6}\)[^=]\+\1 *$") >= 0 > > > >The pattern used in the match() call is the same as in the > >syntax highlighting script. > > My guess is that it's something like an escaping problem. You're > using double-quotes which are a little more finicky about > contained-escapes. Thanks a lot Tim! It was indeed an escaping problem! Just sending the mail again because I forgot to Cc: to the list - sorry for that. I am sure this has been questioned before but why is the "Reply-To:" header field not set via the mailing-list? Kind Regards Michael -- Michael Klier signature.asc Description: Digital signature
Re: Spellcheck HTML files with syntax on?
Mitch Wiedemann wrote: I am using Vim 7.0* and I mostly edit HTML files. I've noticed the on-the-fly spell checking works great in regular .txt files and such, but I can't get it working in HTML files without turning the :syntax off. Is there a way to get on-the-fly spellchecking with syntax highlighting as well? * VIM - Vi IMproved 7.0 (2006 May 7, compiled Mar 29 2007 16:33:16) Compiled by ... Normal version without GUI. Features included (+) or not (-): [...] 1. Unless you removed the "Patches included" line, the above means 7.0.000. The current version is 7.0.224. Make sure to use an up-to-date version: compile it yourself if you must, get it as a binary distro if you can. For Windows, you can use Steve Hall's distro from https://sourceforge.net/project/showfiles.php?group_id=43866&package_id=39721 2. With the latest runtime files (and in particular, $VIMRUNTIME/syntax/html.vim dated 2006 Jun 19) I get spell checking in HTML text when 'spell' is set, even with syntax highlighting on. If step 1 doesn't cure your problem (and on Windows it ought to), get the latest runtime files, for instance by using the Linux commands below (3 commands, type each of them all on one line) from the vim70 directory "for building" containing src/ runtime/ and other subdirs. (This assumes you have installed the Vim source: see http://users.skynet.be/antoine.mechelynck/vim/compunix.htm for details. You may or may not want to uninstall the Debian (or other precompiled) Vim package before you compile your own. rsync -avzcP --delete --exclude="/dos/" ftp.nluug.nl::Vim/runtime/ ./runtime/ 2>&1 |tee rsync.log cd src make installruntime 2>&1 |tee ../install.log Best regards, Tony. -- Hurewitz's Memory Principle: The chance of forgetting something is directly proportional to . to uh ..
RE: Executing vimfunctions in background
Doc states, "Not re-triggered until the user has pressed a key (i.e. doesn't fire every 'updatetime' ms if you leave Vim to make some coffee. :)" So this isn't going to work. How do I put in a feature request for an autocmd that is trigged every 'repeattime' repeatedly? Chuck -Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 04, 2007 1:42 PM To: Chuck Mason Cc: Yakov Lerner; vim@vim.org Subject: Re: Executing vimfunctions in background Chuck Mason wrote: > Well, that sample 'myFunc' was just that- a sample. Imagine now, that it > doesn't depend on cursor location but on a daemon running on your > system. > > Chuck There are also the CursorHold and CursorHoldI autocommands (q.v.), which are triggered _once_ when the keyboard has been idle for 'updatetime' milliseconds (4000 by default). Best regards, Tony. -- "The National Association of Theater Concessionaires reported that in 1986, 60% of all candy sold in movie theaters was sold to Roger Ebert." -- D. Letterman
Re: Vim memory leak
On 4/4/07, Max Dyckhoff <[EMAIL PROTECTED]> wrote: On 4/4/07, Yakov Lerner <[EMAIL PROTECTED]> wrote: > Max, > > I recalled two more things. Is your 'hidden' option set ? If it's set, > vim *will* grow. With 'hidden' set, vim will keep in memory much data > about old buffers. If you want to minimize memory, first thing you'd do is > ':set nohidden'. To check your current state, 'set hidden?'. > > Second important thing is :bw. Even with ':set nohidden', vim will > remember some data for every file it ever visited. To free this data > completely, you need to :ls!, then :bw for every unused buffer. > > I think these two things will decrease vim's memory footprint > (in case you had 'set hidden'). > > Yakov I do have 'hidden' set, because I like to keep things around. :ls! shows that I currently have about 550 buffers open. ... we do have a large code base! Then get another 1-2 GB of RAM. It's not called "memory leak" when program allocates memory according to its functionality. Yakov
Re: Need advice on pattern matching using match()
if match(getline(1,20),"^ \{0,1}\(=\{2,6}\)[^=]\+\1 *$") >= 0 The pattern used in the match() call is the same as in the syntax highlighting script. My guess is that it's something like an escaping problem. You're using double-quotes which are a little more finicky about contained-escapes. You might try match(getline(1,20),'^ \{0,1}\(=\{2,6}\)[^=]\+\1 *$') (using single-quotes rather than double-quotes) or match(getline(1,20),"^ \\{0,1}\\(=\\{2,6}\\)[^=]\+\\1 *$") (escaping your escape-characters). You can read a bit more at :help expr-quote :help expr-string You can also change the \{0,1} syntax to \= for the same results. I don't know if one is faster than another internally, or if it even matters, but it's fewer chars to type. (":help \=") Just a couple ideas, -tim
Re: Executing vimfunctions in background
Chuck Mason wrote: Well, that sample 'myFunc' was just that- a sample. Imagine now, that it doesn't depend on cursor location but on a daemon running on your system. Chuck There are also the CursorHold and CursorHoldI autocommands (q.v.), which are triggered _once_ when the keyboard has been idle for 'updatetime' milliseconds (4000 by default). Best regards, Tony. -- "The National Association of Theater Concessionaires reported that in 1986, 60% of all candy sold in movie theaters was sold to Roger Ebert." -- D. Letterman
Need advice on pattern matching using match()
Hi everybody, I have a little problem with pattern matching using Vims' match() function. I`ve wrote a syntax highlighting script for a certain Wiki Syntax, now I want to check via autocommand if the edited text file is a Wiki file: autocmd BufEnter *.txt call IsWikiSyntax() The function looks like this: fun IsWikiSyntax() if match(getline(1,20),"^ \{0,1}\(=\{2,6}\)[^=]\+\1 *$") >= 0 set textwidth=0 set wrap set linebreak set filetype=wiki endif endfun The pattern used in the match() call is the same as in the syntax highlighting script. The idea is that the function looks for the occurance of the following strings in the first 20 lines and activate change the filetype if it finds a match. The searched strings could be of the type: == foo == = foo = foo === foo === == foo == I am a bit confused because the above pattern works for the syntax highlighting part but not for the match() call. I tried several abbreviations of the above pattern on a string via :echo match(line(1),"[pattern]") but always get "-1". Does the match() function interpret patterns in a different way - or am my missing something else? I am using Vim 7.0.174. Thanks in Advance Michael -- Michael Klier signature.asc Description: Digital signature
RE: Vim memory leak
On 4/4/07, Yakov Lerner <[EMAIL PROTECTED]> wrote: > Max, > > I recalled two more things. Is your 'hidden' option set ? If it's set, > vim *will* grow. With 'hidden' set, vim will keep in memory much data > about old buffers. If you want to minimize memory, first thing you'd do is > ':set nohidden'. To check your current state, 'set hidden?'. > > Second important thing is :bw. Even with ':set nohidden', vim will > remember some data for every file it ever visited. To free this data > completely, you need to :ls!, then :bw for every unused buffer. > > I think these two things will decrease vim's memory footprint > (in case you had 'set hidden'). > > Yakov I do have 'hidden' set, because I like to keep things around. :ls! shows that I currently have about 550 buffers open. I know this seems like a lot, but we do have a large code base! The thing is that if I open this session then it takes up about 90Mb, which is fine for me. But after a few hours and modifications to only a handful of buffers, this has grown to 130Mb or so, which seems excessive. Is there any way I can limit the number of 'hidden' buffers? It'd be nice if it had a history much like : and /, where the least recently used things fall off the bottom (top?). I'm sure that I could manage with only about 100 hidden buffers. Failing that, do you think it could be done in script? Do something like get an array of all the files, check the last touched time, and then discard the oldest? Also, starting up with -u NONE does indeed still exhibit the same "memory leakage" (or use), although it seems a bit slower. Thanks, Max
Re: Vim memory leak
On 4/4/07, Max Dyckhoff <[EMAIL PROTECTED]> wrote: My instance of vim (gvim on Windows) appears to have a memory leak, which makes me sad. Is this a common thing for everyone, or is there something in my setup which might be causing it? It's pretty serious. When I start gvim and load my standard session, it will take up about 86MB of RAM. This includes dozens of buffers, splits, tabs and syntax, so I'm not really worried. After about four hours it will be up to more like 120MB, and after a couple of days it will be 200MB+. Loading a "fresh" copy of gvim with all the plugins and my .vimrc, there are various actions I can see that increase the memory usage as reported by the Windows Task Manager. I have no idea on the validity of the Task Manager, but it's all I have on Windows. :sp on a new buffer causes a raise of 4-8K. :q on a split causes a raise of 4-8K. Switching to/from gvim causes a small increase, typically 4-8K for a few switches. Searching (with *) for a word in a .c file (with syntax highlighting) causes it to increase. If you hold down * then you can see the memory usage rocket up. Basically, pretty much any action. Any ideas? Will I just have to live with it and restart my vim session every couple of days? Max, I recalled two more things. Is your 'hidden' option set ? If it's set, vim *will* grow. With 'hidden' set, vim will keep in memory much data about old buffers. If you want to minimize memory, first thing you'd do is ':set nohidden'. To check your current state, 'set hidden?'. Second important thing is :bw. Even with ':set nohidden', vim will remember some data for every file it ever visited. To free this data completely, you need to :ls!, then :bw for every unused buffer. I think these two things will decrease vim's memory footprint (in case you had 'set hidden'). Yakov
RE: quick query about moving a selection
>>I might've just forgotten to set sw=2, but I noticed that when I was >>editing a file and didn't want nested tabs being tabbed over to pretty >>much the right side of the screen, one little '>>' would tab it over 4 >>tabs (for ts=2) instead of just 1. Thought that was odd. >You must have had shiftwidth at its default of 8. The indent used by ><< and >> is affected only by the setting of shiftwidth and doesn't >depend on the tabstop in any way. (The TYPE of whitespace added by >> >depends on the tabstop option, but the amount of indentation isn't >affected by it.) Yeah, as above, probably just forgot to set ts/sw to be equal. Most of the time I'll just stick a vim-line at the end of the file as an override, only on an as-needed basis, like that specific file that had way too many levels of nested tabs for its own good. Usually just for displaying purposes, so will shrink the tabstop and set line-numbering to make it easier to find things. Otherwise will just leave the default settings.
Re: bracket completion
On Wed, Apr 04, 2007 at 07:14:11PM +0200, A.J.Mechelynck wrote: > Greg Fitzgerald wrote: > >On Tue, Apr 03, 2007 at 04:51:46PM -0400, Karl Guertin wrote: > > > >>On 4/3/07, Panos Laganakos <[EMAIL PROTECTED]> wrote: > >>>Although, I'd prefer if I could use tab to move outside, instead of > >>>the corresponding closing bracket char. > >>This should be fairly simple to add. I won't map it, but I'll set up a > >> for you. > >> > >>On 4/3/07, Jonas Persson <[EMAIL PROTECTED]> wrote: > >>>Is it possible to have the {} pair inserted without disturbing the folds? > >>I use marker based folds and the script doesn't disturb them. If > >>you're doing syntax folding, I can imagine that the folding might get > >>confused, as there's a fair bit of sleight of hand going on. I'll try > >>to fix it, but I'm not sure that I can. > >> > >>On 4/3/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote: > >>>I do have a issue using it though. Every > >>>time i load vim with your script i can no longer use directional keys > >>>when in insert mode. This meaning up,down,left,right or h,j,k,l. Anytime > >>>i try to use these keys vim starts printing capital letters when i hit > >>>the keys instead of moving around. I have to leave insert mode to move > >>>around then go back into insert mode to type again. Any ideas about > >>>that? > >>I can't reproduce this under vim 7.0.122 (debian), gVim 7.0 windows, > >>on gVim 7.0.203 windows. Any ideas? > > > >I just played around with this. Using vim 7.0.201 on Gentoo, i have > >tried removing all other scripts and even my .vimrc and i still have > >the problem only when i load up yours. I looked through your script > >thinking i could possibly figure it out and I have no clue. After giving > >up on that I uploaded it to my OpenBSD box vim 7 something i'm to lazy > >to look for the patch level now. Same issue. Very weird, if you can't > >reproduce it i'm sure it's on my end. Just trying to find out what would > >cause it. Like i mentioned i go into insert mode type anything. If i try > >to use the directional keys while in insert mode i start getting letters > >inserted above the line i'm on. It is always the same letters though for > >each key. > > > >Left = D > >Right = C > >Up = A > >Down = B > > > >Each time i hit a direction a new letter appears above the (on it's own > >line each time, keeps adding to it.) So any ideas would be welcomed. If > >i avoid moving around in insert mode it really does work nice. So hope > >i'm not giving you the wrong impression. I just have been in the habit > >of being about to move around while in insert mode for years now. > > > > Sounds like a wrong termcap entry for the terminal you're on. > > See, among others, > :help :set-termcap > :help 'term' > :help 'ttybuiltin' > :help 'timeout' > :help 'ttimeout' > :help 'timeoutlen' > :help 'ttimeoutlen > > Best regards, > Tony. > -- > hundred-and-one symptoms of being an internet addict: > 161. You get up before the sun rises to check your e-mail, and you > find yourself in the very same chair long after the sun has set. Well you seem to be right, I logged into console only not loading up xorg. When i use the arrow keys there it leaves insert mode and starts to move around just fine. When i go back into xorg and run xterm my keys are screwed up again. I tried exporting a few of the different termcap entries available for xterm on my system, xterm, xterm-color, xterm-xfree86. Had no luck with them. I then wondered if it was a problem with zsh since i had done some custom key mappings. Changed my shell to bash same. I'll have to play with some of the term settings you mentioned in vim later on. Have not figured it out just yet but at least you have me going down the right road now. Thanks.'
Re: quick query about moving a selection
On Wed, 4 Apr 2007 10:23:49 -0400, "Gene Kwiecinski" <[EMAIL PROTECTED]> wrote: > >>i know with >> i can move a selection to the right by one > >>indent, how can i move a selection just one space ? > > >Well, if you want to move by "one indent", you can > > :set sw=1 ts=1 et > >which will then make ">>" and "<<" indent by one space (not one > >tab) or, you can > > I might've just forgotten to set sw=2, but I noticed that when I was > editing a file and didn't want nested tabs being tabbed over to pretty > much the right side of the screen, one little '>>' would tab it over 4 > tabs (for ts=2) instead of just 1. Thought that was odd. You must have had shiftwidth at its default of 8. The indent used by << and >> is affected only by the setting of shiftwidth and doesn't depend on the tabstop in any way. (The TYPE of whitespace added by >> depends on the tabstop option, but the amount of indentation isn't affected by it.) -- Matthew Winn
Re: highlighting errors
GREAT ! thank you it works just fine. Lionel @ 14:58 04/04/2007, >>>Yakov Lerner<<< Wrote :wq! On 4/4/07, Lionel Flandin <[EMAIL PROTECTED]> wrote: Hi everyone, I'm trying to find the command that would find the next error in a file. For instance the following code contains a typo, how can one find it ? - #include int main(int argc, char **argv) { printf("Hello world!\n"); ] // <- Here it is :-), vim detects it and makes it red return 0; } - This seems to be a recurring request. In the past, I I posted to this list a vimscript function that does it. I made it into small plugin: http://www.vim.org/scripts/script.php?script_id=1851 SearchSyntaxError : search for the next syntax error detected by the vim highlighting mechanism The usage is very simple: command :ERR searhes for the next syntax error, or That's it. Yakov
Re: bracket completion
Greg Fitzgerald wrote: On Tue, Apr 03, 2007 at 04:51:46PM -0400, Karl Guertin wrote: On 4/3/07, Panos Laganakos <[EMAIL PROTECTED]> wrote: Although, I'd prefer if I could use tab to move outside, instead of the corresponding closing bracket char. This should be fairly simple to add. I won't map it, but I'll set up a for you. On 4/3/07, Jonas Persson <[EMAIL PROTECTED]> wrote: Is it possible to have the {} pair inserted without disturbing the folds? I use marker based folds and the script doesn't disturb them. If you're doing syntax folding, I can imagine that the folding might get confused, as there's a fair bit of sleight of hand going on. I'll try to fix it, but I'm not sure that I can. On 4/3/07, Greg Fitzgerald <[EMAIL PROTECTED]> wrote: I do have a issue using it though. Every time i load vim with your script i can no longer use directional keys when in insert mode. This meaning up,down,left,right or h,j,k,l. Anytime i try to use these keys vim starts printing capital letters when i hit the keys instead of moving around. I have to leave insert mode to move around then go back into insert mode to type again. Any ideas about that? I can't reproduce this under vim 7.0.122 (debian), gVim 7.0 windows, on gVim 7.0.203 windows. Any ideas? I just played around with this. Using vim 7.0.201 on Gentoo, i have tried removing all other scripts and even my .vimrc and i still have the problem only when i load up yours. I looked through your script thinking i could possibly figure it out and I have no clue. After giving up on that I uploaded it to my OpenBSD box vim 7 something i'm to lazy to look for the patch level now. Same issue. Very weird, if you can't reproduce it i'm sure it's on my end. Just trying to find out what would cause it. Like i mentioned i go into insert mode type anything. If i try to use the directional keys while in insert mode i start getting letters inserted above the line i'm on. It is always the same letters though for each key. Left = D Right = C Up = A Down = B Each time i hit a direction a new letter appears above the (on it's own line each time, keeps adding to it.) So any ideas would be welcomed. If i avoid moving around in insert mode it really does work nice. So hope i'm not giving you the wrong impression. I just have been in the habit of being about to move around while in insert mode for years now. Sounds like a wrong termcap entry for the terminal you're on. See, among others, :help :set-termcap :help 'term' :help 'ttybuiltin' :help 'timeout' :help 'ttimeout' :help 'timeoutlen' :help 'ttimeoutlen Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 161. You get up before the sun rises to check your e-mail, and you find yourself in the very same chair long after the sun has set.
Re: fold acting strangely
On Apr 4, 2007, at 9:13 AM, Tim Chase wrote: The visual indicator of the fold-column can help you prevent overlapping sections, which in turn, should help you avoid the behavior you see. Very cool - I didn't have a good idea of what was going on with folding until I turned this on - thanks! -lev
Re: fold acting strangely
I'm experiencing a problem when folding visual blocks - if I have a section folded directly above another section that I want to fold, they end up merging once I fold the second section, sometimes they even add unfolded text to the fold - am I doing something wrong? It sounds like your folds are trying to overlap, which Vim doesn't allow (in fact, every editor with folding that I've used prohibits folding disjoint-but-overlapping sections). To see what's already folded, you can use :set foldcolumn=4 to put some markers in the left-margin (bumping it up from the default of 0 in case you want/need to reset it). If your new fold boundaries cross into an existing fold, Vim tries to do the "sensible" thing and treat the entire folded section as a single line and extends your fold to take the whole sub-fold into consideration. The visual indicator of the fold-column can help you prevent overlapping sections, which in turn, should help you avoid the behavior you see. -tim
fold acting strangely
I'm experiencing a problem when folding visual blocks - if I have a section folded directly above another section that I want to fold, they end up merging once I fold the second section, sometimes they even add unfolded text to the fold - am I doing something wrong? thanks! -lev
Re: splitting buffer content to several files
I have a buffer consisting of many create view ... ... go blocks. How can I write these blocks somehow efficient to different files? This presumes a little stability in your source (that there's consistent spacing/indenting, that case is consistent, that the view-name immediatedly follows as in "create view vwMyView", and that the terminating "go" appears alone on the line, etc) :g/^create view\>/exec '.,/^go$/w '.matchstr(getline('.'), 'create view \+\zs\w\+').'.sql' might do the trick for you. It would be less complex if it didn't try and extract the view-name from your CREATE VIEW statement, but it's kinda the extra-mile :) Alternatively, if you wanted to just use sequential numbers, you could do something like :let x=0|g/^create view\>/exec '.,/^go$/w '.printf("%05d", x).'.sql'|let x +=1 I think the printf() was added in Vim7 so this is a little uglier if you have to get it working on earlier versions...or if you don't need them zero-padded to N (where in the above, N=5) digits for sorting purposes, you can just use :let x=0|g/^create view\>/exec '.,/^go$/w '.x.'.sql'|let x +=1 Just a couple ideas. -tim
splitting buffer content to several files
Hello, I have a buffer consisting of many create view ... ... go blocks. How can I write these blocks somehow efficient to different files? Thank You Joachim ### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.f-secure.com/
Re: Placement of users _vimrc in a MSWindows system.
On Apr 4, 2007, at 7:21 AM, John R. Culleton wrote: I am writing a package that requires an MSWin user to download and install TeX, Vim and my software bundle. That bundle will contain among other things a special _vimrc or _gvimrc file with some F key designations. The problem is I don't know where to put the _vimrc on the user's system via a zip file. I am dealing with naive users so I don't want to burden them with command line manipulations. Is it sufficient to place the user _vimrc file in the user's own folder or is additional manipulation needed? If your users are the only users of the computer, the default _gvimrc location will work fine. The default is C:\Program Files\Vim\vimxx \_gvimrc. If multiple users of the same computer need different _gvimrc files, you'll have to set up some environment variables and store the files in a user-specific directory, like C:\Documents and Settings\username\Vim. See :help win32 (which is available even if you're not running on Windows) for all the details. -James
Re: my map only works sometimes
On 4/4/07, Yakov Lerner <[EMAIL PROTECTED]> wrote: On 4/4/07, ben lieb <[EMAIL PROTECTED]> wrote: > Yakov Lerner wrote: > > On 4/4/07, ben lieb <[EMAIL PROTECTED]> wrote: > >> The following map is used to do add span tags to highlighted text > >> in-line. My problem is that it only works sometimes, and I don't know > >> why. > >> > >> :map ,bb ckpIAkJJ > >> > >> The map works by cutting the highlighted text, putting it on its own > >> line, adding the tag to the front and the end of the line, and then > >> joining the lines. > >> > >> Any thoughts on why this only works sometimes? I can't isolate what > >> conditions bring it about. > > > > Can be several things. > > > > 1. To cancel possible influence of keyboard timeouts, map > > the same rhs to the single-key combination -- like . > > When ,bb dopesn't work, try . If works, it's related to > > timeouts. > > > > 2. Change to vnoremap instead of map. This cancels possibble > > effects or remapping of some chars in the rhs. I think you want to use > > it in the visual mode, right ? Then use vnoremap. > > > > 3. When it doesn';t work, what exactly happens ? Is it totally ignored, > > or works half-way ? > > > > 4. When it doesn't work, do ':map ,bb' to check whether it's still > > defined and is rhs correct. > > > > Yakov > > > > > > > When it doesn't work it, it re-highlights the first half of the > sentence, and then does nothing. > When it doesn't work, what does ':map ,,b' display ? That should have been 'what does ':map ,bb' say ?' Yakov
Re: my map only works sometimes
On 4/4/07, ben lieb <[EMAIL PROTECTED]> wrote: Yakov Lerner wrote: > On 4/4/07, ben lieb <[EMAIL PROTECTED]> wrote: >> The following map is used to do add span tags to highlighted text >> in-line. My problem is that it only works sometimes, and I don't know >> why. >> >> :map ,bb ckpIAkJJ >> >> The map works by cutting the highlighted text, putting it on its own >> line, adding the tag to the front and the end of the line, and then >> joining the lines. >> >> Any thoughts on why this only works sometimes? I can't isolate what >> conditions bring it about. > > Can be several things. > > 1. To cancel possible influence of keyboard timeouts, map > the same rhs to the single-key combination -- like . > When ,bb dopesn't work, try . If works, it's related to > timeouts. > > 2. Change to vnoremap instead of map. This cancels possibble > effects or remapping of some chars in the rhs. I think you want to use > it in the visual mode, right ? Then use vnoremap. > > 3. When it doesn';t work, what exactly happens ? Is it totally ignored, > or works half-way ? > > 4. When it doesn't work, do ':map ,bb' to check whether it's still > defined and is rhs correct. > > Yakov > > > When it doesn't work it, it re-highlights the first half of the sentence, and then does nothing. When it doesn't work, what does ':map ,,b' display ? Yakov
Re: Vim memory leak
On 4/3/07, Max Dyckhoff <[EMAIL PROTECTED]> wrote: My instance of vim (gvim on Windows) appears to have a memory leak, which makes me sad. Is this a common thing for everyone, or is there something in my setup which might be causing it? It's pretty serious. When I start gvim and load my standard session, it will take up about 86MB of RAM. This includes dozens of buffers, splits, tabs and syntax, so I'm not really worried. After about four hours it will be up to more like 120MB, and after a couple of days it will be 200MB+. Loading a "fresh" copy of gvim with all the plugins and my .vimrc, there are various actions I can see that increase the memory usage as reported by the Windows Task Manager. I have no idea on the validity of the Task Manager, but it's all I have on Windows. :sp on a new buffer causes a raise of 4-8K. :q on a split causes a raise of 4-8K. Switching to/from gvim causes a small increase, typically 4-8K for a few switches. Searching (with *) for a word in a .c file (with syntax highlighting) causes it to increase. If you hold down * then you can see the memory usage rocket up. Basically, pretty much any action. Any ideas? Will I just have to live with it and restart my vim session every couple of days? Did you try to set the 'maxmemtot' option ? (:help 'maxmemtot') Does memory drop down if you :bw all buffers ? If you could simulate thousands of user actions using ClientServer using some action-simulating script and have vim grow past 400-500 mb that would be demonstration. It is not easy to distinguish "necessary grow" from memory leak. But my firefox will predictably grow above 200mb in just couple of days in th air. And it does not have memory leak for all I know. But if you can cause it grow indefinitely by opening and closing some page, that would establish a memory leak. Maybe you simply need to buy anoth 1GB of RAM ? This sharply reduces feelings from another 200gb process :-) Yakov
Re: my map only works sometimes
Yakov Lerner wrote: > On 4/4/07, ben lieb <[EMAIL PROTECTED]> wrote: >> The following map is used to do add span tags to highlighted text >> in-line. My problem is that it only works sometimes, and I don't know >> why. >> >> :map ,bb ckpIAkJJ >> >> The map works by cutting the highlighted text, putting it on its own >> line, adding the tag to the front and the end of the line, and then >> joining the lines. >> >> Any thoughts on why this only works sometimes? I can't isolate what >> conditions bring it about. > > Can be several things. > > 1. To cancel possible influence of keyboard timeouts, map > the same rhs to the single-key combination -- like . > When ,bb dopesn't work, try . If works, it's related to > timeouts. > > 2. Change to vnoremap instead of map. This cancels possibble > effects or remapping of some chars in the rhs. I think you want to use > it in the visual mode, right ? Then use vnoremap. > > 3. When it doesn';t work, what exactly happens ? Is it totally ignored, > or works half-way ? > > 4. When it doesn't work, do ':map ,bb' to check whether it's still > defined and is rhs correct. > > Yakov > > > When it doesn't work it, it re-highlights the first half of the sentence, and then does nothing. The reason I 'enter' twice, and then join the lines twice, is to be able to get the text I want surrounded on a line by itself, then at the tags the the front and back, and then join the lines together again. The map is in my vimrc file. An odd thing is that when it doesn't work, I can re-enter it on the command line, and then it will work.
RE: quick query about moving a selection
>>i know with >> i can move a selection to the right by one >>indent, how can i move a selection just one space ? >Well, if you want to move by "one indent", you can > :set sw=1 ts=1 et >which will then make ">>" and "<<" indent by one space (not one >tab) or, you can I might've just forgotten to set sw=2, but I noticed that when I was editing a file and didn't want nested tabs being tabbed over to pretty much the right side of the screen, one little '>>' would tab it over 4 tabs (for ts=2) instead of just 1. Thought that was odd. Was a one-fer, so didn't look into it all that much. Just reset ts=8, '>>'ed, and rereset ts=2. Like I said, probably just forgot to set sw to match ts. Either way, that's just one of those little things to keep in mind in case anyone screws around with non-8 tabs.
Re: how to replace ESC to some other key?
On 4/4/07, wangxu <[EMAIL PROTECTED]> wrote: ESC is so far from the center of the keyboard. Can I replace this key to Caps Lock,for example? I heard some people use Tab as a substitute for Esc. Weird. But it's easier to do in platform-independent way. Yakov
Re: how to replace ESC to some other key?
On Wed, April 4, 2007 10:55 am, wangxu wrote: > ESC is so far from the center of the keyboard. Can I replace this key > to Caps Lock,for example? I don't know how you would do it with the Caps Lock key, but here's what I put in my vimrc to do it with the command key: let mapleader = "," HTH! Tom Purl
Re: my map only works sometimes
On 4/4/07, ben lieb <[EMAIL PROTECTED]> wrote: The following map is used to do add span tags to highlighted text in-line. My problem is that it only works sometimes, and I don't know why. :map ,bb ckpIAkJJ The map works by cutting the highlighted text, putting it on its own line, adding the tag to the front and the end of the line, and then joining the lines. Any thoughts on why this only works sometimes? I can't isolate what conditions bring it about. Can be several things. 1. To cancel possible influence of keyboard timeouts, map the same rhs to the single-key combination -- like . When ,bb dopesn't work, try . If works, it's related to timeouts. 2. Change to vnoremap instead of map. This cancels possibble effects or remapping of some chars in the rhs. I think you want to use it in the visual mode, right ? Then use vnoremap. 3. When it doesn';t work, what exactly happens ? Is it totally ignored, or works half-way ? 4. When it doesn't work, do ':map ,bb' to check whether it's still defined and is rhs correct. Yakov
Re: my map only works sometimes
:map ,bb ckpIAkJJ Any thoughts on why this only works sometimes? I can't isolate what conditions bring it about. What are the results when it "doesn't work"? It looks like you're actually rejoining the lines, so it's odd to add the s just to remove them. Other items include using ":map" instead of "vnoremap" which isolates the mapping to visual mode. My first take on the matter would be something like :vnoremap ,bb c" If this has funky indenting problems (commonly called "marching indent"), you can use this more complex :vnoremap ,bb c:let b:old_paste=&pasteset paste":let &paste=b:old_paste which preserves the 'paste' option, sets the paste option, does the pasting, and then restores your original paste option. If it was really well behaved, it would even delete the variable for you afterwards. :) You can read more about this stunt at :help i_CTRL-R which pastes -tim
my map only works sometimes
The following map is used to do add span tags to highlighted text in-line. My problem is that it only works sometimes, and I don't know why. :map ,bb ckpIAkJJ The map works by cutting the highlighted text, putting it on its own line, adding the tag to the front and the end of the line, and then joining the lines. Any thoughts on why this only works sometimes? I can't isolate what conditions bring it about.
Re: Question about paragraphs: make lines containing only whitespace characters a paragraph separator
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif Thanks. I think this is about what I was looking for. Regards, Thomas.
Re: Question about paragraphs: make lines containing only whitespace characters a paragraph separator
On 4/3/07, Thomas <[EMAIL PROTECTED]> wrote: > Maybe I misunderstand the problem but can't you change those lines > with just blanks to empty lines? Sure I can remove the whitespace characters. But I'd rather simply not have to care about them (but this is filetype-dependent because for some filetypes this really could be what I want). I was just wondering if there maybe already is a (buffer local) option to do this. Regards, Thomas. This is something that might be easier and better anyway. Recently on the list someone posted this little gem: autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif That will erase any trailing whitespace whenever you save the file. --fREW
Re: highlighting errors
On 4/4/07, Lionel Flandin <[EMAIL PROTECTED]> wrote: Hi everyone, I'm trying to find the command that would find the next error in a file. For instance the following code contains a typo, how can one find it ? - #include int main(int argc, char **argv) { printf("Hello world!\n"); ] // <- Here it is :-), vim detects it and makes it red return 0; } - This seems to be a recurring request. In the past, I I posted to this list a vimscript function that does it. I made it into small plugin: http://www.vim.org/scripts/script.php?script_id=1851 SearchSyntaxError : search for the next syntax error detected by the vim highlighting mechanism The usage is very simple: command :ERR searhes for the next syntax error, or That's it. Yakov
Placement of users _vimrc in a MSWindows system.
I am writing a package that requires an MSWin user to download and install TeX, Vim and my software bundle. That bundle will contain among other things a special _vimrc or _gvimrc file with some F key designations. The problem is I don't know where to put the _vimrc on the user's system via a zip file. I am dealing with naive users so I don't want to burden them with command line manipulations. Is it sufficient to place the user _vimrc file in the user's own folder or is additional manipulation needed? I haven't used Windows regularly for more than a decade but I do have a Windows 2000 partition for testing purposes. I use Linux. -- John Culleton Able Indexing and Typesetting Precision typesetting (tm) at reasonable cost. Satisfaction guaranteed. http://wexfordpress.com
Re: case of very slow regex search
On 4/3/07, Peter Hodge <[EMAIL PROTECTED]> wrote: --- Yakov Lerner <[EMAIL PROTECTED]> wrote: > I use sometimes the regex that finds paragraphs > containing given words w1,w2,... in any order ( I define "paragraph" > as separated by lines, \n\n). > > I use the pattern like this: (two-word example, w1 and w2, but easily > expandable for N words): > /\c\(.\|.\n\)*\\&\(.\|.\n\)*\ >(and I set :set maxmempattern=2 ) > This works. But search time is unbelievably slow on big files. > > My question is; is there a rewrite of this regex that works faster. > > To see the testcase how of how slow this works: >1. wget http://www.vmunix.com/~gabor/c/draft.html > # this is ~1.3 MB file. >2. vim draft.html >3. /\c\(.\|.\n\)*\\&\(.\|.\n\)*\ Try this pattern: /\c\n\zs\%(\%(.\|.\n\)\{-}\\&\%(.\|.\n\)\{-}\\) It has the \n at the start so it will match at most once per line and uses \{-} instead of * to prevent backtracking. That search ends in 30 seconds (on a Dual 1.8ghz G5). You won't need to tweak maxmempattern either. Thanks Peter, This works great. Yakov
wish: show search progress on slow searches
Wish: when search is slow, show the progress line number every second on the bottom line (like, 12345 of 9). Maybe this can be done with plugin, I'm not sure. Maybe simply status line can be refreshed once in a second, temporarily setting line number to the current search position. Some regexes take half minute to several minutes time on multimegabyte file. It would be nice to see the progress numbers onscreen. Thanks Yakov
highlighting errors
Hi everyone, I'm trying to find the command that would find the next error in a file. For instance the following code contains a typo, how can one find it ? - #include int main(int argc, char **argv) { printf("Hello world!\n"); ] // <- Here it is :-), vim detects it and makes it red return 0; } - Thx in advance, Lionel
Re: how to replace ESC to some other key?
It is no recommended to map Esc to CapsLock, because you have to figure out different mapping ways for different environments. Try Ctrl-[, Esc is equivalent to Ctrl-[. or, FYR, I myself use "imap jj " instead.
Re: Esperanto dictionary
On Wed, 4 Apr 2007, Cyril Slobin wrote: > Seems like this letter doesn't reached the list. Reposting. I'm sorry > if it appears twice. > > On 4/2/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: > > > Well, I suppose both uppercase and titlecase should be supported then. Cxu > ne? > > CXU VERE NE? (Kompreneble, ??iukaze mi preferas "verajn" ??apelitajn > literojn.) > > CXU, Cxu and cxu are all passed cheking, CXu doesn't. And I believe > this is a Right Thing. I'll concede this: I'm hardly an expert! :-) > > > I suppose texts written in "??Fundamenta?? h-stilo" could emphasise the > radical > > break when needed, as in flug-haveno, chas-hundo, danc-halo, ktp. (er, > etc.). > > Just checked -- translation table used by my plugin knows about > flughaveno and chashundo, but not about danchalo. I don't write this > table myself, but borrow it from UniRed (another opensource editor). > Anyway you can easy add danchalo and any other such word in the table > by yourself -- it is in simple text format. > > BTW x-style is not free from such problems. Pure Esperanto text is OK, > but consider you use the word "Linux" in it! :-) Linukso, (tiel Vindozo, Unikso...) I think http://fagot.alain.free.fr/KompLeks/UTF8/INDL.html Hugh