美文网首页
2020-08-08

2020-08-08

作者: 熊一二 | 来源:发表于2020-08-08 09:05 被阅读0次

cot command

CotEditor has 'cot' command-line tool which allows you to control CotEditor from the command-line. To use cot command, install it at first.

Installation

You can install the cot command-line tool to a desired location creating a symbolic link via Terminal. The cot substance is bundled at 'Contents/SharedSupport/bin/cot' in CotEditor.app (We recommend to create it at '/usr/local/bin/').

ln -s /Applications/CotEditor.app/Contents/SharedSupport/bin/cot /usr/local/bin/cot

And uninstallation via Terminal is like the following:

unlink /usr/local/bin/cot

Security authorization on Mojave and later

From macOS 10.14 Mojave, user authorization is required to control CotEditor from other applications in which cot command is used. The authorization is normally done via a dialog displays automatically when you use the cot command for the first time. However, in some cases, you may need to authorize it manually from System Preferences > Security & Privacy > Privacy > Automation. Select the checkbox for CotEditor(and also System Events for --wait option) under your client application, such as Terminal.

Options

The following options can be used on cot command.

| -w, --wait | Wait for opened file to be closed before returning to a prompt. |
| -n, --new | Create a new blank document. |
| -l, --line <line> | Jump to specific line in opened document. <line> is an integer specifying the number of line. |
| -c, --column <column> | Jump to specific column in opened document. <column> is an integer specifying the number of column. |
| -b, --background | Do not bring the application to the foreground. |
| -h, --help | Show help. |
| -v, --version | Print version information. |

For --line and --column options, you can specifty a negative number to count from the end of the document (--line option) or a line (--column option).

Examples

A simple cot command will launch CotEditor, or just activate it if CotEditor is already running.

cot

The following command opens the foo.txt file on CotEditor and move the cursor to the line 200 in the opened document. cot command do nothing if foo.txt file is not exists.

cot --line 200 foo.txt

The following command opens the foo.txt file on CotEditor and move the cursor to the end of the document.

cot --line -1 --column -1 foo.txt

You can also pipe a text. CotEditor will open a new document with the piped text.

echo "I am a dog but also a cow at the same time." | cot

Using --wait option, CotEditor can be used as the editor for git.

git config --global core.editor "cot -w"

See Also

相关文章

  • 20/21赛季全纪录

    2020-07-18 1球,累计1场1球 2020-08-01 3球,累计2场4球 2020-08-08 3球2助...

  • 2020-08-10

    2020-08-08 致仓央嘉措(13)最后一篇 再见了玛吉阿米 世人看不清我的心里 我不解世人的心思 俗人眼里我...

  • 若水日记/6/ 秋言

    2020-08-08 星期六 晴 今天依然是晴天,疫情还在继续,封城二十三天了。 今天和两位好友通了电话,告诉了彼...

  • 《随笔》关心则乱,好奇害死猫!

    2020-08-08 一个小时之前群里有朋友告知,在某处发现了三只小猫。 看图片,三只小猫已经睁眼了,看起来还比较...

  • 生活小记

    今天是个好日子,公历2020-08-08,农历六月十九,街上嫁娶的彩车络绎不绝。早上六点爬起来,与妹妹去了惠福寺祈...

  • 这样爱一个人才是最好的方式

    2020-08-08 我们是两个独立存在的个体 我和他在一起是因为我爱他 两个相爱的人能在一起能互相喜欢已是幸运 ...

  • 北京互拍养生群第三次互拍

    2020-08-08周六 北京健康养生群第三次互拍圆满结束。 参加互拍活动的共有十人。 每个人都尽量施展自己的能力...

  • 2020-08-08

    随着年龄的增长,吃不适合我们身体的食物的倾向也会增加,订购外卖或购买冷冻食品变得很方便。尽管可能产生健康后果,但它...

  • 2020-08-08

    读《现代文学三十年》便注意到,政治与文化密不可分的阶段,在三十年代的文学里最为凸显,文学近乎为政治服务,文学主潮也...

  • 2020-08-08

    养猫日记19 天气很热,中午的太阳晒得很,出门的时候,一开门,回头就看到了小黄在脚边,看它这瘦弱的样子,本来不想上...

网友评论

      本文标题:2020-08-08

      本文链接:https://www.haomeiwen.com/subject/jpicdktx.html