Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Run a command with all marked files from all folders #2974

Open
LukasKnuth opened this issue May 15, 2024 · 1 comment
Open

Q: Run a command with all marked files from all folders #2974

LukasKnuth opened this issue May 15, 2024 · 1 comment

Comments

@LukasKnuth
Copy link

Runtime Environment

  • Operating system and version: macOS Sonoma 14.4.1
  • Terminal emulator and version: alacritty 0.13.2
  • Python version: Python 3.12.3
  • Ranger version/commit: ranger 1.9.3
  • Locale: None.UTF-8

Steps to reproduce

  1. Select files using space in different folders
  2. Run :shell hx %p to open the Helix editor with all selected files

Current Behavior

The %p macro only expands to full paths of to the marked files in the current directory

Expected Behavior

The %p macro expands to full paths of all marked files from any directory

Context

I'm using ranger to walk through a large Git repository, previewing files to find the ones I need to work on. I mark said files and then simply want to open all of them for editing in an editor.

Possible Solutions

Perhaps I'm missing a different macro, but https://github.com/ranger/ranger/wiki/Official-User-Guide#macros makes it seem like there are only those that work in the current directory.

@LukasKnuth
Copy link
Author

LukasKnuth commented May 15, 2024

Looking at the code at

macros['p'] = lambda: [os.path.join(self.fm.thisdir.path,
fl.relative_path) for fl in
self.fm.thistab.get_selection()]
it seems like the %p macro should do exactly what I want.

It just seems that self.fm.thistab.get_selection() only returns the files in the currently opened directory. Is the current directory also implicitly the current tab?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant