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

default operation not good #145

Closed
muellerto opened this issue Feb 27, 2019 · 3 comments
Closed

default operation not good #145

muellerto opened this issue Feb 27, 2019 · 3 comments
Labels

Comments

@muellerto
Copy link

muellerto commented Feb 27, 2019

You can navigate using the cursor keys. That's great.

But the <right> key or <l> can be dangerous. As long as you change directories everything is good. If you come onto a file and you press <right> it starts an operation on that file and you don't know much about that operation. Under Windows this seems to be the default shell operation. But this is not good in my cases. On a batch file the default operation is "execute", on a msi-file it is "install", on a reg-file it is "read the file and make changes in the Registry". In the very most cases I just want to have a look into the file, especially when I know it's just text.

I recommend not to map the <right> key by default onto any operation except navigation.

@gokcehan
Copy link
Owner

@muellerto When you intend to look into the file, you should instead be using your editor (default e) or pager (default i). open command is more like double clicking a file. If we change it to edit, then msi files would also be displayed as text and so on. If we leave open command empty by default, then some users can get confused. At some point, we had such an arrangement, and people started reporting open command not doing anything.

If you accidentally do this a lot, you can clear the open command with:

cmd open

Or alternatively, you can define a custom open command for yourself, which would open text files in your editor, and other files with an opener. We have such an example in our example configuration file. You may try to adjust it to windows.

@muellerto
Copy link
Author

If you accidentally do this a lot, you can clear the open command with:

cmd open

Yes, this would be an idea. I thought about mapping <right> and <l> to nothing when the cursor is not on a directory.

I saw yesterday (when I was on my Linux machine) ranger has also an operation on <right> when you are on a file. The difference is rather in the OS: ranger on Linux doesn't start an executable or batch file (like most Linux file managers). lf on Windows does (like most Windows file managers).

@gokcehan
Copy link
Owner

I thought about mapping <right> and <l> to nothing when the cursor is not on a directory.

@muellerto open command is only called if the current is a file. If it is a directory, it simply goes into the directory. So by setting open command to empty, you are effectively doing what you describe.

On the lf side, we try to stay away from file opener functionality and simply leave them to external tools. On linux, we default to xdg-open but you may also change it to rifle (ranger's file opener) if you prefer. On windows, we default to start. It is a little unfortunate that start tries to execute some files which is sometimes not what the user intended. But start is quite useful at other times. For example when you simply want to open a pdf or image file. It uses the current association for the file to launch the corresponding program. By the way, it may be possible to disable execution of msi files by using some registry settings though I'm not sure if this would be a good idea.

Anyway, I'm closing this issue. Feel free to leave your comments.

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

No branches or pull requests

2 participants