Yegappan Lakshmanan wrote: > The above will delete all the global variables not matching > the specified regular expression. So you should make a copy > of the global variables before using the filter() function: > > let l = filter(copy(g:), "v:key =~? '<regexp_pattern>'")
Very sweet. I completely missed that 'g:' is a dictionary when looking for it recently. Here is a complete function: " Return list of global variables that match pattern. function! Globals(pattern) return sort(filter(keys(g:), 'v:val =~? a:pattern')) endfunction " Example usage: let g = Globals('^t') John --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---