As a test, I have created a one line .vimrc file and have an empty .vim/ directory. The .vimrc file is:

nnoremap <leader>fed :e ~/vimrc.test<CR> | echom "opening vimrc . . ."

On vim startup, it displays the opening vimrc text, then waits for input.

Is this expected behavior?


You need a backslash before your pipe \| in order for it all to be considered part of the nnoremap command. Also, you'll want to add a colon before echom and add another <CR> at the end. Try:

nnoremap <leader>fed :e ~/vimrc.test<CR>\|:echom "opening vimrc . . ."<CR>
  • That didn't work. That having been said I found a work around solution to moving the echom command to the bottom of the .vimrc file
    – DrewM
    Sep 8 '18 at 0:42
  • 1
    @DrewM echom needs to be :echom, you'll need two <CR>s, and you can't have spaces around the \|; I've updated the answer. Also see :help map-bar by the way. Sep 8 '18 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.