VIM: Use python 2.5 with vim 7.2
How can use Python2.5 with to write scripts in vim? I'm using vim 7.2 and have Python 2.5. Vim 7.2 seem to be linked with Python 2.4 Do I have to compile from source? ...
How can use Python2.5 with to write scripts in vim? I'm using vim 7.2 and have Python 2.5. Vim 7.2 seem to be linked with Python 2.4 Do I have to compile from source? ...
I'll try to explain by example.. If we have a piece of code like this in vim: if ($feck == true && $drink == false) { echo 'They lie in wait like wolves..'; } And I go to visual mode and select "$drink" for example, is there a way to: detect whether the current selection is one of vim's text-objects (word, WORD, inner {, etc.) ...
I have written this script that replaces many spaces around the cursor with one space. This however doesn't work when I use it with no spaces around the cursor. It seems to me that Vim doesn't replace on a zero-width match. function JustOneSpace() let save_cursor = getpos(".") let pos = searchpos(' \+', 'bc') s/\s*\%#\s*/ /e...
Hi, I am using vim debugger for debugging vim scripts [BreakPts]. :BreakPts //will create a new window and populates it with the list of vim functions available/loaded. We can click Enter on any function name to get the function definition and hit to set a break point on any line. Now, the question is how to print the source file sc...
Hi, i want to get the offset of the current cursor position the current selection range in vim, beginning from the start of the file. I do this in python, so hints how to do it with vim's python scripting would be very helpful. I have used vim.current.. before for doing scripting, but it uses lines and columns rather than a gener...
If I do either of the following two: call search("searchString") exec "/ searchString" From a script, then vim does the search but does not highlight the results, even though hlsearch. Doing the same searches from outside a script highlights the results. Thanks ...
I'm trying to implement the vim script from the book Learning vi and vim on page 202. The following function works, but when I try to use statusline to call it I get the following error: $ vim $ Error detected while processing /Users/me/.vimrc: E518: Unknown option: \ %{SetTimeOfDayColors()} Here's the vim script (it's currently in my...
I'd like to be able to, say, check the value of $1 inside the if block, to get the first backreference. However vimscript is not perl. Is there some way to do this? I'm aware of the possibility of using \1, \2, etc., inside the regex, but I'd like to match and then use the values in subsequent statements, as is possible in perl, php, ...
I would like to tidy up my Vim color scheme file, by replacing #ABCDEF colors with variables. For example, I would like to replace this: highlight String guifg=#61CE3C highlight Identifier guifg=#61CE3C highlight Type guifg=#84A7C1 with something like this (pseudo-code vimscript): my_string =#61CE3C my_type =#84A7C1 high...
I want to write a vim script to do the following: if I have the following in my Java code, Z z = obj1.foo().bar().foo1().bar1() it should be replaced by if(obj1 != null) { T1 o1 = obj1.foo(); if(o1 != null) { T2 o2 = o1.bar(); if(o2!=null) { T3 o3 = o2.foo1(); if(o3 != null) { z = o3.b...
How do I define a vim function such that when called with Foo it searches via vimgrep for \s*class Foo or \s*struct Foo ? [This is poorman's cscope/ctag; I want to be able to type in a class name, and have it search for the class.] If this is easy, is there a way I can tell it to look under my cursor to use that 'word' as the ...
I want to filter the content of a register (in my case, the clipboard register "+) through an external command before pasting it into the buffer. There should be a solution along the lines of http://stackoverflow.com/questions/1694392/, but I just don't seem to be able to figure it out. ...
How to match script functions (s:...) with FuncUndefined autocommand without asterisk (for exact match)? None of that does work: execute "autocmd AutoGroup FuncUndefined s:".funcname." ".cmd execute "autocmd AutoGroup FuncUndefined <SID>".funcname." ".cmd execute "autocmd AutoGroup FuncUndefined <SNR>".sid."_".funcname." ".cmd execute "...
Hi I'm working in gvim with sessions and tabs, and everything works great. However there is something that is bothering me. Say I have two files open: /A/B/foo.ext and /C/D/E/bar.ext, the latter being opened last. Now say I want to open /A/B/foobar.ext. I have to go through the hassle of navigating upwards to / and from there to /A/B. ...
According to http://vimdoc.sourceforge.net/htmldoc/usr_41.html#function-list vim script has functions setline() and append() to modify the current buffer but how do i delete a line from within a script? With setline(1, "") the line is only emptied but I want to get rid of it. ...
I'm hoping to call a "static" dictionary function using call(). By "static" I mean that the keyword 'dict' is not used in the function's definition. I use this nomenclature in the hopes that the effect of this keyword is to declare a static member function as is possible in java/C++/etc, ie to put the function name in the class namespa...
I'm pretty confused by one of the subtleties of the vimscript extend() function. If you use it to extend a list with another list, it does pretty much what you'd expect, which is to insert the second list into the first list at the index given by the third parameter: let list1 = [1,2,3,4,5,6] | echo extend(list1,[1,2,3,4,5,6],5) ...
When I use :%! to run the contents of a file through a filter and the filter fails (it returns another code than 0) and prints an error message to stderr I get my file replaced with this error message. Is there a way to tell vim to skip the filtering if the filter returns an status code that indicates an error and/or ignore output the fi...
I want to add a possibility of restoring mappings overwritten by my plugin. But the problem is that I cannot distinguish between the following mappings: inoremap <expr> @ test and inoremap @ test First mapping inserts the contents of the variable test, while second inserts text «test». Both mappings give maparg("@", 'i')=="test" an...
I have a vim script that uses a one line window to get a filename pattern from the user. This pattern can be completed to a full filename from a database if you press CTRL-X CTRL-O. Now the only problem is that you have to press the auto completion shortcut by yourself. But I want the auto completion to work incrementally so that for eve...