callum-ramage / ctrl-dir-scroll

Add ctrl-up/down single line scrolling to Atom
MIT License
7 stars 4 forks source link

Working on Linux? #12

Open guyellis opened 9 years ago

guyellis commented 9 years ago

Got this installed on Ubuntu 14.04 and not getting it to work. Do you know of anyone who is using this on Linux that has it working?

screenshot from 2015-05-07 10 03 23

callum-ramage commented 9 years ago

I don't know of anyone using this on Linux so I can't confirm that it works.

Do you have the latest version of Atom? It should be 0.198.0. It's displayed in the help menu. If you do have the latest version of Atom can you try pressing ctrl-. to bring up the key binding resolver and then try using the ctrl-alt-down or ctrl-alt-up key combinations. You should see ctrl-dir-scroll mentioned there.

guyellis commented 9 years ago

Got the latest version of Atom.

It doesn't mention ctrl-dir-scroll when I hit those key combos in the key binding resolver.

callum-ramage commented 9 years ago

That probably means the .platform-linux selector is wrong then. Until I have time to dig into it a bit more you could try removing the .platform-linux bit from the keymap or try removing the alt key from it just to see if that allows you to trigger it.

guyellis commented 9 years ago

I found https://atom.io/packages/keyboard-scroll which gets the job done. Let me know if you make progress on this and I'll try it again.

clickbait commented 9 years ago

No use closing the issue if it's not fixed.

harai commented 9 years ago

I am using this on Ubuntu 14.10.

guyellis commented 9 years ago

@harai it works for you on Ubuntu 14.10? I'm using Ubuntu 14.04.

harai commented 9 years ago

@guyellis Yes, it works on my Ubuntu 14.10.

kankaristo commented 9 years ago

The default key bindings are bound to changing workspaces (virtual desktops) on Ubuntu.

The default key bindings should probably be changed to something like alt-up and alt-down on Linux. On some Windows machines, ctrl-alt-up (or down, can't remember which) flips the display upside down, so it might be a good idea to change the key bindings on Windows as well.

The package works on Ubuntu 14.04 (I'm using 14.04.2 LTS), but the key bindings never reach Atom. @guyellis, can you run the commands through the command palette (ctrl-shift-p)?

You can change the key bindings in your keymap.cson:

'.platform-linux atom-text-editor:not(.mini)':
  # Change ctrl-dir-scroll key bindings
  'alt-up': 'ctrl-dir-scroll:scroll-up'
  'alt-down': 'ctrl-dir-scroll:scroll-down'

Edit: The default key bindings don't break anything (or do anything), so the alt-up and alt-down key bindings could just be added as alternatives, but Atom already has far too many key bindings, so the current ones should probably be changed.

Edit 2: Also, the current key bindings conflict with symbols-view, which is part of Atom's core.

callum-ramage commented 9 years ago

On Windows the key binding is ctrl + up/down which is the same as Notepad++, Sublime, etc. I was under the impression that the key binding on Linux matches what it is typically set to for other programs on Linux but I'm happy for it to change if that isn't the case.

If the issue on Linux is simply that the default key binding doesn't make it to atom or the package then it should be changed. I have no preference as to what it should be changed to.

kankaristo commented 9 years ago

I haven't noticed any Linux program using ctrl-alt-up/down for this, as it is usually bound to switching workspaces. But then again, I haven't really used this in anything except Qt Creator, where the key binding is ctrl-up/down.

On Linux (I can really only speak for Ubuntu and Debian), key bindings are usually the same as on Windows. Some key bindings have alternatives, but the Windows key binding works too (e.g. ctrl-v works anywhere except the console, where you can use either ctrl-shift-v or shift-insert).

ctrl-up and ctrl-down are already bound in Atom to move the text on the current line up or down. Although I personally think they should be bound to do what ctrl-dir-scroll does, others might disagree, and overriding core key bindings might be a bad idea.

Edit: I just noticed that ctrl-shift-up/down can be used to scroll up and down in a console, and it's not bound to anything in Atom, so that would be a safe bet. :)

callum-ramage commented 9 years ago

ctrl + up/down has the same behavior in the Windows Atom as the Linux one. I'm overriding it because that's what it's normally bound to in other editors. It's easy enough for a user to change the hotkey for ctrl-dir-scroll if they want to.

In short, I think overriding the default behavior of Atom is fine.

kankaristo commented 9 years ago

Yeah, in this case I agree. Atom has some weird key bindings, which are not common in other editors.

My vote goes for setting the default Linux key binding to ctrl-up/down, so that they would be the same on both platforms (apparently not on OS X?). The current ctrl-alt-up/down don't work in most desktop environments in Linux.

Does XCode (or some other common OS X editor) have this feature? Some people (including myself) have to work across different platforms, so it would be best to have the same key binding on all platforms. I realize the key bindings can be customized, but my keymap.cson is already a mile high, without having to customize it for 3 different platforms.

kankaristo commented 9 years ago

This should be fixed in https://github.com/callum-ramage/ctrl-dir-scroll/pull/21.