Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim 查看Snipmate的可用代码段(备忘单)_Vim_Snipmate - Fatal编程技术网

Vim 查看Snipmate的可用代码段(备忘单)

Vim 查看Snipmate的可用代码段(备忘单),vim,snipmate,Vim,Snipmate,有没有办法检查所有可用的snipMate片段?像i那样,但是有更多的信息吗 我很好奇: 它将完成的字符串 如果可用,请提供代码段的说明或注释 一些允许转换为HTML的工具将非常棒,但vim中的技巧也很酷:)否。 坦率地说,我并不认为这个选项完全是非常有用的。因为代码片段是在键入一个短单词时插入的文本块,所以您不必完整地键入它们。它们是你记忆中的东西,只是不想一遍又一遍地打字 它们不是半可视化编程中的代码块,您只需插入预定义的块。这就是你的目标 签出代码段最简单的方法是浏览代码段文件。这可能有

有没有办法检查所有可用的snipMate片段?像
i
那样,但是有更多的信息吗

我很好奇:

  • 它将完成的字符串
  • 如果可用,请提供代码段的说明或注释
一些允许转换为HTML的工具将非常棒,但vim中的技巧也很酷:)

否。

坦率地说,我并不认为这个选项完全是非常有用的。因为代码片段是在键入一个短单词时插入的文本块,所以您不必完整地键入它们。它们是你记忆中的东西,只是不想一遍又一遍地打字

它们不是半可视化编程中的代码块,您只需插入预定义的块。这就是你的目标


签出代码段最简单的方法是浏览代码段文件。

这可能有帮助,也可能没有帮助,但我编写了一个“ls_snip”shell脚本,它将列出各种文件类型的代码段和前面的任何注释。它没有以任何方式集成到vim中,并且依赖于*nix操作系统。此外,仅适用于snippets/filetype.snippets文件,而不适用于snippets/filetype/match.snippets文件。你可以在这里随意修改

将它放到某个路径目录的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     
snipMateShow默认:模式:插入
显示所有可用的代码段(以开头)
上一个文本(如果存在)。用于

插入模式。

您的要求很高。为此,您可能需要修改Snipmate本身。您可以为此读取代码段文件,或者使用其他插件,如“neocomplcache”,其支持代码段完成(尽管有自己的代码段引擎)。gmate(Gedit+加载插件)在python中有这样一个脚本。它将转换为降价,并允许我制作打印的备忘单,这使我能够达到我熟记备忘的程度。我们并非生来就有这样的知识烙印在我们的大脑中;)@berkes-正确,这就是为什么要打开一个代码片段文件并浏览一点。也许输入一些您自己的。