Sunday, April 24, 2011

Re: Scroll one line up doesn't work in Windows 7 cmdline

On 24/04/11 05:57, Fred wrote:
> Ben Schmidt<mail_ben_schm...@yahoo.com.au> wrote:
>> On 24/04/11 12:41 PM, Fred wrote:
>> <snip>
>>> I'm using vim in Windows 7 via Start -> (search for) vim.
>>> When I key in Ctrl+Y, I get "Already at newest change". Is there an
>>> alternative binding, or what can I do?
>>
>> Sounds to me like you have some default vimrc that came with your Vim that has
>> mapped a few keys to be more Windows-like, e.g. Ctrl-Y for Redo (and probably
>> Ctrl-Z for undo, Ctrl-V for paste, etc.).
>>
>> <snip>
>> Perhaps the easiest way to do this is to, within Vim, issue
>>
>> :e $MYVIMRC
>>
>> and remove the nasty command(s) in there that are trying to make it
>> Windows-friendly. You can comment out a line of Vimscript by putting a double
>> quote character at the beginning of it ("), or you can exit the whole script early
>> by putting a finish command somewhere (just "finish" alone on a line, without quotes).
>> <snip>
>
> Thanks for the prompts.
> I went into $VIMRUNTIME/mswin.vim and commented out the mapping of CTRL
> +Y.
>
> Fred
>

You should not have changed anything in $VIMRUNTIME, the next update (or
the one after that) may undo your changes with no warning.

The thing to do is to make sure that mswin.vim is not sourced:
- If it is invoked from your vimrc, comment away that line
- If there is a "system vimrc" put there by your sysadmin or someone,
and out of your control (look near the middle of the ":version" text to
see where your Vim looks for a system vimrc, and/or check near the top
of the output of ":scriptnames" for what was sourced before mswin.vim),
then I suppose you will have to add to your vimrc something like

" Restore Vim Insert-mode key bindings masked by mswin.vim
" redo is Normal-mode Ctrl-R
unmap! <C-Y>
" undo is Normal-mode u
unmap! <C-Z>
" yank (copy) is Normal-mode y{motion} or Visual-mode y
unmap! <C-C>
" put (paste) is Normal-mode p or P
unmap! <C-V>
" delete (cut) is Normal-mode d{motion} or Visual-mode d
unmap! <C-X>

You may or may not want to override the ":behave mswin" statement that
that script uses. Personally I feel more comfortable with

" behave custom-mode
set selection=inclusive selectmode=key,mouse
set keymodel=startsel mousemodel=popup

which IMHO is a good compromise between ":behave xterm" and ":behave
mswin" -- of course, YMMV.


Best regards,
Tony.
--
My Favorite Drugs [Sung to My Favorite Things]
Reefers and roach clips and papers and rollers
Cocaine and procaine for twenty year molars
Reds and peyote to work out your bugs
These are a few of my favorite drugs.

Uppers and downers and methedrine freakout
Take some amphetamines, watch your brains leak out
Acid and mescaline pull out your plugs
These are a few of my favorite drugs.

Backs that are perfect for carrying monkeys
Users of heroin, often called junkies
Methadone helps then to stop being thugs
Takes them off one of my favorite drugs.

On a bad trip
When the cops come
When I lose my head
I simply take more of my favorite drugs
And then I'm not sad -- I'm dead!

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment