Saluton Ben :) On Tue 19 May 2009 19:09 +0200, Ben Fritz <[email protected]> dixit: > On May 19, 9:51 am, Raúl Núñez de Arenas Coronado <[email protected]> > wrote: >> >> An obvious solution is to call the function with a parameter, indicating >> whether it was called from normal mode or using <C-\><C-O> from insert >> mode, but I don't know if that is a good solution or if a more elegant >> way exists. >> >> Which is the preferred way of doing such kind of discrimination? > > :help mode() shows my preferred way at least :-)
That won't work, since the function is always called in normal mode. As far as I know, it's impossible to call it from insert mode, so "mode()" will always return "n", although obviously I'm missing something because the function can actually return "i", but I don't know how to call a function from insert mode without going to normal mode first! That was the first way I tried, and I got the idea about using a parameter from the Vim wiki. Thanks anyway, Ben :) If you know how to call a function from an "imap" without using <C-O>:call, please tell me because I'm afraid I'm stuck with <C-\><C-O> O:) -- Raúl "DervishD" Núñez de Arenas Coronado Linux Registered User 88736 | http://www.dervishd.net It's my PC and I'll cry if I want to... RAmen! --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
