Re: returning values from function(ex_func_T args)?
> > Yeah, I saw your other post after posting this answer. Well, Vim (and > the vim-script language) defines the following kinds of objects: > skip--- thanks for that listing :) > - Ex-commands > - an Ex-command may trigger an error > - an Ex-command may optionally display something on the command-line > - an Ex-command does not return a value. well - that's it - it cannot return value directly. > In the case of the existing interpreted languages (perl, python, ruby, > Tcl and Mzscheme): > - Vim can > - invoke the interpreter for inline scripts > - invoke the interpreter for individual commands > - invoke the interpreter for every line in a range > - since the interpreter has access to Vim variables, the above can > change variables and thus return a result > - The interpreter can access most Vim variables, functions, commands > and data structures via extensions to the interpreter syntax. yes - I thought about this already, because there is no way to return value. Are there some _documented_ interface to create new variable, and set it to some value? The only thing which comes to mind -- build string and let it be evaluated, but this is quite ugly way. Especially if I will pass lists and dictionaries too. > > You may want to run Exuberant ctags in the src/ directory containing the skip-- > :view eval.c > > etc. > Well, I'm not _that_ clueless :) I've done a lot of RTFS already, but still have questions. -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e [EMAIL PROTECTED]
Re: Problem with completion
Hi Srinath, > For now, I am just going to set noignorecase to get around this, but > it would be nice if this were fixed. On another note, I would like an > option which only ignores case when searching. When doing completion, > I have taken the trouble of typing "Graph" with a capital G, so I > don't want case to be ignored. Is there a way to do this? Aah... there > is... 'smartcase'. Cool... That seems to partly solve the problem. It > works when I have atleast one upper case character typed before I > press C-p. Doesn't completely solve it though. This probably won't make you perfectly happy either, but you can also use '\c' in the search string to force ignore-case, or '\C' to force case-matching. See ':help /\c' for more info. regards, Peter On Yahoo!7 The new Yahoo!7 home page - scan your email inbox, start an IM conversation or update your blog http://au.yahoo.com/
Problem with completion
Hi, I don't know if this has been fixed or "featured", but I am facing a strange problem with completion. In particular, the following options seem to combine in weird ways: vim -u NONE -U NONE /tmp/foobar :set ignorecase :set completeopt+=longest " insert the word "graph" on the first line " and "GraphNode" on second line. " on the third line, type Graph and press . For me, the word I just typed completely dissapears and is replaced with the list containing "graph" and "GraphNode". It seems to be somewhat clear whats going on. Vim ignores case and therefore builds up the list with both "graph" and "GraphNode". But because we only want to display the longest common substring, it tries to find the longest common substring. In finding the common substring, it does respect case (although ignorecase is set) and therefore comes up with an empty string. For now, I am just going to set noignorecase to get around this, but it would be nice if this were fixed. On another note, I would like an option which only ignores case when searching. When doing completion, I have taken the trouble of typing "Graph" with a capital G, so I don't want case to be ignored. Is there a way to do this? Aah... there is... 'smartcase'. Cool... That seems to partly solve the problem. It works when I have atleast one upper case character typed before I press C-p. Doesn't completely solve it though. Anyway, I thought I'd report this since its so easily reproducible. Thanks, Srinath
Re: Conflict in help
100 levels works for me on OS X. regards, Peter --- "A.J.Mechelynck" <[EMAIL PROTECTED]> wrote: > Under ":help starstar-wildcard" it is said that the ** wildcard goes up > to 100 levels deep. > > Under ":help starstar" it is said that it goes up to 30 levels deep by > default, but that any integer value in the range [0,255] can be > explicitly specified. > > Both of them in > *editing.txt* For Vim version 7.0. Last change: 2006 Apr 30 > > Which one is true? 100 or 30? > > > Best regards, > Tony. > On Yahoo!7 Coming soon: Celebrity Survivor - 11 celebrities, 25 days, unlimited drama http://au.yahoo.com/celebrity-survivor/
Conflict in help
Under ":help starstar-wildcard" it is said that the ** wildcard goes up to 100 levels deep. Under ":help starstar" it is said that it goes up to 30 levels deep by default, but that any integer value in the range [0,255] can be explicitly specified. Both of them in *editing.txt* For Vim version 7.0. Last change: 2006 Apr 30 Which one is true? 100 or 30? Best regards, Tony.
Re: returning values from function(ex_func_T args)?
Gaspar Chilingarov wrote: Hi all! IIUC, ex_func_t means "void *", i.e., a pointer to anything. You would still need to know what type of object (a pointer to what) the function you're calling is actually returning. well, I'm going to write if_* script to integrate vim with erlang -- so I need to pass arguments/variables to erlang runtime sistem, and get them back -- there is almost one-to-one mapping from erlang data structures to vim . If what you are interested in writing is a Vim/perl/ruby/tcl/python/mzscheme script and not a C/C++ source file, you should look in the Vim help rather than in the Vim source. ---skip--- no, I'm going to write C code :) Yeah, I saw your other post after posting this answer. Well, Vim (and the vim-script language) defines the following kinds of objects: - data items - Strings and Numbers, which Vim can translate into each other - Number to String doesn't lose information - String to Number converts only what precedes the first non-number (defaul is zero) - Booleans are a special kind of Number (zero=FALSE, nonzero=TRUE) - Lists - Dictionaries - buffers, windows, tab pages - functions - a function takes a fixed or variable number of arguments depending on the function - a function may optionally have side-effects within Vim - a function returns a value, which may be any data item; - by default ("return" without argument, or fall thru to "endfunction") the return value is the Number 0 - a function may trigger an error - Ex-commands - an Ex-command usually does some action - see ":help :command" and scroll to "Command attributes" for the different kinds of arguments, w/wo range, w/wo count, etc. - an Ex-command may trigger an error - an Ex-command may optionally display something on the command-line - an Ex-command does not return a value. In the case of the existing interpreted languages (perl, python, ruby, Tcl and Mzscheme): - Vim can - invoke the interpreter for inline scripts - invoke the interpreter for individual commands - invoke the interpreter for every line in a range - since the interpreter has access to Vim variables, the above can change variables and thus return a result - The interpreter can access most Vim variables, functions, commands and data structures via extensions to the interpreter syntax. You may want to run Exuberant ctags in the src/ directory containing the Vim source, and possibly in whichever include directories are mentioned on the compile command line (as shown by ":version"). This will allow you to go from any word in the source to its definition, see ":help tagsrch.txt". To go _from_ the definition _to_ the use(s) you may have to use the ":vimgrep" command (q.v.) (assuming you have Vim 7). You may also want to read attentively the following, to see how the existing interfaces do it (assuming the src directory is current): :help if_perl.txt :view if_perl.xs :view auto/if_perl.c :view if_perlsfio.c :view proto/if_perl.pro :view proto/if_perlsfio.pro " note: if_perl.c is generated from if_perl.xs when you "make" " Vim. :help if_python.txt :view if_python.c :view if_python.pro :help if_ruby.txt :view if_ruby.c :view if_ruby.pro :help if_tcl.txt :view if_tcl.c :view if_tcl.pro :help if_mzsch.txt :view if_mzsch.c :view if_mzsch.pro :view if_mzsch.h :view eval.c etc. Best regards, Tony.
Re: returning values from function(ex_func_T args)?
Hi all! > IIUC, ex_func_t means "void *", i.e., a pointer to anything. You would > still need to know what type of object (a pointer to what) the function > you're calling is actually returning. well, I'm going to write if_* script to integrate vim with erlang -- so I need to pass arguments/variables to erlang runtime sistem, and get them back -- there is almost one-to-one mapping from erlang data structures to vim . > > If what you are interested in writing is a > Vim/perl/ruby/tcl/python/mzscheme script and not a C/C++ source file, > you should look in the Vim help rather than in the Vim source. ---skip--- no, I'm going to write C code :) -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e [EMAIL PROTECTED]
Re: returning values from function(ex_func_T args)?
Gaspar Chilingarov wrote: Hello! Are there any common method to return values from ex_func_T type functions which are defined in CMD_index in ex_cmds.h (external command handlers - say perl/ruby and etc)? I would like to return function execution result to calling script - say string, or list. Thanks in advance, Gaspar IIUC, ex_func_t means "void *", i.e., a pointer to anything. You would still need to know what type of object (a pointer to what) the function you're calling is actually returning. If what you are interested in writing is a Vim/perl/ruby/tcl/python/mzscheme script and not a C/C++ source file, you should look in the Vim help rather than in the Vim source. If you are calling a Perl function from Vim, see ":help if_perl.vim". If you are calling a Vim function from Perl, look there and also in the help item for the function you're calling. An Ex-command is not the same as a function: a function _may_ have some side-effects (execute an action), it _always_ returns a result (which is the number zero if a ":return" statement without arguments is executed, or if control falls through to the ":endfunction" statement. An Ex-command may execute some action and/or display a status message, it does not "return a result." To intercept errors generated in Vim, you can use the try/catch/finally/endtry mechanism (see ":help :try"). To ignore them, use ":silent" (q.v.) Best regards, Tony.
need hints writing if_*.c file
Hello! I'm trying to develop interface from vim to erlang -- for embedding debugging, competition and etc functions, which is much more easy to do natively in that language, than trying to emulate erlang parser in vim. For now I've managed to create if_erlang extension with definition of functions which I need. One of them is a void ex_erlconnect(exarg_T *eap) if should take 2 arguments -- hostname and password Now I'm concerned how I should parse eap->arg to allow passing there, say, variables -- because I with to allow both erlconnect 'localhost', 'foobar' and let host='localhost' erlconnect host, 'foobar' syntaxes. Are there any building function to deal with command line parsing? or not? Are there any documentation -- I've found none about this subject -- i.e. how to extend vim and write bindings to another languages. I would like also ask how to track network socket activity? The only place, where I've found vim is doing some network exchange is an netbeans.c. After examining code I was surprised, that I should have gtk or X library to make callback if data is available on socket, and not a signal processing (say in SIGIO handler). In general I would like to use that extension without having GUI -- in console vim too. How would you recommend to write network-related part? If there is any documentation -- it's enough to provide link there, I'll read it :) Thanks in advance. /Gaspar -- Gaspar Chilingarov System Administrator, Network security consulting t +37493 419763 (mob) i 63174784 e [EMAIL PROTECTED]
returning values from function(ex_func_T args)?
Hello! Are there any common method to return values from ex_func_T type functions which are defined in CMD_index in ex_cmds.h (external command handlers - say perl/ruby and etc)? I would like to return function execution result to calling script - say string, or list. Thanks in advance, Gaspar
Re: any git developper using gvimdiff ?
Le lun 21 août 2006 17:31, Christian MICHON a écrit : > which was the logical conclusion I also came too! > Thanks for confirming :) > > I now proceed thru a shell script to checkout previous > version and perform gvimdiff asynchronously to git. in decent shells you can do: (g)vimdiff \ <(cat $FILE | (git diff $REV -- $FILE | patch -Rs -o /dev/stdout)) \ $FILE $FILE beeing the file you need to vimdiff and $REV the orginal revision. ->> cat $FILE | (git diff $REV -- $FILE | patch -Rs -o /dev/stdout) that stanza is just a way to obtain the state of $FILE at revision $REV. I may have overlooked sth and maybe there is a "trivial" git command that can do that, if that's true, then you just need to: vimdiff <(git that-command $REV $FILE) $FILE that should work in bash 3+ and zsh of any decent version (like in 4.x I guess). -- ·O· Pierre Habouzit ··O[EMAIL PROTECTED] OOOhttp://www.madism.org pgpMkrU7mJf48.pgp Description: PGP signature
Re: any git developper using gvimdiff ?
which was the logical conclusion I also came too! Thanks for confirming :) I now proceed thru a shell script to checkout previous version and perform gvimdiff asynchronously to git. works like a charm :) On 8/21/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote: Christian MICHON wrote: > Hi vim-devers, > > I'm currently trying out "git" (linux scm) and I have not found yet > how to perform a gvimdiff on a file locally modified with the latest > commit. > > Is there a simple/easy way out for this issue ? Any "git" > specialist amond vim-dev who could give me a hint ? > > Thanks in advance gvimdiff takes two versions of the same file as arguments, so the question boils down to "how to get the successive versions of the file?". I don't know git (and on SuSE 9.3 I have no program of that name in my $PATH) but the command-line for gvimdiff is typically something like gvimdiff filename.ext.old filename.ext The answer may be as simple as taking backup copies of your files. Best regards, Tony. -- Christian
Re: any git developper using gvimdiff ?
Christian MICHON wrote: Hi vim-devers, I'm currently trying out "git" (linux scm) and I have not found yet how to perform a gvimdiff on a file locally modified with the latest commit. Is there a simple/easy way out for this issue ? Any "git" specialist amond vim-dev who could give me a hint ? Thanks in advance gvimdiff takes two versions of the same file as arguments, so the question boils down to "how to get the successive versions of the file?". I don't know git (and on SuSE 9.3 I have no program of that name in my $PATH) but the command-line for gvimdiff is typically something like gvimdiff filename.ext.old filename.ext The answer may be as simple as taking backup copies of your files. Best regards, Tony.
any git developper using gvimdiff ?
Hi vim-devers, I'm currently trying out "git" (linux scm) and I have not found yet how to perform a gvimdiff on a file locally modified with the latest commit. Is there a simple/easy way out for this issue ? Any "git" specialist amond vim-dev who could give me a hint ? Thanks in advance -- Christian
Re: Netrw and cindent
Mark S. Williams wrote: I think I've uncovered an odd bug involving Netrw and the cindent local buffer option for Java files, where cindent is unset under certain conditions. I'm afraid that I don't see this problem; I tried both your examples. Please try v103f from my website: http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs , see "Network Oriented Reading, Writing, and Browsing". If this problem continues to occur, then its likely some setting or other plugin is interfering (the latter most likely via an autocmd). Regards, Chip Campbell
syntax and filetype.vim patch for 'initng' config files
This is filetype.vim patch and syntax for initng config files. Initng is bold new replacement for sysv-init, http://initng.thinktux.net Those config files sit under /etc/initng/** and have extension *.i Distinguishing them from other *.i files is easy, they have #!/bin/itype in the 1st line. The syntax file was written by Elan Ruusamäe <[EMAIL PROTECTED]> and comes from http://glen.alkohol.ee/pld/initng/vim/ Yakov --- filetype.vim2006-08-21 14:46:46.0 + +++ filetype.vim.0012006-08-21 14:19:49.0 + @@ -1250,19 +1250,14 @@ endif endfun -" Progress or assembly or initng -au BufNewFile,BufRead *.i call s:FTprogress_asm_initng() +" Progress or assembly +au BufNewFile,BufRead *.i call s:FTprogress_asm() -function! s:FTprogress_asm_initng() +function! s:FTprogress_asm() if exists("g:filetype_i") exe "setf " . g:filetype_i return endif - " initng *.i files begin with #!/sbin/itype - if getline(1) ==# '#!/sbin/itype' - setf initng - return - endif " This function checks for an assembly comment the first ten lines. " If not found, assume Progress. let lnum = 1 initng.vim Description: Binary data
"\" inside =
The following does not work as expected. I wonder whether it is a bug or a feature: cabbr XXX ="xyz".Left() function! Left() return "\" endfun Instead of repositioning cursor left, I get :[EMAIL PROTECTED] I know It is possible to make it work via feedkeys(), but this [EMAIL PROTECTED] does not make much sense, does it ? I wonder why "\" is nor recognized here as special key ? Is it some sort of bug ? Yakov