RE: Python crash
Just to verify-I tried with python2.4 libs too :-D -Original Message- From: Tom Whittock [mailto:[EMAIL PROTECTED] Sent: Thursday, April 05, 2007 2:47 AM To: Chuck Mason Cc: vim@vim.org Subject: Re: Python crash sys.path.append(c:\\python23\\lib) What's the result of :py import sys :py print sys.version ? If it's not 2.3.something then there is no way you should be doing that.
RE: Python crash
/nodefaultlib:python24.lib That's 2.4 right? The point is that vim.command() is not thread-safe. I tried this in pearl (5.8) as well with the same result. Except that perl's VIM::Msg works in a thread (albeit things seem unstable) and VIM::DoCommand does not. Chuck -Original Message- From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] Sent: Thursday, April 05, 2007 11:11 AM To: Chuck Mason Cc: Tom Whittock; vim@vim.org Subject: Re: Python crash -Original Message- From: Tom Whittock [mailto:[EMAIL PROTECTED] Sent: Thursday, April 05, 2007 2:47 AM To: Chuck Mason Cc: vim@vim.org Subject: Re: Python crash sys.path.append(c:\\python23\\lib) What's the result of :py import sys :py print sys.version ? If it's not 2.3.something then there is no way you should be doing that. Chuck Mason wrote: Just to verify-I tried with python2.4 libs too :-D You should be using the same version of Python as what Vim was compiled for, see the second half of the output of :version. Best regards, Tony. -- I've found my niche. If you're wondering why I'm not there, there was this little hole in the bottom ... -- John Croll
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
: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
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
Executing vimfunctions in background
I'm interested in writing a plugin that could run in the background as I do some work in a buffer. For instance I have a function that appends a line to :copen. I would like to run it in the background continuously. How could I do this and continue working in the foreground? func myFunc() while 1 exe caddexpr expand(%) . : . line(.) . : . getline(.) exe sleep 5 endwhile endfunc how do I launch myFunc() to run continuously in the background? Chuck
RE: Executing vimfunctions in background
Yes and no- I think this would work in certain situations, but of course what happens when I don't move the cursor? Actually, why isn't there a Timer autocommand? :) Feature request? -Original Message- From: Yakov Lerner [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 03, 2007 11:05 AM To: Chuck Mason Cc: vim@vim.org Subject: Re: Executing vimfunctions in background On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote: I'm interested in writing a plugin that could run in the background as I do some work in a buffer. For instance I have a function that appends a line to :copen. I would like to run it in the background continuously. How could I do this and continue working in the foreground? func myFunc() while 1 exe caddexpr expand(%) . : . line(.) . : . getline(.) exe sleep 5 endwhile endfunc how do I launch myFunc() to run continuously in the background? Chuhk, You probably want to give the 'au CursorMoved' autocommand a try for this task. Such tasks are normally solved with autocommands in vim. See: :help au :hep CursorMoved Good luck Yakov
RE: Executing vimfunctions in background
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 -Original Message- From: Yakov Lerner [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 03, 2007 12:44 PM To: Chuck Mason Cc: vim@vim.org Subject: Re: Executing vimfunctions in background On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote: Yes and no- I think this would work in certain situations, but of course what happens when I don't move the cursor? If you didn't move the cursor -- then why would you add the same position to the quicfix list again and again ? What's the point ? How is adding same position again and again (seems meaningless to me) better than reacting to cursor motion ? Yakov Actually, why isn't there a Timer autocommand? :) Feature request? -Original Message- From: Yakov Lerner [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 03, 2007 11:05 AM To: Chuck Mason Cc: vim@vim.org Subject: Re: Executing vimfunctions in background On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote: I'm interested in writing a plugin that could run in the background as I do some work in a buffer. For instance I have a function that appends a line to :copen. I would like to run it in the background continuously. How could I do this and continue working in the foreground? func myFunc() while 1 exe caddexpr expand(%) . : . line(.) . : . getline(.) exe sleep 5 endwhile endfunc how do I launch myFunc() to run continuously in the background? Chuhk, You probably want to give the 'au CursorMoved' autocommand a try for this task. Such tasks are normally solved with autocommands in vim. See: :help au :hep CursorMoved Good luck Yakov
two questions
1. I have been trying to figure out a command that would let me place parenthesis (()) around a word, line paragraph or whatever. I.e. g(wcould put parens around a word g($could put parens around cursor position and end of line, likewise g(^could do beginning of line and cursor g(around a quoted string g(ap around a paragraph, etc. I'm sure you get my point. I tried to write a function visualmode() parameter but I just can't seem to get all my situations. Ideally, g({motion} would parenthesis whatever I specify in {motion}. 2. I often times like to line up certain characters to match characters on the line above or below. I.e: void SomeLongFunctionName( void ); void SomeFunc( void ); I would like to put my cursor on the ( on the 2nd line and type something like \at( for align to ( (on the line above would be implied, but perhaps \aT( would be line below? ) This I haven't attempted yet but my only idea would be to make a function that calls getpos(.), subtract 1 from line, read the line, count up to the next ( and do a for insert-loop. Is there a better way? Any help is much appreciated! Chuck
Making C-] do something different
In source code, C-] follows a tags file. In :help it follows links (Maybe there's a helptags file?). But I've created a new temp buffer from some vim code and I want C-] to do something different for only this buffer. For instance I have a line that looks like: ... sometext somenumber1 someothertext2 And if the user presses C-] anywhere on the line I would like to take somenumber1 and do something with it (follow it by replacing the current buffer with another file referenced by the number). If the line doesn't start with ... Then ignore the keypress. I think I can handle all that but I want to know if its possible to: either set up a handler for C-] or must I just :map it? If I must :map it, I can :map so it only affects the current buffer? :bmap? Any help would surely help! Chuck
cw without losing 0
Does anyone know of a shorter, happier way to perform (in normal mode) Pdwbyw That is, replace the current word with whats in 0 but leave 0 alone? Chuck
RE: cw without losing 0
Almost what I want -- One problem is that foo is not always foo for me. It would change, as I'm changing a bunch of different words to my single target word. The other problem is that your method wipes 0. cwbarEsc puts foo into 0 but what I really want is to ``replace current word with what's already in my 0 without overwriting my 0 '' Chuck -Original Message- From: Aaron Griffin [mailto:[EMAIL PROTECTED] Sent: Thursday, December 07, 2006 9:47 PM To: Chuck Mason Cc: vim@vim.org Subject: Re: cw without losing 0 On 12/7/06, Chuck Mason [EMAIL PROTECTED] wrote: Does anyone know of a shorter, happier way to perform (in normal mode) Pdwbyw That is, replace the current word with whats in 0 but leave 0 alone? If I understand you right, here's what I do in that situation. Say I want to replace all foo with bar like that... /\foo\ find the first foo cwbaresc n . repeat n . repeat etc etc etc
RE: Matching JUST the nth occurence of a text in a line
Am I the only one amused that /homeCRn does nearly the same thing? I mean, I suppose you could be doing operations on your search but couldn't you equally just ayw and do stuff there? Besides \{-}\zs takes too long to type :) -Original Message- From: Bill McCarthy [mailto:[EMAIL PROTECTED] Sent: Thursday, November 30, 2006 4:56 PM To: zzapper Cc: vim@vim.org Subject: Re: Matching JUST the nth occurence of a text in a line On Thu 30-Nov-06 6:31pm -0600, zzapper wrote: Hi given a sample text below home home gg home xxx home ggg ggg home home home home How do you match JUST the second home in any of the above lines (ie avoid greediness) /home.\{-}\zshome -- Best regards, Bill
RE: Search all text files in a directory for text
Sorry to bring this up again. Was there every any solution to this? Do I just need the latest netrw? I was trying to get :Explore **/pattern working But as I do see the Match n of N in the lower right, the cursor never moves in the browse buffer (with S-Down/S-Up) and occasionally I get errors: Error detected while processing function netrw#Explore: line 165: E121: Undefined variable: w:netrw_longlist E15: Invalid expression: w:netrw_longlist == 0 || w:netrw_longlist == 1 I'm using vim7.0 (2006 may 7), and tried this with -N -u NONE. Maybe someone here knows how to get this working? -Original Message- From: Gary Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, August 28, 2006 1:14 PM To: vim@vim.org Subject: Re: Search all text files in a directory for text FWIW, I just tried this on Windows using vim-7.0 without patches, downloaded from vim.sf.net, and netrw 103g. I started vim from the Command Prompt in a directory that contained one Python file and a number of subdirectories, each containing several Python files. vim -N -u NONE -i NONE :runtime plugin/netrwPlugin.vim :Explore **/*.py Error detected while processing function netrw#Explore: line 178: E63: invalid use of \_ the buffer was empty and the status line contained Match 1 of 222. Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Wireless Division | Spokane, Washington, USA
RE: Execute something when I enter in a directory
While I'm still new here, I would like to share my version based on Yakov's. Below uses \\ directory separator so this will not work on any *nix. I could make it more os-independent by doing an `if' and `let cmdsep=whatever', but I'm positive there's a better way to do it. Or maybe there's just a way to chop off the topmost directory name from a string. In any case, the function below simply seeks to the root of the filesystem searching for a _lvimrc and stops after finding one. function! ExecuteLocalConfig() let x = expand('%:p:h') let fn = x . /_lvimrc if filereadable(fn) exe source . substitute(fn, ' ', '\\ ', 'g') else while strridx(x, \\) != -1 let p = strridx(x, \\) let x = strpart(x, 0, p) let fn = x . /_lvimrc echo fn if filereadable(fn) exe source . substitute(fn, ' ', '\\ ', 'g') break endif endwhile endif endfunc handle local config au if !exists(au_localconfig) let au_localconfig = 1 au BufNewFIle,BufRead * call ExecuteLocalConfig() endif Chuck -Original Message- From: Yakov Lerner [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 05, 2006 3:20 AM To: Andrea Spadaccini Cc: vim@vim.org Subject: Re: Execute something when I enter in a directory On 9/5/06, Andrea Spadaccini [EMAIL PROTECTED] wrote: Hello vimmers, I'd like to load some settings when I enter in a directory, like for instance setting makeprg. Is there a way to do it? Thanks in advance from a lurker! :) I have this in my .vimrc: au BufRead,BufNewFile * let x=expand('%:p:h')./.lvimrc | if filereadable(x) | exe source .x | endif let x=expand('%:p:h')./.lvimrc | if filereadable(x) | exe source .x | endif Then I put directory-specififc settings into file .lvimrc in that directory. Yakov
RE: Problem with :normal?
If you do :normal vfld then what happens is what you expect. So, my guess is that the script is simply stopped when f' doesn't do anything. I.e. there is no ' so f' errs and the rest of the command is terminated. That's just my *guess*, though. Chuck -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, August 31, 2006 10:49 AM To: vim@vim.org Subject: Problem with :normal? Hey Vimmers, after reading through a thread earlier on sourcing commands from a file i did a little experimentation with :normal. If given the line: test this line ^ with the cursor at the carat and you do :normal vf'df'D nothing is deleted and you are left in normal mode. If on the other hand, you actually type vf'df'D in normal mode you are only left with test. I've noticed some other strange behavior when using visual mode from :normal. Not sure if this is a bug. It exists through patch 40 of vim7. Looks like both linux and windows versions are affected. Thanks! Dan
RE: Problem with :normal?
Sorry for the added reply, but this is indeed very interesting. I get the same results from recording: qqvf'df'Dq -- does what you expect executing all commands @q -- behaves like :normal vf'df'D and stops executing after f' :normal f' is another example where the are never executed. I browsed through the help and couldn't find anything saying this is intended behavior. In fact, quite the opposite: :norm[al]! {commands} ... {commands} is executed like it is typed. ... Chuck -Original Message- From: Chuck Mason Sent: Thursday, August 31, 2006 11:02 AM To: [EMAIL PROTECTED]; vim@vim.org Subject: RE: Problem with :normal? If you do :normal vfld then what happens is what you expect. So, my guess is that the script is simply stopped when f' doesn't do anything. I.e. there is no ' so f' errs and the rest of the command is terminated. That's just my *guess*, though. Chuck -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, August 31, 2006 10:49 AM To: vim@vim.org Subject: Problem with :normal? Hey Vimmers, after reading through a thread earlier on sourcing commands from a file i did a little experimentation with :normal. If given the line: test this line ^ with the cursor at the carat and you do :normal vf'df'D nothing is deleted and you are left in normal mode. If on the other hand, you actually type vf'df'D in normal mode you are only left with test. I've noticed some other strange behavior when using visual mode from :normal. Not sure if this is a bug. It exists through patch 40 of vim7. Looks like both linux and windows versions are affected. Thanks! Dan
RE: Python Script Execution Support in ViM
Try this the function below. I'm a very novice vim programmer so forgive me if there's an easier way to do this. However, what's below seemed to work for me. Chuck function! ExecuteCurBufAsPython() let buffer = getline(1, line($)) let newbuf = let index = 0 while index len(buffer) let line = buffer[index] let newbuf = newbuf . \n . line let index = index + 1 endwhile execute python . newbuf endfunc :nmap F5 :call ExecuteCurBufAsPython() -Original Message- From: Carroll, Barry [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 5:39 PM To: vim@vim.org Subject: Python Script Execution Support in ViM Greetings: This is my first posting to this list. I have used ViM off and on for many years. For the past year I have been using it exclusively to write Python programs for the Windows (2000/XP) and Linux (Fedora) platforms. I am using version 6.3 with python/dyn enabled on Windows and 6.2 with Python enabled on Linux. Currently, when I want to run a script I am working on I have to open a separate command or interpreter window and do my work there. I would like to be able to execute the open buffer from inside ViM, open a split window and have the Python interpreter start automatically and import the open buffer, and other IDE-like actions. Does ViM offer this kind of support for Python? I have read tantalizing bits on various web pages that indicate it might be so, but can find nothing that tells just what is supported and how to make it work. Can someone point me in the right direction? Thank you in advance for your help. Regards, Barry [EMAIL PROTECTED] 541-302-1107 We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed
RE: previous buffer?
Does C-o and C-i do what you are asking about? Perhaps the jump list can be used to your advantage here. -Original Message- From: Lev Lvovsky [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 23, 2006 9:51 AM 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)? thanks! -lev