Hi all,
I have created a repository (https://github.com/yegappan/design-patterns)
containing implementations of various design patterns using the latest
features in Vim9script (e.g., classes, interfaces, enums, type aliases, etc.).
I used GitHub Copilot to help generate these example scripts.
The goal of this effort is to showcase the modern capabilities of Vim9script
and provide a reference for the community.
Regards,
Yegappan
--
--
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/CAAW7x7%3D1Ea-zF%3Dupz7T4k5rUPByZ1E1usd%2BB8TCVje8JC%2Bie-A%40mail.gmail.com.
Wednesday, February 18, 2026
Friday, February 13, 2026
Re: blacklist some ftplugins?
hello Gary,
thanks for helping but the solution Ben provided is idiomatic and simple
so I will stick with it.
> I use the following system in my vimrc for controlling which
> filetypes get syntax highlighting, but I think the above is
> sufficient.
this is interesting: I'll give a look later on that.
Regards
--
Marc Chantreux
--
--
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/aY9xUdEsUUf0s63j%40prometheus.
thanks for helping but the solution Ben provided is idiomatic and simple
so I will stick with it.
> I use the following system in my vimrc for controlling which
> filetypes get syntax highlighting, but I think the above is
> sufficient.
this is interesting: I'll give a look later on that.
Regards
--
Marc Chantreux
--
--
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/aY9xUdEsUUf0s63j%40prometheus.
Re: blacklist some ftplugins?
hello,
On Fri, Feb 13, 2026 at 09:10:57AM -0800, D. Ben Knoble wrote:
> No such feature exists that I'm aware of, but:
> - what is it about sh.vim that you don't like?
I often set &mp and &efm manually to have a quickfix mode whatever I'm
doing and it pissed me off multiple times to "magically" lose them then
I realized it happened when I setf or e a shell script so I gave a look at
it and realized that I none of the things done by this plugin has any
value in my workflow so I decided just to delete it instead of fixing
it.
But then I came to another machine and got the same problem and that's
why I asked here.
> - are you aware you can override any ftplugin with either
> ~/.vim/ftplugin/sh.vim or (usually my preference, when I'm extending
> rather than replacing) ~/.vim/after/ftplugin/sh.vim? Ditto for syntax and
> indent, since that's what we ship right now.
I actually had all of my stuff in ~/.config/vim/after and completely forgot
about ~/.config/vim/ftplugin. just moving/touching files to maintain the
blacklist is wonderful. thanks for helping me reactivate my rusted
brain.
> See `:help ftplugin-overrule`, `:help 30.3` (indenting), `:help
> mysyntaxfile` (Yikes, what a documentation mess!)
I'm really impressed by the quality of the documentation given all the
changes that are made in vim from the first version I used (which was
3.something) but yes: sometimes it's hard to find the good part of the
doc.
Thank you so much.
--
Marc Chantreux
--
--
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/aY9wx4mtWTDISPzp%40prometheus.
On Fri, Feb 13, 2026 at 09:10:57AM -0800, D. Ben Knoble wrote:
> No such feature exists that I'm aware of, but:
> - what is it about sh.vim that you don't like?
I often set &mp and &efm manually to have a quickfix mode whatever I'm
doing and it pissed me off multiple times to "magically" lose them then
I realized it happened when I setf or e a shell script so I gave a look at
it and realized that I none of the things done by this plugin has any
value in my workflow so I decided just to delete it instead of fixing
it.
But then I came to another machine and got the same problem and that's
why I asked here.
> - are you aware you can override any ftplugin with either
> ~/.vim/ftplugin/sh.vim or (usually my preference, when I'm extending
> rather than replacing) ~/.vim/after/ftplugin/sh.vim? Ditto for syntax and
> indent, since that's what we ship right now.
I actually had all of my stuff in ~/.config/vim/after and completely forgot
about ~/.config/vim/ftplugin. just moving/touching files to maintain the
blacklist is wonderful. thanks for helping me reactivate my rusted
brain.
> See `:help ftplugin-overrule`, `:help 30.3` (indenting), `:help
> mysyntaxfile` (Yikes, what a documentation mess!)
I'm really impressed by the quality of the documentation given all the
changes that are made in vim from the first version I used (which was
3.something) but yes: sometimes it's hard to find the good part of the
doc.
Thank you so much.
--
Marc Chantreux
--
--
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/aY9wx4mtWTDISPzp%40prometheus.
Re: blacklist some ftplugins?
On 2026-02-12, Marc Chantreux wrote:
> Hello people,
>
> I saw there is a write-filetype-plugin section in a documentation and
> will read it (and maybe discuss about it) to get something I would like:
> ftplugins to provide suggestions instead of setting them (maybe it could
> be conventions on how to name the variable that can be the candidate to
> setup &mp).
>
> I have no time for this right now and just fixed the problem:
>
> find /usr/share/vim/vim91/ -name sh.vim |
> sed 'p;s!/!_!g' |
> xargs -n2 mv
>
> That was brutal. was there something less destructive?
> for exemple: a way yo blacklist some system filetypes?
>
> filetype plugin user=sh,raku # to say that I take care about those ones
> filetype plugin disable=sh,raku # to say I just don't want plugins for those ones
>
> thanks for any help and regards,
How about this? Put this autocommand early in your vimrc, before
any filetype or syntax commands:
autocmd Filetype sh,raku let b:did_ftplugin = 1
Then put this autocommand late in your vimrc, after all filetype and
syntax commands:
autocmd Filetype sh,raku syn clear | unlet! b:current_syntax
I use the following system in my vimrc for controlling which
filetypes get syntax highlighting, but I think the above is
sufficient. (b:syn is used to track the desired state of 'syntax'.
Other autocommands use it to control syntax highlighting when 'diff'
is turned on and off.)
" ":syntax manual" will enable syntax highlighting only for specific
" buffers in which :set syntax=ON" is set. See ":help :syn-manual".
"
syntax manual
let no_syntax_filetypes = [ 'c', 'cpp', 'man', 'netrw', 'objcpp', 'python', 'vim' ]
autocmd FileType * if !empty(expand("<amatch>"))
\ | if !count(no_syntax_filetypes, expand("<amatch>"))
\ | let b:syn="ON"
\ | if !&diff
\ | setlocal syntax=ON
\ | endif
\ | else
\ | syn clear
\ | if exists("b:current_syntax")
\ | unlet b:current_syntax
\ | endif
\ | endif
\ | endif
Regards,
Gary
--
--
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/20260213171426.GG14680%40phoenix.
> Hello people,
>
> I saw there is a write-filetype-plugin section in a documentation and
> will read it (and maybe discuss about it) to get something I would like:
> ftplugins to provide suggestions instead of setting them (maybe it could
> be conventions on how to name the variable that can be the candidate to
> setup &mp).
>
> I have no time for this right now and just fixed the problem:
>
> find /usr/share/vim/vim91/ -name sh.vim |
> sed 'p;s!/!_!g' |
> xargs -n2 mv
>
> That was brutal. was there something less destructive?
> for exemple: a way yo blacklist some system filetypes?
>
> filetype plugin user=sh,raku # to say that I take care about those ones
> filetype plugin disable=sh,raku # to say I just don't want plugins for those ones
>
> thanks for any help and regards,
How about this? Put this autocommand early in your vimrc, before
any filetype or syntax commands:
autocmd Filetype sh,raku let b:did_ftplugin = 1
Then put this autocommand late in your vimrc, after all filetype and
syntax commands:
autocmd Filetype sh,raku syn clear | unlet! b:current_syntax
I use the following system in my vimrc for controlling which
filetypes get syntax highlighting, but I think the above is
sufficient. (b:syn is used to track the desired state of 'syntax'.
Other autocommands use it to control syntax highlighting when 'diff'
is turned on and off.)
" ":syntax manual" will enable syntax highlighting only for specific
" buffers in which :set syntax=ON" is set. See ":help :syn-manual".
"
syntax manual
let no_syntax_filetypes = [ 'c', 'cpp', 'man', 'netrw', 'objcpp', 'python', 'vim' ]
autocmd FileType * if !empty(expand("<amatch>"))
\ | if !count(no_syntax_filetypes, expand("<amatch>"))
\ | let b:syn="ON"
\ | if !&diff
\ | setlocal syntax=ON
\ | endif
\ | else
\ | syn clear
\ | if exists("b:current_syntax")
\ | unlet b:current_syntax
\ | endif
\ | endif
\ | endif
Regards,
Gary
--
--
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/20260213171426.GG14680%40phoenix.
Re: blacklist some ftplugins?
On Thursday, February 12, 2026 at 7:36:32 AM UTC-5 Marc Chantreux wrote:
Hello people,
I saw there is a write-filetype-plugin section in a documentation and
will read it (and maybe discuss about it) to get something I would like:
ftplugins to provide suggestions instead of setting them (maybe it could
be conventions on how to name the variable that can be the candidate to
setup &mp).
I have no time for this right now and just fixed the problem:
find /usr/share/vim/vim91/ -name sh.vim |
sed 'p;s!/!_!g' |
xargs -n2 mv
That was brutal. was there something less destructive?
for exemple: a way yo blacklist some system filetypes?
filetype plugin user=sh,raku # to say that I take care about those ones
filetype plugin disable=sh,raku # to say I just don't want plugins for those ones
thanks for any help and regards,
--
Marc Chantreux
No such feature exists that I'm aware of, but:
- what is it about sh.vim that you don't like?
- are you aware you can override any ftplugin with either ~/.vim/ftplugin/sh.vim or (usually my preference, when I'm extending rather than replacing) ~/.vim/after/ftplugin/sh.vim? Ditto for syntax and indent, since that's what we ship right now.
See `:help ftplugin-overrule`, `:help 30.3` (indenting), `:help mysyntaxfile` (Yikes, what a documentation mess!)
--
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/69190e30-e96d-41e6-a5af-ca748ce88ee9n%40googlegroups.com.
Thursday, February 12, 2026
blacklist some ftplugins?
Hello people,
I saw there is a write-filetype-plugin section in a documentation and
will read it (and maybe discuss about it) to get something I would like:
ftplugins to provide suggestions instead of setting them (maybe it could
be conventions on how to name the variable that can be the candidate to
setup &mp).
I have no time for this right now and just fixed the problem:
find /usr/share/vim/vim91/ -name sh.vim |
sed 'p;s!/!_!g' |
xargs -n2 mv
That was brutal. was there something less destructive?
for exemple: a way yo blacklist some system filetypes?
filetype plugin user=sh,raku # to say that I take care about those ones
filetype plugin disable=sh,raku # to say I just don't want plugins for those ones
thanks for any help and regards,
--
Marc Chantreux
--
--
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/aY3JOyyzQnXI22B_%40prometheus.
I saw there is a write-filetype-plugin section in a documentation and
will read it (and maybe discuss about it) to get something I would like:
ftplugins to provide suggestions instead of setting them (maybe it could
be conventions on how to name the variable that can be the candidate to
setup &mp).
I have no time for this right now and just fixed the problem:
find /usr/share/vim/vim91/ -name sh.vim |
sed 'p;s!/!_!g' |
xargs -n2 mv
That was brutal. was there something less destructive?
for exemple: a way yo blacklist some system filetypes?
filetype plugin user=sh,raku # to say that I take care about those ones
filetype plugin disable=sh,raku # to say I just don't want plugins for those ones
thanks for any help and regards,
--
Marc Chantreux
--
--
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/aY3JOyyzQnXI22B_%40prometheus.
Saturday, January 31, 2026
Re: Releasing Vim 9.2
Hi,
yes, I am targeting February 14th or 15th. You have been providing great
support, so don't worry too much.
Thanks to everybody for helping with fixes, updates, translations and
feedback.
Chris
On Sa, 31 Jan 2026, Doug Kearns wrote:
> Christian and all,
>
> Are we still targeting mid February for the release?
>
> I'm trying to plan what I can sneak into this release. I'm sorry I
> haven't contributed much to this endeavour yet but it's not a good
> time of year in my neck of the woods.
>
> Thanks,
> Doug
>
Mit freundlichen Grüßen
Christian
--
My life is a patio of fun!
--
--
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/aX4nfI4MNrLRw0x6%40256bit.org.
yes, I am targeting February 14th or 15th. You have been providing great
support, so don't worry too much.
Thanks to everybody for helping with fixes, updates, translations and
feedback.
Chris
On Sa, 31 Jan 2026, Doug Kearns wrote:
> Christian and all,
>
> Are we still targeting mid February for the release?
>
> I'm trying to plan what I can sneak into this release. I'm sorry I
> haven't contributed much to this endeavour yet but it's not a good
> time of year in my neck of the woods.
>
> Thanks,
> Doug
>
Mit freundlichen Grüßen
Christian
--
My life is a patio of fun!
--
--
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/aX4nfI4MNrLRw0x6%40256bit.org.
Friday, January 30, 2026
Re: Releasing Vim 9.2
Christian and all,
Are we still targeting mid February for the release?
I'm trying to plan what I can sneak into this release. I'm sorry I
haven't contributed much to this endeavour yet but it's not a good
time of year in my neck of the woods.
Thanks,
Doug
--
--
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/CAJ1uvoCFwV0LDQLqEdbcVCYqYvCsJA54BCc%2BjhVKYUXo5Qj4OA%40mail.gmail.com.
Are we still targeting mid February for the release?
I'm trying to plan what I can sneak into this release. I'm sorry I
haven't contributed much to this endeavour yet but it's not a good
time of year in my neck of the woods.
Thanks,
Doug
--
--
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/CAJ1uvoCFwV0LDQLqEdbcVCYqYvCsJA54BCc%2BjhVKYUXo5Qj4OA%40mail.gmail.com.
Tuesday, January 27, 2026
Re: Search first character in a file
One possible reason to initiate a search while already on the thing being searched it to highlight all occurrences of that thing.
--
--
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/ba8bff0b-4f8f-463f-80fb-1094d089818bn%40googlegroups.com.
I have '*' mapped to do exactly that, it sets the search to the word under the cursor, highlighting all occurrences of that word.
Using 'n' and 'N' then searches as expected. That search is being done on words, not characters.
It looks like '*' is mapped to <Plug>SearchHighlightingStar
if I'm understanding things correctly.
On Monday, January 26, 2026 at 8:02:29 PM UTC-5 Eric Marceau wrote:
Cristian,
The "n", or "/ + Enter", are simply built-in substitutes for repeating the original search instruction, namelyI am sure that "alias" definition is somewhere in VIM's software tree. The design of the search function is such that it ignores the match starting at the current position. Otherwise, the search would never advance to the next instance.
- "/a"
Another way to look at it is
- You are already at the "first match" for what you are searching, "a".
- If that is the case, why are you attempting any search ... if not for the next match???
Honestly, this is simply basic logic ... and ... very intuitive.
Hope that helps!
On 2026-01-22 07:03, Doug Kearns wrote:
On Thu, 22 Jan 2026 at 02:21, Cristian <cristia...@gmail.com> wrote:Thank you for the explanation — that makes sense for the behavior of the n key. That said, I was wondering whether, for the initial search (the one NOT triggered by n), it might also be reasonable for vi to start searching from the character currently under the cursor.As others have pointed out, the behaviour is fundamental[1].This could make the behavior a bit more intuitive when the cursor is already on a match.I think your intuition is incorrect. You wouldn't expect 'w', for example, not to move to the next word because the cursor was already at the start of a word. You can think of '/' as executing something like :let @/ = 'pattern' | normal! n The best solution, if you don't want to adjust to how it works, is probably to remap '/' to a user function that calls search('pattern', 'c') and sets the '@/' register. Anything else, like :-;/pattern, won't work well for multiple matches per line. Regards, Doug 1. https://pubs.opengroup.org/onlinepubs/9799919799/utilities/vi.html#tag_20_146_13_36
--
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/ba8bff0b-4f8f-463f-80fb-1094d089818bn%40googlegroups.com.
Monday, January 26, 2026
Re: Search first character in a file
Cristian,
The "n", or "/ + Enter", are simply built-in substitutes for repeating the original search instruction, namely
- "/a"
Another way to look at it is
- You are already at the "first match" for what you are searching, "a".
- If that is the case, why are you attempting any search ... if not for the next match???
Honestly, this is simply basic logic ... and ... very intuitive.
Hope that helps!
On 2026-01-22 07:03, Doug Kearns wrote:
On Thu, 22 Jan 2026 at 02:21, Cristian <cristian.zoicas@gmail.com> wrote:Thank you for the explanation — that makes sense for the behavior of the n key. That said, I was wondering whether, for the initial search (the one NOT triggered by n), it might also be reasonable for vi to start searching from the character currently under the cursor.As others have pointed out, the behaviour is fundamental[1].This could make the behavior a bit more intuitive when the cursor is already on a match.I think your intuition is incorrect. You wouldn't expect 'w', for example, not to move to the next word because the cursor was already at the start of a word. You can think of '/' as executing something like :let @/ = 'pattern' | normal! n The best solution, if you don't want to adjust to how it works, is probably to remap '/' to a user function that calls search('pattern', 'c') and sets the '@/' register. Anything else, like :-;/pattern, won't work well for multiple matches per line. Regards, Doug 1. https://pubs.opengroup.org/onlinepubs/9799919799/utilities/vi.html#tag_20_146_13_36
Thursday, January 22, 2026
Re: Search first character in a file
On Thu, 22 Jan 2026 at 02:21, Cristian <cristian.zoicas@gmail.com> wrote:
>
>
> Thank you for the explanation — that makes sense for the behavior of the n key.
>
> That said, I was wondering whether, for the initial search (the one
> NOT triggered by n), it might also be reasonable for vi to start
> searching from the character currently under the cursor.
As others have pointed out, the behaviour is fundamental[1].
> This could make the behavior a bit more intuitive when the cursor
> is already on a match.
I think your intuition is incorrect. You wouldn't expect 'w', for
example, not to move to the next word because the cursor was already
at the start of a word.
You can think of '/' as executing something like :let @/ = 'pattern' | normal! n
The best solution, if you don't want to adjust to how it works, is
probably to remap '/' to a user function that calls search('pattern',
'c') and sets the '@/' register. Anything else, like :-;/pattern,
won't work well for multiple matches per line.
Regards,
Doug
1. https://pubs.opengroup.org/onlinepubs/9799919799/utilities/vi.html#tag_20_146_13_36
--
--
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/CAJ1uvoDs5UVnTpQ1UkZLju5PA5Uh1%2BRVrAo1FjWB5mSzpQyufQ%40mail.gmail.com.
>
>
> Thank you for the explanation — that makes sense for the behavior of the n key.
>
> That said, I was wondering whether, for the initial search (the one
> NOT triggered by n), it might also be reasonable for vi to start
> searching from the character currently under the cursor.
As others have pointed out, the behaviour is fundamental[1].
> This could make the behavior a bit more intuitive when the cursor
> is already on a match.
I think your intuition is incorrect. You wouldn't expect 'w', for
example, not to move to the next word because the cursor was already
at the start of a word.
You can think of '/' as executing something like :let @/ = 'pattern' | normal! n
The best solution, if you don't want to adjust to how it works, is
probably to remap '/' to a user function that calls search('pattern',
'c') and sets the '@/' register. Anything else, like :-;/pattern,
won't work well for multiple matches per line.
Regards,
Doug
1. https://pubs.opengroup.org/onlinepubs/9799919799/utilities/vi.html#tag_20_146_13_36
--
--
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/CAJ1uvoDs5UVnTpQ1UkZLju5PA5Uh1%2BRVrAo1FjWB5mSzpQyufQ%40mail.gmail.com.
Wednesday, January 21, 2026
Re: Search first character in a file
Thank you for the explanation — that makes sense for the behavior of the n key.
That said, I was wondering whether, for the initial search (the one
NOT triggered by n), it might also be reasonable for vi to start
searching from the character currently under the cursor.
This could make the behavior a bit more intuitive when the cursor
is already on a match.
Best regards,
Cristian
That said, I was wondering whether, for the initial search (the one
NOT triggered by n), it might also be reasonable for vi to start
searching from the character currently under the cursor.
This could make the behavior a bit more intuitive when the cursor
is already on a match.
Best regards,
Cristian
On Wednesday, January 21, 2026 at 3:04:53 PM UTC+1 Tony Mechelynck wrote:
On Wed, Jan 21, 2026 at 2:58 PM Cristian <cristia...@gmail.com> wrote:
>
> Hello all,
>
> 1. I have this file:
>
> --- begin testfile.txt ---
> a
> a
> a
> b
> --- end testfile.txt ---
>
> 2. I run the command:
>
> $ vim testfile.txt
>
> 3. Inside when the cursor is positioned on the first character I type:
> /a<ENTER>
>
> The first "a" is not found. Unless I type "n" until I get to the end of the file and then another "n".
>
> Is it possible to search the first character in the file immediately after you open the file?
> Is this a bug or a design decision ?
>
> Thank you.
> Cristian
I think it's a feature, not a bug: if by hitting n when the cursor is
on a match, you wouldn't make it move, then repeatedly hitting n would
never move the cursor. To find the first a when already on it, then
hit n followed by N. By doing that when not on a match, you would find
the last match, however.
Best regards,
Tony.
--
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/c21fd8a3-50bc-4d15-9533-31f9617610c9n%40googlegroups.com.
Re: Search first character in a file
On 2026-01-21 05:57, Cristian wrote:
> --- begin testfile.txt ---
> a
> a
> a
> b
> --- end testfile.txt ---
[snip]
> 3. Inside when the cursor is positioned on the first character I type:
> /a<ENTER>
>
> The first "a" is not found. Unless I type "n" until I get to the end of the
> file and then another "n".
>
> Is it possible to search the first character in the file immediately after
> you open the file?
Typically the way I've resolved this is to start the search from the
last line (as long as 'wrapscan' is set, which it is by default so you'd
only need to mess with it if you've unset it explicitly)
:set wrapscan
:$/a
> Is this a bug or a design decision ?
As Tony notes, I'm pretty sure this was a design decision because it
starts the search after the cursor so you don't just keep finding the
same thing.
-tim
--
--
--
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/aXDd4bD0pysTNrJK%40thechases.com.
> --- begin testfile.txt ---
> a
> a
> a
> b
> --- end testfile.txt ---
[snip]
> 3. Inside when the cursor is positioned on the first character I type:
> /a<ENTER>
>
> The first "a" is not found. Unless I type "n" until I get to the end of the
> file and then another "n".
>
> Is it possible to search the first character in the file immediately after
> you open the file?
Typically the way I've resolved this is to start the search from the
last line (as long as 'wrapscan' is set, which it is by default so you'd
only need to mess with it if you've unset it explicitly)
:set wrapscan
:$/a
> Is this a bug or a design decision ?
As Tony notes, I'm pretty sure this was a design decision because it
starts the search after the cursor so you don't just keep finding the
same thing.
-tim
--
--
--
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/aXDd4bD0pysTNrJK%40thechases.com.
Re: Search first character in a file
On Wed, Jan 21, 2026 at 2:58 PM Cristian <cristian.zoicas@gmail.com> wrote:
>
> Hello all,
>
> 1. I have this file:
>
> --- begin testfile.txt ---
> a
> a
> a
> b
> --- end testfile.txt ---
>
> 2. I run the command:
>
> $ vim testfile.txt
>
> 3. Inside when the cursor is positioned on the first character I type:
> /a<ENTER>
>
> The first "a" is not found. Unless I type "n" until I get to the end of the file and then another "n".
>
> Is it possible to search the first character in the file immediately after you open the file?
> Is this a bug or a design decision ?
>
> Thank you.
> Cristian
I think it's a feature, not a bug: if by hitting n when the cursor is
on a match, you wouldn't make it move, then repeatedly hitting n would
never move the cursor. To find the first a when already on it, then
hit n followed by N. By doing that when not on a match, you would find
the last match, however.
Best regards,
Tony.
--
--
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/CAJkCKXtUESqgN7zr3ixB0OMaCjipLRvD0KgfdfZAdGQQV%2BpcXA%40mail.gmail.com.
>
> Hello all,
>
> 1. I have this file:
>
> --- begin testfile.txt ---
> a
> a
> a
> b
> --- end testfile.txt ---
>
> 2. I run the command:
>
> $ vim testfile.txt
>
> 3. Inside when the cursor is positioned on the first character I type:
> /a<ENTER>
>
> The first "a" is not found. Unless I type "n" until I get to the end of the file and then another "n".
>
> Is it possible to search the first character in the file immediately after you open the file?
> Is this a bug or a design decision ?
>
> Thank you.
> Cristian
I think it's a feature, not a bug: if by hitting n when the cursor is
on a match, you wouldn't make it move, then repeatedly hitting n would
never move the cursor. To find the first a when already on it, then
hit n followed by N. By doing that when not on a match, you would find
the last match, however.
Best regards,
Tony.
--
--
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/CAJkCKXtUESqgN7zr3ixB0OMaCjipLRvD0KgfdfZAdGQQV%2BpcXA%40mail.gmail.com.
Search first character in a file
Hello all,
1. I have this file:
--- begin testfile.txt ---
The first "a" is not found. Unless I type "n" until I get to the end of the file and then another "n".
Is it possible to search the first character in the file immediately after you open the file?
Is this a bug or a design decision ?
--
--
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/5cdce17b-3ffe-4fe4-87de-1a3c1bd8030an%40googlegroups.com.
1. I have this file:
--- begin testfile.txt ---
a
a
a
b
--- end testfile.txt ---
2. I run the command:
$ vim testfile.txt
3. Inside when the cursor is positioned on the first character I type:
/a<ENTER>
3. Inside when the cursor is positioned on the first character I type:
/a<ENTER>
The first "a" is not found. Unless I type "n" until I get to the end of the file and then another "n".
Is it possible to search the first character in the file immediately after you open the file?
Is this a bug or a design decision ?
Thank you.
Cristian
--
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/5cdce17b-3ffe-4fe4-87de-1a3c1bd8030an%40googlegroups.com.
Wednesday, January 14, 2026
Re: Vim installer for Windows is 3 weeks old
On Mi, 14 Jan 2026, Igor wrote:
> Looking at vim installer for Windows: https://github.com/vim/
> vim-win32-installer/releases and I see last version is v9.1.2022 which is 3
> weeks old.
>
> Is there intentional that vim installer is not updated with fresh updates to
> main github.com/vim/vim repository?
No, there is an issue with ruby right now. Patch v9.1.2039 or v9.1.2036
broke the ruby integration and it hasn't been fixed yet.
Thanks,
Christian
--
A woman without a man is like a fish without a bicycle.
Therefore, a man without a woman is like a bicycle without a fish.
--
--
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/aWeGZAPhuMgS0XXB%40256bit.org.
> Looking at vim installer for Windows: https://github.com/vim/
> vim-win32-installer/releases and I see last version is v9.1.2022 which is 3
> weeks old.
>
> Is there intentional that vim installer is not updated with fresh updates to
> main github.com/vim/vim repository?
No, there is an issue with ruby right now. Patch v9.1.2039 or v9.1.2036
broke the ruby integration and it hasn't been fixed yet.
Thanks,
Christian
--
A woman without a man is like a fish without a bicycle.
Therefore, a man without a woman is like a bicycle without a fish.
--
--
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/aWeGZAPhuMgS0XXB%40256bit.org.
Vim installer for Windows is 3 weeks old
Looking at vim installer for Windows: https://github.com/vim/vim-win32-installer/releases and I see last version is v9.1.2022 which is 3 weeks old.
Is there intentional that vim installer is not updated with fresh updates to main github.com/vim/vim repository?
-- --
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/f22e0f7e-c9ef-4786-bd67-b7e8c59cc6d4n%40googlegroups.com.
Monday, January 5, 2026
Re: decvers.vim
hello Mark,
On Fri, Jan 02, 2026 at 03:57:08PM -0600, Mark Manning wrote:
> Actually, I was just posting it so if anyone wanted it they could have
> it. As for using someone else's script - I just like mine.
if so, you should probably create a git repo outthere so people can
easily deploy, comment, contribute ...
> Thanks for > letting me know how you feel. :-)
I try to be as helpful as others was to me when providing me this kinds
of feedbacks. you're welcome.
regards
--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
☎ 03.68.85.60.79
--
--
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/aVudy8pUCiDoyrDe%40prometheus.
On Fri, Jan 02, 2026 at 03:57:08PM -0600, Mark Manning wrote:
> Actually, I was just posting it so if anyone wanted it they could have
> it. As for using someone else's script - I just like mine.
if so, you should probably create a git repo outthere so people can
easily deploy, comment, contribute ...
> Thanks for > letting me know how you feel. :-)
I try to be as helpful as others was to me when providing me this kinds
of feedbacks. you're welcome.
regards
--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
☎ 03.68.85.60.79
--
--
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/aVudy8pUCiDoyrDe%40prometheus.
Friday, January 2, 2026
Re: decvers.vim
Actually, I was just posting it so if anyone wanted it they could have
it. As for using someone else's script - I just like mine. Thanks for
letting me know how you feel. :-)
On Fri, Jan 2, 2026 at 7:04 AM Marc Chantreux <mc@unistra.fr> wrote:
>
> hello Mark,
>
> As you posted the whole script on the list, you probably expect some
> feedbacks so mine is:
>
> I script a lot of things and what I consider a good practice is the
> complete oposite of what you're trying to achieve here: If your code is
> useful, someone will probably want to use it out of vim so don't use
> viml and pick another scripting langage (zsh, dash, rc, tcl, perl, js,
> ruby, python, R, there are tons of those) then use it from vim using
> ! or system* functions.
>
> Also: take a look at vim9script: it it much more confortable than the
> old style vim langage.
>
> regards,
> Marc
>
>
> --
> Marc Chantreux
>
> --
> --
> 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 a topic in the Google Groups "vim_use" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/uz1SylyjsfQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/vim_use/aVfCMhJyywsFvJNM%40prometheus.
--
--
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/CAPJLamx-OupBP2j6Agw60ueZbfRRi4m00iG6d-Qez8Ss%3DksDYQ%40mail.gmail.com.
it. As for using someone else's script - I just like mine. Thanks for
letting me know how you feel. :-)
On Fri, Jan 2, 2026 at 7:04 AM Marc Chantreux <mc@unistra.fr> wrote:
>
> hello Mark,
>
> As you posted the whole script on the list, you probably expect some
> feedbacks so mine is:
>
> I script a lot of things and what I consider a good practice is the
> complete oposite of what you're trying to achieve here: If your code is
> useful, someone will probably want to use it out of vim so don't use
> viml and pick another scripting langage (zsh, dash, rc, tcl, perl, js,
> ruby, python, R, there are tons of those) then use it from vim using
> ! or system* functions.
>
> Also: take a look at vim9script: it it much more confortable than the
> old style vim langage.
>
> regards,
> Marc
>
>
> --
> Marc Chantreux
>
> --
> --
> 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 a topic in the Google Groups "vim_use" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/uz1SylyjsfQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/vim_use/aVfCMhJyywsFvJNM%40prometheus.
--
--
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/CAPJLamx-OupBP2j6Agw60ueZbfRRi4m00iG6d-Qez8Ss%3DksDYQ%40mail.gmail.com.
Re: decvers.vim
hello Mark,
As you posted the whole script on the list, you probably expect some
feedbacks so mine is:
I script a lot of things and what I consider a good practice is the
complete oposite of what you're trying to achieve here: If your code is
useful, someone will probably want to use it out of vim so don't use
viml and pick another scripting langage (zsh, dash, rc, tcl, perl, js,
ruby, python, R, there are tons of those) then use it from vim using
! or system* functions.
Also: take a look at vim9script: it it much more confortable than the
old style vim langage.
regards,
Marc
--
Marc Chantreux
--
--
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/aVfCMhJyywsFvJNM%40prometheus.
As you posted the whole script on the list, you probably expect some
feedbacks so mine is:
I script a lot of things and what I consider a good practice is the
complete oposite of what you're trying to achieve here: If your code is
useful, someone will probably want to use it out of vim so don't use
viml and pick another scripting langage (zsh, dash, rc, tcl, perl, js,
ruby, python, R, there are tons of those) then use it from vim using
! or system* functions.
Also: take a look at vim9script: it it much more confortable than the
old style vim langage.
regards,
Marc
--
Marc Chantreux
--
--
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/aVfCMhJyywsFvJNM%40prometheus.
Thursday, January 1, 2026
decvers.vim
First, sorry for top posting. I was just replying to my email. Live and learn as they say. Now I know to not do that. I'll try to always go to the list and post there from now on. Again - very sorry.
--
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/b8b1a020-dbcd-48bd-9350-348eb66b068an%40googlegroups.com.
I decided to post my decvers.vim script here in case anyone out there would like to use it. Why is it called decvers.vim? The "dec" part comes from the Digital Equipment Corporation or DEC name. The "vers" is for the word "version". Thus decvers.vim.
What it does is to make a copy of your source code automatically. It does this by adding a semicolon (;) to the end of the file name and then adding a five digit number to the end of the file name also. (So like "00000" or "00001" and so on.) Each time you edit the file, it adds one new number onto the end of the save (I have it set to do this three times). When you reach the maximum number of saves the earliest version is removed. Thus, you don't over run your system with backup copies. The interesting thing about this is that this shows you how you could do an automated version number in the program but I'm just interested in just having a backup I can return to if somehow I manage to muck up the current version. Anyway, here is the code. It is not perfect but it works. :-)
decvers.vim
" Note that tab stops should be at 4 spaces. Also I left all of my ECHO commands
" in - in case anyone wants to play around with the script. This is free software and
" can be used anywhere for anything. It is basically public domain. MEM.
Beginning of script
" -*- vim -*-
" @(#) $Id: decvers.vim,v 0.1 Mark Manning
"
" Notes: Please note that I am using five zeros as the size of the
" backup file names. So we have 00000 and then 00001, 00002, etc...
"
let path_name=expand("%:p")
let file_name=expand("%:t")
"
" Now see about getting all of the iterations of the current file
"
let cmd ='dir /b/on "' . path_name . ';*"'
let x=systemlist(cmd)
" let x=split(x[0],"\n")
let ary_len=len(x)
" echo "CMD = " . cmd
" echo "X = "
" echo x
"
" Now get the highest number of the iterations
"
let l=0
let high_num=0
if( ary_len > 0 )
while( l < ary_len )
let a=split(x[l],";")
" echo "A = "
" echo a
let a_len = len(a) - 1
let a_last = a[a_len]
" echo "a_last = " . a_last
if( a_last >= high_num )
"
" For unknown reasons a_last is never higher than high_num
"
" echo "a_last = " . a_last
let high_num = str2nr( a_last, 10 )
" echo "High_num = " . high_num
else
" echo "a_last = " . a_last
let high_num = str2nr( a_last, 10 )
" echo "High_num = " . high_num
endif
" echo "L = " . l
let l += 1
endwhile
endif
"
" Make a new filename (ie: full file name PLUS .(high_num+1)
" In other words - make a new filename with the backup number one
" higher than the highest backup number. Example A.BOB;00001
"
" echo "High_num = " . high_num
let high_num = high_num + 1
" echo "High_num = " . high_num
let ext = printf("%05d", high_num )
" echo "High_num = " . high_num
" echo "ext = " . ext
let new_path = expand("%:p") . ";" . ext
"
" Now save the file to the new file name we just made.
"
" echo "new_path = " . new_path
let cmd = 'copy "' . path_name . '" "' . new_path . '"'
let output = systemlist( cmd )
" echo "CMD = " . cmd
" echo "Output = "
" echo output
"
" Now get rid of any extra backup files we might have. MAX_BACKUPS is set here.
"
let max_backups = 3
"
" Now do the above again to get all of the backup files
"
let cmd ='dir /b/on "' . path_name . ';*"'
let x=systemlist(cmd)
" let x=split(x[0],"\n")
let ary_len = len(x)
" echo "CMD = " . cmd
" echo "X = "
" echo x
"
" If the ary_len is greater than max_backups - get rid of
" the lowest numbers because those are the oldest.
"
if( ary_len > max_backups )
let l=0
let ary_len = ary_len - max_backups
if( ary_len > 0 )
while( l < ary_len )
let a=split(x[l],";")
" echo "A = "
" echo a
let a_len = len(a) - 1
let ext = a[a_len]
let file_name = expand("%:p") . ";" . ext
let cmd = 'del "' . file_name . '"'
let output = systemlist( cmd )
" echo "CMD = " . cmd
" echo "Output = "
" echo output
" echo "L = " . l
let l += 1
endwhile
endif
endif
finish
" @(#) $Id: decvers.vim,v 0.1 Mark Manning
"
" Notes: Please note that I am using five zeros as the size of the
" backup file names. So we have 00000 and then 00001, 00002, etc...
"
let path_name=expand("%:p")
let file_name=expand("%:t")
"
" Now see about getting all of the iterations of the current file
"
let cmd ='dir /b/on "' . path_name . ';*"'
let x=systemlist(cmd)
" let x=split(x[0],"\n")
let ary_len=len(x)
" echo "CMD = " . cmd
" echo "X = "
" echo x
"
" Now get the highest number of the iterations
"
let l=0
let high_num=0
if( ary_len > 0 )
while( l < ary_len )
let a=split(x[l],";")
" echo "A = "
" echo a
let a_len = len(a) - 1
let a_last = a[a_len]
" echo "a_last = " . a_last
if( a_last >= high_num )
"
" For unknown reasons a_last is never higher than high_num
"
" echo "a_last = " . a_last
let high_num = str2nr( a_last, 10 )
" echo "High_num = " . high_num
else
" echo "a_last = " . a_last
let high_num = str2nr( a_last, 10 )
" echo "High_num = " . high_num
endif
" echo "L = " . l
let l += 1
endwhile
endif
"
" Make a new filename (ie: full file name PLUS .(high_num+1)
" In other words - make a new filename with the backup number one
" higher than the highest backup number. Example A.BOB;00001
"
" echo "High_num = " . high_num
let high_num = high_num + 1
" echo "High_num = " . high_num
let ext = printf("%05d", high_num )
" echo "High_num = " . high_num
" echo "ext = " . ext
let new_path = expand("%:p") . ";" . ext
"
" Now save the file to the new file name we just made.
"
" echo "new_path = " . new_path
let cmd = 'copy "' . path_name . '" "' . new_path . '"'
let output = systemlist( cmd )
" echo "CMD = " . cmd
" echo "Output = "
" echo output
"
" Now get rid of any extra backup files we might have. MAX_BACKUPS is set here.
"
let max_backups = 3
"
" Now do the above again to get all of the backup files
"
let cmd ='dir /b/on "' . path_name . ';*"'
let x=systemlist(cmd)
" let x=split(x[0],"\n")
let ary_len = len(x)
" echo "CMD = " . cmd
" echo "X = "
" echo x
"
" If the ary_len is greater than max_backups - get rid of
" the lowest numbers because those are the oldest.
"
if( ary_len > max_backups )
let l=0
let ary_len = ary_len - max_backups
if( ary_len > 0 )
while( l < ary_len )
let a=split(x[l],";")
" echo "A = "
" echo a
let a_len = len(a) - 1
let ext = a[a_len]
let file_name = expand("%:p") . ";" . ext
let cmd = 'del "' . file_name . '"'
let output = systemlist( cmd )
" echo "CMD = " . cmd
" echo "Output = "
" echo output
" echo "L = " . l
let l += 1
endwhile
endif
endif
finish
End of Script
Have fun with it!
-- --
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/b8b1a020-dbcd-48bd-9350-348eb66b068an%40googlegroups.com.
Re: Q&A: MSDOS SET command gave me some of my mapped commands
Please do not top poste.
On Mi, 31 Dez 2025, Mark Manning wrote:
> One last message. Plus zero did not work. Yes, it is acting as if it
> were octal. Vim should not really do that as sometimes people do put
> zeros in front of the number. (At least, this old fogey remembers when
> people used to do that all of the time.)
I am afraid that ship has sailed long ago.
> Here is what works:
>
> str2nr( $value, $type )
>
> So I used str2nr( $ext, 10 )
>
> And that forced it to keep the number as 10. Just thinking aloud here
> but it would be nice to have 0b for binary, 0c for octal, 0x for
> hexadecimal, and 0d for decimal. But I guess no one wants to do that.
> :-)
:h expr-number
Thanks,
Christian
--
Ingrate, n.:
A man who bites the hand that feeds him, and then complains of
indigestion.
--
--
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/aVaKtE78zPujCmAi%40256bit.org.
On Mi, 31 Dez 2025, Mark Manning wrote:
> One last message. Plus zero did not work. Yes, it is acting as if it
> were octal. Vim should not really do that as sometimes people do put
> zeros in front of the number. (At least, this old fogey remembers when
> people used to do that all of the time.)
I am afraid that ship has sailed long ago.
> Here is what works:
>
> str2nr( $value, $type )
>
> So I used str2nr( $ext, 10 )
>
> And that forced it to keep the number as 10. Just thinking aloud here
> but it would be nice to have 0b for binary, 0c for octal, 0x for
> hexadecimal, and 0d for decimal. But I guess no one wants to do that.
> :-)
:h expr-number
Thanks,
Christian
--
Ingrate, n.:
A man who bites the hand that feeds him, and then complains of
indigestion.
--
--
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/aVaKtE78zPujCmAi%40256bit.org.
Subscribe to:
Comments (Atom)