You are not logged in.

#1 2023-09-10 08:45:58

lmnch
Member
Registered: 2023-09-10
Posts: 1

xdg-open text/plain file with vim: Input is not from a terminal

Hi,
I'm trying to open a plain text file using xdg-open with vim/nvim.
My .desktop file looks like this:

...
TryExec=vim
Exec=vim %F
Terminal=true
...

When I try to open a file (xdg-open test.txt), I receive the following message:

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

Do you have any idea what I have to change?

Last edited by lmnch (2023-09-10 08:46:24)

Offline

#2 2023-09-10 11:24:59

seth
Member
Registered: 2012-09-03
Posts: 61,638

Re: xdg-open text/plain file with vim: Input is not from a terminal

Specualative: xdg-open closes stdin but doesn't run vim in a new TE but re-uses the existing one where vim then runs w/o stdin.

Create some ~/bin/xvim binary that explicitly runs vim in the TE of your choice '… -e vim -p "$@"' and add a desktop entry for that in ~/.local/share/applications/xvim.desktop w/ "Terminal=false" (cause you're bringing the TE)

Nice benefit is that you can also control aspects of the specific TE (geometry, colors, …)

Offline

Board footer

Powered by FluxBB