Re: RFC: Function to get the list of marks (getmarks)

2019-09-20 Fir de Conversatie Bram Moolenaar


Yegappan wrote:

> > > Currently the following Vim built-in functions are available to get
> > > information about individual marks: getpos(), line() and col().
> > >
> > > But we don't have a function to get the list of marks placed in a
> > > buffer or the list of global marks (similar to the list displayed by
> > > the :marks command).
> > >
> > > What do you think about adding a getmarks() function that returns
> > > the list of global marks or the list of marks placed in a buffer?
> >
> > One can loop over all the mark names to get all the values.  When would
> > it be useful to get the whole list?
> >
> > If anybody would want to get marks for a buffer that is not in a window
> > we could add an optional argument to getpos().  But I don't recall
> > anyone asking for this.
> 
> This feature request came up in the "Support for plugin authors needs to be
> improved (poll) #3573" last year:
> 
> https://github.com/vim/vim/issues/3573
> 
> In addition to this, the discussion also centered around adding support for
> user-specified custom marks from a plugin.

That has been implemented with text properties.  You can use an
invisible text property, it will stick to the text.  Also when
characters are inserted/deleted.  Marks only keep the line.

-- 
GALAHAD: No, please.  Please! I can defeat them!  There's only a hundred.
GIRLS:   He will beat us easily.  We haven't a chance.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201909201222.x8KCMDuZ017953%40masaka.moolenaar.net.


Re: RFC: Function to get the list of marks (getmarks)

2019-09-19 Fir de Conversatie Yegappan Lakshmanan
Hi Bram,

On Thu, Sep 19, 2019 at 12:28 PM Bram Moolenaar  wrote:
>
> Yegappan wrote:
>
> > Currently the following Vim built-in functions are available to get
> > information about individual marks: getpos(), line() and col().
> >
> > But we don't have a function to get the list of marks placed in a
> > buffer or the list of global marks (similar to the list displayed by
> > the :marks command).
> >
> > What do you think about adding a getmarks() function that returns
> > the list of global marks or the list of marks placed in a buffer?
>
> One can loop over all the mark names to get all the values.  When would
> it be useful to get the whole list?
>
> If anybody would want to get marks for a buffer that is not in a window
> we could add an optional argument to getpos().  But I don't recall
> anyone asking for this.
>

This feature request came up in the "Support for plugin authors needs to be
improved (poll) #3573" last year:

https://github.com/vim/vim/issues/3573

In addition to this, the discussion also centered around adding support for
user-specified custom marks from a plugin.

- Yegappan

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7nkJtx8AGgi8661FCWg%3Dh0%3DgkVRCgwEKS9h4yq341TnyQ%40mail.gmail.com.


Re: RFC: Function to get the list of marks (getmarks)

2019-09-19 Fir de Conversatie Bram Moolenaar


Yegappan wrote:

> Currently the following Vim built-in functions are available to get
> information about individual marks: getpos(), line() and col().
> 
> But we don't have a function to get the list of marks placed in a
> buffer or the list of global marks (similar to the list displayed by
> the :marks command).
> 
> What do you think about adding a getmarks() function that returns
> the list of global marks or the list of marks placed in a buffer?

One can loop over all the mark names to get all the values.  When would
it be useful to get the whole list?

If anybody would want to get marks for a buffer that is not in a window
we could add an optional argument to getpos().  But I don't recall
anyone asking for this.

-- 
GALAHAD: No look, really, this isn't nescess ...
PIGLET:  We must examine you.
GALAHAD: There's nothing wrong with ... that.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201909191928.x8JJSBRO007594%40masaka.moolenaar.net.


Re: RFC: Function to get the list of marks (getmarks)

2019-09-18 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Wed, Sep 18, 2019 at 8:47 AM 'Andy Wokula' via vim_dev
 wrote:
>
> Am 18.09.2019 um 17:18 schrieb Yegappan Lakshmanan:
> > Hi all,
> >
> > Currently the following Vim built-in functions are available to get
> > information about individual marks: getpos(), line() and col().
> >
> > But we don't have a function to get the list of marks placed in a
> > buffer or the list of global marks (similar to the list displayed by
> > the :marks command).
> >
> > What do you think about adding a getmarks() function that returns
> > the list of global marks or the list of marks placed in a buffer?
>
> What do you mean by "a buffer" -- "the current buffer" or "any given buffer"?
>

This function will return the local marks for any given buffer.

- Yegappan

>
> Getting global marks or marks of the current buffer is trivial
>
> :echo filter(split('ABCDEFGHIJKLMNOPQRSTUVWXYZ', '\m'), 'line("''". v:val) >= 
> 1')
> :echo filter(split('abcdefghijklmnopqrstuvwxyz', '\m'), 'line("''". v:val) >= 
> 1')
> " (some other special marks omitted)
>
> but I wouldn't know how to get marks from any given buffer without
> making that buffer current.  Anyway I'm not sure if I ever asked for
> the local marks of a non-current buffer.
>

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7kySHjtcG3FidK3oos28Ee2%2BXMHqXZ2J4uTmCQaB7M0fQ%40mail.gmail.com.


Re: RFC: Function to get the list of marks (getmarks)

2019-09-18 Fir de Conversatie 'Andy Wokula' via vim_dev

Am 18.09.2019 um 17:18 schrieb Yegappan Lakshmanan:

Hi all,

Currently the following Vim built-in functions are available to get
information about individual marks: getpos(), line() and col().

But we don't have a function to get the list of marks placed in a
buffer or the list of global marks (similar to the list displayed by
the :marks command).

What do you think about adding a getmarks() function that returns
the list of global marks or the list of marks placed in a buffer?


What do you mean by "a buffer" -- "the current buffer" or "any given buffer"?

Getting global marks or marks of the current buffer is trivial

:echo filter(split('ABCDEFGHIJKLMNOPQRSTUVWXYZ', '\m'), 'line("''". v:val) >= 
1')
:echo filter(split('abcdefghijklmnopqrstuvwxyz', '\m'), 'line("''". v:val) >= 
1')
" (some other special marks omitted)

but I wouldn't know how to get marks from any given buffer without
making that buffer current.  Anyway I'm not sure if I ever asked for
the local marks of a non-current buffer.

--
Andy

--
--
You received this message from the "vim_dev" 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_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/5D825175.9000602%40yahoo.de.


RFC: Function to get the list of marks (getmarks)

2019-09-18 Fir de Conversatie Yegappan Lakshmanan
Hi all,

Currently the following Vim built-in functions are available to get
information about individual marks: getpos(), line() and col().

But we don't have a function to get the list of marks placed in a
buffer or the list of global marks (similar to the list displayed by
the :marks command).

What do you think about adding a getmarks() function that returns
the list of global marks or the list of marks placed in a buffer?

Thanks,
Yegappan

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7%3DFuxsq5FbB%3D7i76SbFazyMpxDkbkcrMiBJf-bsFieC1A%40mail.gmail.com.