Shougo / defx.nvim

:file_folder: The dark powered file explorer implementation for neovim/Vim8
MIT License
1.17k stars 86 forks source link

new_file args for open #318

Closed v6cc closed 3 years ago

v6cc commented 3 years ago

use new_multiple_files create mult files in different dir then open them feel a little hard,

so hope can have arg , create mult files then open all newfiles

and often , new_file, new_directory also want to open, so also hope have open arg

v6cc commented 3 years ago

@Shougo open file worked ok, and also need drop file to open in right, I foget it...

and now open for new_directory will enter dir, hope also can have arg open_tree for this dir instead of enter

Shougo commented 3 years ago

Really?? Oh, no.

v6cc commented 3 years ago

@Shougo Is there some wrong with drop?

Shougo commented 3 years ago

Please update defx.

I have thought you will request the feature, and it is true.

v6cc commented 3 years ago

@Shougo

new_file work ok , create, refresh, open,

nnoremap <silent><buffer><expr><nowait> x defx#do_action('new_file' ,['open','drop'])

but new_multiple_files

nnoremap <silent><buffer><expr><nowait> X defx#do_action('new_multiple_files',['open','drop']) will not refresh defx, could you make it refresh same as mult time use new_file ?

and this open_tree not focus dir, I thought it should focus,

if new_directory for a/b , will not open_tree

but if new_directory create a, then delete a, then new_directory create a/b will open_tree,

I thought it should always open_tree

nnoremap <silent><buffer><expr><nowait> M  defx#do_action('new_directory'     ,['open','open_tree'])
Shougo commented 3 years ago

Fixed.

v6cc commented 3 years ago

@Shougo now new_directory work ok ,

but use defx#do_action('new_file') create a/b will focus b in defx, defx#do_action('new_file' ,['open','drop']) create a/b will not foucus b in defx, hope always open dir a then focus b in defx then open file b ...

Shougo commented 3 years ago

Fixed.

v6cc commented 3 years ago

@Shougo seems work perfect!

petobens commented 3 years ago

@Shougo Dunno if it's another issue or related to this one but after the changes here if I open vim with the following minimal vimrc:

let $DOTVIM = expand('$HOME/.config/nvim')

set runtimepath+=$DOTVIM/bundle/repos/github.com/Shougo/defx.nvim

au FileType defx call s:defx_settings()
function! s:defx_settings()
    nnoremap <silent><buffer><expr> s
        \ defx#do_action('multi', [['drop', 'split'], 'quit'])
endfunction

and then run :Defx and in one the files press s I get the following error:

[defx] function defx#call_action[9]..defx#util#rpcrequest[18]..defx#util#execute_path, line 2
[defx] Vim(substitute):E488: Trailing characters
Shougo commented 3 years ago

Please update defx to the latest.

petobens commented 3 years ago

Thanks!