Skip to content

Commit

Permalink
fix(rcommand): can't use action with multiple args to edit file (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhwang91 committed Apr 3, 2021
1 parent bf7d787 commit d9664d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions doc/rnvimr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ g:rnvimr_action
<
|NvimEdit| : Use Neovim's command to edit the selected file in Ranger.
'edit', 'split', 'vsplit', 'drop' and 'tabedit' is actions of Neovim.
`NvimEdit split True/False`: will override |g:rnvimr_enable_picker| variable
to split the file, 'edit', 'vsplit', 'drop' and 'tabedit' is similar to
'split'.
`NvimEdit split true/false`: if the last argument of the action is 'true'
or 'false' that will override |g:rnvimr_enable_picker| variable to split
the file, 'edit', 'vsplit', 'drop' and 'tabedit' is similar to 'split'.

|JumpNvimCwd| : Change Ranger's cwd to Neovim's.
|EmitRangerCwd| : Change Neovim's cwd to Ranger's.
Expand Down
9 changes: 5 additions & 4 deletions ranger/plugins/rcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ class NvimEdit(Command):
"""

def execute(self):
action = self.args[1]
try:
picker_enabled = self.args[2].lower() == 'true'
except IndexError:
last_arg = self.args[-1]
if last_arg.lower() in ('true', 'false'):
picker_enabled = self.args.pop().lower() == 'true'
else:
picker_enabled = None
action = ' '.join(self.args[1:])

if not self.fm.thisfile.is_file or not action:
return
Expand Down

0 comments on commit d9664d9

Please sign in to comment.