Enabling/disabling abbreviations

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Enabling/disabling abbreviations

Andre Majorel-7
What's the best approach to enabling/disabling a large subset
(thousands) of the abbreviations ? Use "<expr>" and turn them
all into functions that are no-ops when some global variable is
set ?

Or is there a way to group or tag abbreviations that I've missed ?

Thanks in advance.

--
André Majorel http://www.teaser.fr/~amajorel/
Subliminal message : Vim needs arbitrary tab stops.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Enabling/disabling abbreviations

Nikolay Aleksandrovich Pavlov
Ответ на сообщение «Enabling/disabling abbreviations»,
присланное в 22:47:56 17 сентября 2010, Пятница,
отправитель Andre Majorel:

Don't know, why you need thousands of abbreviations, but you can use execute:
    let s:abbreviations=[["e", "example"], ["e2", "example2"]]
    function s:EnableAbbreviations(ablist)
        for a in a:ablist
           execute "inoreabbrev ".a[0]." ".a[1]
        endfor
    endfunction
    function s:DisableAbbreviations(ablist)
        for a in a:ablist
           execute "iunabbrev ".a[0]
        endfor
    endfunction
    command -nargs=0 -bar AbEnable  call s:EnableAbbreviations(s:abbreviations)
    command -nargs=0 -bar AbDisable call s:DisableAbbreviations(s:abbreviations)

Текст сообщения:
> What's the best approach to enabling/disabling a large subset
> (thousands) of the abbreviations ? Use "<expr>" and turn them
> all into functions that are no-ops when some global variable is
> set ?
>
> Or is there a way to group or tag abbreviations that I've missed ?
>
> Thanks in advance.

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Enabling/disabling abbreviations

Benjamin R. Haskell-8
In reply to this post by Andre Majorel-7
On Fri, 17 Sep 2010, Andre Majorel wrote:

> What's the best approach to enabling/disabling a large subset
> (thousands) of the abbreviations ? Use "<expr>" and turn them all into
> functions that are no-ops when some global variable is set ?
>
> Or is there a way to group or tag abbreviations that I've missed ?

I assume this is related to your "common word endings" idea, in which
case, you're going to be much better off using functions.  I'll respond
in that thread with an idea.

--
Best,
Ben

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Enabling/disabling abbreviations

Luc Hermitte
In reply to this post by Andre Majorel-7
Hello,

"Andre Majorel" wrote:

> What's the best approach to enabling/disabling a large subset
> (thousands) of the abbreviations ? Use "<expr>" and turn them
> all into functions that are no-ops when some global variable is
> set ?

The badly named Triggers.vim plugin I wrote ages ago answers this need:
-> http://code.google.com/p/lh-vim/source/browse/misc/trunk/plugin/Triggers.vim
(documented there: http://hermitte.free.fr/vim/general.php#expl_triggers)

You'll require system_tools and quite likely lh-vim-lib to make it work.

HTH,

--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Enabling/disabling abbreviations

Benjamin Fritz
In reply to this post by Andre Majorel-7


On Sep 17, 1:47 pm, Andre Majorel <[hidden email]> wrote:
> What's the best approach to enabling/disabling a large subset
> (thousands) of the abbreviations ? Use "<expr>" and turn them
> all into functions that are no-ops when some global variable is
> set ?
>

There are other side effects, but :set paste will disable *all* your
abbreviations, and :set nopaste will restore them. See :help 'paste'
and :help 'pastetoggle'

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Enabling/disabling abbreviations

Andy Wokula
In reply to this post by Andre Majorel-7
Am 17.09.2010 20:47, schrieb Andre Majorel:
> What's the best approach to enabling/disabling a large subset
> (thousands) of the abbreviations ? Use "<expr>" and turn them
> all into functions that are no-ops when some global variable is
> set ?
>
> Or is there a way to group or tag abbreviations that I've missed ?
>
> Thanks in advance.

I'd prepare two scripts:
     :so enable_abbrevs.vim
     :so disable_abbrevs.vim

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php