gpt4 book ai didi

vim - 查看 Snipmate 的可用片段(备忘单)

转载 作者:行者123 更新时间:2023-12-04 23:07:25 24 4
gpt4 key购买 nike

有没有办法检查所有可用的 snipMate 片段?喜欢 i <c-r><tab>是的,但有更多信息吗?

我很好奇:

  • 它将完成的字符串。
  • 如果可用,请提供带有代码段的描述或评论。

  • 一些允许转换为 HTML 的工具会很棒,但在 vim 中的技巧也会很酷:)

    最佳答案

    这可能有帮助,也可能无济于事,但我整理了一个“ls_snip”shell 脚本,它将列出各种文件类型的片段和任何前面的注释。它没有以任何方式集成到 vim 中,并且依赖于 *nix 操作系统。此外,仅适用于snippets/filetype.snippets 文件而不适用于snippets/filetype/match.snippets 文件。您可以根据自己的喜好从这里破解它。

    将它放在某个 PATH 目录中的 ls_snip 中,并使其可执行。

    #! /bin/bash
    list_snippets_for() {
    egrep "^snippet|^#" ~/.vim/snippets/$1.snippets | awk '/^#/ {comment = comment $0} /^snippet/ {print $0 "\t\t" comment; comment=""}'
    }

    if [ "$1" == "" ]
    then
    echo "You must specify at least one file type as an argument to ls_snip"
    exit
    fi

    for filetype in "$@"
    do
    echo `echo $filetype | awk '{print toupper($0)}'`
    list_snippets_for $filetype
    echo
    done

    这是一个示例输出
    [lwoodson@lwoodson-mint-vb spike] [root@rva-lw] $ ls_snip javascript html
    JAVASCRIPT
    snippet proto # Prototype
    snippet fun # Function
    snippet f # Anonymous Function
    snippet if # if
    snippet ife # if ... else
    snippet t # tertiary conditional
    snippet switch # switch
    snippet case # case
    snippet for # for (...) {...}
    snippet forr # for (...) {...} (Improved Native For-Loop)
    snippet wh # while (...) {...}
    snippet do # do...while
    snippet :f # Object Method
    snippet timeout # setTimeout function
    snippet get # Get Elements
    snippet gett # Get Element

    HTML
    snippet nbs # Some useful Unicode entities# Non-Breaking Space
    snippet left # ←
    snippet right # →
    snippet up # ↑
    snippet down # ↓
    snippet return # ↩
    snippet backtab # ⇤
    snippet tab # ⇥
    snippet shift # ⇧
    snippet control # ⌃
    snippet enter # ⌅
    snippet command # ⌘
    snippet option # ⌥
    snippet delete # ⌦
    snippet backspace # ⌫
    snippet escape # ⎋
    snippet doctype HTML 4.01 Strict # Generic Doctype
    snippet doctype HTML 4.01 Transitional
    snippet doctype HTML 5
    snippet doctype XHTML 1.0 Frameset
    snippet doctype XHTML 1.0 Strict
    snippet doctype XHTML 1.0 Transitional
    snippet doctype XHTML 1.1
    snippet docts # HTML Doctype 4.01 Strict
    snippet doct # HTML Doctype 4.01 Transitional
    snippet doct5 # HTML Doctype 5
    snippet docxf # XHTML Doctype 1.0 Frameset
    snippet docxs # XHTML Doctype 1.0 Strict
    snippet docxt # XHTML Doctype 1.0 Transitional
    snippet docx # XHTML Doctype 1.1
    snippet html
    snippet xhtml
    snippet body
    snippet head
    snippet title
    snippet script
    snippet scriptsrc
    snippet style
    snippet base
    snippet r
    snippet div
    snippet movie # Embed QT Movie
    snippet fieldset
    snippet form
    snippet h1
    snippet input
    snippet label
    snippet link
    snippet mailto
    snippet meta
    snippet opt
    snippet optt
    snippet select
    snippet table
    snippet textarea
    snippet fcg

    关于vim - 查看 Snipmate 的可用片段(备忘单),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8607662/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com