15
V2EX  ›  问与答

有什么办法让编辑器把一个 txt 文件按 php 的语法来显示呢?

  •  1
     
  •   15 · Apr 9, 2015 · 3615 views
    This topic created in 4063 days ago, the information mentioned may be changed or developed.
    其实这里面的txt和php都可以替换,例如我想把htm文件识别为py,按py的语法高亮显示

    我平时用的是editplus,如果editplus没办法实现,其他编辑器也可以的
    8 replies    2015-04-26 09:49:47 +08:00
    Jat001
        1
    Jat001  
       Apr 9, 2015   ❤️ 2
    sublime text
    Puteulanus
        2
    Puteulanus  
       Apr 9, 2015

    我用的sublime text,可以手动改。。
    zangbob
        3
    zangbob  
       Apr 9, 2015
    同2楼。ST3很好用
    hitsmaxft
        4
    hitsmaxft  
       Apr 9, 2015
    vim 的话


    最后加入一行

    # vim:ft=php

    第一字符按该语言的注释语法,ft 是 filetype 的意思, 当然,一般是会自动根据 扩展名识别文件类型的
    aaaa007cn
        5
    aaaa007cn  
       Apr 9, 2015
    vim
    :set filetype=php

    notepad++ 可以直接菜单调整语法高亮
    editplus 应该也可以
    http://editplus.info/wiki/FAQ#How_do_I_make_EditPlus_correctly_highlight_the_syntax_of_a_file_with_no_extension.3F
    Document > Change File Type?
    zts1993
        6
    zts1993  
       Apr 10, 2015 via Android
    st2 快捷键 ctrl shit p 搜索php
    invite
        7
    invite  
       Apr 10, 2015
    在设置里面, txt类型的,把php语法文件添加进去就好了。
    mingyun
        8
    mingyun  
       Apr 26, 2015
    ctrl+shift+p 输入set syntax: ,选择php
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5603 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 68ms · UTC 03:47 · PVG 11:47 · LAX 20:47 · JFK 23:47
    ♥ Do have faith in what you're doing.