Sunday, January 22, 2012

Re: cexpr getpos entries

On Sun, 22 Jan 2012, sinbad wrote:

> i have a list of getpos() entries,
> i want to feed this list of entries to cexpr
> is it possible ?

Not directly. It'd probably work to use setqflist(), but getpos()
doesn't contain a buffer or filename (one or the other of which is
required), unless you're using getpos("'{mark}").

E.g.

" start a list
let list=[ [bufnr('%')] + getpos('.') ]

" move around, then add another location to the list
call add(list, [bufnr('%')] + getpos('.'))

" continue... (can use @: to repeat last :-command)

" then:

call setqflist(map(copy(list), '{"bufnr": v:val[0], "lnum": v:val[2], "col": v:val[3], "text": "random text"}'))

See full help at:

:help setqflist()
:help setloclist()
:help map()
:help copy()
:help add()
:help bufnr()
:help getpos()

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

No comments: