Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm - Autocomplete Quotes -Get out from within Quotes and Move the Cursor after the Closing Cursor

Tags:

pycharm

I'm new to PyCharm.

I like that it autocompletes single and double quotes, but how do I "get out" from within the quotes and move the cursor to the right side of the closing quote ?

Example: I start typing,

string = 'Hello World'

After I'm done with the letter d, my cursor is stuck there.

So is there a fancy way of hitting SPACE so that I can move the cursor to the right side out of the closing quote?

Thanks a lot!

like image 714
waitwaitwait Avatar asked Dec 17 '13 08:12

waitwaitwait


People also ask

How do I enable code completion in PyCharm?

Start typing. By default, PyCharm displays the code completion popup automatically as you type. If automatic completion is disabled, press Ctrl+Shift+Space or choose Code | Code Completion | Type-Matching from the main menu. Press Ctrl+Shift+Space or choose Code | Code Completion | Type-Matching from the main menu.

How do I add punctuation in PyCharm?

PyCharm automatically completes the construct and adds the required punctuation. The caret is placed at the next editing position. PyCharm automatically inserts a trailing comma before a line break in multiline collection literals. In dict literals, it inserts a colon between a key and a value. Press Ctrl+Shift+Enter to invode statement completion:

Why can’t I print a single quote in Python?

The reason is that a single quote or double quote itself is a special character we use in our Python program. In many cases, it has been seen that you want to print a string or you want to work with a string. But the problem you face when there are one or more quotes in that string.

What happens when you execute PyCharm code multiple times?

Many actions in PyCharm provide more results when you execute them multiple times. For example, when you invoke basic code completion with Ctrl+Space on a part of a field, parameter, or variable declaration, it suggests names depending on the item type within the current scope.


2 Answers

The fastest way of achieving it in pycharm is hitting the same quotation (single or double) after u finish typing the text in the quotations. Eg.

Typing: ' then hello world then ' gives --> 'hello world'|

The first ' will give you this --> '|' The second quotation ' will push your cursor outside the end quotation.

like image 171
Mohammad Yusuf Avatar answered Oct 18 '22 17:10

Mohammad Yusuf


Press Tab.

You can now just press Tab to move outside the quote mark.

It should work by default, but if not you can enable the option in Preferences->Editor->General->SmartKeys and enable "Jump outside closing bracket/quote with Tab when typing"

like image 22
Darren G Avatar answered Oct 18 '22 18:10

Darren G