为BBEdit插入并关闭标记脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为BBEdit插入并关闭标记脚本相关的知识,希望对你有一定的参考价值。

I've used Textmate since I started hand-coding websites. My boss loves BBEdit. This script allows me to do the thing I missed most from Textmate creating and wrapping tags around text. Enjoy!
  1. tell application "BBEdit"
  2. set theText to text of front text document
  3. set theSelection to the selection as string
  4. set theCharStart to (characterOffset of selection)
  5. set theResponse to text returned of (display dialog "Wrap what tags around selection?" default answer "" default button 2)
  6. set theTag to first word of theResponse
  7. --set theOther to chars((length of first word of theResponse) - end) of theResponse
  8. set tmpStr to "<" & theResponse & ">" & theSelection & "</" & theTag & ">"
  9. set the selection to tmpStr
  10. set insertionPosition to (theCharStart + (length of tmpStr))
  11. --select (characters insertionPosition through (insertionPosition - 1)) of front text document
  12. select insertion point before character insertionPosition of front text document
  13. end tell

以上是关于为BBEdit插入并关闭标记脚本的主要内容,如果未能解决你的问题,请参考以下文章

为 Blogger 上的博客格式化代码片段 [关闭]

BBEdit 14 for mac 软件大版本更新

SQL - 快速插入 1000 个值 [关闭]

将代码片段插入数据库并在 textarea 中以相同方式显示

使用Grep和BBEdit / Textwrangler复制一个set变量并将其粘贴到行中

如何在 HTML 脚本标签中插入任意 JSON