Hi Bee!

On Do, 09 Jun 2011, Bee wrote:

> I would like to jump to the next (or prev) line, always a multiple of
> "tline".
> 
> let tline = 16
> 
> This calculates how many more lines to jump
> useful with "j"
> 
> :echo tline - line(".") % tline
> 
> This calculates the line to jump to
> useful with "G"
> 
> :echo ( line(".") / tline + 1 ) * tline
> 
> How to create a mapping?
> 
> This does NOT work.
> 
> :nmap J execute "normal " . tline - line('.') % tline . "j"

You want an expression mapping:

:nmap <expr> J tline-line('.')%tline.'j'

See also the help at :h map-expression

regards,
Christian
-- 

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