1

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?

  • 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 '19 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 '19 at 6:02