" Jump to start of nth or next block of 16 lines
nnoremap<expr>  ]]
   \ v:count
   \ ? ":<C-U><cr>".(v:count*16+1)."Gzz"
   \ : 17-line(".")%16."jzz"

Why is the :<C-U><CR> there? Doesn't that do nothing?

" Display line and block number
nnoremap ][ :echo (line(".")-1)%16 line(".")/16 "List"<cr>

BUT this function is not working:

fu! List()
" Jump to start of nth or next block of 16 lines
   v:count ? ":<C-U><cr>".(v:count*16+1)."Gzz" : 17-line(".")%16."jzz"
" Display line and block number
   echo (line(".")-1)%16 line(".")/16 "List"<cr>
endfu
nnoremap ]] :call List()<cr>

In a function, you actually have to run the commands, not just return
keystrokes like in an expr mapping. Something like this:

fu! List()
   " Jump to start of nth or next block of 16 lines
   if v:count
      execute "normal ".(v:count*16+1)."Gzz"
   else
      execute "normal ".(17-line(".")%16)."jzz"
   endif
   " Display line and block number
   echo (line(".")-1)%16 line(".")/16 "List"
endfu

:help :if
:help :execute
:help :normal

Ben.



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

Reply via email to