Skip to content

Substitution with an expression breaks messages #23

@chocolateboy

Description

@chocolateboy

Vim: 8.0
OS: Linux (Arch)
eregex: 950027d

Messages created with echom(sg) aren't displayed correctly or saved to the message history when using :%S/<pattern>/\=<expression>/.

echom-vimrc

call plug#begin()
Plug 'othree/eregex.vim'
call plug#end()

set nocompatible

" echo the supplied arg and return it unchanged
function! Echo(arg)
    echomsg 'arg: ' . a:arg
    return a:arg
endfunction

steps to reproduce

native (:substitute)

  • open a file with vim -u echom-vimrc test.txt
  • insert the word "foo", and replace it with: :%s/foo/\=Echo('bar')/
  • undo the change, then re-run the substitution
  • the message ("arg: foo") is displayed after each substitution, and appears twice in the output of :messages

eregex (:S)

  • open a file with vim -u echom-vimrc test.txt
  • insert the word "foo", and replace it with: :%S/foo/\=Echo('bar')/
  • undo the change, then re-run the substitution
  • the message ("arg: foo") is only displayed after the first substitution, and doesn't appear at all in the output of :messages

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions