issue subtituting new lines

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

issue subtituting new lines

Eli the Bearded
I use several versions of vim throughout the day, all inside xterms, and
some inside tmux running in an xterm. Some versions of vim I have
noticed break my long standing way of adding newlines in a :s///
substitute command.

To make all %% sequences turn into a new line, what I'd type is:

  colon percent s slash percent percent slash ctrl-v ctrl-m slash g enter

And that would look like this in vi, nvi, and vim up until recently:

  :%s/%%/^M/g

On the versions that break that, it instead looks like this:

  :%s/%%/^[[27;5;109~/g

Which will not (does not) provide the subtitution I want.

I have found the vim I'm using on NetBSD inside xterms without tmux
do this, but that same vim on NetBSD inside xterms with tmux does not
do that.

:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan  7 2020 09:55:54)
Included patches: 1-2200
[...]

:r! uname -sr
NetBSD 8.1

Inside tmux, $TERM is "screen", outside tmux $TERM is "xterm",
$XTERM_VERSION is "XTerm(330)". Figuring out the exact differences
between the screen and xterm terminal definitions is not something I
want to dive into.

If I use vim.old on that same system, the substitute works inside and
outside of tmux. On vim.old:

:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 11 2019 15:16:00)
Included patches: 1-1517

Is this a known bug that has been fixed in a patch after 2200? If so,
I'll request the vim here be updated. If not, can this be fixed? (And
then I'll request the update.)

thanks,
Elijah

--
--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/49RNSv1Yp1zfYt%40panix5.panix.com.
Reply | Threaded
Open this post in threaded view
|

Re: issue subtituting new lines

Christian Brabandt

On Di, 19 Mai 2020, Eli the Bearded wrote:

> I use several versions of vim throughout the day, all inside xterms, and
> some inside tmux running in an xterm. Some versions of vim I have
> noticed break my long standing way of adding newlines in a :s///
> substitute command.
>
> To make all %% sequences turn into a new line, what I'd type is:
>
>   colon percent s slash percent percent slash ctrl-v ctrl-m slash g enter
>
> And that would look like this in vi, nvi, and vim up until recently:
>
>   :%s/%%/^M/g
>
> On the versions that break that, it instead looks like this:
>
>   :%s/%%/^[[27;5;109~/g
>
> Which will not (does not) provide the subtitution I want.
>
> I have found the vim I'm using on NetBSD inside xterms without tmux
> do this, but that same vim on NetBSD inside xterms with tmux does not
> do that.
>
> :version
> VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan  7 2020 09:55:54)
> Included patches: 1-2200
> [...]
>
> :r! uname -sr
> NetBSD 8.1
>
> Inside tmux, $TERM is "screen", outside tmux $TERM is "xterm",
> $XTERM_VERSION is "XTerm(330)". Figuring out the exact differences
> between the screen and xterm terminal definitions is not something I
> want to dive into.
>
> If I use vim.old on that same system, the substitute works inside and
> outside of tmux. On vim.old:
>
> :version
> VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 11 2019 15:16:00)
> Included patches: 1-1517
>
> Is this a known bug that has been fixed in a patch after 2200? If so,
> I'll request the vim here be updated. If not, can this be fixed? (And
> then I'll request the update.)

A feature or a bug i suppose. What you are seeing are the effects of the
modifyOtherKeys feature of Vim and xterm (see :h modifyOtherKeys).

I am not sure why it happens for you when pressing CTRL-V in command
line mode, it does work for me as expected, unless you accidentally
pressed Shift-Ctrl-V instead of Ctrl-V

To disable it, set the t_TI and t_TE terminal settings to the empty
string:

let &t_TI=""
let &t_TE=""


Best,
Christian
--
Das Beste in einem Menschen ist das, was er selber nicht kennt.
                -- 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].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200519175846.GB16708%40256bit.org.
Reply | Threaded
Open this post in threaded view
|

Re: issue subtituting new lines

Eli the Bearded
Christian Brabandt <[hidden email]> wrote:

> On Di, 19 Mai 2020, Eli the Bearded wrote:
>> And that would look like this in vi, nvi, and vim up until recently:
>> :%s/%%/^M/g
>> On the versions that break that, it instead looks like this:
>> :%s/%%/^[[27;5;109~/g
> A feature or a bug i suppose. What you are seeing are the effects of the
> modifyOtherKeys feature of Vim and xterm (see :h modifyOtherKeys).
>
> I am not sure why it happens for you when pressing CTRL-V in command
> line mode, it does work for me as expected, unless you accidentally
> pressed Shift-Ctrl-V instead of Ctrl-V

No, I was quite careful in what I typed. But reading :h modifyOtherKeys
leads me to understand what is going on.

If, when modifyOtherKeys is enabled, instead of:

  colon percent s slash percent percent slash ctrl-v ctrl-m slash g enter

I type:

  colon percent s slash percent percent slash ctrl-v enter slash g enter

I get the:

  :%s/%%/^M/g

output I expect. xterm and vim are trying to represent a <ctrl-m> as
different than <enter> with that setting and I'm seeing the results. But
since <enter> is what I really want, actually using <enter> works.

I'll have to mull over if I consider this an improvement or not.

> To disable it, set the t_TI and t_TE terminal settings to the empty
> string:
>
> let &t_TI=""
> let &t_TE=""

Why that syntax instead of "set t_TI=|set t_TE="? I'm already using
"set t_Co=0" in ~/.vimrc to disable colors. (Specifically it sets
the number of colors available to zero.) In testing, both forms seem
to work in .vimrc, and neither seems to work from the ":" prompt --
even after I ":!ls" as suggested by the help page.

Thanks for finding that.

Elijah

--
--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/49RVBx4fKWzfYt%40panix5.panix.com.
Reply | Threaded
Open this post in threaded view
|

Re: issue subtituting new lines

Ken Takata-2
Hi,

2020/5/20 Wed 6:58:58 UTC+9 Eli the Bearded wrote:
Christian Brabandt <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="tRMat7nmBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">cbl...@...> wrote:

> On Di, 19 Mai 2020, Eli the Bearded wrote:
>> And that would look like this in vi, nvi, and vim up until recently:
>> :%s/%%/^M/g
>> On the versions that break that, it instead looks like this:
>> :%s/%%/^[[27;5;109~/g
> A feature or a bug i suppose. What you are seeing are the effects of the
> modifyOtherKeys feature of Vim and xterm (see :h modifyOtherKeys).
>
> I am not sure why it happens for you when pressing CTRL-V in command
> line mode, it does work for me as expected, unless you accidentally
> pressed Shift-Ctrl-V instead of Ctrl-V

No, I was quite careful in what I typed. But reading :h modifyOtherKeys
leads me to understand what is going on.

If, when modifyOtherKeys is enabled, instead of:

  colon percent s slash percent percent slash ctrl-v ctrl-m slash g enter

I type:

  colon percent s slash percent percent slash ctrl-v enter slash g enter

I get the:

  :%s/%%/^M/g

output I expect. xterm and vim are trying to represent a <ctrl-m> as
different than <enter> with that setting and I'm seeing the results. But
since <enter> is what I really want, actually using <enter> works.

I'll have to mull over if I consider this an improvement or not.

> To disable it, set the t_TI and t_TE terminal settings to the empty
> string:
>
> let &t_TI=""
> let &t_TE=""

Why that syntax instead of "set t_TI=|set t_TE="? I'm already using
"set t_Co=0" in ~/.vimrc to disable colors. (Specifically it sets
the number of colors available to zero.) In testing, both forms seem
to work in .vimrc, and neither seems to work from the ":" prompt --
even after I ":!ls" as suggested by the help page.

Thanks for finding that.

Elijah

I think this behavior is fixed in 8.1.2350.
Both Ctrl-V Ctrl-M and Ctrl-V <Enter> will input ^M now.

Regards,
Ken Takata

--
--
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].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/de8b0963-143c-4fd8-aecc-87f7e031813f%40googlegroups.com.