Skip to main content
added 9 characters in body; edited title
Source Link
D. Ben Knoble
  • 27.7k
  • 3
  • 31
  • 68

Multiline string passed in bash Pass visually-selected text as argument to script

I am trying to write a command that passes selected text to a shell script.

The command works fine when there is no \n character in the selected text (using Visual mode).

:vmap <Leader>tts 0y:silent exec ":!/home/user/tts.sh ".@0 <Enter>

The problems occurs when I try to select multiple lines. I tried to surround the shell script arguments with escaped quotes

:vmap <Leader>tts 0y:silent exec ":!/home/user/tts.sh \"".@0."\"" <Enter>

But this solution doesn't work either.

How can I do this?

I am using neovim v0.4.4

Any hint ?.

Multiline string passed in bash script

I am trying to write a command that passes selected text to a shell script.

The command works fine when there is no \n character in the selected text (using Visual mode).

:vmap <Leader>tts 0y:silent exec ":!/home/user/tts.sh ".@0 <Enter>

The problems occurs when I try to select multiple lines. I tried to surround the shell script arguments with escaped quotes

:vmap <Leader>tts 0y:silent exec ":!/home/user/tts.sh \"".@0."\"" <Enter>

But this solution doesn't work either.

I am using neovim v0.4.4

Any hint ?

Pass visually-selected text as argument to script

I am trying to write a command that passes selected text to a shell script.

The command works fine when there is no \n character in the selected text (using Visual mode).

:vmap <Leader>tts 0y:silent exec ":!/home/user/tts.sh ".@0 <Enter>

The problems occurs when I try to select multiple lines. I tried to surround the shell script arguments with escaped quotes

:vmap <Leader>tts 0y:silent exec ":!/home/user/tts.sh \"".@0."\"" <Enter>

But this solution doesn't work either.

How can I do this?

I am using neovim v0.4.4.

Source Link

Multiline string passed in bash script

I am trying to write a command that passes selected text to a shell script.

The command works fine when there is no \n character in the selected text (using Visual mode).

:vmap <Leader>tts 0y:silent exec ":!/home/user/tts.sh ".@0 <Enter>

The problems occurs when I try to select multiple lines. I tried to surround the shell script arguments with escaped quotes

:vmap <Leader>tts 0y:silent exec ":!/home/user/tts.sh \"".@0."\"" <Enter>

But this solution doesn't work either.

I am using neovim v0.4.4

Any hint ?