I had to replace gvim with neovim

94 views
Skip to first unread message

Steve Litt

unread,
Feb 28, 2024, 8:25:33 AMFeb 28
to vim...@googlegroups.com
Hi all,

The gvim program became too much of a hassle because it printed all
sorts of GTk errors and warnings to the terminal, obliterating valuable
information that was there. So I had to uninstall Vim and install
neovim, which isn't as good, but all those GTk warnings were messing up
my workflow.

If anyone knows how to use gvim without all those GTk warnings, I'd
like to hear it.

SteveT

Steve Litt

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21

Gary Johnson

unread,
Feb 28, 2024, 9:46:13 AMFeb 28
to vim...@googlegroups.com
On 2024-02-28, Steve Litt wrote:
> Hi all,
>
> The gvim program became too much of a hassle because it printed all
> sorts of GTk errors and warnings to the terminal, obliterating valuable
> information that was there. So I had to uninstall Vim and install
> neovim, which isn't as good, but all those GTk warnings were messing up
> my workflow.
>
> If anyone knows how to use gvim without all those GTk warnings, I'd
> like to hear it.

Hi Steve,

I can't test this because I don't get those warnings, but I'm
assuming they are printed to standard error. Try starting gvim this
way and see if the warnings go away.

$ gvim 2> /dev/null

If that works, then you can either create an alias like this in your
~/.bashrc, assuming your shell is bash:

alias gvim='2>/dev/null gvim'

or you can put the command in this shell script and put the shell
script in some directory in your PATH ahead of wherever gvim is,
e.g. in ~/bin.

#!/bin/sh
exec /usr/bin/gvim "$@" 2>/dev/null

That assumes that your gvim is in /usr/bin. If necessary, change
/usr/bin to the directory where your gvim resides. To find out, use

$ type gvim

Regards,
Gary

Steve Litt

unread,
Feb 28, 2024, 9:03:45 PMFeb 28
to vim...@googlegroups.com
Gary Johnson said on Wed, 28 Feb 2024 06:45:04 -0800

>On 2024-02-28, Steve Litt wrote:
>> Hi all,
>>
>> The gvim program became too much of a hassle because it printed all
>> sorts of GTk errors and warnings to the terminal, obliterating
>> valuable information that was there. So I had to uninstall Vim and
>> install neovim, which isn't as good, but all those GTk warnings were
>> messing up my workflow.
>>
>> If anyone knows how to use gvim without all those GTk warnings, I'd
>> like to hear it.
>
>Hi Steve,
>
>I can't test this because I don't get those warnings, but I'm
>assuming they are printed to standard error. Try starting gvim this
>way and see if the warnings go away.
>
> $ gvim 2> /dev/null

Thanks Gary, I should have thought of that. I followed your advice and
renamed /usr/bin/gvim to gvim.warnings, and then made a shellscript
called gvim to call it, piping stderr to /dev/null.

Thanks,

Rory Campbell-Lange

unread,
Mar 4, 2024, 3:21:48 PMMar 4
to vim...@googlegroups.com
On 28/02/24, Steve Litt (sl...@troubleshooters.com) wrote:
> Gary Johnson said on Wed, 28 Feb 2024 06:45:04 -0800
>
> >On 2024-02-28, Steve Litt wrote:
> >> The gvim program became too much of a hassle because it printed all
> >> sorts of GTk errors and warnings to the terminal

> > Try starting gvim this way and see if the warnings go away.
> >
> > $ gvim 2> /dev/null
>
> Thanks Gary, I should have thought of that. I followed your advice and
> renamed /usr/bin/gvim to gvim.warnings, and then made a shellscript
> called gvim to call it, piping stderr to /dev/null.

Have you considered using console vim (eg vim-nox on Debian)? One is unlikely
to get any GTk errors with that.

Steve Litt

unread,
Mar 5, 2024, 1:30:48 AMMar 5
to vim...@googlegroups.com
Rory Campbell-Lange said on Mon, 4 Mar 2024 20:21:38 +0000
Thanks Rory,

I got gvim working correctly by piping stderr to /dev/null, but your
idea has merit. As long as the terminal I use is white background and
black text, Vim works quite well on it. I could make a shellscript to
spawn a terminal, make its parent PID1, and run Vim on it. It must be
a terminal with good copy and paste abilities. As soon as possible I
will try this. Thank you for the very good idea.

Steve

Gary Johnson

unread,
Mar 5, 2024, 4:21:17 AMMar 5
to vim...@googlegroups.com
On 2024-03-05, Steve Litt wrote:
> Rory Campbell-Lange said on Mon, 4 Mar 2024 20:21:38 +0000
>
> >On 28/02/24, Steve Litt wrote:
> >> Gary Johnson said on Wed, 28 Feb 2024 06:45:04 -0800
> >>
> >> >On 2024-02-28, Steve Litt wrote:
> >> >> The gvim program became too much of a hassle because it printed
> >> >> all sorts of GTk errors and warnings to the terminal
> >
> >> > Try starting gvim this way and see if the warnings go away.
> >> >
> >> > $ gvim 2> /dev/null
> >>
> >> Thanks Gary, I should have thought of that. I followed your advice
> >> and renamed /usr/bin/gvim to gvim.warnings, and then made a
> >> shellscript called gvim to call it, piping stderr to /dev/null.
> >
> >Have you considered using console vim (eg vim-nox on Debian)? One is
> >unlikely to get any GTk errors with that.
>
> Thanks Rory,
>
> I got gvim working correctly by piping stderr to /dev/null, but your
> idea has merit. As long as the terminal I use is white background and
> black text, Vim works quite well on it. I could make a shellscript to
> spawn a terminal, make its parent PID1, and run Vim on it. It must be
> a terminal with good copy and paste abilities. As soon as possible I
> will try this. Thank you for the very good idea.

I don't have the details on the vim-nox package, but the name
suggests that is has no support for X as well as no GUI. Suit
yourself, but you could be without support for copy and paste to and
from the X clipboard, except via the terminal itself. I don't know
how support for the mouse might be affected.

Fedora has or had a package (vimx or xvim) that provided a terminal
vim with X11 and xterm_clipboard support. I don't see anything like
that for Ubuntu, though.

You could also build vim yourself, configured just the way you want
it. It's pretty simple.

It seems a shame to give up X11 support just because GTK is
misbehaving.

Launching vim in a new terminal should be as easy as

$ xterm -e vim &

or as a function:

function tvim {
xterm -e vim "$@" &
}

or as a shell script:

#!/bin/sh
exec xterm -e vim "$@" &

Regards,
Gary

Reply all
Reply to author
Forward
0 new messages