How to add "new line" keyboard shortcuts in spyder

how to add fractions
how to add numbers
addition
adding math
how to add fast
subtraction
how to add in excel
how to add percentages

When using other editors, most of them have a function about "new line". For example, the Sublime Text, use

Ctrl + enter

to enter new line directly whatever cursor is at end of line or not. After checked all the setting about spyder, have no idea about this.

Thus i want to add new feature about "new line" with

Ctrl + enter

To enter a new line without the cursor need to move to tail

Would you have some ideas to share me ? Thank you.

I'm just a Spyder user, but yes you can add such a functionality yourself. For this you need to modify the file codeeditor.py, which in Windows is under \spyderlib\widgets\sourcecode\codeeditor.py.

WARNING: Backup the codeeditor.py file before modifying it.

What you need to do is to modify the keyPressEvent function that starts at line 2129 (in my Spyder 2.3.1).

You'll see that one of the first conditionals takes care of enter/return keypresses: line 2139, if key in (Qt.Key_Enter, Qt.Key_Return):

The option ctrl+Enter is already taken... so without messing too much with the options, I'm just going to put here an option for ctrl+shift+Enter, which is free to use. Is this ok?

So what you want to do is to add, after the option if not shift and not ctrl:, another option with shift and control pressed; i.e. in my case I would add this at line 2153, with indentation to match the if not shift and not ctrl: line:

elif shift and ctrl: # Insert newline functionality
    cursor = self.textCursor() 
    startpos = cursor.position() # Remember where the cursor is
    self.stdkey_end(False, False) # Go to the end of the line
    self.insert_text(self.get_line_separator()) # Add a newline
    cursor.setPosition(startpos) # Go back to the initial position
    self.setTextCursor(cursor)

Now close Spyder, and reopen it. Try the ctrl + shift + enter combination in the editor, and you should get a new line just below the line you're in, as you wanted.

If you don't mind rebinding or eliminating the "Run cell" functionality in your own copy of Spyder, you could even play around and put this code under the elif ctrl: condition, then you'd have the ctrl+enter binding just like in Sublime Text.

Addition, Use a number line if you're just learning to add.​​ Draw a line, then write numbers along the line from 0-15. Circle the first number you want to add. Start at that number. Then, count down your number line, moving the same number of spaces as the second number you're adding. Adding integers is similar to adding whole numbers, but integers can be positive or negative. To add two negetive integers, you add the same way as you would add whole numbers, but place a negative sign in front of the answer. Adding positive and negative integers can get more tricky. To do that, you subtract the larger number from the ,smaller

If you want to continue writing in the new line (move the cursor there) instead of only adding a new line and keep the cursor where it is, just ignore the related lines in the accepted answer:

elif shift and ctrl: # Insert newline functionality
    cursor = self.textCursor() 
    # startpos = cursor.position() # optional
    self.stdkey_end(False, False) # Go to the end of the line
    self.insert_text(self.get_line_separenter code hereator()) # Add a newline
    # cursor.setPosition(startpos) # optional
    # self.setTextCursor(cursor) # optional

I'am going to do a pull request on this, since I guess many others can profit from this keybinding as well. Thanks for your answer.

4 Ways to Add, Adding 8 + 7. About Transcript. Sal adds 8 + 7 by making a group of ten. Created by Sal Duration: 3:19 Posted: Jul 29, 2016 To add fractions there are Three Simple Steps: Step 1: Make sure the bottom numbers (the denominators) are the same Step 2: Add the top numbers (the numerators ), put that answer over the denominator Step 3: Simplify the fraction (if needed)

A simple way to help you: use right shift key as End+Enter

First : sudo apt-get install xdotool

In settings, open keyboard and add a custom shortcut

name : New_line

command : xdotool key End KP_Enter

then click the 'disabled' and type R_shift key

Now you can use right shift to achieve what you want !

Basic Operations, If you multiply by 10, you get 530 and grouping them by ten makes them a lot easier to add Duration: 3:36 Posted: Jan 20, 2015 Set up an equation. If you begin with a word problem and not an equation, then you must “translate” the word problem Find the common denominator. You have to find a common denominator — that is, find the same number that each denominator Add the numerators. When you add the numerators, leave

Adding 8 + 7 (video), Use a number line to add 15 + (-46) + 29.Duration: 5:33 Posted: Aug 1, 2016 Add a Wireless Printer The steps to install a wireless printer may vary by manufacturer. In general, however, modern printers today will detect your network and automate the installation.

Adding 53+17 by making a group of 10 (video), Learn how to add and subtract negative numbers. The problems solved in this video are 2 - 3 Duration: 4:07 Posted: Sep 5, 2013 Before you can add the Google Chrome icon to your desktop, make sure you have it installed on your computer. If you are certain that you have it installed, skip this section.

Adding numbers with different signs (video), Whether you add or subtract variables, you follow the same rule, even though they have different operations: when adding or subtracting terms that have exactly  How to Add Font in Microsoft Word. This wikiHow teaches you how to install a font on your Windows or Mac computer in order to use the font in Microsoft Word. Download the font from a trusted website.

Comments
  • Can you explain a bit more what you want this feature to do? How is it different than just pressing "enter"?
  • @Blckknght Thank you,modified
  • @VicYu Would you accept an option for ctrl + shift + enter? It's because ctrl + enter is already used for "Run cell". You could rebind it in your own copy of Spyder anyways, I'm just putting here an answer that doesn't mess too much with Spyder's functionality as it is.
  • @Roberto Thank you ,excellent!You're a genius!Key is fine,importance is the feature.
  • Yeah ,these are something different between 2.3.1 and 2.3.2.But your post is so clear and easy-understand.I implemented this feature with your genius ,Thank you .
  • (Spyder dev here) Beware that your changes to codeeditor.py will be erased every time you update Spyder. If you want to this functionality as part of Spyder, please open an issue in our issue tracker so we can add this code directly to our own.