synstack() in insert mode

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

synstack() in insert mode

Marcin Szamotulski
Hello,

Trying to make a nice feature for editing LaTeX document for
AutomaticTexPlugin:
    http://www.vim.org/scripts/script.php?script_id=2945
I run into the following problem:

I would like to call synstack() function using autocommand with group
CursorMovedI, thus in the insert mode. But then synstack() returns 0 instead
of [] when there is no syntax group at the cursor position.

The same thing happens when I try to use synstack function in a completion
function which is mapped using <Ctrl-R>= ... or if I use vim option
'completefunc'.

Best regards,
Marcin Szamotulski

--
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
Reply | Threaded
Open this post in threaded view
|

Re: synstack() in insert mode

Tony Mechelynck
On 05/07/10 21:02, Marcin Szamotulski wrote:

> Hello,
>
> Trying to make a nice feature for editing LaTeX document for
> AutomaticTexPlugin:
>      http://www.vim.org/scripts/script.php?script_id=2945
> I run into the following problem:
>
> I would like to call synstack() function using autocommand with group
> CursorMovedI, thus in the insert mode. But then synstack() returns 0 instead
> of [] when there is no syntax group at the cursor position.
>
> The same thing happens when I try to use synstack function in a completion
> function which is mapped using<Ctrl-R>= ... or if I use vim option
> 'completefunc'.
>
> Best regards,
> Marcin Szamotulski
>

Works for me. After typing the following in Normal mode:

        :set cmdheight=2
        :augroup test|exe "au CursorMovedI * echo synstack(line('.'),
col('.'))"|augroup END

every Insert-mode cursor move (where no syntax items are defined)
displays [] below the bottom status line.

I tested this using both Vim 7.2.444 and a freshly-compiled Vim 7.3a
(revision 69064995302a dated Mon Jul 05 22:57:59 2010 +0200).


Best regards,
Tony.
--
A tautology is a thing which is tautological.

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