How to make gvim/vim-gtk3 behave exactly like vim

85 views
Skip to first unread message

Ottavio Caruso

unread,
Jan 19, 2024, 7:26:26 AMJan 19
to vim...@googlegroups.com
I have installed and uninstalled gvim many times. I have to re learn
some (many) keyboard combinations. Is there a safe way to mod gvim to
make it behave exactly like vim on the terminal?

--
Ottavio Caruso

Christian Brabandt

unread,
Jan 19, 2024, 7:59:20 AMJan 19
to vim...@googlegroups.com
Like what? There are some fundamental differences between a GUI and the
terminal version, some of it being that the terminal may not understand
all key combinations. But I really wonder what you mean with you have to
re-learn some key combinations?

Best,
Christian
--
Everything you read in newspapers is absolutely true, except for that
rare story of which you happen to have first-hand knowledge.
-- Erwin Knoll

jr

unread,
Jan 19, 2024, 8:27:18 AMJan 19
to vim...@googlegroups.com
hi,
not sure I understand exactly, but you can create a '~/.gvimrc' to
complement your '~/.vimrc'.

--
regards, jr.

You have the right to free speech, as long as you're not dumb enough
to actually try it.
(The Clash 'Know Your Rights')

this email is intended only for the addressee(s) and may contain
confidential information. if you are not the intended recipient, you
are hereby notified that any use of this email, its dissemination,
distribution, and/or copying without prior written consent is
prohibited.

Ottavio Caruso

unread,
Jan 19, 2024, 9:25:42 AMJan 19
to vim...@googlegroups.com, jr
Am 19/01/2024 um 13:26 schrieb jr:
> hi,
>
> On Fri, 19 Jan 2024 at 12:26, 'Ottavio Caruso' via vim_use
> <vim...@googlegroups.com> wrote:
>> I have installed and uninstalled gvim many times. I have to re learn
>> some (many) keyboard combinations. Is there a safe way to mod gvim to
>> make it behave exactly like vim on the terminal?
>
> not sure I understand exactly, but you can create a '~/.gvimrc' to
> complement your '~/.vimrc'.
>

And what should I put into ~/.gvimrc that would make gvim behave like vim?

--
Ottavio Caruso

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

rwmit...@gmail.com

unread,
Jan 19, 2024, 9:46:24 AMJan 19
to vim_use
What keys combinations do you have to relearn?

Gary Johnson

unread,
Jan 19, 2024, 11:27:33 AMJan 19
to vim...@googlegroups.com
On 2024-01-19, 'Ottavio Caruso' via vim_use wrote:
> Am 19/01/2024 um 13:26 schrieb jr:
> >hi,
> >
> >On Fri, 19 Jan 2024 at 12:26, 'Ottavio Caruso' via vim_use
> ><vim...@googlegroups.com> wrote:
> >>I have installed and uninstalled gvim many times. I have to re learn
> >>some (many) keyboard combinations. Is there a safe way to mod gvim to
> >>make it behave exactly like vim on the terminal?
> >
> >not sure I understand exactly, but you can create a '~/.gvimrc' to
> >complement your '~/.vimrc'.
> >
>
> And what should I put into ~/.gvimrc that would make gvim behave like vim?

You don't need a separate gvimrc, just a vimrc. Using just the one
configuration file makes it simpler to keep the settings the same
for both gvim and vim.

I don't know why you would have to learn different keyboard
combinations. Please elaborate on that.

It has been a goal of mine, too, to make gvim indistinguishable from
terminal vim. That's largely to make gvim on Windows behave the
same as terminal vim on Linux. I think I've done pretty well. As
it is, I sometimes have to check the title bar to see which one I'm
using.

The main difference is the behavior of :sh. I just don't use it
often in situations where I'm running gvim.

On Linux, it's important to use a vim built for X11 so that you have
access to the clipboard. I also run autocutsel, which keeps the
clipboard and the cut buffer synchronized so that I don't have to
remember the differences between them and which one I just copied
something into.

I mostly use vim in an xterm on Linux, so I use only features
available in that configuration out of habit and don't miss any that
are available only in the GUI. I use a custom color scheme that
pretty much preserves vim's default colors and keeps them the same
on both gvim and vim.

Regards,
Gary

Ottavio Caruso

unread,
Jan 19, 2024, 11:44:10 AMJan 19
to vim...@googlegroups.com
Am 19/01/2024 um 16:25 schrieb Gary Johnson:
> On 2024-01-19, 'Ottavio Caruso' via vim_use wrote:
>> Am 19/01/2024 um 13:26 schrieb jr:
>>> hi,
>>>
>>> On Fri, 19 Jan 2024 at 12:26, 'Ottavio Caruso' via vim_use
>>> <vim...@googlegroups.com> wrote:
>>>> I have installed and uninstalled gvim many times. I have to re learn
>>>> some (many) keyboard combinations. Is there a safe way to mod gvim to
>>>> make it behave exactly like vim on the terminal?
>>>
>>> not sure I understand exactly, but you can create a '~/.gvimrc' to
>>> complement your '~/.vimrc'.
>>>
>>
>> And what should I put into ~/.gvimrc that would make gvim behave like vim?
>
> You don't need a separate gvimrc, just a vimrc. Using just the one
> configuration file makes it simpler to keep the settings the same
> for both gvim and vim.
>
> I don't know why you would have to learn different keyboard
> combinations. Please elaborate on that.

Then you say:
>
> It has been a goal of mine, too, to make gvim indistinguishable from
> terminal vim. That's largely to make gvim on Windows behave the
> same as terminal vim on Linux. I think I've done pretty well. As
> it is, I sometimes have to check the title bar to see which one I'm
> using.

You answered your own question.


>
> I mostly use vim in an xterm on Linux, so I use only features
> available in that configuration out of habit and don't miss any that
> are available only in the GUI. I use a custom color scheme that
> pretty much preserves vim's default colors and keeps them the same
> on both gvim and vim.


I also use vim on xterm on Linux. It just is difficult cut/copy/paste
data to/from, for example a web browser. Yes, it is possible, it is just
not that neat.

Christian Brabandt

unread,
Jan 19, 2024, 11:50:20 AMJan 19
to vim...@googlegroups.com

On Fr, 19 Jan 2024, 'Ottavio Caruso' via vim_use wrote:
> I also use vim on xterm on Linux. It just is difficult cut/copy/paste
> data to/from, for example a web browser. Yes, it is possible, it is
> just not that neat.

And why would those be different between terminal Vim and Gui Vim?

Thanks,
Christian
--
Pilfering Treasury property is paticularly dangerous: big thieves are
ruthless in punishing little thieves.
-- Diogenes

Gary Johnson

unread,
Jan 19, 2024, 12:01:37 PMJan 19
to vim...@googlegroups.com
It is true that there are keyboard combinations available in the GUI
that are not available in the terminal, but anything that can be
done in the terminal can be done in the GUI using the same keyboard
combinations. You don't have to learn different keyboard
combinations, just always use those that work in the terminal.

> >I mostly use vim in an xterm on Linux, so I use only features
> >available in that configuration out of habit and don't miss any that
> >are available only in the GUI. I use a custom color scheme that
> >pretty much preserves vim's default colors and keeps them the same
> >on both gvim and vim.
>
> I also use vim on xterm on Linux. It just is difficult cut/copy/paste
> data to/from, for example a web browser. Yes, it is possible, it is
> just not that neat.

That's why I use autocutsel. Then I don't have to think about it.

Regards,
Gary

Marvin Renich

unread,
Jan 19, 2024, 3:32:38 PMJan 19
to vim...@googlegroups.com
* 'Ottavio Caruso' via vim_use <vim...@googlegroups.com> [240119 11:44]:
> Am 19/01/2024 um 16:25 schrieb Gary Johnson:
> > I don't know why you would have to learn different keyboard
> > combinations. Please elaborate on that.
>
> Then you say:
> >
> > It has been a goal of mine, too, to make gvim indistinguishable from
> > terminal vim. That's largely to make gvim on Windows behave the
> > same as terminal vim on Linux. I think I've done pretty well. As
> > it is, I sometimes have to check the title bar to see which one I'm
> > using.
>
> You answered your own question.

Not really. He has given a general answer when he is asking you for a
more specific answer (as have several others on this list).

An example would be:

Ctrl-V on gvim does ..., while on vim it does ....

If you can give a few keystrokes that behave differently, we can help
you find out why, and give suggestions for fixing it.

You can try «:verbose map» in your vim/gvim sessions and see if the
keystrokes you are concerned about have been remapped, and which script
remapped it. That might give you enough info to be able to fix it
yourself.

As others have said, in general a keystroke that does something in vim
will do the same thing in gvim, but gvim has some keystrokes that are
not available in vim. A script can easily map specific keystrokes
differently in vim than gvim, and the above "map" command should give
you some clues, if that is the problem.

I don't remember if you said which OS/distribution you are using.
Different distributions have different system-wide default vim
configuration files. This info might also give us a better idea how to
help you.

...Marvin

Steve Litt

unread,
Jan 26, 2024, 1:47:05 PMJan 26
to vim...@googlegroups.com
Christian Brabandt said on Fri, 19 Jan 2024 17:50:11 +0100

>On Fr, 19 Jan 2024, 'Ottavio Caruso' via vim_use wrote:
>> I also use vim on xterm on Linux. It just is difficult cut/copy/paste
>> data to/from, for example a web browser. Yes, it is possible, it is
>> just not that neat.
>
>And why would those be different between terminal Vim and Gui Vim?

Linux is a spectacular OS compared to Linux, but my workflow experience
is that Windows cut and paste is much simpler and easier to use than
Linux'. I'm not a fan of multiple paste buffers.

Linux cut and paste is different on lxterminal vs xterm, different on
xterm with and xterm without tmux, etc, so of course it will be
different depending on whether Vim is GUI or hosted on a terminal
emulator. These things aren't Vim's fault. The one thing I could blame
on Vim is that Shift+',Shift+8,yy doesn't do what I think it would do,
requiring middle mouse rather than Ctrl+v or Edit>Paste to paste.
Shift+',Shift++,yy is more what you want, but even then Ctrl+V won't
paste.

SteveT

Steve Litt

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

Gary Johnson

unread,
Jan 27, 2024, 12:41:30 AMJan 27
to vim...@googlegroups.com
On 2024-01-26, Steve Litt wrote:
> Christian Brabandt said on Fri, 19 Jan 2024 17:50:11 +0100
>
> >On Fr, 19 Jan 2024, 'Ottavio Caruso' via vim_use wrote:
> >> I also use vim on xterm on Linux. It just is difficult cut/copy/paste
> >> data to/from, for example a web browser. Yes, it is possible, it is
> >> just not that neat.
> >
> >And why would those be different between terminal Vim and Gui Vim?
>
> Linux is a spectacular OS compared to Linux, but my workflow experience
> is that Windows cut and paste is much simpler and easier to use than
> Linux'. I'm not a fan of multiple paste buffers.
>
> Linux cut and paste is different on lxterminal vs xterm, different on
> xterm with and xterm without tmux, etc, so of course it will be
> different depending on whether Vim is GUI or hosted on a terminal
> emulator. These things aren't Vim's fault. The one thing I could blame
> on Vim is that Shift+',Shift+8,yy doesn't do what I think it would do,
> requiring middle mouse rather than Ctrl+v or Edit>Paste to paste.
> Shift+',Shift++,yy is more what you want, but even then Ctrl+V won't
> paste.

I agree that copy-and-paste with tmux is a pain (I just hold the
shift key down while selecting with the mouse), as is using mintty
on Windows with an ssh connection to a Linux machine. However, as
I wrote earlier, autocutsel has solved all (I think) of my
copy-and-paste problems on Linux. I run the following script
automatically at start-up.

#!/bin/sh
# See https://mutelight.org/subtleties-of-the-x-clipboard
autocutsel -fork
autocutsel -selection PRIMARY -fork

HTH,
Gary

Reply all
Reply to author
Forward
0 new messages