Linux – Set default xdg-open application to terminal program

arch linuxterminalxdg-open

Is it possible to use terminal vim with xdg-open?

I don't have a GUI text editor because I only use vim through the terminal. (I don't care very much for gvim either.) Is it possible to tell xdg-open to open a terminal, then open vim with the selected file?

Thanks.

Best Answer

In either your .bashrc or .zshrc, depending whether you use bash or zsh respectively, export these two environment variables:

export EDITOR=vim
export VISUAL=vim

Adittionally, you might want to associate vim to the mimetype of text files:

xdg-mime default vim.desktop text/plain

Now you'll have to create a vim.desktop file in /usr/share/applications, which should execute the terminal emulator you want, opening vim.

Related Question