Re: [Vim-latex-devel] Some problems with command implementation
Brought to you by:
srinathava,
tmaas
From: Benji F. <be...@me...> - 2002-12-30 01:59:30
|
Srinath Avadhanula wrote: > On Sun, 29 Dec 2002, Srinath Avadhanula wrote: > > > >This works nicely! Thanks! > > > >I shall use this idea in packages.vim, templates.vim and > >custommacros.vim. > > > > > I see that there's still a problem: > > The command: > > com! Foo normal! i > > doesn't leave the user in insert mode, whereas > > com! Foo normal! 0v$ > > does leave the user in select mode. > > This seems to be a vim inconsistency... Any workarounds? Doing a > startinsert after the command is not going to cut it because sometimes > we want to end up in insert mode, sometimes in select mode. > > Srinath I think the idea of "complete command" under :help :normal is that you are not allowed to end in Insert mode. It is inconvenient, but I have always been able to work around it. Of course, I have never tried to do much with commands... I guess my general approach is to keep the command simple: mostly, it just calls a function. The function can end with something like if a:endMode == "i" startinsert elseif a:endMode == "s" execute "normal! 0v$\<C-G>" elseif a:endMode == "v" normal! 0v$ endif (I was going to say that your command leaves me in Visual mode, not Select mode, until I remembered the 'selectmode' option. Let's wait until someone complains, and then modify all our functions to respect this one!) HTH --Benji |