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} -

1 Answer 1

3

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.