tirenweb
tirenweb

Reputation: 31739

Show the list of the files inside the folder of the current file

Imagine I'm editing file, and I want to show the list of the files inside the folder who belongs the file I'm editing, to edit one of them.

How can I do that? Is there any way using FuzzyFinder?

Upvotes: 5

Views: 5194

Answers (3)

Zsolt Botykai
Zsolt Botykai

Reputation: 51663

Depends on what you mean by showing the file.

To include the list of files in the currently edited files, you can do something like:

:read !ls /path/to/file

(it can be shortened to :cd %:h | read !ls if you don't mind if vim changes it's current directory...)

If you want to pick another file to edit, I'd suggest to take a look at NerdTree plugin (here is a little intro). Or you can simply issue:

:cd %:h | e .

Upvotes: 0

romainl
romainl

Reputation: 196789

Did you even read FuzzyFinder's documentation (:help fuzzyfinder)? Quickly opening nearby files is one of that plugin's main features.

  • Without installing anything, you can do:

    :Ex[plore]
    

    to open the netrw file tree. See :help netrw.

  • You can also do:

    :e <Tab>
    

    Add these lines to your ~/.vimrc to make command line completion even better:

    set wildmenu
    set wildmode=list:full
    

    and read :help wildmenu and :help commandline-completion.

set autochdir is a useful option to add to your ~/.vimrc, by the way.

Upvotes: 11

Kent
Kent

Reputation: 195209

change vim current directory to current file's:

:cd %:h

then

FuzzyFinder can do what you want (pick and edit). (:FufFile) I have mapping :

nmap <Leader>ff :FufFile<cr>

NERDTree can do that as well.

Upvotes: 1

Related Questions