You are not logged in.

#1 2023-09-15 16:15:09

scarwire
Member
Registered: 2023-09-15
Posts: 2

[Solved] xdg-open fails to open text files in vim

Hello all,

I'm using hyprland on a fresh arch install and having difficulty setting vim as the default app to open text files.

Basically, when I execute

xdg-open foo.txt

in a terminal, the terminal briefly flashes, and then I get this:

Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...        
Vim: Finished.

2R1R1;277;0c10;rgb:b2b2/b2b2/b2b211;rgb:0000/0000/0000

I haven't touched the vim.desktop file packaged with vim. Also, the results of the following are normal:

> xdg-mime query filetype foo.txt
text/plain
> xdg-mime query default text/plain
vim.desktop

If I set the default to another app (kate, for example) it opens fine in kate. But when I set it to vim (or neovim), I get the same strange error. Opening the file on the command line with

vim foo.txt

works fine, but I'd like to be able to open text files in a file browser that uses xdg-open.

Anyone have an idea of a next step to troubleshoot this?

Last edited by scarwire (2023-09-16 16:13:23)

Offline

#2 2023-09-15 19:03:57

seth
Member
Registered: 2012-09-03
Posts: 54,566

Offline

#3 2023-09-16 16:13:05

scarwire
Member
Registered: 2023-09-15
Posts: 2

Re: [Solved] xdg-open fails to open text files in vim

Don't know how I missed that other thread. Thanks for your suggestion, which works perfectly.

Offline

Board footer

Powered by FluxBB