23

I would like to use the Sublime Text 2 key bindings in Pycharm. I know how to edit it one by one. Is there a way to override the entire keymap in one shot?

Something like

  • export the key bindings from sublime text 2
  • convert it into Pycharm's format
  • import it into Pycharm

Pycharm has some pre-configured keymaps. If there's a text / XML / JSON file where these maps are stored, I can try to convert it myself.

enter image description here

user
  • 17,781
  • 20
  • 98
  • 124

4 Answers4

21

PyCharm now has Sublime Text keymap inbuilt as an alternative to Default Keymap.

Go to Setting -> Keymap and select Sublime Text from Keymap dropdown.

enter image description here

Hope that helps.

myusuf
  • 11,810
  • 11
  • 35
  • 50
5

After poking around, I feel there's no easy way to do this.

If you change the default bindings, PyCharm creates a file in user space that shows the format of keymap. Theoretically, one could override all the fields in this file. But the problem is, there's no standard way of describing the action performed by a shortcut. Someone will have to do it manually, for each macro, to establish a correspondence between the actions performed by PyCharm & Sublime Text.

user
  • 17,781
  • 20
  • 98
  • 124
3

There is an IntelliJ request for this in their Youtrack tracker: IDEA-111333 Provide Sublime Text keymap.

From that thread, I found a repository for another remapping project. The keybinding file that imitates most of Sublime text can be found at in the directory PHPStorm-SpacePeacock/win_linux-keymaps-only/keymaps/Default for GNOME copy.xml. From the README:

The key mapping has been updated to better fit Sublime Text conventions. Because I didn't think that ctrl + shift + alt + t is a reasonable key combination for something as frequently used as Refactor This.

Additionally, "search everywhere" HAD to be changed because double-tapping left-shift is a two stroke trigger. This is a problem because as you're working the IDE will be busy with analyzing, indexing, and all of the things that IDEs do. If it's busy when you try to hit the first left-shift, then the second left-shift won't pop up the window. As far as user interfaces go, you should never have any lack of confidence that an action will trigger the appropriate response. Once you have that, you have to visually check each operation which is slow and creates cognitive overhead. Consequently, this was changed to ctrl + p (also to match Sublime Text) which completely removes this problem.

ctrl + p search everywhere

ctrl + r search methods in current file

ctrl + alt + p change projects

ctrl + shift + enter complete current statement

ctrl + alt + enter refactor this

alt + enter show intended actions (intentions are one of my favorite part JetBrains software)

ctrl + n new thing dialog

ctrl + shift + f format code

ctrl + d select word at cursor, or if a word is selected the select the next occurrence of the word (multiple-cursors)

ctrl + t run tests

ctrl + alt + h show local history

ctrl + alt + r git conflict merge tool

Seanny123
  • 8,776
  • 13
  • 68
  • 124
Ben Creasy
  • 3,825
  • 4
  • 40
  • 50
  • I tried both the @maggie osx one and the one here. This ones works better on linux. Just copy the keymap file called "Default copy for GNOME" to /home//.PyCharm50/config/keymaps Restart pycharm and select it in pycharm. – tal Jun 10 '16 at 10:05
  • @tal do you mean from the GitHub link? – Seanny123 Oct 06 '16 at 18:34
  • I have since figured out that he did mean from the GitHub link. Notice that if you have a Setting Repository, the link to copy your keymaps will be different. – Seanny123 Oct 06 '16 at 20:11
0

(Less popular) keymaps that can be used with JetBrains Rider but not included in the installation package. https://github.com/JetBrains/rider-non-bundled-keymaps

Intalling keymaps

In releases, get the sublime-text-keymap.jar file for the desired keymap.

In your IDE, choose File | Import Settings... from the menu and select the sublime-text-keymap.jar file.

sajal garg
  • 129
  • 3
  • 8