fff
fff copied to clipboard
How to open a selected file by "less " instead of "vim"
Hi,
fff
is a wonderful tool I think which is easy to use. But When I want to open a selected text file whose sizes may be large than several GBs, it's not easy to open it with vim
. So how to change the tools (eg. less
) to open a text file?
Thanks.
VISUAL
is used for opening text files and those without an extension, with EDITOR
and then vi
as fallbacks. In your bashrc
you can set one or both to less
, but there is then no way to get to vi/m
through fff
. less
allows you to press 'v' to go to vi/m
, but that references the same environment variables and so will just launch itself. What I did is set both to 'editor'
, and then put the following in an executable file named editor
in a folder on my path:
#!/bin/bash
[[ "$(ps -o comm= $PPID)" == "less" ]] && vim "$@" || less "$@"
This will launch less
first, then if you press 'v' will switch to vim
.
Hi! In my fork of fff I added an ability to open with
any file (or multiple marked files) with a command provided by you e.g. pressing o
and inputting less
will open less
with file(s) you wanted. Hope it helps.