lf icon indicating copy to clipboard operation
lf copied to clipboard

Instantiate a shell

Open samholmes opened this issue 3 years ago • 8 comments

$ will allow you to run a shell command and the output goes somewhere (idk). Is there a way to make $ open a full shell sub-process (prompt) in the preview window at the current directory? This way all of the output is visible and you get a full log of all the commands your previously ran. Of course, you could run exit to close the shell, but it'd be additionally convenient if you could "hide" the shell somehow so you can get back to it later with $.

I don't see why you would ever have to leave lf with the ability to: navigate around the file system, pop into the active shell, run some commands, pop out of the shell, move to another directory, pop back into the shell (in the active directory), run some new commands, etc.

samholmes avatar Aug 03 '22 21:08 samholmes

The default binding for launching a shell is w, see the documentation. Of yourse you can change the binding to whatever you prefer.

The output of the shell should redraw whenever you exit the shell and start a new one from lf (perhaps this depends on your terminal capabilities), so there should be no need to "hide" an active shell.

lahwaacz avatar Aug 04 '22 05:08 lahwaacz

Is there a way to have the shell open in the third (right-most) window; where the file previews are shown?

samholmes avatar Aug 04 '22 15:08 samholmes

No, you can't open the shell "within" the lf window/screen – that's a non-feature. You can use tmux to split the terminal whatever you like.

lahwaacz avatar Aug 04 '22 15:08 lahwaacz

The issue with using something like tmux is that it doesn't manage the lf screens. I'm interested in managing the behavior of the three windows/screens.

samholmes avatar Aug 04 '22 17:08 samholmes

If you have a lf binding for splitting the current tmux window, you can combine it with toggling the preview option.

lahwaacz avatar Aug 04 '22 18:08 lahwaacz

Interesting. Can you toggle lf to only show one narrow screen of the current directory? This way I can bind many lf commands to open a new tmux window on the right with a 3/4th screen width (or similar) for not only an interactive shell, but also for showing editors which may be cool too. How do I change the view mode for lf (show only current directory) and then how do I send the correct tmux commands to split the window?

samholmes avatar Aug 04 '22 20:08 samholmes

You can try something like :set ratios 1:1:1000 or 1:1000:1, but unfortunately that depends on whether you have preview on or off. I don't think lf has an option to set the number of panes to 2 or 1. As for tmux, you can find some examples here and in other sections on that page.

lahwaacz avatar Aug 04 '22 20:08 lahwaacz

Sorry for my bumping, but is there way to inherit shell options for $ - it doesn't follow neither aliases nor env variables, sadly

tony-sol avatar Aug 29 '22 11:08 tony-sol