Ctrl+Y in gVim for Windows

1,198 views
Skip to first unread message

Siddhartha Kasivajhula

unread,
Sep 26, 2008, 7:56:19 PM9/26/08
to v...@vim.org
Hello,
 
I frequently use the Ctrl+Y shortcut to "scroll up" without moving the cursor. In gVim, though, I find that it is mapped to "Redo" which is the usual mapping in Windows programs.
 
I would like to make all key combinations in gVim do EXACTLY WHAT THEY DO IN LINUX! I don't want the Windows accessibility! Or at least, does someone know how I can remap specific ones?
 
Help!
 
Thanks!
-Siddhartha
 

Ben Schmidt

unread,
Sep 26, 2008, 9:13:21 PM9/26/08
to vim...@googlegroups.com

With pleasure!

:e $MYVIMRC

and then remove the line that sources mswin.vim, save it and reload Vim!

Ben.


fritzophrenic

unread,
Sep 26, 2008, 11:09:49 PM9/26/08
to vim_use
Or look at mswin.vim and pick and choose...but you probably don't want
most of it.

In general, though, to see where a mapping occurs:

:verbose map <C-Y>
:verbose map! <C-Y>

this will tell you all the mappings for CTRL-Y and in what file they
occur.

You can then :unmap the mapping entirely or :map something else to it
(you may need :noremap). See the :help entry for each of these for
more detail.

Gary Johnson

unread,
Sep 26, 2008, 11:20:18 PM9/26/08
to vim...@googlegroups.com

You may want to remove the "behave mswin" line as well.

Regards,
Gary

Tony Mechelynck

unread,
Sep 27, 2008, 12:49:44 AM9/27/08
to vim...@googlegroups.com

NEVER EVER make changes of your own in any file in $VIMRUNTIME or any of
its subdirectories, because the next update of that file will silently
make your changes disappear. Now you don't know when that "next update"
will happen. It will certainly be not later than when you install the
next version of Vim, and by that time you won't understand why suddently
"vim doesn't behave the way it used to", and you probably won't remember
what and where all your own-coded changes were.

The other directories mentioned in 'runtimepath' should be used for that
(or your ~/[._]vimrc and/or ~/[._]gvimrc), Vim won't alter that. Each of
these 'runtimepath' trees has a slightly different purpose:

~/.vim (on Unix) or ~/vimfiles (on Windows): full-fledged scripts
specific to one user

$VIM/vimfiles: full-fledged system-wide scripts

$VIMRUNTIME: scripts (and other files) distributed together with Vim
(under Windows also the executables), AND NOTHING ELSE.

$VIM/vimfiles/after: system-wide small changes to any or all of the above

~/.vim/after or ~/vimfiles/after: user-specific small changes to any of
the above.

So: _don't_ add, remove or change lines here or there in
$VIMRUNTIME/mswin.vim, and don't replace the file by a zero-length file:
sooner or later your changes will be undone with no warning. If you
(like me) don't like what mswin.vim does, just make sure your vimrc
doesn't call it.


Best regards,
Tony.
--
Christ:
A man who was born at least 5,000 years ahead of his time.

Alessandro Antonello

unread,
Sep 27, 2008, 2:38:34 PM9/27/08
to vim...@googlegroups.com
Hi all.

I agree with Tony. You don't need to change anything in the Vim main
directory. The best way to do is make a "vimfiles" folder in besides
the Vim directory and change your "_vimrc" or "_gvimrc" to do not call
"mswin.vim". You don't need to delete the line "behave mswin" too. It
is used to many things than key mapping. So, the best way is to
override the default configuration in other way.

Regards.

2008/9/27 Tony Mechelynck <antoine.m...@gmail.com>:

--
Alessandro Antonello

Tony Mechelynck

unread,
Sep 27, 2008, 3:27:37 PM9/27/08
to vim...@googlegroups.com
On 27/09/08 20:38, Alessandro Antonello wrote:
> Hi all.
>
> I agree with Tony. You don't need to change anything in the Vim main
> directory. The best way to do is make a "vimfiles" folder in besides
> the Vim directory and change your "_vimrc" or "_gvimrc" to do not call
> "mswin.vim". You don't need to delete the line "behave mswin" too. It
> is used to many things than key mapping. So, the best way is to
> override the default configuration in other way.
>
> Regards.

The ":behave" command is actually a shortcut for setting four options at
the same time.

These options' defaults are
:set selectmode= keymodel= selection=inclusive
and (for Windows)
:set mousemodel=popup
or (for Unix)
:set mousemodel=extend

":behave mswin" is equivalent to
:set selectmode=mouse,key mousemodel=popup
:set keymodel=startsel,stopsel selection=exclusive

":behave xterm" is equivalent to
:set selectmode= mousemodel=extend
:set keymodel= selection=inclusive

I use neither, but
:set selectmode=key,mouse mousemodel=popup
:set keymodel=startsel selection=inclusive

which is a sort of middle-ground between them. Unlike mswin.vim, none of
the above clobbers any useful keystrokes so I recommend that you study
what these options do and make your own choice.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
190. You quickly hand over your wallet, leather jacket, and car keys
during a mugging, then proceed to beat the crap out of your
assailant when he asks for your laptop.

Siddhartha Kasivajhula

unread,
Sep 29, 2008, 2:08:38 PM9/29/08
to vim...@googlegroups.com
Thank you all for being so prompt and helpful! It works just as I wanted!
-Siddhartha
Reply all
Reply to author
Forward
0 new messages