Abbreviation

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

Abbreviation

henrik-10
Hi Vimmers,

i am facing a problem using abbreviation with vim.
Everything works fine using  :abb bla abbreviation within a file in the
commandline modus. To make life easier i want to define it globally in
my .vimrc-file like

:abbreviate #t %%%%%%%%%%%%%%%%%%%%%%


But i can't use it within the file!What is wrong????


Thanks for some hints in advance,
  Henrik

Reply | Threaded
Open this post in threaded view
|

Re: Abbreviation

Tim Chase-2
> i am facing a problem using abbreviation with vim. Everything
>  works fine using  :abb bla abbreviation within a file in the
>  commandline modus. To make life easier i want to define it
> globally in my .vimrc-file like
>
> :abbreviate #t %%%%%%%%%%%%%%%%%%%%%%
>
> But i can't use it within the file!What is wrong????

I'm not sure I follow the problem you're having.  I just created
a test vimrc file with that one line in it (minus the colon) and
it worked fine.

        bash> echo "abbreviate #t %%%%%%%%%%%%%%%%%%%%" > myvimrc
        bash> vim -u myvimrc
[starts vim using this custom myvimrc file instead of your
regular vimrc file]

went into insert mode, entered "#t " with the space to trigger
the expansion of appreviations...IIUC, any non-word character
will do that (see ":help 'iskeyword'" and ":help abbreviations").
As is detailed in the help on abbreviations, it looks like you're
doing an "end-id" type abbreviation, which means that it will
also expand in cases like

        foo#t -> foo%%%%%%%%%%%%%%%%%%%%%%%%%%%

Alternatively, some freak script *might* be running ":abc" which
clears all your abbreviations.

My suggestion would be to do as above, creating a vimrc with
*just* the abbreviation you want in it, and start vim using that.
Does that produce the behavior you expect?  If so, something
else may be munging with your abbreviations.  If it doesn't then
perhaps you could detail how it fails to meed your expectations.

Hope this helps,

-tim







Reply | Threaded
Open this post in threaded view
|

Re: Abbreviation

henrik-10
Hi Tim,

thanks for U help ... my problem was that i modified my .vimrc file and
wanted at the same time using this changes in a open file. But
using :abbreviate i found out that no abbreviation made in the record
file could be loaded in my open file. So i closed it and restart it
again and know everything is working to my satisfaction.


Bye,
 Henrik




On Wed, 2005-08-10 at 08:33 -0500, Tim Chase wrote:

> > i am facing a problem using abbreviation with vim. Everything
> >  works fine using  :abb bla abbreviation within a file in the
> >  commandline modus. To make life easier i want to define it
> > globally in my .vimrc-file like
> >
> > :abbreviate #t %%%%%%%%%%%%%%%%%%%%%%
> >
> > But i can't use it within the file!What is wrong????
>
> I'm not sure I follow the problem you're having.  I just created
> a test vimrc file with that one line in it (minus the colon) and
> it worked fine.
>
> bash> echo "abbreviate #t %%%%%%%%%%%%%%%%%%%%" > myvimrc
> bash> vim -u myvimrc
> [starts vim using this custom myvimrc file instead of your
> regular vimrc file]
>
> went into insert mode, entered "#t " with the space to trigger
> the expansion of appreviations...IIUC, any non-word character
> will do that (see ":help 'iskeyword'" and ":help abbreviations").
> As is detailed in the help on abbreviations, it looks like you're
> doing an "end-id" type abbreviation, which means that it will
> also expand in cases like
>
> foo#t -> foo%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> Alternatively, some freak script *might* be running ":abc" which
> clears all your abbreviations.
>
> My suggestion would be to do as above, creating a vimrc with
> *just* the abbreviation you want in it, and start vim using that.
> Does that produce the behavior you expect?  If so, something
> else may be munging with your abbreviations.  If it doesn't then
> perhaps you could detail how it fails to meed your expectations.
>
> Hope this helps,
>
> -tim
>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Abbreviation

Tim Chase-2
> thanks for U help ... my problem was that i modified my .vimrc
> file and wanted at the same time using this changes in a open
> file.

Ah...I understand now.  Usually, you can make changes in your
.vimrc file take effect without closing Vim by issuing

        :so $VIMRUNTIME/.vimrc

(or _vimrc if on Win32).  There are a number of cases in which
this won't produce the *exact* effect of starting a fresh copy of
vim, but it's often good enough.

See

        :help :source

for more info if you want.

-tim