Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ctrl+] and Ctrl+[ as indent and unindent shortcuts #3406

Closed
talkaminker opened this issue Sep 6, 2016 · 14 comments
Closed

Add Ctrl+] and Ctrl+[ as indent and unindent shortcuts #3406

talkaminker opened this issue Sep 6, 2016 · 14 comments

Comments

@talkaminker
Copy link
Contributor

talkaminker commented Sep 6, 2016

This is a feature request.
ctrl ] and ctrl [ are super common shortcuts to indent current line/block and unindent current line/block.
This is different from Tab because Tab inserts a tab if pressed in the middle of a line and only works as indent line if the line is selected.
In other ides (sublime, and notebook) you don't have to select the line before pressing shift [ or ]

Thanks!

@goanpeca
Copy link
Member

goanpeca commented Sep 6, 2016

Thanks for the suggestion. Are there any other IDEs using this?


This is an easy fix an a great place to start contributing to Spyder (if @spyder-ide/core-developers think is a good idea)

@talkaminker
Copy link
Contributor Author

talkaminker commented Sep 6, 2016

editors that have this behavior by default:

  • IDLE
  • Sublime Text
  • Jupyter Notebook
  • Atom
  • Textmate
  • Matlab
  • maybe more but I didn't check

The fact that it is default in IDLE and Jupyter Notebook is the prevailing reason since python people are used to it.

@goanpeca
Copy link
Member

goanpeca commented Sep 6, 2016

@talkaminker thanks for the feedback. You are welcome to submit a PR :-), if you need some pointers let us know

@talkaminker talkaminker changed the title Add left shift ] and left shift [ as indent and unindent shortcuts Add ctrl ] and ctrl [ as indent and unindent shortcuts Sep 6, 2016
@talkaminker
Copy link
Contributor Author

talkaminker commented Sep 6, 2016

I made a mistake before, I meant ctrl + [ and ctrl + ].
these are the commonly used ones (in all the ide's I mentioned), not shift [ and shift ]
I updated the feature ticket. oops my bad.
In any case, can I develop this? did it get approved by @spyder-ide/core-developers ?

@goanpeca
Copy link
Member

goanpeca commented Sep 6, 2016

Well if all those other IDEs are using it, I say go for it!

@jitseniesen
Copy link
Member

I like the idea, now that it's Ctrl + [ and not Left Shift + [

@goanpeca
Copy link
Member

goanpeca commented Sep 6, 2016

👍

@ccordoba12 ccordoba12 added this to the v3.1 milestone Sep 6, 2016
@ccordoba12 ccordoba12 self-assigned this Sep 6, 2016
@ccordoba12
Copy link
Member

The best thing we can do to fix this (and other shortcuts related stuff, like the use of Ctrl+Enter to execute a single line, requested by RStudio users) is to remove fixed shortcuts and make all our shortcuts configurable. That way people could adjust everything to their likings :-)

This is my plan for 3.1 :-)


@goanpeca, you were right at the end: fixed shortcuts were a bad idea ;-p

@goanpeca
Copy link
Member

goanpeca commented Sep 6, 2016

:-)

@talkaminker
Copy link
Contributor Author

If we are on the subject, also would be cool to allow assign multiple shortcuts for the same operation (like pycharm and sublime text allows)
And be able to export all the shortcuts and import them in a different instance of spyder.
Sublime text for example uses one huge json to define all the shortcuts.

@goanpeca
Copy link
Member

goanpeca commented Sep 7, 2016

allow assign multiple shortcuts for the same operation

Could you paste a screenshot of the interface where multiple shortcuts are defined (for either pycharm or sublime.. or both?)

And be able to export all the shortcuts and import them in a different instance of spyder.

Sure, this one is an easy one, could you open a new issue for that as a feature request?

@talkaminker
Copy link
Contributor Author

talkaminker commented Sep 8, 2016

The pycharm way is the most straightforward
Here you see the keymap menu where you search for a shortcut. and right-clicking on the line will give you the small menu you see where you can remove any of the previous shortcuts. Each small yellow balloon is the shortcut.

pycharm_two_shortcuts

Clicking on "Add Keyboard Shortcut"
will result in the following menu:

pycharm_two_shortcuts

Where you click on the keyboard the shortcut you want and it will automatically write it down. In this example, I hit Shift+8. if the shortcut already exists it will tell you and ask you if you want to remove the second shortcut.

Note that you can also disable a shortcut completely if you don't like the operation

@gandalfsaxe
Copy link

I second this. Cmd+[ and Cmd+] is very conventional today to use for indent/unindent.

At the very least, it should be configurable, but it's nowhere to be found in Preferences->Keyboard shortcuts.

@ccordoba12 ccordoba12 modified the milestones: v3.2, v4.0beta2 Jun 4, 2017
@ccordoba12
Copy link
Member

@rlaverde, please implement this by making the shortcuts to indent/unindent configurable.

@ccordoba12 ccordoba12 assigned rlaverde and unassigned ccordoba12 Jun 4, 2017
@ccordoba12 ccordoba12 changed the title Add ctrl ] and ctrl [ as indent and unindent shortcuts Add Ctrl+] and Ctrl+[ as indent and unindent shortcuts Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants