"iabbrev" erratic behaviour

29 views
Skip to first unread message

Ottavio Caruso

unread,
Feb 19, 2024, 7:29:19 AMFeb 19
to vim...@googlegroups.com
Hi,

I have this is in my .vimrc:

iabbrev mdate <C-R>=strftime("%a %d/%m/%Y")


It used to work fine, but as of recently (3 or 4 weeks or so), this
abbreviation only works if it is the first thing that I input on any
file. If I edit a file, type some characters and then I type "mdate",
it doesn't get expanded. I have to save and exit the file, then
re-open it and then type "mdate".

Is there a way to troubleshoot that?

--
Ottavio Caruso

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Maxim Kim

unread,
Feb 19, 2024, 10:18:08 PMFeb 19
to vim_use
> Is there a way to troubleshoot that?

You can check if it works without your configuration: 

$ vim -Nu NONE
: iabbrev mdate <C-R>=strftime("%a %d/%m/%Y")<CR>

If it isthere must be something in vim config you will need to figure out. One common approach is to bisect your vimrc.

Gary Johnson

unread,
Feb 20, 2024, 12:49:16 AMFeb 20
to vim_use
On 2024-02-19, Maxim Kim wrote:

> On Monday, February 19, 2024 at 11:29:19 PM UTC+11 Ottavio Caruso wrote:
> >
> > Hi,
> >
> > I have this is in my .vimrc:
> >
> > iabbrev mdate <C-R>=strftime("%a %d/%m/%Y")
> >
> >
> > It used to work fine, but as of recently (3 or 4 weeks or so), this
> > abbreviation only works if it is the first thing that I input on any
> > file. If I edit a file, type some characters and then I type "mdate",
> > it doesn't get expanded. I have to save and exit the file, then
> > re-open it and then type "mdate".
> >
> > Is there a way to troubleshoot that?
>
> You can check if it works without your configuration: 
>
> $ vim -Nu NONE
> : iabbrev mdate <C-R>=strftime("%a %d/%m/%Y")<CR>
>
> If it isthere must be something in vim config you will need to figure out. One
> common approach is to bisect your vimrc.

Also, you can start vim like this:

$ vim --noplugin

which will use your vimrc but not your plugins. If your
abbreviation works then, it's _probably_ a plugin and not your
vimrc.

To see which plugins are loaded, use this:

:scriptnames

If it appears to be a plugin that's causing the problem, you can
bisect your list of plugins by moving some of them elsewhere
temporarily.

Since the problem started 3 or 4 weeks ago, it's likely due to
something you changed 3 or 4 weeks ago. This command might help in
spotting a change you made at that time.

$ find ~/.vim -type f -mtime +21 -mtime -35 | xargs ls -lt

That will find all regular files (-type f) with modification times
(-mtime) greater than 3 weeks ago (+21) and less than 5 weeks ago
(-35) and list them, sorted by modification time.

>> A: Because it messes up the order in which people normally read text.
>> Q: Why is top-posting such a bad thing?
>> A: Top-posting.
>> Q: What is the most annoying thing in e-mail?

B-)

Regards,
Gary

Christian Brabandt

unread,
Feb 20, 2024, 4:43:04 AMFeb 20
to vim...@googlegroups.com

On Mo, 19 Feb 2024, 'Ottavio Caruso' via vim_use wrote:

> Hi,
>
> I have this is in my .vimrc:
>
> iabbrev mdate <C-R>=strftime("%a %d/%m/%Y")
>
>
> It used to work fine, but as of recently (3 or 4 weeks or so), this
> abbreviation only works if it is the first thing that I input on any
> file. If I edit a file, type some characters and then I type "mdate",
> it doesn't get expanded. I have to save and exit the file, then
> re-open it and then type "mdate".
>
> Is there a way to troubleshoot that?

Make sure you do not have paste mode left enabled.

Thanks,
Christian
--
Official Project Stages:
(1) Uncritical Acceptance
(2) Wild Enthusiasm
(3) Dejected Disillusionment
(4) Total Confusion
(5) Search for the Guilty
(6) Punishment of the Innocent
(7) Promotion of the Non-participants

Ottavio Caruso

unread,
Feb 20, 2024, 9:40:39 AMFeb 20
to vim...@googlegroups.com
Am 20/02/2024 um 09:42 schrieb Christian Brabandt:
>
> On Mo, 19 Feb 2024, 'Ottavio Caruso' via vim_use wrote:
>
>> Hi,
>>
>> I have this is in my .vimrc:
>>
>> iabbrev mdate <C-R>=strftime("%a %d/%m/%Y")
>>
>>
>> It used to work fine, but as of recently (3 or 4 weeks or so), this
>> abbreviation only works if it is the first thing that I input on any
>> file. If I edit a file, type some characters and then I type "mdate",
>> it doesn't get expanded. I have to save and exit the file, then
>> re-open it and then type "mdate".
>>
>> Is there a way to troubleshoot that?
>
> Make sure you do not have paste mode left enabled.

Thanks. I have double checked but it's not enabled. This is erratic. It
seems to work now. There must be some key combination that triggers this
behaviour.
Reply all
Reply to author
Forward
0 new messages