Printing code with syntax highlighting?

后端 未结 13 2432
轻奢々
轻奢々 2021-02-01 16:00

I have occasion to need to print code (Horrors!!! ;) ), and i was wondering what editor or tool would i use to print that code out with proper formatting and syntax highlighting

13条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-01 16:29

    Solution For Bash Shell

    1. Add this line to ~/.bashrc if you are using UBUNTU
      or, to ~/.bash_profile if you are using MAC
      If that file does not exists, create it.

      alias lprc='vim -me -c ":syntax on" -c ":hardcopy" -c ":q"'

    2. source ~/.bashrc or source ~/.bash_profile

    3. To print colored hello.py just do this:
      lprc hello.py instead of lpr hello.py

提交回复
热议问题