15
V2EX  ›  问与答

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

  •  1
     
  •   15 · Apr 9, 2015 · 4072 views
    This topic created in 4226 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
    Jat001
    Apr 9, 2015❤️2
    1
    sublime text
    Puteulanus
    Puteulanus
    Apr 9, 2015
    2

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


    最后加入一行

    # vim:ft=php

    第一字符按该语言的注释语法,ft 是 filetype 的意思, 当然,一般是会自动根据 扩展名识别文件类型的
    aaaa007cn
    aaaa007cn
    Apr 9, 2015
    5
    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
    zts1993
    Apr 10, 2015 via Android
    6
    st2 快捷键 ctrl shit p 搜索php
    invite
    invite
    Apr 10, 2015
    7
    在设置里面, txt类型的,把php语法文件添加进去就好了。
    mingyun
    mingyun
    Apr 26, 2015
    8
    ctrl+shift+p 输入set syntax: ,选择php
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1411 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:27 · PVG 06:27 · LAX 14:27 · JFK 17:27
    ♥ Do have faith in what you're doing.