第六章 Using syntax highlighting

usr_06 Using syntax highlighting

06.1 Switching it on
:syntax enable                                                                                                                                                                                                       
        if &t_Co > 1                                                                                                                                                                                                 
           syntax enable                                                                                                                                                                                             
        endif                                                                                                                                                                                                        
06.2 No or wrong colors?
  • Your terminal does not support colors.
  • Your terminal does support colors, but Vim doesn’t know this.
                TERM=xterm-color; export TERM                                                                                                                                                                        
  • The file type is not recognized.
                :set filetype                                                                                                                                                                                        
                :set filetype=fortran                                                                                                                                                                                
  • There is no highlighting for your file type.
    you can write your own syntax file.
    Or the colors could be wrong:
  • The colored text is very hard to read.
                :set background=dark                                                                                                                                                                                 
                :set background=light                                                                                                                                                                                
  • The colors are wrong when scrolling bottom to top.
06.3 Different colors
        :colorscheme evening                                                                                                                                                                                         

You could also write your own color scheme.

06.4 With colors or without colors
        :syntax clear                                                                                                                                                                                                
        :syntax off                                                                                                                                                                                                  
        :syntax manual                                                                                                                                                                                               
        :set syntax=ON                                                                                                                                                                                               
06.5 Printing with colors

Convert the current file to HTML with this command:

        :TOhtml                                                                                                                                                                                                      
06.6 Further reading
usr_44.txt  Your own syntax highlighted.                                                                                                                                                                             
syntax      All the details.                                                                                                                                                                                         
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值