Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/karlicoss/open-in-editor
Script to jump into files in you text editor, from your web browser
https://github.com/karlicoss/open-in-editor
editor emacs mime vim xdg-open
Last synced: 15 days ago
JSON representation
Script to jump into files in you text editor, from your web browser
- Host: GitHub
- URL: https://github.com/karlicoss/open-in-editor
- Owner: karlicoss
- License: mit
- Created: 2020-05-30T06:44:17.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-28T13:28:33.000Z (over 3 years ago)
- Last Synced: 2024-05-30T01:15:20.681Z (6 months ago)
- Topics: editor, emacs, mime, vim, xdg-open
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 9
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+begin_src python :exports results :results output drawer
import open_in_editor
print(open_in_editor.__doc__)
#+end_src#+RESULTS:
:results:This scripts allows opening your text editor from a link on a webpage/within a browser extension via MIME.
See a short [[https://karlicoss.github.io/promnesia-demos/jump_to_editor.webm][demo]].It handles URIs like:
: editor:///path/to/file:123
: editor:///path/to/file?line=456See =test_parse_uri= for more examples.
To install (register the MIME handler), run
: python3 open_in_editor.py --install --editor emacs
See =--help= for the list of available editors. If you want to add other editors, the code should be easy to follow.
You can check that it works with
: xdg-open 'editor:///path/to/some/file'
I haven't found any existing/mature scripts for this, *please let me know if you know of any*! I'd be quite happy to support one less script :)
The script was tested on *Linux only*! I'd be happy if someone contributes adjustments for OSX.
:end:
* Usage
#+begin_src bash :exports results :results output verbatim
./open_in_editor.py --help
#+end_src#+RESULTS:
#+begin_example
usage: open_in_editor.py [-h] [--editor {emacs,vim,gvim,default}] [--install]
[--run-tests]
[uri]positional arguments:
uri URI to open + optional line numberoptional arguments:
-h, --help show this help message and exit
--editor {emacs,vim,gvim,default}
Editor to use. 'default' means using your default GUI
editor (discovered with open/xdg-open)
--install Pass to install (i.g. register MIME in your system)
--run-tests Pass to run unit tests
#+end_example