Make ranger open vim editor

Hello everyone,
ranger always open files in nano by default I want files to open in neovim.
And also how to make ranger open html files in neovim and not in web browser.It is very annoying when it shoots up the browser instead of html file.
In my .config/ranger folder there is only rc.conf file and plugins folder.

Change the EDITOR variable to point to your preferred editor - depending on how you launch the editor maybe look for the VISUAL variable.

Look at the file ~/.profile or ~/.bashrc

hello I am new to linux please explain me the answer I don’t uderstand these words like variables yet.

if you are new to Linux then vi and derivatives like neovim is not the editor of choice

there is no editor variable in the .bashrc

no no I know to operate vim I learned it with vscode vim extension back in windows.

Add the following line to your ~/.bashrc:arrow_down:

export EDITOR=neovim

Save the file, then log out and log back in.

Edit: Apparently the executable is called nvim, so the command should be… :arrow_down:

export EDITOR=nvim

I did this when I open any file this message flashes on screen/bin/sh : line 1 neovim command not found
should I write export EDITOR=nvim

If that is the name of the executable, then yes ─ of course. I don’t have neovim installed, so I assumed that the executable would be called that. :man_shrugging:

1 Like

No the package I installed was neovim but when It is nvim to open neovim

Depending on the location of the bin file, maybe add /usr/bin/ before nvim

let me try this.

adding export EDITOR=nvim to .bashrc worked

That’s a different issue and I don’t even have ranger installed, so please start a separate thread about that subject. Your question as per the title of this thread has been answered. :man_shrugging:

understood thankYou for helping everyone .:pray: :grinning:

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.