Friday, November 4, 2011

Re: mapping ALT-backspace

On 03/11/11 17:07, meino.cramer@gmx.de wrote:
> Tony Mechelynck<antoine.mechelynck@gmail.com> [11-11-03 17:00]:
>> On 03/11/11 03:54, meino.cramer@gmx.de wrote:
>>> Tony Mechelynck<antoine.mechelynck@gmail.com> [11-11-02 06:40]:
>>>> On 02/11/11 03:53, meino.cramer@gmx.de wrote:
>>>>> Hi,
>>>>>
>>>>> the zsh I am using is recoginzing ALT-backspace as "delete one
>>>>> word backward", which is very handy.
>>>>>
>>>>> Unfortunately I have not found a way to map this in a similiar
>>>>> way for vim.
>>>>>
>>>>> How can I map ALT-backspace in vim?
>>>>>
>>>>> Thank you very much in advance for any help!
>>>>> Best regards,
>>>>> mcc
>>>>>
>>>>
>>>> In Console Vim, it may depend on your terminal: I'm not sure that
>>>> every
>>>> terminal passes something recognizable to Vim when you hit
>>>> Alt-Backspace.
>>>>
>>>> In gvim, it's<M-BS> and my gvim (with GTK2/Gnome2 GUI) sees it.
>>>>
>>>> To see if Vim gets something when you hit that key combo, open Vim in
>>>> Insert mode in an empty buffer and hit Ctrl-V followed by
>>>> Alt-Backspace, then Ctrl-K followed by Alt-Backspace. If you don't
>>>> get
>>>> anything, Vim hasn't seen the keypress. If it sees something, in gvim
>>>> you should see the<> equivazlent in both cases; in Console Vim you
>>>> should see the bytes passed by the keyboard interface after Ctrl-V,
>>>> or
>>>> the<> equivalent (here,<M-BS>, unless the keyboard passes something
>>>> else) after Ctrl-K.
>>>>
>>>> In Insert mode, to delete the word before the cursor you can hit
>>>> Ctrl-W, see :help i_CTRL-W
>>>>
>>>> In Normal mode, you should be able to use Shift-Left as a modifier to
>>>> the d (delete) command, to delete [count] words leftwards, or the
>>>> command daw ("delete a word") to delete the word under the cursor (on
>>>> both sides) and the white space on one side of it. See :help
>>>> text-objects
>>>>
>>>>
>>>> Best regards,
>>>> Tony.
>>>> --
>>>> hundred-and-one symptoms of being an internet addict:
>>>> 209. Your house stinks because you haven't cleaned it in a week.
>>>>
>>>> --
>>>> 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
>>>>
>>>
>>>
>>> Hi Tony,
>>>
>>> Thank you very much for your explanations. Since I am using console
>>> vim most of the time I am trying to get it working there.
>>>
>>> The result of the test is, that vim doesn't see any of the keypresses.
>>> You wrote that is due to the terminal.
>>>
>>> I dont understand this completly I fear...
>>>
>>> The zsh, running under the same terminal adn which was the one startet
>>> vim, does see ALT-nackspace.
>>>
>>> What I am doing/inderstanding wrong here?
>>>
>>> Best regards,
>>> mcc
>>>
>>>
>>
>> I don't know. Maybe nothing: Vim in Windows console uses "cooked" input
>> IIRC, and that puts it more at the mercy of the DOS-like keyboard
>> driver than if it used "raw" input; but OTOH (IIUC), "raw" input would
>> read AaZzQqWwMm incorrectly on AZERTY keyboards, YyZz and maybe Ww on
>> QWERTZ keyboards, and practically everything on Dvorak keyboards, not
>> to mention non-Latin keyboards. But maybe I don't UC.
>>
>> See also :help win32-problems (I'm not sure how applicable these are to
>> Windows NT / XP / Vista / 7).
>>
>>
>> Best regards,
>> Tony.
>> --
>> We gave you an atomic bomb, what do you want, mermaids?
>> -- I. I. Rabi to the Atomic Energy Commission
>>
>> --
>> 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
>>
>
> Hi Tony,
>
> I am running Linux, not windows. Sorry for not mention this...
>
> Best regards,
> mcc
>
>
>

Well, under Linux each different terminal (Linux console, KDE konsole,
gnome-terminal, xterm, mlterm, ...) can react differently, but gvim has
a better grasp of what you type than any of them, because there's one
fewer layer between Vim and your keyboard. For a similar reason it also
gives you better control of what you display (more colours, better
control of: fonts, multi-language texts, cursor shapes, ...). IMHO the
only job for which console Vim is better than the GUI is when displaying
RTL and LTR scripts together in a single file, in a full-bidi terminal
such as mlterm.


Best regards,
Tony.
--
It's odd, and a little unsettling, to reflect upon the fact that
English is the only major language in which "I" is capitalized; in many
other languages "You" is capitalized and the "i" is lower case.
-- Sydney J. Harris

--
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: