Re: wish: allow a: in the function def
So that the name is consistent everywhere. Makes it much easier to search. I would appreciate this addition, too. Example function! Test(param) echo a:param endfunction When you see param and want to know where it is used, all you have to do is pressing * (using set hlsearch or a plugin such as mark.vim) When seeing the line a:param you know where to look as well. using [[ should take you to the place where param was defined. So I can't see why this should make it much easier to search ? (joke: If you see a:param and you do start grepping .vim you've missed a point :)
Re: wish: allow a: in the function def
So maybe one could make vimscript search a variable foo as l:foo, a:foo, (maybe also: w:foo, b:foo), s:foo, g:foo, and then throw an undefined variable name error if none exists. Or so. No. I don't want to go back to VB without using Option Explicit ;) Don't let vim find some value somewhere. This leads to failures not so easy to spot But you are right. This might be useful: Use buffer setting if it exists, if not use global one.. But you should be able to emulate this behaviour using the function exists: function GetSetting(name) if exists('b:'.a:name) exec 'return b:'.a:name elseif exists('g:'.a:name) exec 'return g:'.a:name else echoe Please define setting .a:name endif endfunction perhaps even add a optional parameter for a default value.. I'm using this very often: function! vl#lib#brief#args#GetOptionalArg( name, default, ...) if a:0 == 1 let idx = a:1 else let idx = 1 endif if type( a:default) != 1 throw wrong type: default parameter of vl#lib#brief#args#GetOptionalArg must be a string, use string(value) endif let script = [ if a:0 = . idx \ , let .a:name. = a:.idx \ , else \ , let .a:name. = .a:default \ , endif \ ] return join( script, \n) endfunction function GetSetting(name, ...) exec vl#lib#brief#args#GetOptionalArg('default', string(option not given)) if exists('b:'.a:name) exec 'return b:'.a:name elseif exists('g:'.a:name) exec 'return g:'.a:name else return default endif endfunction Then you can use let b = GetSetting('my_name','default value') or let b = GetSetting('my_name') which will set b to option not given if neither b:my_name nor g:my_name does exist HTH Marc
Re: suggestion
On Tue, Apr 17, 2007 at 10:35:14PM -0400, David Howland wrote: Dear Vim gods, Please consider adding the following command to Vim: :bc (for buffer close) It acts just like :bd , except that if the buffer is in a split window, it does not remove the window. Thank you. I've seen this somewhere.. Yeah. http://mysite.verizon.net/astronaut/vim/index.html See Deleting a buffer without changing you window layout.. Marc
Re: Highlighting keywords from C libraries
Since projects won't have as many keywords as glibc, the only slow down will be with the syntax file (re)generation. ctags is reasonably fast Sorry. I haven't read your message thoroughly enough. I was talking about what you've written in your comment. /me hides ;) Marc
Suggestion: numbers for completion menu?
It would be convinient to get an item from the completion menu faster than downdown .. or typing more characters. What do you think of prepending each item with a number and add a key-mapping c-iidx to get the idxth item? so c-i4 would select the 4th. Would it be convinient to add another mapping space for completions? mnoremap 2 c-i2 ? m = omni completion _m_enu ? Or is there another easy way to achieve this ? Marc
Re: BOF Vim 8 - EncryptLine
On Thu, Jan 18, 2007 at 02:15:36PM +1100, John Beckett wrote: Suggested new feature: Make an easy way to encrypt a secret within a line. Then you can have a simple text file to document stuff, with embedded secrets. On reading, you only need to enter a key if you want to see a secret. I don't think this should be a general vim feature either. Yet another idea to solve this: Why not use syntax and set forgground/background color to the same value to hide the text? Then you don't even notice that there is text. eg hidden Password:$ - end of line revealed Password: my secret pwd $ - end of line you can use regexp to match secrets this way. Marc
Re: some ideas
On Mon, Dec 11, 2006 at 09:08:20PM -0200, Rodolfo Borges wrote: (1) When tab-completing on Vim :cmdline, start with the dir of the current file being edited, instead of the $PWD (use ./ for that). Yet another idea. I'm using many mappinngs like this to not change workinng directory (it seems to me that you want too keep that because of using ./), but inserting the path to file automatically. cmap fd c-r=expand('%:p:h').'/'cr (Type fd at commandline to insert the path of the file beeing edited.) really useful is this mapping, too. After inserting this you don't have to bother about the path at all if there aren't too many subdirectories/files cmap m-* **/* Marc
Re: compilation of regular expressions/ enhancement?
Hi Tony. Of course this was a trivial example. I was grepping the output of jar - content-texfile to find the packages of a java-class. Currently I'm using this function. I'm invoking this function for up to 40 files or more.. That depends on how many modules I have imported. let type_pattern = '\zs\('.func_name.'\)\%(\s*,\s*\%('.func_name.'\)\)*\ze\s*::' if line =~ type_pattern This is no longer that simple. But I can do a deepcopy and use filter.. But then I'll no longer able to get the line numbers.. My question was meant to be more general as my example given in the last post. Greetings Marc function! vl#dev#haskell#modules_list_cache_jump#ScanModuleForFunctions(file) a function is recognized as function if the looks like a b c = ... and a is no keyword (data, new\=type, instance) let func_name = '\w\+' let no_f_pattern = '\%(\%(\%(new\)\=type\)\|data\)' pattern1 / 2 matches 1) function_name arg1 arg2 = 2) arg1 `function_name` arg2 = let f_pattern1 = '\zs'.func_name.'\ze\%(\s\+\w\+\)*\s*=' let f_pattern2 = '\w\+\s*`\zs\w\+\ze`\s*\w\+\s*=' let f_pattern = '^\s*\%(\%('.f_pattern1.'\)\|\%('.f_pattern2.'\)\)' let result = {} for line_nr in range(0,len(a:file)-1) let line = a:file[line_nr] if line =~ no_f_pattern continue endif if line =~ f_pattern let result[matchstr(line, f_pattern1)]={impl: line_nr} endif endfor add type declarations.. doesn't recognize lists (a, b :: ) yet. Is needed to get the function names eg of newtype Cont r a = Cont { runCont :: (a - r) - r } let type_pattern = '\zs\('.func_name.'\)\%(\s*,\s*\%('.func_name.'\)\)*\ze\s*::' let g:tp = type_pattern for line_nr in range(0,len(a:file)-1) let line = a:file[line_nr] if line =~ type_pattern let list = split(matchstr(line, type_pattern),'\s*,\s*') for func_name in list if exists(result['.func_name.']) let result[func_name]['type'] = line_nr else let result[func_name]={type: line_nr} endif endfor endif endfor return result endfunction
vim server ? security hole?
I did notice that you can do su gvim :echo SERVERNAME and then using another user gvim --servername=GVIMxx --remote-send='!/dowhatyouwant ;-)' Thus: If you know your admin is using vim you can easily try to get one gvim instance to execute arbitrary commands as super user!! Don't think this shuold be the case by default. In my case it does what I want but.. Did I miss anything? Cheers Marc Weber
Re: vim server ? security hole?
Marc, In case you are talking X11: D you have x11 authorization enabled or disabled ? I've been taking x11. I did modify xhost because I wanted a php script be able to launch vim. But I've restarted X now and xhost - shows the same as xhost. It still works. So c-rsystem('xhost') inserts: access control enabled, only authorized clients can connect But I'm not sure.. wether I've enabled localhost.. Anyway, should this be possible? I mean root and somesuer should be able to connect to X without somesuer beeing able to run root tasks using --remote-send.. by default. If your access control is disabled, then can you try 'xhost -' (turn access control on) and repeat your check ? What you describe can not happen, AFAIK, when x11 access control is enabled. I've looked at vim code once.. On x it's using some weired gtk hack.. To do this stuff. I think you've tried it yourself and weren't able to reproduce it.. So I think it's my setup only. Marc
Re: VIM 7.0 scripts, ctags and taglist.vim
Such a behavior most likely is far from one's expectations. Though, there is no any riddle here, just the latest version of exuberant ctags cannot parse new extensions to VIM script. It can't parse function autoload#blah#foo#method, either. So if you want to include this into your patch, too? It's only a hack there might be better solutions but it should work fine 99c99,102 if (isupper ((int) *cp) || scope == 's' || scope == '') --- if (isupper ((int) *cp) || islower ((int) *cp) || // this is because of the new autoload style fun ab#Upper() (folders may start with lower case letters) // I think its useful if the location is included into the tag scope == 's' || scope == '') 105c108,109 } while (isalnum ((int) *cp) || *cp == '_'); --- } while (isalnum ((int) *cp) || *cp == '_' || *cp == '#' ); // '#' is sed in the new autoload mechanism. see :h autoload in vim help Marc
Re: New feature: bind layout of windows to keys?
:help tabpage.txt See also :h mksession .. That is was ZoomWin.vim (from Charles E. Campbell) is using.. You can get it on vim.org Marc