Shougo / defx.nvim

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

support open_tree recursive toggle on root dir , not influence history #322

Closed v6cc closed 3 years ago

v6cc commented 3 years ago

I use this restore history

defx#do_action('cd', g:defx#_histories[-1][1])

and sometimes want to open_tree recursive on root dir , need

call defx#call_action('cd', ['..', 'open'])
call defx#call_action('open_tree', ['recursive', 'toggle']) 
call defx#call_action('drop')

history will become parent dir, but I just want to open, don't want to change history

Could you support direct open_tree recursive toggle on root, not influence history ?

v6cc commented 2 years ago

@Shougo now defx#do_action('cd', ['..', 'open', 'nohist']) work ok , but defx#do_action('cd', ['..', 'open']) will get error

Error invoking '_defx_do_action' on channel 4 (python3-rplugin-host):
error caught in request handler '_defx_do_action [['cd', ['..', 'open'], {'columns': 'indent:icons:space:filename:git', 'auto_cd': 1, 'winrelative': 'editor', 'root_marker': '[in] ', 'resume': 1, 'close': False, 'auto_recursive_level': 0,
 'sort': 'filename', 'listed': False, 'new': False, 'ignored_files': '.*,*.class', 'focus': True, 'direction': 'topleft', 'visual_end': 0, 'winheight': 30, 'profile': False, 'preview_height': 12, 'post_action': '', 'search_recursive': '',
 'buffer_name': 'default', 'filtered_files': '', 'prev_bufnr': 2, 'split': 'vertical', 'preview_width': 40, 'winborder': 'none', 'visual_start': 0, 'cursor': 2, 'floating_preview': False, 'prev_last_bufnr': -1, 'search': '', 'prev_winid':
 1001, 'wincol': 59, 'winwidth': 30, 'winrow': 21, 'session_file': '', 'ignored_recursive_files': '.git,node_modules,__pycache__,miniprogram_npm,colorui,debug,target,themes,icons', 'vertical_preview': False, 'show_ignored_files': False, '
drives': [], 'toggle': 1}]]':
Traceback (most recent call last):
    File "/home/abc/.local/share/nvim/plugged/defx.nvim/rplugin/python3/defx/__init__.py", line 40, in do_action
        self._rplugin.do_action(args)
    File "/home/abc/.local/share/nvim/plugged/defx.nvim/rplugin/python3/defx/rplugin.py", line 54, in do_action
        view.do_action(args[0], args[1], args[2])
    File "/home/abc/.local/share/nvim/plugged/defx.nvim/rplugin/python3/defx/view.py", line 131, in do_action
        ret = action.do_action(self, defx, action_name, context)
    File "/home/abc/.local/share/nvim/plugged/defx.nvim/rplugin/python3/defx/action.py", line 62, in do_action
        action.func(view, defx, context)
    File "/home/abc/.local/share/nvim/plugged/defx.nvim/rplugin/python3/defx/kind/filelike.py", line 212, in _cd
        save_history = len(context.args) < 2 or context.args[2] != 'nohist'
IndexError: list index out of range
Shougo commented 2 years ago

Fixed.