Make lazygit Open Files With rifle

A fresh installation of lazygit launches the operating system’s “open file” command when you use the o key to open a file. Obviously. I prefer to use rifle as my daily file launcher. Today, I wanted lazygit’s “open file” command to use rifle to open files.

It delights me how little work this required.

Summary

Set os.open in lazygit’s config to rifle -- {{filename}}.

Details

I run Pop!_OS, which is a flavor of Linux. I found my lazygit user-level configuration file at $HOME/.config/lazygit/config.yml. I added this setting:

os:
open: 'rifle -- {{filename}}'

That makes lazygit’s Open file command run rifle for the selected file. rifle then chooses an application using its own rules, usually from ~/.config/ranger/rifle.conf. Check the rules it would use with rifle -l path/to/file.