Skip to content

Instantly share code, notes, and snippets.

@dahu
Created August 11, 2012 08:19
Show Gist options
  • Select an option

  • Save dahu/3322468 to your computer and use it in GitHub Desktop.

Select an option

Save dahu/3322468 to your computer and use it in GitHub Desktop.
Simple Flatten() for lists in VimL
function! Flatten(list)
let val = []
for elem in a:list
if type(elem) == type([])
call extend(val, Flatten(elem))
else
call extend(val, [elem])
endif
unlet elem
endfor
return val
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment