Wednesday, November 6, 2024

Re: Annoying vim problem - again

Yes you are right about the subject.

On Wed, Nov 6, 2024 at 5:41 PM Marvin Renich <mrvn@renich.org> wrote:
* Riza Dindir <riza.dindir@gmail.com> [241105 23:26]:
> As you might recall I had a problem with VIM. I also have written to the
> group with the title "Annoying vim problem".

That subject is very generic and non-descriptive.  A much better subject
might be "When switching to a buffer, some of my previous editing is
undone".  Using a subject that summarizes your problem, rather than just
stating that you have a problem, is much more helpful to everybody.

...Marvin

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/Zyt/%2BI5CG2kqIP0E%40basil.wdw.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CA%2Bek4BHgRn1Pv4d1S1oOwOTT1J9ST0Ck_%3DqFAmhsLh%3DZH8zg%2BQ%40mail.gmail.com.

Re: Annoying vim problem - again

* Riza Dindir <riza.dindir@gmail.com> [241105 23:26]:
> As you might recall I had a problem with VIM. I also have written to the
> group with the title "Annoying vim problem".

That subject is very generic and non-descriptive. A much better subject
might be "When switching to a buffer, some of my previous editing is
undone". Using a subject that summarizes your problem, rather than just
stating that you have a problem, is much more helpful to everybody.

...Marvin

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/Zyt/%2BI5CG2kqIP0E%40basil.wdw.

Re: Annoying vim problem - again

Hello Christian

I have checked my configuration files. As far as I can tell the only u's there are in mappings that use "source" and "curl" and in commented out lines. Commented out lines do begin with " I believe. For source files I use them as such "^[:source ..." and for curl I do use it the same, by escaping insert mode and opening a command and entering the curl command in a mapping.

After removing undofile and undodir, I do not have any undo files in the /tmp directory at least. Maybe there are undo files that the system is using. So I will have to wait and see if the same thing happens again.

Regards

On Wed, Nov 6, 2024 at 12:55 PM Christian Brabandt <cblists@256bit.org> wrote:

On Mi, 06 Nov 2024, Riza Dindir wrote:

> Hello Jürgen
>
> I had the undofile and undodir set. I do not know why I set these, but they
> were set.
>
> Why do we need undofile and undodir? As far as I can understand these are for a
> persistent undo mechanism. To be able to undo after rebooting system, or
> quitting the editor and starting it up again.
>
> I think the editor does have unlimited undo capabilities. I would not care for
> a persistent undo mechanism (undoing after rebooting my computer, or even
> quitting the editor then come back and be able to undo), so I have removed
> these settings. Hope this is the problem that I was facing. Thanks to the -V
> flag in vim, I was able to identify it at last.

What Jürgen meant was that you apparently have an undo command in one of
your Vim configuration files. That has nothing to do with the persistent
undo feature. Please see the help at :h persistent-undo for why one may
want to enable this feature.

So please check carefully your configuration. It may also help to verify
that the issues does not happen when starting vim using `vim --clean`.

Thanks,
Christian
--
If you go out of your mind, do it quietly, so as not to disturb those
around you.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/Zys9CQu0PpEn81p/%40256bit.org.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CA%2Bek4BFLZxwi1CSOG6BcahfWY_wswF24xeUDQVEE9tgt7rtyuw%40mail.gmail.com.

Re: Annoying vim problem - again

On Mi, 06 Nov 2024, Riza Dindir wrote:

> Hello Jürgen
>
> I had the undofile and undodir set. I do not know why I set these, but they
> were set.
>
> Why do we need undofile and undodir? As far as I can understand these are for a
> persistent undo mechanism. To be able to undo after rebooting system, or
> quitting the editor and starting it up again.
>
> I think the editor does have unlimited undo capabilities. I would not care for
> a persistent undo mechanism (undoing after rebooting my computer, or even
> quitting the editor then come back and be able to undo), so I have removed
> these settings. Hope this is the problem that I was facing. Thanks to the -V
> flag in vim, I was able to identify it at last.

What Jürgen meant was that you apparently have an undo command in one of
your Vim configuration files. That has nothing to do with the persistent
undo feature. Please see the help at :h persistent-undo for why one may
want to enable this feature.

So please check carefully your configuration. It may also help to verify
that the issues does not happen when starting vim using `vim --clean`.

Thanks,
Christian
--
If you go out of your mind, do it quietly, so as not to disturb those
around you.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/Zys9CQu0PpEn81p/%40256bit.org.

Re: Annoying vim problem - again

Hello Jürgen

I had the undofile and undodir set. I do not know why I set these, but they were set.

Why do we need undofile and undodir? As far as I can understand these are for a persistent undo mechanism. To be able to undo after rebooting system, or quitting the editor and starting it up again.

I think the editor does have unlimited undo capabilities. I would not care for a persistent undo mechanism (undoing after rebooting my computer, or even quitting the editor then come back and be able to undo), so I have removed these settings. Hope this is the problem that I was facing. Thanks to the -V flag in vim, I was able to identify it at last.

Regards,
Riza

On Wed, Nov 6, 2024 at 9:50 AM 'Jürgen Krämer' via vim_use <vim_use@googlegroups.com> wrote:
Hi,

Riza Dindir schrieb am 06.11.2024 um 05:25:
> As you might recall I had a problem with VIM. I also have written to the group with the title "Annoying vim problem".
>
> When I switch a buffer or when I run vim and open a file that I edited before it was undoing what I did the last time to the file.
>
> I was suspecting it had something to do with the .viminfo file or something like that. So I have started vim using "vim -V10". I am showing some of the :messages command below.
>
> sourcing "/home/.../tmp/cmd.vi <http://cmd.vi>"
> chdir(./.../...)
> fchdir() to previous dir
> chdir(/home/.../.../.../.../.../.../.../...)
> fchdir() to previous dir
> "./../../some.py" 109L, 5253B
> Reading viminfo file "/home/rdindir/.viminfo" marks
> Reading undo file: /tmp/%home%...%...%...%...%...%...%...%...%some.py
>
> I have replaced path components with "..." in the paths above, which I did not share. 
>
> The interesting part is this. It reads the .viminfo file and then read the undo file in the /tmp directory. This causes the last things that I have made in the file to be undone, after I open that file again.
>
> Can anybody tell me why this might happen? Any ideas?

sounds like you have a stray `:undo` somewhere in the scripts that get sourced during startup or in an autocommand.

You can see which scripts get sourced with `:scriptnames`. If this strange behavior only happens with python files, I'd first look at file type plugins. Maybe the contain a leftover `u` in a line, which would be interpreted as an abbreviation of `undo`. With the `undofile` option set this would immediately undo your last change from the last edit session upon loading the python file.

If other file types show the same behavior you will have to check more of the sourced files.

Also an autocommand might include a stray `u` or `undo`. You might want to check the ones that get executed on loading files into a buffer, like those whose event names start with "BufRead" or "FileRead" and especially the "FileType" event.

Regards,
Jürgen
--
~
~
~
:wq

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/6b064607-dc5d-42ac-a5d0-9fa18000d422%40googlemail.com.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CA%2Bek4BHzE6MN3zBS1t4KoAaB%2Bzx2CXi-CwSMfxdxfAYYGc9x_Q%40mail.gmail.com.

Tuesday, November 5, 2024

Re: Annoying vim problem - again

Hi,

Riza Dindir schrieb am 06.11.2024 um 05:25:
> As you might recall I had a problem with VIM. I also have written to the group with the title "Annoying vim problem".
>
> When I switch a buffer or when I run vim and open a file that I edited before it was undoing what I did the last time to the file.
>
> I was suspecting it had something to do with the .viminfo file or something like that. So I have started vim using "vim -V10". I am showing some of the :messages command below.
>
> sourcing "/home/.../tmp/cmd.vi <http://cmd.vi>"
> chdir(./.../...)
> fchdir() to previous dir
> chdir(/home/.../.../.../.../.../.../.../...)
> fchdir() to previous dir
> "./../../some.py" 109L, 5253B
> Reading viminfo file "/home/rdindir/.viminfo" marks
> Reading undo file: /tmp/%home%...%...%...%...%...%...%...%...%some.py
>
> I have replaced path components with "..." in the paths above, which I did not share. 
>
> The interesting part is this. It reads the .viminfo file and then read the undo file in the /tmp directory. This causes the last things that I have made in the file to be undone, after I open that file again.
>
> Can anybody tell me why this might happen? Any ideas?

sounds like you have a stray `:undo` somewhere in the scripts that get sourced during startup or in an autocommand.

You can see which scripts get sourced with `:scriptnames`. If this strange behavior only happens with python files, I'd first look at file type plugins. Maybe the contain a leftover `u` in a line, which would be interpreted as an abbreviation of `undo`. With the `undofile` option set this would immediately undo your last change from the last edit session upon loading the python file.

If other file types show the same behavior you will have to check more of the sourced files.

Also an autocommand might include a stray `u` or `undo`. You might want to check the ones that get executed on loading files into a buffer, like those whose event names start with "BufRead" or "FileRead" and especially the "FileType" event.

Regards,
Jürgen
--
~
~
~
:wq

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/6b064607-dc5d-42ac-a5d0-9fa18000d422%40googlemail.com.

Annoying vim problem - again

As you might recall I had a problem with VIM. I also have written to the group with the title "Annoying vim problem".

When I switch a buffer or when I run vim and open a file that I edited before it was undoing what I did the last time to the file.

I was suspecting it had something to do with the .viminfo file or something like that. So I have started vim using "vim -V10". I am showing some of the :messages command below.

sourcing "/home/.../tmp/cmd.vi"
chdir(./.../...)
fchdir() to previous dir
chdir(/home/.../.../.../.../.../.../.../...)
fchdir() to previous dir
"./../../some.py" 109L, 5253B
Reading viminfo file "/home/rdindir/.viminfo" marks
Reading undo file: /tmp/%home%...%...%...%...%...%...%...%...%some.py

I have replaced path components with "..." in the paths above, which I did not share. 

The interesting part is this. It reads the .viminfo file and then read the undo file in the /tmp directory. This causes the last things that I have made in the file to be undone, after I open that file again.

Can anybody tell me why this might happen? Any ideas?

Regards
Riza

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CA%2Bek4BESfkdgr2XU8HTE8%2B9Q2YcviOg-2sgZeZ1shB%2B0LBa8Tg%40mail.gmail.com.