3

Usually, vim will get the highlighting right from the file extension, but this obviously doesn't work when I'm displaying content read from standard input.

cat File.hs | some | processing | pipeline | view -

I can obtain the proper highlighting with

:set syntax=haskell

but that's awkward to do multiple times. How do I select the highlighting right at command-line invocation?

cat File.hs | vim -R {???syntax=haskell} -
3

You can use +command to execute command after the "file" is loaded:

cat File.hs | some | processing | pipeline | vim -R +'setf haskell' -
  • Great, works. What exactly is setf? – leftaroundabout Mar 19 '16 at 16:40
  • 2
    See :help :setf. – romainl Mar 19 '16 at 17:56

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.