Skip to content

Instantly share code, notes, and snippets.

@itzikBraun
Last active July 14, 2017 15:49
Show Gist options
  • Save itzikBraun/c296c653e81f89186d98dfc3226bd007 to your computer and use it in GitHub Desktop.
Save itzikBraun/c296c653e81f89186d98dfc3226bd007 to your computer and use it in GitHub Desktop.
SublimeText+Mitmproxy

Mitmproxy+SublimeText=Great Success

Setup

add the following lines to your bash_profile or zsh_rc or your equivelent terminal startup file.

export SUBLIME_PATH="path/to/your/subl"
export EDITOR=/path/to/sublw.sh

How does it work

Mitmproxy will execute sublw script with a path to the file that contains the text to edit. Once the script had exited it will read the content from the file thus replacing it. When subl is called it starts another thread so we have to wrap this call and block till the file is saved. For that im using fswatch a great cross-platform file change monitor. You can find more details about fswatch here

#!/bin/bash
# Starting sublime
$("$SUBLIME_PATH" "$1")
# Blocking untill the file is saved
fswatch -1 "$1"
@gilvegliach
Copy link

Amazing 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment