tg-z / web-clip

24 stars 5 forks source link

external editor with violent monkey #1049

Open tg-z opened 4 years ago

tg-z commented 4 years ago

How to edit scripts with your favorite editor? - Violentmonkey

ViolentmonkeyGet itGuideAPIFAQBlog

How to edit scripts with your favorite editor?

Table of Contents

For anyone who uses Violentmonkey, it is easy to find a way to edit a script like this:

However, it is really hard to make everyone love it. A probably likes a theme of monokai, while B prefers eclipse. C might use 2 spaces for indentation while D prefers tabs.

It is impossible to satisfy every single user. Lots of configurations may be added for this, but are they really worth it? A user would have to face lots of choices before he could use it just as a script manager, or have to look for a simple option among lots of unrelated editor options. What is worse, the browser may inhibit some shortcuts or operations that a local editor can have. In other words, an editor inside Violentmonkey will never be as good as your favorite one.

Here comes the question: How to edit my script with my favorite editor?

Save to a file

First, copy the script to your favorite editor and save it to a file.

VIM is my favorite editor, and the script is saved at D:/Source/vm-script.user.js. Note that the script file must have a name ending with .user.js, otherwise won't be recognized by Violentmonkey.

Install a local script

First make sure the local script is named with a suffix of .user.js.

There are two ways to install a local script:

Make sure the track local file option is checked and then confirm installation.

Edit and sync

After installation, the confirmation page will keep watching the file before the page is closed. Once the file is changed, the new version will be installed automatically. As a result, you edit the script in your favorite editor, and the changes are synced to Violentmonkey immediately.

Known issues

Published at March 14, 2017

Violentmonkey © All rights reserved.

Privacy Policy

Open Chat https://violentmonkey.github.io/posts/how-to-edit-scripts-with-your-favorite-editor/