Sublime Forum

Synchronized, Multiple file edit plug-in example?


Hello, I’m new to this community and have urgent task for my work here.

Say, I have a file “Myfile.txt1” and “Myfile.txt2” - they have a bit different format, while I have a (line,column) to (line,column) map file as a third file.

Now, I want to have these two file open vertically, and editing one file modifies other file simultaneously, with some highlights on unsaved changes.

I’ve been looking though API and other examples but still can’t jump start. Is there any similar example that I can look through as starting point?

Thank you so much!!



perhaps the closest thing I’ve seen to what you’re describing is

1 Like


Thank you @kingkeith, This is great start! Now, I just need to know how to constantly listen on both edit view so that changes are made instantly without running command. Any suggestion again?



The on_modified event is raised whenever the content of a view is changed, so if you want to automatically take some action based on file changes happening, that’s the way to go.

Note however that if you modify a file in response to modifying a file, you get an event that tells you that you modified a file (i.e. be careful to screen events or you’ll get yourself into an infinite loop).

1 Like


Thank you @OdatNurd! will make sure infinite loop doesn’t happen.
You can imagine what I’m trying to do is like a Hex editor but working on two different files that has 1:1 mapping between Line/Col number. Thus, I want more of buffer change event than file modify event.
I’m currently searching how to make a thread that listens to… maybe keystroke event on a view to get row/col and text value at cursor. Disappointed at how slow my search is these days.

Update: Ah I read now that on_modify is actually event with changes in view! not file :slight_smile:
Just need to find how to create thread that catches the event :slight_smile:

Update: Sublime is aswsome! just found good starting point simply defining a EventListener inherited class!! this is amazing. Thank you guys for all the help!

1 Like