On Jul 31, 9:36 am, Rashmi <rashmi....@gmail.com> wrote:
> Thank you both for your replies.
>
> I used imap as suggested previously, it works well because it also
> allows positioning the cursor to between the double quotes.
>

Actually, iabbr also allows you to position the cursor:

iabbr sout System.out.println("");<Left><Left><Left>

However, triggering this iabbr with, for example, sout<Tab> will place
a tab inside the "" which I don't think you want. Your mapping may
therefore be better for your purposes.

> Also , if we add this
> :imap sout<Press Tab>      System.out.println("");<Esc>F"i
>

This exits insert mode (albeit briefly) which could have some
unintended side effects. Also, you don't need to insert a literal tab
character, you can use <Tab> (exactly like that, as text with '<' and
'>' characters) in your mapping. This should work in exactly the same
way without the side effects:

imap sout<Tab> System.out.println("");<Left><Left><Left>

> to a new file created under
> C:\Program Files\Vim\vimfiles\ftplugin\java.vim
>
> the mapping gets set each time ViM is started, so I don't have to set
> the mapping each time.

Actually, it gets set each time you edit java code in Vim. Not if you
use Vim to edit a .c file, or a .txt file. Probably a good idea to do
it this way, then.

> I got this tip from:http://vim.wikia.com/wiki/VimTip1510(Keep your
> vimrc file clean)
>

It's great to see people getting useful information from the wiki!
Keep visiting, I hope you learn even more.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to