Sunday, October 25, 2015

Re: Character s is not work on vim maps

On Sun, Oct 25, 2015 at 1:00 AM, Sven Guckes <guckes@guckes.net> wrote:
> * 吴江 <wujiangthu@gmail.com>:
>> When I use noremap <C-S> :update<CR> to map ctrl-s to save file,
>> it's not work, and I use noremap <C-S-l> :update<CR> to
>> map ctrl-shift-s works, since character s is not work
>> and s will be translate only into shift in map? Thanks.
>
> * Dr. Charles E. Campbell, Jr. <drchip@campbellfamily.biz> [2015-10-25 00:49]:
>> Hello-I suspect you're using vim (as opposed to gvim) -
>> and your terminal is taking the ctrl-s.
>
> that's what i thought, too. but why does c-s-l work then?
>
> anyway.. wujiangthu - it's not the 's' that doesnt work -
> it is the CTRL-S which has a special meaning for terminals.
> the CTRL-S is usually the "stop" command for them.
> so the terminal "eats" it before vim gets to see it.
>
> if you do use vim within a terminal then you
> can unset the "stop" which CTRL-S gives it:
> $ stty stop ""
>
> now start vim and you will see that when you switch
> to insert mode and type CTRL-S that a "^S" shows up.
>
> however, you might want stop+start with CTRL-S
> and CTRL-Q in your terminal at times. if so then
> consider mapping command to other key combinations.

Yes, I recommend using the F keys (except <F1> = Help and sometimes
<F10> = Menu), with or without Shift, as {lhs} for mappings, because
they don't have a default binding. (On Linux, at least, Ctrl-Fn
combinations are usually preempted by the window manager; and
Ctrl-Alt-Fn, or Alt-Fn in non-X11 consoles, switch virtual consoles.)
Twelve F keys, times two for shift or no shift, minus two already
defined, that's a total of 22 keys available for mapping: one for
every Hebrew letter or Tarot arcana ;-)

>
> as the comma is on the same key with
> DE+EN layouts i use ",," for updating:
> map ,, :upd<cr>

I use F3 to "save all my work":
map <F3> :wa|wv<CR>
map! <F3> <C-O>:wa|wv<CR>

This, of course, needs care: if a file mustn't be modified on disk, it
has become second nature to me to open it with :view or :sview, not
:edit or :new, so that any attempt to write it this way causes an
error.

>
> Sven
>


Best regards,
Tony.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: