1

In vim8, you can do:

:. term

to send the current line to execute in your terminal's shell (e.g., bash).

But how, in normal and ex mode, do you execute a single line that contains line continuations -- ie backslash characters (\) like the following?

curl 'http://localhost:8983/solr/films/select?q=*:*&rows=0'\
'&facet=true'\
'&facet.range=initial_release_date'\
'&facet.range.start=NOW-20YEAR'\
'&facet.range.end=NOW'\
'&facet.range.gap=%2B1YEAR'

The following works but seems clumsy:

:%s/\\\n// | . term
  • 2
    just select the lines in visual mode, then :'<,'>term or use any other range – Mass Mar 30 '18 at 17:25
  • @Mass that works great "as is" (thanks!), but fails if I use tabs or spaces on subsequent lines: curl: (6) Could not resolve host: &facet=true and curl: (6) Could not resolve host: &facet.range=initial_release_date etc – mellow-yellow Mar 30 '18 at 17:45
  • are you sure that even works in bash? stackoverflow.com/a/7316194 – Mass Mar 30 '18 at 19:24

Your Answer

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

Browse other questions tagged or ask your own question.