On Tuesday 12 June 2018 10:36,
Gena Makhomed <g...@csdoc.com> put forth the proposition:
> On 12.06.2018 2:22, Tony Mechelynck wrote:
>
> > On Mon, Jun 11, 2018 at 9:57 PM, Christian Brabandt wrote:
>
> > > :let @n='&nbsp;'
> > > :inoremap <F1> <c-r>n
> > > :nmap <f1> a<f1><esc>
>
> Christian, thank you! All works fine now!
>
> > > Note that I would not recommend mapping <f1>
>
> Why not? <F1>, as I understand, is always mapped to vim :help command.
> <F1> on keyboard located near <ESC> key, it is very useful to press <F1>
>
> > Neither would I, because in Vim like in most other programs, F1 brings
> > you to the first page of help.
>
> And this is completely useless for me, I always can enter :help command
> from keyboard. Even more, typing just three keys :h<CR> is enough.
>
> It is more useful for me to read vim documentation via web-site,
> for example, site http://vimdoc.sourceforge.net/htmldoc/help.html
> contains documentation for vim 7.3, and I am use vim 7.4, it is Ok.
>
> Web site http://vimdoc.sourceforge.net/htmldoc/help.html
> was not updated from 2010 year - this is bug or feature?
>
> > Gena: What's wrong with Ctrl-R n (in Insert mode) or "np (in Normal
> > mode)?
>
> wrong #1: it is different keys in different modes,
> this is uncomfortable.
>
> wrong #2: I need to press more when one key on the keyboard,
> this is uncomfortable too.
>
> wrong #3: I use vim to edit text written on Russian language,
> and my keyboard frequently switched to Russian language layout.
> If keyboard in Russian language mode - vim just beep and do nothing.
>
> So, I need first switch keyboard from Russian to English,
> when find in which mode vim is currently, and select appropriate
> keyboard sequence, when enter this sequence on keyboard,
> when switch keyboard back from English to Russian mode.
>
> This is very uncomfortable for editing text.
> Just pressing <F1> is very fast and very useful.
>
> > Or if you're dead set on using only one keystroke, any F key
> > other than F1 (Help) and F10 (Menu) or any Shift-F key, would IMHO be
> > better than F1.
>
> I just don't want continually switch keyboard
> from Russian to English and from English to Russian.
>
> So, I can use only functional keys on keyboard or other
> key combinations which are available in VT100 terminal mode.
> (I use PuTTY, ssh and screen, so terminal is limited to VT100)
>
> P.S.
>
> One more question.
>
> Is it possible with vim:
>
> If I press <F1> and text under cursor is space - replace it with &nbsp;
> If I press <F1> and text under cursor is not space - generate beep
>
> I try to write this via function:
>
> ===========================================================
>
> function SpaceReplace()
>     if getline(".")[col(".")-1] == ' '
>         echo "replace <space> under cursor with &nbsp;"
>     else
>         echo "beep"
>     endif
> endfunction
>
> inoremap <F1> <esc>:call SpaceReplace()<CR>a
> nnoremap <F1> :call SpaceReplace()<CR>
>
> ===========================================================
>
> But I can't understand what I need to write instead "echo".

For the replacement you could try:

normal xi&nbsp;

For the 'beep' I guess echomsg "ERROR" for a visual message, or
something like:

silent ! printf "\a"

to make an ascii bell. Substitute the command after the ! to play a
sound if you want that. You will probably need to do a :redraw or a
:redrawstatus afterwards.

-Dave

> --
> Best regards,
>  Gena

--

There are no threads in a.b.p.erotica,  so there's no  gain in using a
threaded news reader.
  -- unknown source

                                                            .--.  oo
                                                           (____)//
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

-- 
-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to