Excerpts from mobi phil's message of Wed Jul 15 14:43:45 +0200 2009: > > > > Again: :h pattern : look for this line: > > > |/\_.| \_. \_. any single character or end-of-line > > Thus you can already search across line boundaries. But it might be more > > difficult to write the search pattern. > > > that is again workaround. Sure it is. Bu the workaround takes less than 5min to implement. If you do 5 searches a minute.. Go for it - good luck. If I have such an idea and want to implement it it turns out to take days. That's why I suggested asking for "workarounds" and exploring whether they could work for you.
I'd like to see some more development on vim as well. > symbols for the script etc. The same with python. I doubt that the > functions available to the python interface would allow me to implement > the previously presented smartsearch for example There is another way: Implement kind of event loop listening for keyboard input using getchar() replacing the search pattern on the fly? Here is an implementation which might just work for you without patching C code, source the file and press F2, then type ba to match "bar\napple" fun! CharsToPattern(list) let pattern = '' let spaces='\%(\n\|\s\)\+' " newline or space at least once for i in a:list let pattern .= '\<'.i.'\S*'.spaces endfor return pattern endfun " starts an event loop polling for keyboard input " type esc to abort, <cr> to accept smart search " TODO: don't use cursorline but use regex to highlight match fun! SmartSearch() echo "smart-search, type some chars" " FIXME: turn it off again conditionally set cursorline let oldpos = getpos('.') let typedchars = [] " keeps a list of characters while 1 let c = getchar() if index([13,10],c) >= 0 " pressed enter, keeep position call feedkeys("/".CharsToPattern(typedchars)."\n") return elseif index([27], c) >=0 " esc, abort call setpos('.', oldpos) return "" elseif c == "\<bs>" " backspace, remove last item let typedchars = typedchars[:-2] else call add(typedchars, nr2char(c)) endif " reset cursor pos cause we want the next match call setpos('.', oldpos) let g:pattern = CharsToPattern(typedchars) call search(g:pattern, 'w') redraw! echo join(typedchars,'').' press esc to exit, <cr> to accept' endwhile endf noremap <F2> :call SmartSearch()<cr> > Look, I think I am enough mature and have years of IT, I know how to > attack a problem. Sure. I didn't want to say you can't solve problems. Sure you can. I want to show you that vim is its own world and has its own solutions. So do me a favour and judge the solution above and tell how distinct is it from a real acceptable solution ? > Of course I will try to use it for everything. I had few month ago an > experiment > to go back a bit to Eclipse, but the first time I had to move my hand to the > mouse, I was sick :) So eclim is for you. There are some use cases using a mouse is faster. Eg renaming keywords in Java files using Eclipse IDE cause Eclipse is Java aware and will do a perfect job an many files. You can't get that speed by using dozens of mappings using vim, can you? (Of course I miss idutils and I grep code using vim far more often than using Eclipse IDE). Another thing I'd cosider using Eclipse is debugging PHP, Python, Java Code. There are some debuggers for vim. But they lack some important features such as clicking on the stack trace and exploring vars at that point of the trace. Yes, you have to leave the keyboard.. But you can set breakpoint properties and such more easily (IMHO).. That's what I meant by using the right tool for a task. So for Debugging I'd vote for Eclipse. For code I know very well I'd use vim. > But I would not give up with the idea to search efficiently in 2GB text > data. 2GB text data? Is it one file? Yes, you're right vim can be a good solution for this problem (maybe switching of syntax highlighting etc..) > you would rather smartsearch, than writing hierogliphs in your search > commands :) I agreed and gave you a very first proof of concept implementation. I gave you a much smarter second one now. So judge it again and let's see.. About locking and making vim threadsafe: I don't want to make the whole vim code thread safe. I don't have that much time and probably I'm not smart enough to finish that task in reasonable time.. So I'd try getting a lock when vim runs any action (eg due to keyboard input) or a python thread calls vim.eval. This might be doable. If you really want to have this stuff have a look at tovl. I used vim server features to talk back to vim using another thread. That works only when running X but it works :) By the way: Nice to meet you! Marc Weber --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---