Hi,
I would like to write a vim script which reads into a list, the directory tree…
how it is possible to get the subdirectories into a list ? (from PWD for example.)
Thanks a lot in advice.
Br,
Peter G. Marczis
You can read in the output of a shell command, so you can use
:r !find .
on most *nix-like OSes, or on Windows, you can do any of the
following
:r !dir /s/b
:r !dir /s/b/a "include hid/sys files
:r !tree "just subdirs
:r !tree /f "include files
:r !tree /f /a "files and ascii-tree representation
It's OS-specific, so you'd have to read up on your variant. The
"find" command is super-powerful in tuning the files returned (be
sure to read up at the man-pages), whereas the "dir"/"tree"
commands are a bit wanting in flexibility of output.
-tim
"Peter Marczis (NSN - HU/Budapest)" <peter....@nsn.com> wrote :
> I would like to write a vim script which reads into a list , the
> directory tree…
> how it is possible to get the subdirectories into a list ? (from PWD
> for example.)
You can also play with:
echo filter(split(globpath(getcwd(), '**'), '\n'), 'isdirectory(v:val)')
It may not be the most efficient way, but it should do the trick.
--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/
for item in sacks
menu ]environments.{item} echo "coool"
endfor
sacks is a list. and I would like to create a menu from this list...
but, how can I use the item variable to create the menu ?
thanks for all your trouble !
Br,
Peter.