Did you type the mappings in the email message or did you copy/paste them
from your VIMRC? Are you able to get the mappings to work if you copy/paste
them onto the command-line after Vim has started? The primary problem I can
see with the mappings is that you have them defined as n<ScriptCmd> instead
of just n:

...n<ScriptCmd> th... defines a mapping for n<ScriptCmd>
...n <ScriptCmd>th... defines a mapping for n that then executes a script
command and is probably what you want

As an aside, the function you defined is technically correct, though
inefficient in a few things, but that's not likely to be the cause of your
woes.

On Mon, Oct 31, 2022 at 1:43 AM Nicolas <nivaem...@gmail.com> wrote:

> Hi,
>
>
> Using this def func to blink searched word I mapped it in $MYVIMRC as this
> but it seems that at vim startup, the nnoremap is not defined, no call
> occurs.
>
> Thankyou for help
> Nicolas
>
> *$MYVIMRC*
> import autoload './vimfiles/plugged/foobar.vim'
> as thatHelp
>
> nnoremap n   n<ScriptCmd> thatHelp.HLNext(80)<CR>
> nnoremap N   N<ScriptCmd> thatHelp.HLNext(80)<CR>
>
>
>
> *foobar.vim*
> export def HLNext(blinktime: number): number
>     # https://www.youtube.com/watch?v=aHm36-na4-4#t6m36s
>
>   echomsg 'export def HLNext has been called.'
>
>   highlight BlackOnBlack guibg=black guifg=#3c4c55 ctermbg=black
> ctermfg=black
>
>   var [bufnum: number, lnum: number, col: number, off: number] =
> getpos('.')
>   var target_pat: string = '\k*\%#\k*'
>   target_pat = '\%#' .. @/
>   target_pat = '\k*\%#\k*'
>   var blinks: number = 3
>
>   var sleep_duration: number = ( blinktime / (2 * blinks) )->float2nr()
>   var sleep_cmd: string = 'sleep ' .. sleep_duration .. 'm'
>
>
>   for n in range(1, blinks)
>
>     # echomsg n
>     var hide: number = matchadd('BlackOnBlack', target_pat, 101)
>     redraw
>     exec sleep_cmd
>     matchdelete(hide)
>     redraw
>     exec sleep_cmd
>
>   endfor
>
>   return 0
>
> enddef
>
>
>
> --
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/f6861e1f-9783-49b6-b151-b6f1625e6ce5n%40googlegroups.com
> <https://groups.google.com/d/msgid/vim_use/f6861e1f-9783-49b6-b151-b6f1625e6ce5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

Salman

I, too, shall something make and glory in the making.

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CANuxnEd4hGKmRdLjwpDzFc27ntXrryff-rZ4w4gH1jubzCnqdw%40mail.gmail.com.

Reply via email to