Friday, February 19, 2010

strange behaviour of normal command

Hi folks,

I'm seeing a strange behaviour of normal comand.

Let's say I have the below function.

function! NormalNTest()
let saveCursor = getpos('.')
"call setpos([0, 1, 1, 0 ] )
normal gg
call setpos('.', saveCursor)
echohl Special | echon "hi" |echohl None
echon ' vim_use'
endfunc

now I defined a map like

map ,vi :call NormalNTest() <CR>

Let say I opened some text file and run map ,vi. It displays "hi
vim_use". Now I move the cursor in my text file using any motion
commands. Let's say, I moved forward to the next page then I ran
map ,vi. It doesn't display the output :( . Again if I ran map ,vi at
the same location it will show.

When the output isn't displayed the screen slightly flickers. If I
replace the normal gg statement with call setpos([0, 1, 1, 0 ] ) then
it works fine without any problems.

Why with normal gg it isn't working as expected?

Regards,
Kkde

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

No comments: