Thank you for the answer.
I have vim 7.2 and I have pasted your suggestion to my .vimrc then :so it.
Then when I do :w1 VIM tries to save to file named 1.

This is how I pasted:
if version<  700
        cnoreabbrev w1 w!
else
        cnoreabbrev  <expr>  w1  ((getcmdtype() == ':'  &&
getcmdpos()  <= 2)?   'w!' : 'w1')
endif

(I also tried your version that is spread to more lines, it doesn't
work as well).

On Wed, Nov 5, 2008 at 9:23 PM, Tony Mechelynck
<[EMAIL PROTECTED]> wrote:
>
> On 05/11/08 19:27, yosi izaq wrote:
>> I often make the mistake of typing w1 instead of w!.
>> Can you please suggest how to map w1 to w!?
>>
>> TIA
>
> Depending what you want to achieve...
>
>        :cmap 1 !
>
> would of course work, but I think it would have undesirable
> side-effects. Otherwise, similarly to my previous answer,
>
>         command! -bar -nargs=? -complete=file -range=% w1
>                 \  <line1>,<line2>w! <args>
>
> or
>
>         if version<  700
>                 cnoreabbrev w1 w!
>         else
>                 cnoreabbrev  <expr>  w1
>                 \ ((getcmdtype() == ':'  &&  getcmdpos()  <= 2)?
>                 \ 'w!' : 'w1')
>         endif
>
> but maybe the real solution would be to PaY mOre atTentiOn at hOw yOu
> aRe hIttIng tHe sHifT kEy?
>
> I guess I'm of that one of the members of that "old school" of thought
> who regard the fact that a text editor, when you type "teh",
> automatically corrects it to "the" without even asking, as doing (in the
> long run) a disservice to the user, helping him not to learn orthography.
>
>
> Best regards,
> Tony.
> --
> Very few profundities can be expressed in less than 80 characters.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to