As the filemanager plugin doesn't want to open files in a new tab (only a new window split), how about a filemanager plugin which simply loads a split on the side, like the filemanager does, but runs a console that immediately runs ranger?
You can overwrite rangers default config options, and also tell it to ignore the global rc file when it loads, so the plugin would only need a custom ranger rc file included to have a nicely isolated env/config, tweaked it to the plugins/micros needs:
single column
file previews disabled
etc
If some way of hijacking rangers file open method can be made to open a new micro tab for each file chosen, then that would be great!
A very simplistic one would be:
update the ranger file open routine to just print to STDOUT the selected file(s)/dir(s)
a Lua or Go function listening to STDOUT of ranger process:
on receiving STDOUT from ranger, do something with it:
if file not yet opened in micro, open file in tab
if file already open in micro, go to tab
if dir, do nothing
NOTE: updating "the ranger file open routine" probably means jus having a very simplified custom scope.sh or rifle.sh living inside the plugin, with the main ranger config, and for the config to be setup to use it.
Advanced idea:
Very fast file previews:
Every time a user highlights a file in ranger (but doesn't click on it), a tab titled "Preview" can be created, always as the last (or first?) tab, showing the highlighted file...
In menu, if the user presses ESCAPE, the "Preview" tab disappears, main window returns to the previously viewed tab.
In menu, if they open a file, the Preview tab becomes the new file, or they are returned to the tab of an already opened file.
From menu, if the user enters the main micro editor without "opening" a file when the preview tab is showing (they mouse-click in main window, or use Ctrl-W, for example), the previewed file is opened properly (rename tab title from "Preview" to filename).
This would closely emulate Sublimes "click once to show preview of file" feature.
A ranger plugin?
As the
filemanager
plugin doesn't want to open files in a new tab (only a new window split), how about a filemanager plugin which simply loads a split on the side, like thefilemanager
does, but runs a console that immediately runsranger
?You can overwrite rangers default config options, and also tell it to ignore the global rc file when it loads, so the plugin would only need a custom ranger rc file included to have a nicely isolated env/config, tweaked it to the plugins/micros needs:
If some way of hijacking rangers file open method can be made to open a new micro tab for each file chosen, then that would be great!
A very simplistic one would be:
NOTE: updating "the ranger file open routine" probably means jus having a very simplified custom
scope.sh
orrifle.sh
living inside the plugin, with the main ranger config, and for the config to be setup to use it.Advanced idea:
Very fast file previews:
Every time a user highlights a file in ranger (but doesn't click on it), a tab titled "Preview" can be created, always as the last (or first?) tab, showing the highlighted file...
In menu, if the user presses ESCAPE, the "Preview" tab disappears, main window returns to the previously viewed tab.
In menu, if they open a file, the Preview tab becomes the new file, or they are returned to the tab of an already opened file.
From menu, if the user enters the main micro editor without "opening" a file when the preview tab is showing (they mouse-click in main window, or use Ctrl-W, for example), the previewed file is opened properly (rename tab title from "Preview" to filename).
This would closely emulate Sublimes "click once to show preview of file" feature.