1

This question already has an answer here:

recently i stumpled over vim :terminal mode. i am really exited about that. now i wanted to ask, how i can create a mapping, which sends a command, including a pipe symbol to :terminal? it should look like this:

nnoremap <leader>hcu :term echo "hello" | grep "ll"<CR>

But gives me something like this: https://i.imgur.com/kFdYzgF.png

Any hints, on how i can use commands like this with the :term command?

marked as duplicate by Martin Tournoij May 14 at 5:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    However, there is one noteworthy aspect that is not covered here. The command you tell the :term command to be run, won't be processed by the shell, so output redirection like using a | (pipe) cannot work. The :term command expects the command provided to be executed directly (see also this question). – Christian Brabandt May 14 at 6:02
  • 2
    So you have to provide the shell command to be run directly and make sure to use double quotes to quote the necessary parts, as single quotes might not always work. – Christian Brabandt May 14 at 6:02