:p & :P bugs?

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

:p & :P bugs?

Tim Chase
Brought to my attention by this thread:

https://www.reddit.com/r/vim/comments/a3e80i/is_vim_right_for_me/

It seems to me that :p should always only print the line, even if
'number' is set.  If you want to print the line with its line-number,
you can either use ":p#" (:help ex-flags) or even just ":#".  But
without storing 'nu' and deactivating it before issuing and restoring
the state of 'nu' after, there's no way to get unnumbered results.

Additionally, while reading over those docs, I encountered that
":P[rint]" should do the same thing as ":p", but netrwPlugin.vim
overrides ":P" in a fairly stock environment (in a fresh OpenBSD
system, installed vim; invoking "vim" had netrwPlugin loaded).  That
said, if invoked as "vim -u NONE", the `:P` works as documented.  So
it seems like either the docs should be updated so that ":help :P"
goes to netrw docs; or netrw's "Pexplore" shouldn't override the
built-in ":P"

(and here's hoping that your mail-client doesn't turn all those
colon-P strings into smile-with-tongue-out emoji)

-tim



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: :p & :P bugs?

Jürgen Krämer-4

Hi,

Tim Chase schrieb am 06.12.2018 um 14:19:
> Brought to my attention by this thread:
>
> https://www.reddit.com/r/vim/comments/a3e80i/is_vim_right_for_me/
>
> It seems to me that :p should always only print the line, even if
> 'number' is set.  If you want to print the line with its line-number,
> you can either use ":p#" (:help ex-flags) or even just ":#".  But
> without storing 'nu' and deactivating it before issuing and restoring
> the state of 'nu' after, there's no way to get unnumbered results.

this seems to be mandated by POSIX. From

  http://pubs.opengroup.org/onlinepubs/007904975/utilities/ex.html#tag_04_45_13_31

| If the # flag is specified or the number edit option is set, each line
| shall be preceded by its line number in the following format:
|
| "%6dΔΔ", <line number>

(The "ΔΔ" probably represents two spaces.)

Regards,
Jürgen

--
~
~
~
:wq

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: :p & :P bugs?

Christian Brabandt
In reply to this post by Tim Chase

On Do, 06 Dez 2018, Tim Chase wrote:

> Brought to my attention by this thread:
>
> https://www.reddit.com/r/vim/comments/a3e80i/is_vim_right_for_me/
>
> It seems to me that :p should always only print the line, even if
> 'number' is set.  If you want to print the line with its line-number,
> you can either use ":p#" (:help ex-flags) or even just ":#".  But
> without storing 'nu' and deactivating it before issuing and restoring
> the state of 'nu' after, there's no way to get unnumbered results.

I think this is demanded by Posix, as I have mentioned here:
https://github.com/vim/vim/issues/2862

> Additionally, while reading over those docs, I encountered that
> ":P[rint]" should do the same thing as ":p", but netrwPlugin.vim
> overrides ":P" in a fairly stock environment (in a fresh OpenBSD
> system, installed vim; invoking "vim" had netrwPlugin loaded).  That
> said, if invoked as "vim -u NONE", the `:P` works as documented.  So
> it seems like either the docs should be updated so that ":help :P"
> goes to netrw docs; or netrw's "Pexplore" shouldn't override the
> built-in ":P"

Hm, we explicitly allow to overrule :Print since 7.3.054, but do not
allow e.g. :Next

> (and here's hoping that your mail-client doesn't turn all those
> colon-P strings into smile-with-tongue-out emoji)

:-P

Best,
Christian
--
Wer in einer Gesellschaft ein Bonmot erklärt, hat seine Feinheit nicht
verstanden.
                -- Jean Paul

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: :p & :P bugs?

Bram Moolenaar
In reply to this post by Tim Chase

Tim Chase wrote:

> Brought to my attention by this thread:
>
> https://www.reddit.com/r/vim/comments/a3e80i/is_vim_right_for_me/
>
> It seems to me that :p should always only print the line, even if
> 'number' is set.  If you want to print the line with its line-number,
> you can either use ":p#" (:help ex-flags) or even just ":#".  But
> without storing 'nu' and deactivating it before issuing and restoring
> the state of 'nu' after, there's no way to get unnumbered results.
>
> Additionally, while reading over those docs, I encountered that
> ":P[rint]" should do the same thing as ":p", but netrwPlugin.vim
> overrides ":P" in a fairly stock environment (in a fresh OpenBSD
> system, installed vim; invoking "vim" had netrwPlugin loaded).  That
> said, if invoked as "vim -u NONE", the `:P` works as documented.  So
> it seems like either the docs should be updated so that ":help :P"
> goes to netrw docs; or netrw's "Pexplore" shouldn't override the
> built-in ":P"
>
> (and here's hoping that your mail-client doesn't turn all those
> colon-P strings into smile-with-tongue-out emoji)

These are old Vi commands.  Keeping them working as they did in the past
40 years is more important than some tuning of their behavior.

If you actually use :P for printing a line (I never do that), you can
redefine :Pexplore somehow.  I don't think there are enough users that
run into this for it to matter.

--
OLD WOMAN: King of the WHO?
ARTHUR:    The Britons.
OLD WOMAN: Who are the Britons?
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: :p & :P bugs?

Tim Chase
In reply to this post by Christian Brabandt
On 2018-12-06 14:39, Christian Brabandt wrote:

> > Brought to my attention by this thread:
> >
> > https://www.reddit.com/r/vim/comments/a3e80i/is_vim_right_for_me/
> >
> > It seems to me that :p should always only print the line, even if
> > 'number' is set.  If you want to print the line with its
> > line-number, you can either use ":p#" (:help ex-flags) or even
> > just ":#".  But without storing 'nu' and deactivating it before
> > issuing and restoring the state of 'nu' after, there's no way to
> > get unnumbered results.  
>
> I think this is demanded by Posix

Okay, I'm good with that as an explanation. Still think it's
annoying, but won't fight with POSIX :-)

-tim


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.