Synchronised Scrolling Between Panes


#1

Title says it all, I know some editors out there have this feature which is actually quite helpful, or does atom already have this feature? Thanks to any reply :smiley:


#2

Just curious. What’s the use case for? Usually you want non synchronized right? Do you hit a special key / mode? When do you find it useful?


#3

it is useful anytime you are comparing two files. Also when going through a file and copying sections of code from one to the other.


#4

Oh yeah true, but really what we want then is a diff program right?


#5

A diff program is often too much trouble. If you have two tabs with the files you want to compare then using one command is a lot easier than firing up another program and specifying the files to compare.

Although it might be nice to have a single command that brings up an external diff program with the correct files. That would be as easy to start but the diff program may be overly complicated for what you want to do.

In any case I have found scroll-tracking to be useful.


#6

Git has a command

git difftool

It’s built into git and set up in

git config

I guess I was proposing a built in differ (in atom). Eclipse had one for example. Some of the differ’s are open source so we might be able to leverage that? For now, I’m sure one of the git tools out there for Atom has a command to open in your git difftool config preference…


#7

We are talking about any two open files, not ones in git.

For real diffing of two files I’d like to see the diff built into an atom package. The package I’m working on now does diffing for a different purpose. I could write one easily. Maybe I’ll do it after this package is finished.


#8

True. Actually could do a temp git trick to create that in a package though :smile:


#9

Yeah, if you write a differ that’d probably be an awesome contrib to Atom :smile:


#10

Totally agree with @mark_hahn, it would be awesome if you could write a package for this!


#11

I too think a general diff tool, with git diff specifically as one possible mode, would be a major plus for Atom!


#12

One more thing I thought of last night. It’d be really nice if the markdown viewer scrolled with the code too.

I think that can be done with some kind of anchors like behavior too.


#13

for git diff i like how netbeans handles it, where you get a popup with the changes inline and are even able to revert changes line by line.

Synchronized scrolling makes total sense for everything that compiles, Coffee, sass etc. but i think for that sourcemaps might be better to show the correct result position.
Do sourcemaps exist for markdown?


#14

I also am interested in learning how to sync pane’s scrolling. I have an open feature issue for my package, Preview ( https://github.com/Glavin001/atom-preview ). Source maps has been suggested and makes sense. However, for a basic starting implementation I want to get the scroll position of the first pane and set on the other. Any advise?


#15

Maybe it is less work to call the diff tool directly, rather than setting up a git repo just so that git can call the tool…


#16

Webstorm did the same exact thing. I really miss that feature. Luckily Atom provides everything needed with the Git class.


#17

@kgrossjo, That’s not what I meant, I actually suggested git difftool much earlier for another suggestion.

What I meant was you could take buffers, make git commits with them, and leverage the power of git. Classic command line diff would probably suffice for this though.


#18

I was looking for the same functionality. Being able to scroll markdown-preview along with the markdown file would be great.

Multiple scrolling of panes isn’t enough. We’d need an anchoring system where we can specify how the two documents relate…


#19

Specifying anchoring for arbitrary usage is an interesting problem. I would think there would need to be plugins. A text differencing should be trivial. The plugin for markdown shouldn’t be too hard either.

When I started thinking about syncing coffeescript and the transpiled javascript I realized that the browser’s .map file has all you need. If markdown created a similar file then that would remove the need for a plugin architecture.


#20

Markdown source-mapping. Anyone know if it’s been done?