Wednesday, September 2, 2009

Re: Language dependent mapping

Derek Wyatt wrote:
> On Wed, Sep 2, 2009 at 6:26 AM, Dmitry V. Krivenok
> <krivenok@orangesystem.ru <mailto:krivenok@orangesystem.ru>> wrote:
>
> I want to map insertion of such strings to some key (e.g. F8).
> However, I want this mapping to be language dependent.
> It should recognize type of file in the current buffer and insert
> appropriate string.
>
> Is it possible to implement such mapping in VIM?
> Are there ready-to-use solutions?
> What should I learn to implement such mapping from scratch?
>
>
> One way to do this is by using the filetype.
>
> Create two files, $VIM/ftplugin/cpp.vim and $VIM/ftplugin/perl.vim and
> put your mappings in there:
>
> in $VIM/ftplugin/cpp.vim
> nmap <buffer> <F8> 80i/<esc>
> imap <buffer> <F8> <esc>80i/<esc>
>
>
> $VIM/ftplugin/perl.vim
> nmap <buffer> <F8> 80i#<esc>
> imap <buffer> <F8> <esc>80i#<esc>

Thank you very much!
This solution works fine!

>
>
>
> >


--
Sincerely yours, Dmitry V. Krivenok
Orange System Co., Ltd.
Saint-Petersburg, Russia
work phone: +7 812 332-32-40
cellular phone: +7 921 576-70-91
e-mail: krivenok@orangesystem.ru
web: http://www.orangesystem.ru
skype: krivenok_dmitry
jabber: krivenok_dmitry@jabber.ru
icq: 242-526-443


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments:

Post a Comment