Ranger : Open with vim in new window

7,407

Solution 1

You can edit ranger's rifle config for that. Rifle is ranger's file opener.

ranger --copy-config=rifle.conf

to copy the default rifle config to ~/.config/ranger/rifle.conf

Then change the line in rifle.conf which says

mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@" to

mime ^text,  label editor = nohup termite -e "${VISUAL:-$EDITOR} $@" >/dev/null &

I use termite terminal emulator. Change that to st in your case.

To open multiple files at once you can use

  mime ^text,  label editor = OPEN_WITH_TABS="${VISUAL:-$EDITOR} -p $@" && nohup termite -e "${OPEN_WITH_TABS}" >/dev/null &

Solution 2

You can use t flag to open in a new terminal.

Use r shortcut or type :open_with vim t.

Solution 3

I used the solution spotted by Yash for opening mpv in seperate window

mime ^audio|ogg$, terminal, has mpv = nohup gnome-terminal -e "mpv '$a'" > /dev/null &

very useful

Share:
7,407

Related videos on Youtube

Thamoo
Author by

Thamoo

Updated on September 18, 2022

Comments

  • Thamoo
    Thamoo almost 2 years

    Using : st, Ranger, vim, i3

    With most files when I open them with ranger it opens in a new window. However, when I try to open a file with vim it opens it in the current terminal which is currently running ranger.

    I understand why it does it, I'm just not finding how to get the desired outcome of opening files with vim (from ranger) in a new terminal.

  • Javanator
    Javanator almost 5 years
    I had to remove the quotes to get this to work, so my rifle.conf looks like: mime ^text, label editor = nohup termite -e ${VISUAL:-$EDITOR} $@ >/dev/null &