Bug#350021: Alt-I should insert \item before the current character

Franz Pletz fpletz at franz-pletz.org
Mon Apr 24 20:19:51 UTC 2006


Hi Joachim,

On Mon, Apr 24, 2006 at 07:43:35PM +0200, Joachim Breitner wrote:
> I have to disagree here. This is a normal circumstance:
>         iteimze <F5> Bla1 <ENTER> <Alt-I> Bla2 <ENTER> Bla3 (oups,
>         forgot to press Alt-I) <Pos1> <Alt-I>
> Ausgabe:
> \begin{itemize}
> \item Bla1
> \item Bla2
> B\item la3
> \end{itemize}<++>
> 
> Or is the result different with your setup?

well, it is different, in fact. On my box, autoindent is turned on, so
with your keystrokes I get the following output:

\begin{itemize}
    \item Bla1
    \item Bla2
    \item        Bla3
\end{itemize}<++>

The problem with Bla3 is that <Pos1> puts the cursor an the beginning of
the current line. Using ^ for setting the cursor to the beginning of the
first word and then pressing <Alt+I> works fine.

> Another point to support my view:
[..]
> And then pressing <Alt-I> before the 1,2,3 and 4. The first two
> shouldn't result in the identical line, IMHO.

This is also correct, of course. For all my decisions and thoughts I was
assuming that autoindent was turned on because it's good practice.

> It works for the first case, but the other cases are not optimal,
> either:
[..]
> i.e., the "\item " is inserted exactly at the current cursor position.

Ah, right. That's a problem with the input mode in vim. If you are in
command mode and press I, you get into input mode with the cursor before
the currently hilighted character. When exiting input mode with <Esc>
the character before will be hilighted and so on. If you are in input
mode beween the first and the second character of a line and then press
<Esc> you hilight the first character and going into input mode with <i>
(like in my workaround and in the original code) puts the cursor right
before the first character.

This is a bit of a tricky behaviour in vim. To fix this problem I removed
specifically going into insert mode. While testing this I'm wondering why
upstream actually ensures input mode because if you're not insert mode
<Alt-i> doesn't work.

Anyway, this should work now as expected (just removed <Esc>i):

inoremap <script> <silent> <Plug>Tex_xInsertItemBeforeOnThisLine <C-r>=Tex_InsertItem()<CR>
augroup LatexSuite
    au LatexSuite User LatexSuiteFileType
                \ imap <buffer> <M-I> <Plug>Tex_xInsertItemBeforeOnThisLine
augroup END

With this version compatibility is actually nearly the same, with the
exception of the end of a line where a similar problem araises.

> Thanks for reading the trough, and if you agree, please consider
> reverting the severity.

Okay, I agree that this behaviour is not optimal though autoindent
basically "solves" it. I'll raise the severity only to minor though.
Thanks for stating your point of view in detail.

Please confirm the correct behaviour of my new version and I'll put this
into the next version of vim-latexsuite replacing the old mapping to <M-i>
and contact upstream.

Thanks,
Franz

-- 
Franz Pletz                   \  The Internet treats censorship as
www: http://franz-pletz.org/   \  damage and routes around it.
email: fpletz at franz-pletz.org   \  -- John Gilmore
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20060424/779d4882/attachment.pgp


More information about the pkg-vim-maintainers mailing list