P.S. In my previous post, the attachments are Big, Huge, Normal, Small
and Tiny in that order. I think the second one (Huge) is maybe the
most interesting one.
Best regards,
Tony.
On Tue, Aug 31, 2021 at 4:47 PM Tony Mechelynck
<antoine.mechelynck@gmail.com> wrote:
>
> When running incremental make (running make after a source update,
> without rerunning configure, in order to compile only what is
> necessary, i.e. changed modules plus anything that depends on them) it
> may happen (rarely but not never) that make spontaneously decides to
> rerun configure. Of course, if you pass configure arguments on the
> configure command-line, make won't have them at hand. The "safe" way
> is never to run configure yourself, but always let make do it, and
> pass configure arguments to make by means of environment variables.
> I'm attaching as examples the scripts which I use to compile one
> version each of Huge, Big, Normal, Small and Tiny Vim, in each case
> plus or minus some particular features which I want to have or not to
> have in that particular build of Vim. These scripts (written for the
> bash shell) must be "sourced", not "run", by the same shell which will
> run "make" (and/or "make config" "make reconfig" "make install" etc.)
> When there are new patches, I run five instances of make in parallel,
> each in its own shell with its own configuration. If you want to use
> these scripts, at least one line (the "compiled by" line) and possibly
> others, must be changed: use your best taste and good judgment. These
> scripts happen to have the same filename: don't download them under
> that name into the same directory.
>
> 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 on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvgvqCrrdKP8nbCbaPVtZikKjFqVC6dE0Ad_E4bqD62pA%40mail.gmail.com.
Tuesday, August 31, 2021
Re: Enabling/Disabling Vim features during compilation
When running incremental make (running make after a source update,
without rerunning configure, in order to compile only what is
necessary, i.e. changed modules plus anything that depends on them) it
may happen (rarely but not never) that make spontaneously decides to
rerun configure. Of course, if you pass configure arguments on the
configure command-line, make won't have them at hand. The "safe" way
is never to run configure yourself, but always let make do it, and
pass configure arguments to make by means of environment variables.
I'm attaching as examples the scripts which I use to compile one
version each of Huge, Big, Normal, Small and Tiny Vim, in each case
plus or minus some particular features which I want to have or not to
have in that particular build of Vim. These scripts (written for the
bash shell) must be "sourced", not "run", by the same shell which will
run "make" (and/or "make config" "make reconfig" "make install" etc.)
When there are new patches, I run five instances of make in parallel,
each in its own shell with its own configuration. If you want to use
these scripts, at least one line (the "compiled by" line) and possibly
others, must be changed: use your best taste and good judgment. These
scripts happen to have the same filename: don't download them under
that name into the same directory.
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvrZsbiAWsZ6NHoZYfnK2mq2EJTQWYYnHt2pbLZ%3DRHbKw%40mail.gmail.com.
without rerunning configure, in order to compile only what is
necessary, i.e. changed modules plus anything that depends on them) it
may happen (rarely but not never) that make spontaneously decides to
rerun configure. Of course, if you pass configure arguments on the
configure command-line, make won't have them at hand. The "safe" way
is never to run configure yourself, but always let make do it, and
pass configure arguments to make by means of environment variables.
I'm attaching as examples the scripts which I use to compile one
version each of Huge, Big, Normal, Small and Tiny Vim, in each case
plus or minus some particular features which I want to have or not to
have in that particular build of Vim. These scripts (written for the
bash shell) must be "sourced", not "run", by the same shell which will
run "make" (and/or "make config" "make reconfig" "make install" etc.)
When there are new patches, I run five instances of make in parallel,
each in its own shell with its own configuration. If you want to use
these scripts, at least one line (the "compiled by" line) and possibly
others, must be changed: use your best taste and good judgment. These
scripts happen to have the same filename: don't download them under
that name into the same directory.
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvrZsbiAWsZ6NHoZYfnK2mq2EJTQWYYnHt2pbLZ%3DRHbKw%40mail.gmail.com.
Re: Enabling/Disabling Vim features during compilation
On 2021-08-30 23:11, Christian Brabandt wrote:
> Not sure what you mean by that. Many features (but not all) can be
> enabled passing appropriate flags to the configure script. Check the
> help from ./configure --help for the different flags.
https://vimhelp.org/various.txt.html#%2Bfeature-list is the list of
features that can be enable during compilation. Those features that have
'-' before them are features that are no longer available. I am asking
if any of those features in the feature list can be enabled or disabled
on its own during compilation.
> Yes. You may edit the header file feature.h. Note, if you just start
> enabling features blindly, compilation may fail (because of ifdefs), so
> be careful.
I know there are some features that can't be enabled by editing
feature.h as the comments around them in feature.h explicitly tell you
to enable/disable them using ./configure
I am basically looking to compile Vim myself, enabling all the features
I want and disabling the ones I don't, explicitly, one by one, not
having to rely on the 'big/small' etc feature set options and I was
hoping to do it by editing the PKGBUILD in AUR for vim-git hence wanting
to enable/disable all features using ./configure.
Also, ./configure has the option --enable-FEATURE and --disable-FEATURE
where FEATURE is to be replaced by the feature's name, so I am guessing
in theory it is possible to enable or disable each of the features in
https://vimhelp.org/various.txt.html#%2Bfeature-list using ./configure
options
> I believe this is a feature, that is enabled using feature.h depending
> on the feature set (huge, normal, small). What are you trying to do
> here? Is there a particular interest in the builtinterms feature?
I want to compile Vim myself, enabling the features I want and
+builtinterms is one of them, but like I've mentioned above, I don't
want to have to rely on the 'huge/normal/small' feature set. I want to
specify each feature myself.
> chrisbra@debian ~/code/vim-src/src% ./configure --help |grep -i perl
> --enable-perlinterp=OPTS Include Perl interpreter. default=no
> OPTS=no/yes/dynamic
> #v-
>
> Does that help?
That helps a lot. Thank you!
Not sure how I missed it when looking at ./configure --help
> Best,
> Christian
> --
> Jemand, der immer lustig ist, ist was Unerträgliches.
> -- Loriot (eigentlich Vicco von Bülow)
>
> --
Best Regards,
IFo Hancroft
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/c8273dbb604335995c84b931bd5cc347%40ifohancroft.com.
> Not sure what you mean by that. Many features (but not all) can be
> enabled passing appropriate flags to the configure script. Check the
> help from ./configure --help for the different flags.
https://vimhelp.org/various.txt.html#%2Bfeature-list is the list of
features that can be enable during compilation. Those features that have
'-' before them are features that are no longer available. I am asking
if any of those features in the feature list can be enabled or disabled
on its own during compilation.
> Yes. You may edit the header file feature.h. Note, if you just start
> enabling features blindly, compilation may fail (because of ifdefs), so
> be careful.
I know there are some features that can't be enabled by editing
feature.h as the comments around them in feature.h explicitly tell you
to enable/disable them using ./configure
I am basically looking to compile Vim myself, enabling all the features
I want and disabling the ones I don't, explicitly, one by one, not
having to rely on the 'big/small' etc feature set options and I was
hoping to do it by editing the PKGBUILD in AUR for vim-git hence wanting
to enable/disable all features using ./configure.
Also, ./configure has the option --enable-FEATURE and --disable-FEATURE
where FEATURE is to be replaced by the feature's name, so I am guessing
in theory it is possible to enable or disable each of the features in
https://vimhelp.org/various.txt.html#%2Bfeature-list using ./configure
options
> I believe this is a feature, that is enabled using feature.h depending
> on the feature set (huge, normal, small). What are you trying to do
> here? Is there a particular interest in the builtinterms feature?
I want to compile Vim myself, enabling the features I want and
+builtinterms is one of them, but like I've mentioned above, I don't
want to have to rely on the 'huge/normal/small' feature set. I want to
specify each feature myself.
> chrisbra@debian ~/code/vim-src/src% ./configure --help |grep -i perl
> --enable-perlinterp=OPTS Include Perl interpreter. default=no
> OPTS=no/yes/dynamic
> #v-
>
> Does that help?
That helps a lot. Thank you!
Not sure how I missed it when looking at ./configure --help
> Best,
> Christian
> --
> Jemand, der immer lustig ist, ist was Unerträgliches.
> -- Loriot (eigentlich Vicco von Bülow)
>
> --
Best Regards,
IFo Hancroft
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/c8273dbb604335995c84b931bd5cc347%40ifohancroft.com.
Monday, August 30, 2021
Re: Enabling/Disabling Vim features during compilation
On Mo, 30 Aug 2021, lists@ifohancroft.com wrote:
>
> Hi,
>
> I have a couple of questions that I couldn't find an answer for. If anything
> is unclear, please let me know.
>
> 1. Excluding the features marked with '-', can each of the
> features in https://vimhelp.org/various.txt.html#%2Bfeature-list be
> explicitly enabled or disabled on their own during compilation?
Not sure what you mean by that. Many features (but not all) can be
enabled passing appropriate flags to the configure script. Check the
help from ./configure --help for the different flags.
> 2. Are there any features that can be disabled/enabled during compilation
> that can't be enabled/disabled by passing an option to ./configure?
Yes. You may edit the header file feature.h. Note, if you just start
enabling features blindly, compilation may fail (because of ifdefs), so
be careful.
> If the answer to #1 is yes and the answer to #2 is no - I see that
> ./configure --help doesn't list a separate option for each of the
> features, but there is --enable-FEATURE[=ARG] and --disable-FEATURE so I
> am guessing I just replace FEATURE with the name of the feature I wish
> to enable or disable and I don't actually include the + sign, just the
> plain feature name, however:
>
> 3.1. If builtin_terms is enabled, whether only some terminals will be
> builtin or all of them depends on whether builtin_terms is
> +builtin_terms or ++builtin_terms. How do I specify ++builtin_terms as
> --enable-FEATURE? Should it be --enable-+builtinterms?
I believe this is a feature, that is enabled using feature.h depending
on the feature set (huge, normal, small). What are you trying to do
here? Is there a particular interest in the builtinterms feature?
> 3.2. I see that some features that have explicit enable/disable options
> for them and require passing an argument (for example the Perl
> interpreter option requires an argument whether it should be anbled or
> not and whether it should be dynamically loaded) have a +feature
> equivalent with separate options for the different arguments of the
> builtin enable/disable option. Very clever btw! In such a case, if I
> choose to enable the Perl interpret using --enable-perl and want it
> loaded dynamic, instead of setting --enable-perlinterp=dynamic, do I use
> just --enable-perl/dyn or should I use both --enable-perl and
> --enable-perl/dyn?
Check the help of the configure script:
#v+
chrisbra@debian ~/code/vim-src/src% ./configure --help |grep -i perl
--enable-perlinterp=OPTS Include Perl interpreter. default=no OPTS=no/yes/dynamic
#v-
Does that help?
Best,
Christian
--
Jemand, der immer lustig ist, ist was Unerträgliches.
-- Loriot (eigentlich Vicco von Bülow)
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20210831061120.GA1795913%40256bit.org.
>
> Hi,
>
> I have a couple of questions that I couldn't find an answer for. If anything
> is unclear, please let me know.
>
> 1. Excluding the features marked with '-', can each of the
> features in https://vimhelp.org/various.txt.html#%2Bfeature-list be
> explicitly enabled or disabled on their own during compilation?
Not sure what you mean by that. Many features (but not all) can be
enabled passing appropriate flags to the configure script. Check the
help from ./configure --help for the different flags.
> 2. Are there any features that can be disabled/enabled during compilation
> that can't be enabled/disabled by passing an option to ./configure?
Yes. You may edit the header file feature.h. Note, if you just start
enabling features blindly, compilation may fail (because of ifdefs), so
be careful.
> If the answer to #1 is yes and the answer to #2 is no - I see that
> ./configure --help doesn't list a separate option for each of the
> features, but there is --enable-FEATURE[=ARG] and --disable-FEATURE so I
> am guessing I just replace FEATURE with the name of the feature I wish
> to enable or disable and I don't actually include the + sign, just the
> plain feature name, however:
>
> 3.1. If builtin_terms is enabled, whether only some terminals will be
> builtin or all of them depends on whether builtin_terms is
> +builtin_terms or ++builtin_terms. How do I specify ++builtin_terms as
> --enable-FEATURE? Should it be --enable-+builtinterms?
I believe this is a feature, that is enabled using feature.h depending
on the feature set (huge, normal, small). What are you trying to do
here? Is there a particular interest in the builtinterms feature?
> 3.2. I see that some features that have explicit enable/disable options
> for them and require passing an argument (for example the Perl
> interpreter option requires an argument whether it should be anbled or
> not and whether it should be dynamically loaded) have a +feature
> equivalent with separate options for the different arguments of the
> builtin enable/disable option. Very clever btw! In such a case, if I
> choose to enable the Perl interpret using --enable-perl and want it
> loaded dynamic, instead of setting --enable-perlinterp=dynamic, do I use
> just --enable-perl/dyn or should I use both --enable-perl and
> --enable-perl/dyn?
Check the help of the configure script:
#v+
chrisbra@debian ~/code/vim-src/src% ./configure --help |grep -i perl
--enable-perlinterp=OPTS Include Perl interpreter. default=no OPTS=no/yes/dynamic
#v-
Does that help?
Best,
Christian
--
Jemand, der immer lustig ist, ist was Unerträgliches.
-- Loriot (eigentlich Vicco von Bülow)
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20210831061120.GA1795913%40256bit.org.
Enabling/Disabling Vim features during compilation
Hi,
I have a couple of questions that I couldn't find an answer for. If
anything is unclear, please let me know.
1. Excluding the features marked with '-', can each of the
features in https://vimhelp.org/various.txt.html#%2Bfeature-list be
explicitly enabled or disabled on their own during compilation?
2. Are there any features that can be disabled/enabled during
compilation
that can't be enabled/disabled by passing an option to ./configure?
If the answer to #1 is yes and the answer to #2 is no - I see that
./configure --help doesn't list a separate option for each of the
features, but there is --enable-FEATURE[=ARG] and --disable-FEATURE so I
am guessing I just replace FEATURE with the name of the feature I wish
to enable or disable and I don't actually include the + sign, just the
plain feature name, however:
3.1. If builtin_terms is enabled, whether only some terminals will be
builtin or all of them depends on whether builtin_terms is
+builtin_terms or ++builtin_terms. How do I specify ++builtin_terms as
--enable-FEATURE? Should it be --enable-+builtinterms?
3.2. I see that some features that have explicit enable/disable options
for them and require passing an argument (for example the Perl
interpreter option requires an argument whether it should be anbled or
not and whether it should be dynamically loaded) have a +feature
equivalent with separate options for the different arguments of the
builtin enable/disable option. Very clever btw! In such a case, if I
choose to enable the Perl interpret using --enable-perl and want it
loaded dynamic, instead of setting --enable-perlinterp=dynamic, do I use
just --enable-perl/dyn or should I use both --enable-perl and
--enable-perl/dyn?
Best Regards,
IFo Hancroft
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/1e08ab0c32000a30f1c160eb4d1a9cd7%40ifohancroft.com.
I have a couple of questions that I couldn't find an answer for. If
anything is unclear, please let me know.
1. Excluding the features marked with '-', can each of the
features in https://vimhelp.org/various.txt.html#%2Bfeature-list be
explicitly enabled or disabled on their own during compilation?
2. Are there any features that can be disabled/enabled during
compilation
that can't be enabled/disabled by passing an option to ./configure?
If the answer to #1 is yes and the answer to #2 is no - I see that
./configure --help doesn't list a separate option for each of the
features, but there is --enable-FEATURE[=ARG] and --disable-FEATURE so I
am guessing I just replace FEATURE with the name of the feature I wish
to enable or disable and I don't actually include the + sign, just the
plain feature name, however:
3.1. If builtin_terms is enabled, whether only some terminals will be
builtin or all of them depends on whether builtin_terms is
+builtin_terms or ++builtin_terms. How do I specify ++builtin_terms as
--enable-FEATURE? Should it be --enable-+builtinterms?
3.2. I see that some features that have explicit enable/disable options
for them and require passing an argument (for example the Perl
interpreter option requires an argument whether it should be anbled or
not and whether it should be dynamically loaded) have a +feature
equivalent with separate options for the different arguments of the
builtin enable/disable option. Very clever btw! In such a case, if I
choose to enable the Perl interpret using --enable-perl and want it
loaded dynamic, instead of setting --enable-perlinterp=dynamic, do I use
just --enable-perl/dyn or should I use both --enable-perl and
--enable-perl/dyn?
Best Regards,
IFo Hancroft
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/1e08ab0c32000a30f1c160eb4d1a9cd7%40ifohancroft.com.
Re: How do I search and replace based on a list?
On 2021-08-28 03:05, Luciano ES wrote:
> So I would like to create a list of string pairs, ideally in a
> separate file and with some kind of separator such as '|' between
> the strings. Then I would highlight the line or paragraph and run
> the macro or script and have all pair replacements applied
> automatically.
If you're willing to keep it in a vim-script rather than an external
file, and you can identify your search-strings generically with a
regex, it's amazingly beautiful:
:%s/generic regex/\=get({'from1': 'to1', 'from2': 'to2', 'from3':
'to3'}, submatch(0), submatch(0))/g
where you only need to update that from→to dict.
If each is only a single word, that generic regex can be as simple as
:%s/\w\+/\=get({…}, submatch(0), submatch(0))/g
That dictionary doesn't *have* to be inlined, so you can create it
and maintain it dynamically:
:let b:mymap={'from1': 'to1', 'from2': 'to2', 'from3': 'to3'}
and then use
:%s/\w\+/\=get(b:mymap, submatch(0), submatch(0))/g
allowing you to dynamically update it
:let b:mymap['tim']='luciano'
and re-run the command to pick up the new substitution(s)
:%s/\w\+/\=get(b:mymap, submatch(0), submatch(0))/g
It can even be made into a mapping in your vimrc if you want easy
access to it rather than relying on your preserved command-history.
It also has the advantage that each item only gets substituted once.
For an example, imagine doing
%s/wasp/horsefly/g
%s/fly/gnat/g
you'd end up with a bunch of "horsegnats".
However, if you want, you can transform a pipe-delimited list
(assuming no crazy meta-chars) into commands that can then be
executed:
:%s@\(.*\)|\(.*\)@:%s/\1/\2/g
This mogrifies it into a list of :s commands. You can then yank them
all
:%y
At this point, you can either
:q!
to close that buffer discarding those modifications, or you can keep
them around and directly modify the list of substitute commands
directly rather than using an intermediate pipe-delimited form that
you need to transform every time.
Once you've yanked them into the scratch/unnamed register, you can
execute them as a macro
@"
However, beware the replacing-already-replaced-things issue mentioned
above.
Hope this helps,
-Tim
For more, you can read up at
:help get()
:help sub-replace-special
:help @
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20210830082956.5e225016%40bigbox.attlocal.net.
> So I would like to create a list of string pairs, ideally in a
> separate file and with some kind of separator such as '|' between
> the strings. Then I would highlight the line or paragraph and run
> the macro or script and have all pair replacements applied
> automatically.
If you're willing to keep it in a vim-script rather than an external
file, and you can identify your search-strings generically with a
regex, it's amazingly beautiful:
:%s/generic regex/\=get({'from1': 'to1', 'from2': 'to2', 'from3':
'to3'}, submatch(0), submatch(0))/g
where you only need to update that from→to dict.
If each is only a single word, that generic regex can be as simple as
:%s/\w\+/\=get({…}, submatch(0), submatch(0))/g
That dictionary doesn't *have* to be inlined, so you can create it
and maintain it dynamically:
:let b:mymap={'from1': 'to1', 'from2': 'to2', 'from3': 'to3'}
and then use
:%s/\w\+/\=get(b:mymap, submatch(0), submatch(0))/g
allowing you to dynamically update it
:let b:mymap['tim']='luciano'
and re-run the command to pick up the new substitution(s)
:%s/\w\+/\=get(b:mymap, submatch(0), submatch(0))/g
It can even be made into a mapping in your vimrc if you want easy
access to it rather than relying on your preserved command-history.
It also has the advantage that each item only gets substituted once.
For an example, imagine doing
%s/wasp/horsefly/g
%s/fly/gnat/g
you'd end up with a bunch of "horsegnats".
However, if you want, you can transform a pipe-delimited list
(assuming no crazy meta-chars) into commands that can then be
executed:
:%s@\(.*\)|\(.*\)@:%s/\1/\2/g
This mogrifies it into a list of :s commands. You can then yank them
all
:%y
At this point, you can either
:q!
to close that buffer discarding those modifications, or you can keep
them around and directly modify the list of substitute commands
directly rather than using an intermediate pipe-delimited form that
you need to transform every time.
Once you've yanked them into the scratch/unnamed register, you can
execute them as a macro
@"
However, beware the replacing-already-replaced-things issue mentioned
above.
Hope this helps,
-Tim
For more, you can read up at
:help get()
:help sub-replace-special
:help @
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20210830082956.5e225016%40bigbox.attlocal.net.
Sunday, August 29, 2021
Re: [key combinations, shortcuts]
On Thu, Aug 26, 2021 at 04:08:49PM +0300, Maxim Abalenkov wrote:
>After further investigation I came up with the following solution:
>
>:imap <C-h> {% highlight perl %}<Enter><Enter>{% endhighlight %}<Up>
>
>Please correct me, if there are any obvious mistakes. Thank you!
Just one: you should use inoremap instead of imap. inoremap will prevent the expansion of further maps taking place on the right-hand side. For example, if you had mapped "e" to "X" (":inoremap e X"), you'd have ended up with
{% highlight pXrl %}
{% Xndhighlight %}
Also, bear in mind that in terminal vim, <c-h> is the same as control-backspace, so either one of those keystrokes would trigger your mapping.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/YSu/W3AVwb9G%2B0VP%40rainslide.net.
>After further investigation I came up with the following solution:
>
>:imap <C-h> {% highlight perl %}<Enter><Enter>{% endhighlight %}<Up>
>
>Please correct me, if there are any obvious mistakes. Thank you!
Just one: you should use inoremap instead of imap. inoremap will prevent the expansion of further maps taking place on the right-hand side. For example, if you had mapped "e" to "X" (":inoremap e X"), you'd have ended up with
{% highlight pXrl %}
{% Xndhighlight %}
Also, bear in mind that in terminal vim, <c-h> is the same as control-backspace, so either one of those keystrokes would trigger your mapping.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/YSu/W3AVwb9G%2B0VP%40rainslide.net.
Friday, August 27, 2021
How do I search and replace based on a list?
Greetings.
I've been using Vim for a long time, but never got around to learning programming in it. I've always found it difficult. I wonder if someone here is willing to help me with a little project.
I sometimes highlight a line or paragraph and run some search and replace on it:
:'<,'>s/some string/another string/g
Then I may do it again with another pair of strings. Then another pair.
Some time later, I may have to do it again. There may be new string pairs, but most of the pairs will have been applied before. So at least they are recorded in the command history for some time. But sometimes that history is lost/overwritten or it's just annoying to scroll until I find the exact desired pair.
So I would like to create a list of string pairs, ideally in a separate file and with some kind of separator such as '|' between the strings. Then I would highlight the line or paragraph and run the macro or script and have all pair replacements applied automatically.
The replacing part would be quite easy for me to accomplish if I only wanted to apply one pair of strings. But I want to keep a list and I have no idea about how to open and parse the list file and iterate over each pair. I know a little programming and I could certainly achieve that in other languages, but I am really not fluent in Vimish. Can someone please help me with that?
TIA
--
Luciano ES
>>
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20210828030535.3c58eb60%40lud1.home.
I've been using Vim for a long time, but never got around to learning programming in it. I've always found it difficult. I wonder if someone here is willing to help me with a little project.
I sometimes highlight a line or paragraph and run some search and replace on it:
:'<,'>s/some string/another string/g
Then I may do it again with another pair of strings. Then another pair.
Some time later, I may have to do it again. There may be new string pairs, but most of the pairs will have been applied before. So at least they are recorded in the command history for some time. But sometimes that history is lost/overwritten or it's just annoying to scroll until I find the exact desired pair.
So I would like to create a list of string pairs, ideally in a separate file and with some kind of separator such as '|' between the strings. Then I would highlight the line or paragraph and run the macro or script and have all pair replacements applied automatically.
The replacing part would be quite easy for me to accomplish if I only wanted to apply one pair of strings. But I want to keep a list and I have no idea about how to open and parse the list file and iterate over each pair. I know a little programming and I could certainly achieve that in other languages, but I am really not fluent in Vimish. Can someone please help me with that?
TIA
--
Luciano ES
>>
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/20210828030535.3c58eb60%40lud1.home.
Thursday, August 26, 2021
Re: [key combinations, shortcuts]
Dear all,
After further investigation I came up with the following solution:
:imap <C-h> {% highlight perl %}<Enter><Enter>{% endhighlight %}<Up>
Please correct me, if there are any obvious mistakes. Thank you!
—
Best wishes,
Maxim
On 26 Aug 2021, at 13:46, Maxim Abalenkov <maxim.abalenkov@gmail.com> wrote:Dear all,I found out that this functionality is called "mapping". I followed this tutorial (https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1)) to create a basic map in the insert mode::map ,h {% highlight perl %}{% endhighlight %}What I would like to do, is to place a newline in between the curly braces symbols "}{" and have my cursor there, such that I can start typing the source code directly. Finally, I'm sure the ",h" key combination is not the best. Would you be able to recommend me some best practices on choosing a good key combination? Thank you and have a good day ahead!—Best wishes,MaximOn 26 Aug 2021, at 13:17, Maxim Abalenkov <maxim.abalenkov@gmail.com> wrote:Dear all,How are you? I hope all is well with you. I have a rather basic question. Recently I find myself typing a lot of text in markdown. Frequently I need to input highlighted Perl or bash source code into my markdown. To do that I use the{% highlight perl %}{% endhighlight %}macro. I'm certain it would be possible to create a "key shortcut" in Vim, such that when I press a certain key combination, Vim would automatically insert the above macro. Would you please direct me: how is this functionality called in Vim and where can I read more about it and see some basic examples? Thank you and have a good day ahead!—Best wishes,Maxim
Re: [key combinations, shortcuts]
Dear all,
I found out that this functionality is called "mapping". I followed this tutorial (https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1)) to create a basic map in the insert mode:
:map ,h {% highlight perl %}{% endhighlight %}
What I would like to do, is to place a newline in between the curly braces symbols "}{" and have my cursor there, such that I can start typing the source code directly. Finally, I'm sure the ",h" key combination is not the best. Would you be able to recommend me some best practices on choosing a good key combination? Thank you and have a good day ahead!
—
Best wishes,
Maxim
On 26 Aug 2021, at 13:17, Maxim Abalenkov <maxim.abalenkov@gmail.com> wrote:Dear all,How are you? I hope all is well with you. I have a rather basic question. Recently I find myself typing a lot of text in markdown. Frequently I need to input highlighted Perl or bash source code into my markdown. To do that I use the{% highlight perl %}{% endhighlight %}macro. I'm certain it would be possible to create a "key shortcut" in Vim, such that when I press a certain key combination, Vim would automatically insert the above macro. Would you please direct me: how is this functionality called in Vim and where can I read more about it and see some basic examples? Thank you and have a good day ahead!—Best wishes,Maxim
Re: [key combinations, shortcuts]
Hi,
i think you're searching for abbreviate, `:help abbreviate` and/or https://vim.fandom.com/wiki/Using_abbreviations should get you started.
-- Am Do., 26. Aug. 2021 um 12:17 Uhr schrieb Maxim Abalenkov <maxim.abalenkov@gmail.com>:
I'm certain it would be possible to create a "key shortcut" in Vim, such that when I press a certain key combination, Vim would automatically insert the above macro. Would you please direct me: how is this functionality called in Vim and where can I read more about it and see some basic examples? Thank you and have a good day ahead!
i think you're searching for abbreviate, `:help abbreviate` and/or https://vim.fandom.com/wiki/Using_abbreviations should get you started.
regards,
Stefan
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAA%3DcwqH5h8w%2B6wkWE4kSRfOhyKCedt6Gsr3NM5DaQE7ZxKb1KQ%40mail.gmail.com.
[key combinations, shortcuts]
Dear all,
How are you? I hope all is well with you. I have a rather basic question. Recently I find myself typing a lot of text in markdown. Frequently I need to input highlighted Perl or bash source code into my markdown. To do that I use the
{% highlight perl %}
{% endhighlight %}
macro. I'm certain it would be possible to create a "key shortcut" in Vim, such that when I press a certain key combination, Vim would automatically insert the above macro. Would you please direct me: how is this functionality called in Vim and where can I read more about it and see some basic examples? Thank you and have a good day ahead!
—
Best wishes,
Maxim
Thursday, August 19, 2021
Re: [vim9script] Why is a forward declaration needed?
On 2021-08-19, Bram Moolenaar <Bram@moolenaar.net> wrote:
> You are using "Call" in Expr(), and Expr is used in an expression
> to set "TrailingArg". To be able to check the type there, Expr() is
> compiled, which requires "Call" to exist.
Got it.
> NumberLiteral is defined just before setting "TrailingArg".
Too silly of me not to notice that.
> What is tricky here that in principle a variable needs to be defined
> before used, and when used in a function it should be defined before
> that function. But since compilation is done only when needed, it can
> be defined after the function, so long as it's before compiling it.
Ok, that makes sense.
Thanks,
Life.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/sfmdd7%24j5r%241%40ciao.gmane.io.
> You are using "Call" in Expr(), and Expr is used in an expression
> to set "TrailingArg". To be able to check the type there, Expr() is
> compiled, which requires "Call" to exist.
Got it.
> NumberLiteral is defined just before setting "TrailingArg".
Too silly of me not to notice that.
> What is tricky here that in principle a variable needs to be defined
> before used, and when used in a function it should be defined before
> that function. But since compilation is done only when needed, it can
> be defined after the function, so long as it's before compiling it.
Ok, that makes sense.
Thanks,
Life.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/sfmdd7%24j5r%241%40ciao.gmane.io.
Re: [vim9script] Why is a forward declaration needed?
> Hi, I have tried to port this TypeScript script:
>
> https://github.com/sigma-engineering/blog-combinators/blob/master/index.ts
>
> to Vim9 script (please find the full code at the end of this message).
> It appears to work, but to make it work I had to add a "forward
> declaration" of the Call() function:
>
> var Call: func(dict<any>): dict<any>
>
> If I comment out the above line, I get a "E1001: Variable not found:
> Call" error, pointing at this line:
>
> const TrailingArg = Map(Sequence([Str(","), Expr]), (args) => args[1])
>
> What baffles me is that Vim doesn't complain in the same way about
> NumberLiteral. Does anyone have an explanation for this behaviour?
You are using "Call" in Expr(), and Expr is used in an expression
to set "TrailingArg". To be able to check the type there, Expr() is
compiled, which requires "Call" to exist.
NumberLiteral is defined just before setting "TrailingArg".
What is tricky here that in principle a variable needs to be defined
before used, and when used in a function it should be defined before
that function. But since compilation is done only when needed, it can
be defined after the function, so long as it's before compiling it.
--
What do you get when you cross a joke with a rehtorical question?
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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 on the web visit https://groups.google.com/d/msgid/vim_use/202108191909.17JJ941V654208%40masaka.moolenaar.net.
>
> https://github.com/sigma-engineering/blog-combinators/blob/master/index.ts
>
> to Vim9 script (please find the full code at the end of this message).
> It appears to work, but to make it work I had to add a "forward
> declaration" of the Call() function:
>
> var Call: func(dict<any>): dict<any>
>
> If I comment out the above line, I get a "E1001: Variable not found:
> Call" error, pointing at this line:
>
> const TrailingArg = Map(Sequence([Str(","), Expr]), (args) => args[1])
>
> What baffles me is that Vim doesn't complain in the same way about
> NumberLiteral. Does anyone have an explanation for this behaviour?
You are using "Call" in Expr(), and Expr is used in an expression
to set "TrailingArg". To be able to check the type there, Expr() is
compiled, which requires "Call" to exist.
NumberLiteral is defined just before setting "TrailingArg".
What is tricky here that in principle a variable needs to be defined
before used, and when used in a function it should be defined before
that function. But since compilation is done only when needed, it can
be defined after the function, so long as it's before compiling it.
--
What do you get when you cross a joke with a rehtorical question?
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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 on the web visit https://groups.google.com/d/msgid/vim_use/202108191909.17JJ941V654208%40masaka.moolenaar.net.
[vim9script] Why is a forward declaration needed?
Hi, I have tried to port this TypeScript script:
https://github.com/sigma-engineering/blog-combinators/blob/master/index.ts
to Vim9 script (please find the full code at the end of this message).
It appears to work, but to make it work I had to add a "forward
declaration" of the Call() function:
var Call: func(dict<any>): dict<any>
If I comment out the above line, I get a "E1001: Variable not found:
Call" error, pointing at this line:
const TrailingArg = Map(Sequence([Str(","), Expr]), (args) => args[1])
What baffles me is that Vim doesn't complain in the same way about
NumberLiteral. Does anyone have an explanation for this behaviour?
Using Vim 8.2.3350.
Thanks,
Life.
##############################################################################
vim9script
# See also: https://github.com/sigma-engineering/blog-combinators
# type TSuccess dict<any>
# type TFailure dict<any>
# type TResult TSuccess | TFailure
# type TContext dict<any>
# type TParser func(TContext): TResult
def Success(ctx: dict<any>, value: any): dict<any>
return { success: true, value: value, ctx: ctx }
enddef
def Failure(ctx: dict<any>, expected: string): dict<any>
return { success: false, expected: expected, ctx: ctx }
enddef
# Match a string exactly, or fail
def Str(match: string): func(dict<any>): dict<any>
return (ctx: dict<any>): dict<any> => {
const endIndex = ctx.index + len(match) - 1
if (ctx.text[(ctx.index) : (endIndex)] ==# match)
ctx.index = endIndex + 1
return Success(ctx, match)
else
return Failure(ctx, match)
endif
}
enddef
# Match a regexp or fail
def Regex(re: string, expected: string): func(dict<any>): dict<any>
return (ctx: dict<any>): dict<any> => {
const res = matchstrpos(ctx.text, re, ctx.index)
if res[1] == ctx.index
ctx.index = res[2]
return Success(ctx, res[0])
else
return Failure(ctx, expected)
endif
}
enddef
# Try each matcher in order, starting from the same point in the input. return
# the first one that succeeds. or return the failure that got furthest in the
# input string. Which failure to return is a matter of taste; we prefer the
# furthest failure because it tends be the most useful/complete error
# message.
def Either(Parsers: list<func(dict<any>): dict<any>>): func(dict<any>): dict<any>
return (ctx: dict<any>): dict<any> => {
var furthestRes: dict<any> = {ctx: {index: -1}}
for Parser in Parsers
const res = Parser(ctx)
if res.success
return res
endif
if furthestRes.ctx.index < res.ctx.index
furthestRes = res
endif
endfor
return furthestRes
}
enddef
def Null(ctx: dict<any>): dict<any>
return Success(ctx, null)
enddef
# Match a parser, or fail silently
def Optional(Parser: func(dict<any>): dict<any>): func(dict<any>): dict<any>
return Either([Parser, Null])
enddef
def Many(Parser: func(dict<any>): dict<any>): func(dict<any>): dict<any>
return (ctx): dict<any> => {
var values = []
var nextCtx = ctx
while (true)
const res = Parser(nextCtx)
if (!res.success)
break
endif
values->add(res.value)
nextCtx = res.ctx
endwhile
return Success(nextCtx, values)
}
enddef
# Look for an exact sequence of parsers, or fail
def Sequence(Parsers: list<func(dict<any>): dict<any>>): func(dict<any>): dict<any>
return (ctx): dict<any> => {
var values = []
var nextCtx = ctx
for Parser in Parsers
const res = Parser(nextCtx)
if (!res.success)
return res
endif
values->add(res.value)
nextCtx = res.ctx
endfor
return Success(nextCtx, values)
}
enddef
# A convenience method that will map a Success to callback, to let us do
# common things like build AST nodes from input strings.
def Map(Parser: func(dict<any>): dict<any>, Fn: func(any): any): func(dict<any>): dict<any>
return (ctx: dict<any>): dict<any> => {
const res = Parser(ctx)
return res.success ? Success(res.ctx, Fn(res.value)) : res
}
enddef
def Str2Nr(n: string): number
return str2nr(n)
enddef
# Grammar-specific
# Expr ::= Call | NumberLiteral
# Call ::= Ident '(' [ArgList] ')'
# ArgList ::= Expr (TrailingArg)*
# TrailingArg ::= ',' Expr
# Number ::= '[+-]\?[0-9]\+'
# Ident ::= '[a-zA-Z][a-zA-Z0-9]*'
#########################################################
# This seems necessary for Vim to digest what follows: #
#########################################################
var Call: func(dict<any>): dict<any>
#########################################################
# Why? #
#########################################################
def Expr(ctx: dict<any>): dict<any>
return Either([NumberLiteral, Call])(ctx)
enddef
const Ident = Regex('[a-zA-Z][a-zA-Z0-9]*', 'identifier')
const NumberLiteral = Map(Regex('[+-]\?[0-9]\+', 'number'), Str2Nr)
const TrailingArg = Map(Sequence([Str(","), Expr]), (args) => args[1])
const ArgList = Map(Sequence([Expr, Many(TrailingArg)]), (args) => flattennew(args))
Call = Sequence([Ident, Str('('), Optional(ArgList), Str(')')])
# Top level parsing function
def Parse(text: string): any
const res = Expr({ text: text, index: 0 })
if res.success
return res.value
endif
return printf("Parse error, expected %s", res.expected)
enddef
def Example(code: string): void
echo Parse(code)
enddef
Example("1")
Example("Foo()")
Example("Foo(Bar())")
Example("Foo(Bar(1,2,3))")
##############################################################################
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/sflhni%247rp%241%40ciao.gmane.io.
https://github.com/sigma-engineering/blog-combinators/blob/master/index.ts
to Vim9 script (please find the full code at the end of this message).
It appears to work, but to make it work I had to add a "forward
declaration" of the Call() function:
var Call: func(dict<any>): dict<any>
If I comment out the above line, I get a "E1001: Variable not found:
Call" error, pointing at this line:
const TrailingArg = Map(Sequence([Str(","), Expr]), (args) => args[1])
What baffles me is that Vim doesn't complain in the same way about
NumberLiteral. Does anyone have an explanation for this behaviour?
Using Vim 8.2.3350.
Thanks,
Life.
##############################################################################
vim9script
# See also: https://github.com/sigma-engineering/blog-combinators
# type TSuccess dict<any>
# type TFailure dict<any>
# type TResult TSuccess | TFailure
# type TContext dict<any>
# type TParser func(TContext): TResult
def Success(ctx: dict<any>, value: any): dict<any>
return { success: true, value: value, ctx: ctx }
enddef
def Failure(ctx: dict<any>, expected: string): dict<any>
return { success: false, expected: expected, ctx: ctx }
enddef
# Match a string exactly, or fail
def Str(match: string): func(dict<any>): dict<any>
return (ctx: dict<any>): dict<any> => {
const endIndex = ctx.index + len(match) - 1
if (ctx.text[(ctx.index) : (endIndex)] ==# match)
ctx.index = endIndex + 1
return Success(ctx, match)
else
return Failure(ctx, match)
endif
}
enddef
# Match a regexp or fail
def Regex(re: string, expected: string): func(dict<any>): dict<any>
return (ctx: dict<any>): dict<any> => {
const res = matchstrpos(ctx.text, re, ctx.index)
if res[1] == ctx.index
ctx.index = res[2]
return Success(ctx, res[0])
else
return Failure(ctx, expected)
endif
}
enddef
# Try each matcher in order, starting from the same point in the input. return
# the first one that succeeds. or return the failure that got furthest in the
# input string. Which failure to return is a matter of taste; we prefer the
# furthest failure because it tends be the most useful/complete error
# message.
def Either(Parsers: list<func(dict<any>): dict<any>>): func(dict<any>): dict<any>
return (ctx: dict<any>): dict<any> => {
var furthestRes: dict<any> = {ctx: {index: -1}}
for Parser in Parsers
const res = Parser(ctx)
if res.success
return res
endif
if furthestRes.ctx.index < res.ctx.index
furthestRes = res
endif
endfor
return furthestRes
}
enddef
def Null(ctx: dict<any>): dict<any>
return Success(ctx, null)
enddef
# Match a parser, or fail silently
def Optional(Parser: func(dict<any>): dict<any>): func(dict<any>): dict<any>
return Either([Parser, Null])
enddef
def Many(Parser: func(dict<any>): dict<any>): func(dict<any>): dict<any>
return (ctx): dict<any> => {
var values = []
var nextCtx = ctx
while (true)
const res = Parser(nextCtx)
if (!res.success)
break
endif
values->add(res.value)
nextCtx = res.ctx
endwhile
return Success(nextCtx, values)
}
enddef
# Look for an exact sequence of parsers, or fail
def Sequence(Parsers: list<func(dict<any>): dict<any>>): func(dict<any>): dict<any>
return (ctx): dict<any> => {
var values = []
var nextCtx = ctx
for Parser in Parsers
const res = Parser(nextCtx)
if (!res.success)
return res
endif
values->add(res.value)
nextCtx = res.ctx
endfor
return Success(nextCtx, values)
}
enddef
# A convenience method that will map a Success to callback, to let us do
# common things like build AST nodes from input strings.
def Map(Parser: func(dict<any>): dict<any>, Fn: func(any): any): func(dict<any>): dict<any>
return (ctx: dict<any>): dict<any> => {
const res = Parser(ctx)
return res.success ? Success(res.ctx, Fn(res.value)) : res
}
enddef
def Str2Nr(n: string): number
return str2nr(n)
enddef
# Grammar-specific
# Expr ::= Call | NumberLiteral
# Call ::= Ident '(' [ArgList] ')'
# ArgList ::= Expr (TrailingArg)*
# TrailingArg ::= ',' Expr
# Number ::= '[+-]\?[0-9]\+'
# Ident ::= '[a-zA-Z][a-zA-Z0-9]*'
#########################################################
# This seems necessary for Vim to digest what follows: #
#########################################################
var Call: func(dict<any>): dict<any>
#########################################################
# Why? #
#########################################################
def Expr(ctx: dict<any>): dict<any>
return Either([NumberLiteral, Call])(ctx)
enddef
const Ident = Regex('[a-zA-Z][a-zA-Z0-9]*', 'identifier')
const NumberLiteral = Map(Regex('[+-]\?[0-9]\+', 'number'), Str2Nr)
const TrailingArg = Map(Sequence([Str(","), Expr]), (args) => args[1])
const ArgList = Map(Sequence([Expr, Many(TrailingArg)]), (args) => flattennew(args))
Call = Sequence([Ident, Str('('), Optional(ArgList), Str(')')])
# Top level parsing function
def Parse(text: string): any
const res = Expr({ text: text, index: 0 })
if res.success
return res.value
endif
return printf("Parse error, expected %s", res.expected)
enddef
def Example(code: string): void
echo Parse(code)
enddef
Example("1")
Example("Foo()")
Example("Foo(Bar())")
Example("Foo(Bar(1,2,3))")
##############################################################################
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/sflhni%247rp%241%40ciao.gmane.io.
Wednesday, August 18, 2021
having a hard time with vim pasta ctrlp bug
hello All,
when I use ctrlp to search for something, like a file /foo/print.txt
when I type the p character,
I get the below error,
Error detected while processing function <SNR>48_NormalPasta:
line 13:
E21: Cannot make changes, 'modifiable' is off
line 13:
E21: Cannot make changes, 'modifiable' is off
I'm not super clear how to debug this, i'mma long time vim user but I wouldn't say I always understand the underlying configurations or how to debug them.
any thoughts on the above ? i'd like to be able to ctrlp search for things like /application or whatever with 'p'
my vimrc is here, https://gist.github.com/jcdavison/18d635959d756300b994037c6d94867b
thanks :thanks:
JD
--
Founder, CTO, StartupLandia.io
https://www.linkedin.com/company/startuplandia/
https://twitter.com/startuplandia
https://www.linkedin.com/company/startuplandia/
https://twitter.com/startuplandia
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAF9TSm7sbVaOJfZd9L-4OOyuj0W2BK%3DAA-f-gr8MsXmF61Wj1Q%40mail.gmail.com.
Re: repost in new thread...how does Vim open a TTY window?
> Does vim do it's own TTY / terminal extension, or does it use the one
> in Win10.
What do you mean with "terminal extension"? Vim runs in the console,
can use the Windows terminal and also has a built-in terminal emulator.
> I.e. I thought someone said they didn't think it would work under
> Win7?
The Windows terminal is not available in Windows 7.
--
Biting someone with your natural teeth is "simple assault," while biting
someone with your false teeth is "aggravated assault."
[real standing law in Louisana, United States of America]
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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 on the web visit https://groups.google.com/d/msgid/vim_use/202108181843.17IIhFQ3359822%40masaka.moolenaar.net.
> in Win10.
What do you mean with "terminal extension"? Vim runs in the console,
can use the Windows terminal and also has a built-in terminal emulator.
> I.e. I thought someone said they didn't think it would work under
> Win7?
The Windows terminal is not available in Windows 7.
--
Biting someone with your natural teeth is "simple assault," while biting
someone with your false teeth is "aggravated assault."
[real standing law in Louisana, United States of America]
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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 on the web visit https://groups.google.com/d/msgid/vim_use/202108181843.17IIhFQ3359822%40masaka.moolenaar.net.
Tuesday, August 17, 2021
repost in new thread...how does Vim open a TTY window?
Does vim do it's own TTY / terminal extension, or does it use the one
in Win10.
I.e. I thought someone said they didn't think it would work under
Win7?
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/611C369A.7020609%40tlinx.org.
in Win10.
I.e. I thought someone said they didn't think it would work under
Win7?
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/611C369A.7020609%40tlinx.org.
Re: VIM session files treated as 'file list database'?
Hi bill.h...,
On Tuesday, 2021-08-17 06:18:15 -0700, bill.h...@gmail.com wrote:
> There's one more tag in the vim session file: after $argadd, after edit,
> after balt, there are 'badd' specifications.
Filename added to buffer list.
> If there are 100 $argadd, then
> I found 99 'badd'. Since I'm looking for those few that I 'selected' by
> leaving a buffer/window open/active, 'badd' didfn't help either.
It would, if instead of "leaving" (however you're doing that) you
deleted the buffer of the currently open file with :bd (:bdelete) or
even :bw (:bwipeout), after which :mks stores only the still active
buffers in the list with badd (plus the Session.vim buffer).
Eike
--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.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 on the web visit https://groups.google.com/d/msgid/vim_use/YRvxGvWMEXZNsguT%40kulungile.erack.de.
On Tuesday, 2021-08-17 06:18:15 -0700, bill.h...@gmail.com wrote:
> There's one more tag in the vim session file: after $argadd, after edit,
> after balt, there are 'badd' specifications.
Filename added to buffer list.
> If there are 100 $argadd, then
> I found 99 'badd'. Since I'm looking for those few that I 'selected' by
> leaving a buffer/window open/active, 'badd' didfn't help either.
It would, if instead of "leaving" (however you're doing that) you
deleted the buffer of the currently open file with :bd (:bdelete) or
even :bw (:bwipeout), after which :mks stores only the still active
buffers in the list with badd (plus the Session.vim buffer).
Eike
--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.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 on the web visit https://groups.google.com/d/msgid/vim_use/YRvxGvWMEXZNsguT%40kulungile.erack.de.
Re: VIM session files treated as 'file list database'?
There's one more tag in the vim session file: after $argadd, after edit, after balt, there are 'badd' specifications. If there are 100 $argadd, then I found 99 'badd'. Since I'm looking for those few that I 'selected' by leaving a buffer/window open/active, 'badd' didfn't help either. The 'edit' single spec mentions a file that also appears in 'balt' list, BTW.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/4a44934f-7558-4ca6-b7f4-d9e14cee76acn%40googlegroups.com.
I can only think that based on 'balt' specs, open tabs/windows/buffers are re-opened, then there must be some sense of 'logical operations being applied' which then changes what files actually appear in the open GVim editor window.
What got me across the finish line was good old 'redirect' - along with 'ls' or 'history' - with option 'a', you only get a list of active/open buffers.
What got me across the finish line was good old 'redirect' - along with 'ls' or 'history' - with option 'a', you only get a list of active/open buffers.
So: in my .vimrc I mapped Alt-S thusly:
map ó :set nomore<CR>:redir >> /tmp/chosen-files<CR>:ls a <CR>:redir END <CR>:set more<CR>-
This command, I used, not once per file but once per GVim window (per 'session', if you will) - and in the end had that list of filenames in /tmp/chosen-files.
Bob's your uncle. Hope this helps someone else in the future.
[Posted from browser on groups web site since this group does not send my own posts back to me - resulting in horrible confusion in distant past. Sorry about that.]
/Bill
On Monday, August 16, 2021 at 2:36:57 PM UTC-4 bill.h...@gmail.com wrote:
Trying to use sessions as 'database' using gvim. I hope this makes sense.
E.g., I'm reviewing 25 text notes/files - most are discarded, but some
are 'hits'. These files, I leave open (control-w to split window,
switch to the lower 'window' on the same file, and go to the next file
in the filelist).
At the end of the buffer list, I have 7 open buffers/'windows' out of
the original 25 files.
I run 'mksession a.vim', and in that file, I see these kinds of entries:
$argadd (25 times)
edit (1 time - current being edited)
balt (7 times)
Now, a simple linux pipe on the cmd-line prints the file names from
the 'balt' specifications/lines in the VIM session file.
BUT - I then realized that those files are NOT the files that open if
I use 'vim -S a.vim'. I can't figure it out. Is this documented other
than in the source code?
FYI, my .vimrc has:
set sessionoptions=buffers,help,resize,winpos,winsize,
(Hope it's obvious once I find the files in vim, I want to copy them
to another subtree so I can annotate, etc. I don't want to write them
one-at-a-time in VIM, even using a macro, as I'm really talking about
more than 600 files, not the measly 25 I use here in my example.)
I can't share the session file, because of the file names included
(legal reasons). BUT if no one knows what to do, I can dummy up
something with a few dozen fake file names to create a kind of example
showing this behavior; it'll just take a bit of time).
Thanks for any help -
--
/Bill
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/4a44934f-7558-4ca6-b7f4-d9e14cee76acn%40googlegroups.com.
Monday, August 16, 2021
VIM session files treated as 'file list database'?
Trying to use sessions as 'database' using gvim. I hope this makes sense.
E.g., I'm reviewing 25 text notes/files - most are discarded, but some
are 'hits'. These files, I leave open (control-w to split window,
switch to the lower 'window' on the same file, and go to the next file
in the filelist).
At the end of the buffer list, I have 7 open buffers/'windows' out of
the original 25 files.
I run 'mksession a.vim', and in that file, I see these kinds of entries:
$argadd (25 times)
edit (1 time - current being edited)
balt (7 times)
Now, a simple linux pipe on the cmd-line prints the file names from
the 'balt' specifications/lines in the VIM session file.
BUT - I then realized that those files are NOT the files that open if
I use 'vim -S a.vim'. I can't figure it out. Is this documented other
than in the source code?
FYI, my .vimrc has:
set sessionoptions=buffers,help,resize,winpos,winsize,
(Hope it's obvious once I find the files in vim, I want to copy them
to another subtree so I can annotate, etc. I don't want to write them
one-at-a-time in VIM, even using a macro, as I'm really talking about
more than 600 files, not the measly 25 I use here in my example.)
I can't share the session file, because of the file names included
(legal reasons). BUT if no one knows what to do, I can dummy up
something with a few dozen fake file names to create a kind of example
showing this behavior; it'll just take a bit of time).
Thanks for any help -
--
/Bill
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/7284a702-2391-665e-2faa-ad4e3ac5d433%40gmail.com.
E.g., I'm reviewing 25 text notes/files - most are discarded, but some
are 'hits'. These files, I leave open (control-w to split window,
switch to the lower 'window' on the same file, and go to the next file
in the filelist).
At the end of the buffer list, I have 7 open buffers/'windows' out of
the original 25 files.
I run 'mksession a.vim', and in that file, I see these kinds of entries:
$argadd (25 times)
edit (1 time - current being edited)
balt (7 times)
Now, a simple linux pipe on the cmd-line prints the file names from
the 'balt' specifications/lines in the VIM session file.
BUT - I then realized that those files are NOT the files that open if
I use 'vim -S a.vim'. I can't figure it out. Is this documented other
than in the source code?
FYI, my .vimrc has:
set sessionoptions=buffers,help,resize,winpos,winsize,
(Hope it's obvious once I find the files in vim, I want to copy them
to another subtree so I can annotate, etc. I don't want to write them
one-at-a-time in VIM, even using a macro, as I'm really talking about
more than 600 files, not the measly 25 I use here in my example.)
I can't share the session file, because of the file names included
(legal reasons). BUT if no one knows what to do, I can dummy up
something with a few dozen fake file names to create a kind of example
showing this behavior; it'll just take a bit of time).
Thanks for any help -
--
/Bill
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/7284a702-2391-665e-2faa-ad4e3ac5d433%40gmail.com.
Saturday, August 14, 2021
Re: RedHat Athena: GUI vim is extremely slow using terminal
On 2021/05/07 11:56, Bram Moolenaar wrote:
> Aleksandr Jakušev wrote:
>
>
>> Which makes me thing that the problem is GUI/X server related. And true,
>> this does not happen in the console verion of vim. FYI, My X server is one
>> of the latest versions of vcxsrv running on Win 10.
>>
>> Any advice would be appreciated.
>>
>
> You are using an X server running on MS-Windows? I have had nothing but
> problems with that. I haven't tried for years though. Can you run with
> a native X server?
>
Finally got to trying an 8.x running on my Linux (SuSE) w/display
on Windows 7SP1 (64bit) using Cygwin's Xserver.
I guess vim isn't using the win10-only terminal functions since it is
working on Win7
For speed testing, I did a full ls listing of /usr/lib64 w/6917 entries and
used 'dd' to sync. In bash, I used it's time function (and format:
TIMEFORMAT="%2Rsec %2Uusr %2Ssys (%P%% cpu)" ).
ran the whole thing under " bash -c 'cmd'":
time bash -c 'ls --quoting-style=literal --show-control-chars
--color=always -lgG /usr/lib64|dd oflag=dsync'
So besides the color output in the terminal window (TERM=xterm-256color),
I got 2 timings:
1164+1 records in
1164+1 records out
596002 bytes (596 kB, 582 KiB) copied, 3.49621 s, 170 kB/s
3.51sec 0.04usr 0.05sys (2.60% cpu)
So about a 17 million baud equivalent (this is over my 8Gb ethernet link).
I'd try a different X-server and I assume you have a 1Gb wired connection?
Best of luck!
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/6118548F.1060702%40tlinx.org.
> Aleksandr Jakušev wrote:
>
>
>> Which makes me thing that the problem is GUI/X server related. And true,
>> this does not happen in the console verion of vim. FYI, My X server is one
>> of the latest versions of vcxsrv running on Win 10.
>>
>> Any advice would be appreciated.
>>
>
> You are using an X server running on MS-Windows? I have had nothing but
> problems with that. I haven't tried for years though. Can you run with
> a native X server?
>
Finally got to trying an 8.x running on my Linux (SuSE) w/display
on Windows 7SP1 (64bit) using Cygwin's Xserver.
I guess vim isn't using the win10-only terminal functions since it is
working on Win7
For speed testing, I did a full ls listing of /usr/lib64 w/6917 entries and
used 'dd' to sync. In bash, I used it's time function (and format:
TIMEFORMAT="%2Rsec %2Uusr %2Ssys (%P%% cpu)" ).
ran the whole thing under " bash -c 'cmd'":
time bash -c 'ls --quoting-style=literal --show-control-chars
--color=always -lgG /usr/lib64|dd oflag=dsync'
So besides the color output in the terminal window (TERM=xterm-256color),
I got 2 timings:
1164+1 records in
1164+1 records out
596002 bytes (596 kB, 582 KiB) copied, 3.49621 s, 170 kB/s
3.51sec 0.04usr 0.05sys (2.60% cpu)
So about a 17 million baud equivalent (this is over my 8Gb ethernet link).
I'd try a different X-server and I assume you have a 1Gb wired connection?
Best of luck!
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/6118548F.1060702%40tlinx.org.
Thursday, August 12, 2021
Re: vim terminal bracketed-paste from register ?
Hi,
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/d684944a-46f7-43c2-824c-221e6bd6e219n%40googlegroups.com.
ok, thanks Bram.
I was thinking perhaps something like -
let @b="\<Esc>[?2004h"
let @p="\<Esc>[?2004l"
<C-w>"b<C-w>"*<C-w>"p
might do it. But no matter, I can make sure my 'outer' terminal pastes w/BP instead of sending S-Insert ...
take care,
-m
On Thursday, August 12, 2021 at 9:12:17 AM UTC-4 Bram Moolenaar wrote:
> Thank you all always for awesome vim.
> If I have a mapping -
>
> tnoremap <S-Insert> <C-w>"*
>
> It does not seem to use bracketed-paste ?
> A 'p' in normal mode vim does use bracketed-paste.
> And a <C-r>* in insert mode vim does use bracketed-paste.
> Its just the same buffer but pasted in the terminal.
> Is bracketed-paste possible with a "* in a vim terminal ?
> My TERM inside the vim terminal is set to xterm-256color.
> vim termcap shows:
> t_BE=^[[?2004h
> t_BD=^[[?2004l
> t_PS <PasteStart> ^[[200~
> t_PE <PasteEnd> ^[[201~
Not sure what exactly you are doing, but I would think that in a
terminal window bracketed paste is controlled by the program running in
the terminal. E.g. if you run Vim in a terminal window it should work.
--
Q: What's orange and sounds like a parrot?
A: A carrot
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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 on the web visit https://groups.google.com/d/msgid/vim_use/d684944a-46f7-43c2-824c-221e6bd6e219n%40googlegroups.com.
Re: vim terminal bracketed-paste from register ?
> Thank you all always for awesome vim.
> If I have a mapping -
>
> tnoremap <S-Insert> <C-w>"*
>
> It does not seem to use bracketed-paste ?
> A 'p' in normal mode vim does use bracketed-paste.
> And a <C-r>* in insert mode vim does use bracketed-paste.
> Its just the same buffer but pasted in the terminal.
> Is bracketed-paste possible with a "* in a vim terminal ?
> My TERM inside the vim terminal is set to xterm-256color.
> vim termcap shows:
> t_BE=^[[?2004h
> t_BD=^[[?2004l
> t_PS <PasteStart> ^[[200~
> t_PE <PasteEnd> ^[[201~
Not sure what exactly you are doing, but I would think that in a
terminal window bracketed paste is controlled by the program running in
the terminal. E.g. if you run Vim in a terminal window it should work.
--
Q: What's orange and sounds like a parrot?
A: A carrot
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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 on the web visit https://groups.google.com/d/msgid/vim_use/202108121312.17CDC4Cx3213283%40masaka.moolenaar.net.
> If I have a mapping -
>
> tnoremap <S-Insert> <C-w>"*
>
> It does not seem to use bracketed-paste ?
> A 'p' in normal mode vim does use bracketed-paste.
> And a <C-r>* in insert mode vim does use bracketed-paste.
> Its just the same buffer but pasted in the terminal.
> Is bracketed-paste possible with a "* in a vim terminal ?
> My TERM inside the vim terminal is set to xterm-256color.
> vim termcap shows:
> t_BE=^[[?2004h
> t_BD=^[[?2004l
> t_PS <PasteStart> ^[[200~
> t_PE <PasteEnd> ^[[201~
Not sure what exactly you are doing, but I would think that in a
terminal window bracketed paste is controlled by the program running in
the terminal. E.g. if you run Vim in a terminal window it should work.
--
Q: What's orange and sounds like a parrot?
A: A carrot
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.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 on the web visit https://groups.google.com/d/msgid/vim_use/202108121312.17CDC4Cx3213283%40masaka.moolenaar.net.
Re: vim terminal bracketed-paste from register ?
Hi,
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/b7db1009-78d3-47bd-ae43-40dcd214de00n%40googlegroups.com.
> A 'p' in normal mode vim does use bracketed-paste.
> And a <C-r>* in insert mode vim does use bracketed-paste.
I meant to say bracketed-paste is not applicable for these two cases, and that they work ok.
thx,
-m
On Thursday, August 12, 2021 at 12:49:06 AM UTC-4 mckel...@gmail.com wrote:
Hi,Thank you all always for awesome vim.If I have a mapping -tnoremap <S-Insert> <C-w>"*It does not seem to use bracketed-paste ?A 'p' in normal mode vim does use bracketed-paste.And a <C-r>* in insert mode vim does use bracketed-paste.Its just the same buffer but pasted in the terminal.Is bracketed-paste possible with a "* in a vim terminal ?My TERM inside the vim terminal is set to xterm-256color.vim termcap shows:t_BE=^[[?2004ht_BD=^[[?2004lt_PS <PasteStart> ^[[200~t_PE <PasteEnd> ^[[201~thx,-m
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/b7db1009-78d3-47bd-ae43-40dcd214de00n%40googlegroups.com.
Wednesday, August 11, 2021
vim terminal bracketed-paste from register ?
Hi,
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/2156feb9-2b37-43be-b946-a808bf5145abn%40googlegroups.com.
Thank you all always for awesome vim.
If I have a mapping -
tnoremap <S-Insert> <C-w>"*
It does not seem to use bracketed-paste ?
A 'p' in normal mode vim does use bracketed-paste.
And a <C-r>* in insert mode vim does use bracketed-paste.
Its just the same buffer but pasted in the terminal.
Is bracketed-paste possible with a "* in a vim terminal ?
My TERM inside the vim terminal is set to xterm-256color.
vim termcap shows:
t_BE=^[[?2004h
t_BD=^[[?2004l
t_PS <PasteStart> ^[[200~
t_PE <PasteEnd> ^[[201~
thx,
-m
-- --
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 on the web visit https://groups.google.com/d/msgid/vim_use/2156feb9-2b37-43be-b946-a808bf5145abn%40googlegroups.com.
Thursday, August 5, 2021
Re: unicode: UTF / UCS
THX to EIKE and TONY for TIME and EFFORT @ REPLY!
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/714b5bfe-9f5b-4a96-8b2b-66701f331073n%40googlegroups.com.
I was confused due to reading the unicode documentation,
whereby utf-32 codepoints are local expandable with 1) blocks
in planes OR 2) whole planes... And intuitively
i had in mind the utf-8 is for downwardly compatible with us-ascii codespace.
The "usecase" with bash script and us-ascii puts the same into
my mind. Q: Is bash script reading text files similar to binary? (when i am
not allow to use a BOM). Meant, is not using a charset encoding
applied by linux.
Then partition tables, which should be readable
on different systems, are encoded with utf-16/ucs-2.
Thus implied to me, UCS-2 is a new standard for independent
decentralized 2-byte charsets. And the UTF is the local interpreting
process...
Finally, it doesnt matter - because the linux decoder seems to
be very rich of decision possibilities (e.g. creates 1-byte utf-8 file like us-ascii
until i use an utf-16 codepoint) and therefore my files should
be readable with the 1byte utf-8 for my lifetime.
But attention! ...with the modern "android smartphone" philosophy
i got brainwashed: At all cost - stay up-to-date with your software and hardware
systems, else you are not with us (community, life etc.) anymore.
Then i got _paranoid_ when i still know there is a new charset encoding
since years, and my system goes back to the deprecated one ... *take for fun*
sincerely
-kefko
...
http://www.johannes-koehler.de
antoine.m...@gmail.com schrieb am Montag, 2. August 2021 um 13:59:26 UTC+2:
As some have said above, UTF-8 is a variable-length encoding, which
encodes 7-bit ASCII characters exactly like us-ascii, and characters
(codepoints) above U+007F in two or more bytes, each of them with the
high bit set. Originally Unicode was foreseen to be able to go as far
up as U+3FFFFFFF, but when UTF-16 was crafted and surrogate codepoints
were assigned it was decided that codepoints higher than U+10FFFF
would never mean anything (and U+F0000 to U+10FFFF are "for private
use" anyway, i.e. transmitter and receiver have to agree on the
values, which are not defined by Unicode). The Wikipedia page about it
is well-written and I recommend reading it.
The so-called "byte order mark" U+FEFF ZERO-WIDTH NO-BREAK SPACE
should more appropriately be coded an "encoding mark" : it can
discriminate most Unicode encodings and endiannesses from each other,
including UTF-8, which has no byte-order ambiguity. At the head of a
UTF-8 file (e.g. an HTML file or CSS script, whose syntaxes expressly
support it), it means "This is UTF-8". However some programs which
expect only US-ASCII will choke if they get a file headed by a BOM:
for instance a #! "executable script" header will not be recognized if
it is preceded by a BOM, so if you want to start your first line by
#!/bin/bash or #!/bin/env python the file may be in UTF-8 (which
encodes the 128 ASCII characters just like us-ascii) but without BOM.
See:
https://en.wikipedia.org/wiki/Unicode
https://en.wikipedia.org/wiki/UTF-8
and beware that the Microsoft Windows documentation usually says
"Unicode" when what it means is "UTF-16" which represents each
codepoint in one, or sometimes two, 16-bit words.
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 on the web visit https://groups.google.com/d/msgid/vim_use/714b5bfe-9f5b-4a96-8b2b-66701f331073n%40googlegroups.com.
Monday, August 2, 2021
Re: unicode: UTF / UCS
As some have said above, UTF-8 is a variable-length encoding, which
encodes 7-bit ASCII characters exactly like us-ascii, and characters
(codepoints) above U+007F in two or more bytes, each of them with the
high bit set. Originally Unicode was foreseen to be able to go as far
up as U+3FFFFFFF, but when UTF-16 was crafted and surrogate codepoints
were assigned it was decided that codepoints higher than U+10FFFF
would never mean anything (and U+F0000 to U+10FFFF are "for private
use" anyway, i.e. transmitter and receiver have to agree on the
values, which are not defined by Unicode). The Wikipedia page about it
is well-written and I recommend reading it.
The so-called "byte order mark" U+FEFF ZERO-WIDTH NO-BREAK SPACE
should more appropriately be coded an "encoding mark" : it can
discriminate most Unicode encodings and endiannesses from each other,
including UTF-8, which has no byte-order ambiguity. At the head of a
UTF-8 file (e.g. an HTML file or CSS script, whose syntaxes expressly
support it), it means "This is UTF-8". However some programs which
expect only US-ASCII will choke if they get a file headed by a BOM:
for instance a #! "executable script" header will not be recognized if
it is preceded by a BOM, so if you want to start your first line by
#!/bin/bash or #!/bin/env python the file may be in UTF-8 (which
encodes the 128 ASCII characters just like us-ascii) but without BOM.
See:
https://en.wikipedia.org/wiki/Unicode
https://en.wikipedia.org/wiki/UTF-8
and beware that the Microsoft Windows documentation usually says
"Unicode" when what it means is "UTF-16" which represents each
codepoint in one, or sometimes two, 16-bit words.
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXtYN%3DvCHeQXiKygB864xYwr0GcnTxrUNRMfM-SvQc_2Xg%40mail.gmail.com.
encodes 7-bit ASCII characters exactly like us-ascii, and characters
(codepoints) above U+007F in two or more bytes, each of them with the
high bit set. Originally Unicode was foreseen to be able to go as far
up as U+3FFFFFFF, but when UTF-16 was crafted and surrogate codepoints
were assigned it was decided that codepoints higher than U+10FFFF
would never mean anything (and U+F0000 to U+10FFFF are "for private
use" anyway, i.e. transmitter and receiver have to agree on the
values, which are not defined by Unicode). The Wikipedia page about it
is well-written and I recommend reading it.
The so-called "byte order mark" U+FEFF ZERO-WIDTH NO-BREAK SPACE
should more appropriately be coded an "encoding mark" : it can
discriminate most Unicode encodings and endiannesses from each other,
including UTF-8, which has no byte-order ambiguity. At the head of a
UTF-8 file (e.g. an HTML file or CSS script, whose syntaxes expressly
support it), it means "This is UTF-8". However some programs which
expect only US-ASCII will choke if they get a file headed by a BOM:
for instance a #! "executable script" header will not be recognized if
it is preceded by a BOM, so if you want to start your first line by
#!/bin/bash or #!/bin/env python the file may be in UTF-8 (which
encodes the 128 ASCII characters just like us-ascii) but without BOM.
See:
https://en.wikipedia.org/wiki/Unicode
https://en.wikipedia.org/wiki/UTF-8
and beware that the Microsoft Windows documentation usually says
"Unicode" when what it means is "UTF-16" which represents each
codepoint in one, or sometimes two, 16-bit words.
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 on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXtYN%3DvCHeQXiKygB864xYwr0GcnTxrUNRMfM-SvQc_2Xg%40mail.gmail.com.
Statusline's minwidth not respected?
Vim gurus,
if I set the statusline as follows:
set statusline=X%1MX
the % item does not occupy any space if the buffer is unmodified,
despite the minimum width of one character. Is that expected behaviour?
What I would expect is what I get with:
set statusline=X%1(%M%)X
Thanks,
Life.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/se8cqm%24b7j%241%40ciao.gmane.io.
if I set the statusline as follows:
set statusline=X%1MX
the % item does not occupy any space if the buffer is unmodified,
despite the minimum width of one character. Is that expected behaviour?
What I would expect is what I get with:
set statusline=X%1(%M%)X
Thanks,
Life.
--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/se8cqm%24b7j%241%40ciao.gmane.io.
Sunday, August 1, 2021
Re: unicode: UTF / UCS
Hi 'Johannes,
On Saturday, 2021-07-31 12:37:08 +0200, 'Johannes Köhler' via vim_use wrote:
> > It's not that simple unfortunately, UTF-16 (let's leave aside UCS-2, it
> > shouldn't matter) cannot be assumed to always have two bytes per
>
> UCS: _Uni_versal _Cod_ed Character Set
>
> In my mind, UCS is the mathematical quantum and UTF the
> encoding/decoding function using this:
> magnitudes: 16(32)bit
> plurality: charset / coded character
You are confusing things.
UCS-4 and UTF-32 as its subset are capable to hold respectively encode
assigned Unicode characters as direct representations of the Unicode
characters' code points.
UCS-2 is a 2-byte fixed width character set capable of encoding 65536
characters, or just the Unicode Basic Multilingual Plane (BMP).
UTF-16 is capable to encode the entire Unicode character range. It is
almost identical to UCS-2 in the first 64k characters, except the
"escape sequences" it needs to represent surrogate pairs for characters
of higher planes.
> Assuming that the data of the hdd partition tables (e.g.UID),
> used by the operating system, are encoded in 16bit Unicode.
> Well, my inferring thoughts were that UCS-2 is a
> hardware encoding, UTF-8 for ASCII purpose, UTF-32 a
> high level programmer attitude and UTF-16 the real unicode.
That's all nonsense. Really.
> In the end that means, the controller is made for 2-byte.
> The old ASCII code needs 7bit and probably one for
> sth., now than UTF-8 has to work with a different endian.
There is no endianess in UTF-8. Unless your hardware has less than
8 bits per word..
> And... why should i use a deprecated ASCII scheme
> at my system, when i can have lots of advantage
> using utf-16 (e.g. control/hash functions). It fells
> like utf-8 is a "work around" wrapper for
> the ASCII scheme...
UTF-8 is an efficient encoding that for Unicode characters <128 (which
happen to be identical with ASCII and a subset of Unicode) needs only
1 byte per character, whereas UTF-16 needs at least 2 bytes for each
character.
UTF-16 is a workaround for those who wanted Unicode and started off with
UCS-2 but then realized there's more than just BMP.
Or, UTF-16 is the devil's work:
https://robert.ocallahan.org/2008/01/string-theory_08.html
Eike
--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.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 on the web visit https://groups.google.com/d/msgid/vim_use/YQdSsnKXRVsDvhFt%40kulungile.erack.de.
On Saturday, 2021-07-31 12:37:08 +0200, 'Johannes Köhler' via vim_use wrote:
> > It's not that simple unfortunately, UTF-16 (let's leave aside UCS-2, it
> > shouldn't matter) cannot be assumed to always have two bytes per
>
> UCS: _Uni_versal _Cod_ed Character Set
>
> In my mind, UCS is the mathematical quantum and UTF the
> encoding/decoding function using this:
> magnitudes: 16(32)bit
> plurality: charset / coded character
You are confusing things.
UCS-4 and UTF-32 as its subset are capable to hold respectively encode
assigned Unicode characters as direct representations of the Unicode
characters' code points.
UCS-2 is a 2-byte fixed width character set capable of encoding 65536
characters, or just the Unicode Basic Multilingual Plane (BMP).
UTF-16 is capable to encode the entire Unicode character range. It is
almost identical to UCS-2 in the first 64k characters, except the
"escape sequences" it needs to represent surrogate pairs for characters
of higher planes.
> Assuming that the data of the hdd partition tables (e.g.UID),
> used by the operating system, are encoded in 16bit Unicode.
> Well, my inferring thoughts were that UCS-2 is a
> hardware encoding, UTF-8 for ASCII purpose, UTF-32 a
> high level programmer attitude and UTF-16 the real unicode.
That's all nonsense. Really.
> In the end that means, the controller is made for 2-byte.
> The old ASCII code needs 7bit and probably one for
> sth., now than UTF-8 has to work with a different endian.
There is no endianess in UTF-8. Unless your hardware has less than
8 bits per word..
> And... why should i use a deprecated ASCII scheme
> at my system, when i can have lots of advantage
> using utf-16 (e.g. control/hash functions). It fells
> like utf-8 is a "work around" wrapper for
> the ASCII scheme...
UTF-8 is an efficient encoding that for Unicode characters <128 (which
happen to be identical with ASCII and a subset of Unicode) needs only
1 byte per character, whereas UTF-16 needs at least 2 bytes for each
character.
UTF-16 is a workaround for those who wanted Unicode and started off with
UCS-2 but then realized there's more than just BMP.
Or, UTF-16 is the devil's work:
https://robert.ocallahan.org/2008/01/string-theory_08.html
Eike
--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.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 on the web visit https://groups.google.com/d/msgid/vim_use/YQdSsnKXRVsDvhFt%40kulungile.erack.de.