Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created 2008 · complexity basic · author Umu · version 7.0
Given a huge file listing as text file, you can use this script to comfortably browse it. Use all fold commands of Vim to open/close parts of the directory tree, as used from standard file managers ( but even more flexible, including moving in fold structure, executing commands on folds ... )
The more, on Unix-like systems you can pipe the output of tools like
tar -t, ... directly into Vim executing this script by using
- as filename.
vim -u browser.vim arch-hurd-i386.files find . | vim -u browser.vim - locate nox | vim -u browser.vim - tar -tzf boost.tar.gz | vim -u browser.vim -
set mouse=a set foldminlines=1 foldcolumn=2 fillchars="+" foldlevel=0 set foldmethod=expr set foldexpr=FileBrowserFoldExpr() set foldtext=FileBrowserFoldText() function FileBrowserFoldExpr() let line=getline(v:lnum) let n=strlen(substitute(line,'[^/]*','','g')) if (line=~'^.*/$') return '>'.n elseif (strpart(getline(v:lnum+1),0,strlen(line)+1)==line.'/') return '>'.(n+1) endif return n endfunction function FileBrowserFoldText() return getline(v:foldstart) . ' ... [' . (v:foldend-v:foldstart+1) . ' lines]' endfunction
- Briefly explain purpose of tip and how to use (don't assume reader can quickly determine what idea is).
- Include something like "On Unix systems..." near top as hint for new readers.
- Mention how the
-makes Vim input from stdin.