How to change PyCharm keyboard shortcuts on Mac - python

I want to change the run console command to pressing SHIFT and ENTER. I followed this tutorial but am unable to understand the actual step to input my personal commands.
I've made it all the way to the screenshot below and need more specific directions to input my personal commands. What do I do next?

That tutorial is about controlling/setting config for a specific run/script. To change keyboard shortcut/settings go your PyCharm preferences. Select Keymap on the left and in the search bar type "Run". You should see it under Run as the first option. Right click on it and you should see an "Add Keyboar Shortcut" and enter your preferred keyboard shortcut.
Keep in mind that Shift + Enter is already assigned so either change that or try another combination

Related

Why is the green run button grey/disabled? Pycharm [duplicate]

I observed that on a new project the Run option is disabled and I expected to be able to run a script without having to manually add a configuration for it.
If you're creating a project from existing source:
and
If the existing source directory contains a lot of data/files:
the Run option (and others, assumably) are disabled until PyCharm is finished indexing the contents in the project. You'll see a progress bar in the lower-right-hand corner.
You can speed this up by right-clicking on folders and selecting "Mark directory as..." -> "Excluded" if they aren't to be indexed.
Right click inside your main file & then you get Run option!
You can't run without a configuration, however temporary configuration can be created automatically if you use Run context menu option in the script editor.
I solved it just by right clicking on the .py file and clicking 'run'. After this the run button appeared enabled!
If the project folder contains a lot of files then the indexing process can take a long time. So you might need to wait before the Run button appears.
Select drop down menu to the left of the run button at the top right, select Edit configurations, expand defaults on the left, select whatever you were working on (if python, select python). Then click OK. Dialogue will close. Make sure the file that you want to run is on top. Hit ctrl+shift+F10 to run. The run button should be enabled again.
Select your file name in drop down menu on top right corner.
Then go to edit configurations.
Next the Run/Debug Configurations dialog box will be open.
Then under execution, uncheck Run with Python console
Apply> Ok
Then you will get the Run window again.
It is possible that when you have newly setup your pycharm environment, it starts to index the scripts. You will see something like Indexing... at the bottom of the window. Once it is complete you can right click and select Run.
I tried all answers, and none worked for me. What did work is:
1.) open another repository / project
File > Open > select project > OK
2.) If you have the pop-up to choose "This Window or "New Window", chose "This Window"
3.) Open the repository / project that had the greyed out run button
4.) It should be green by now

VSCode: How to run active line without highlighting it?

In JupyterLab you can run code in many different ways. And I often use the option to run the active line (where the mouse pointer is) using Run > Run Selected text or current line in console with a keyboard shortcut. After doing this, the pointer jumps to the next line, and you can keep going.
Can the same thing be done using VSCode?
And just to be clear, the following is not what I'm looking for:
Ctrl+Enter will run the whole cell.
Shift+Enter when highlighting a line or or other parts of the code will run that part.
Shift+Enter with no highlighted code runs the whole cell and inserts a new cell below the active cell.
So, how can I run only the active line without highlighting it?
A similar question has been asked here: How to run the select code in VScode?, but that sends code to the Terminal and does not provide the answer I'm looking for.
Go to file > preferences > keyboard shortcuts, search for Run Selection / Line in interactive window and assign your desired keyboard shortcut. And make sure that there are not conflicts. I found out that several tasks had Shift + Enter assigned to it, and that's what had me confused in the first place.

ipython notebook clear all code

All I want to do is try some new codes in ipython notebook and I don't want to save it every time as its done automatically. Instead what I want is clear all the codes of ipython notebook along with reset of variables.
I want to do some coding and clear everything and start coding another set of codes without going to new python portion and without saving the current code.
Any shortcuts will be appreciated.
Note: I want to clear every cells code one time. All I want is an interface which appears when i create new python file, but I don't want to save my current code.
In Jupyter, do the following to clear all cells:
Press Esc to enter command mode.
Hold Shift. Select the first and last cells to select all cells.*
Press d twice to delete all selected cells.
Alternatively, if you simply want to try out code, consider running the ipython console, which is purely interactive in the REPL and does not require creating a new file. In a command prompt, type:
> ipython
Demo
Click outside the textbox to select a cell in command mode (thanks #moondra's).
Command Mode (Yes)
Edit Mode (No)
Well, you could use Shift-M to merge the cells (from top) - at least there's only one left to delete manually.
You can type dd to remove current selected cell. And if you continously press dd you can clean the screen.
Press the scissors (cut) button multiple times for each cell you want to delete.
Just do Ctrl+A , this selects all the individual blocks/cells and then press d twice.
Ok youngster, I will break this down for ya in simple steps:
go to the intended textbox and put your mouse cursor there
on keyboard press crtl-a and delete
Ta-dah all done
Glad to help

If there a way to always have a list of choice when pressing Ctrl+Space on Komodo Edit?

I'm new to Komodo Edit / Python. I would like to know why Komodo gives me a list of word to autocomplete my current word sometimes while at other times, it gives me nothing or it auto completes my current word without asking me (even if there's multiple choices)
Is there a way to tell Komodo to ALWAYS give me a list of choice when pressing Ctrl+Space (like the Visual Studio's behavior ?)
def TestMethod():
return 1
def TestSecondMethod():
return 2
Test #It doesn't show me the intellisense
TestSecondMethod #When I press Ctrl+Space, it autocomplete
#(without asking me) my word by entering
#the name of the second method
Komodo (IDE or Edit) doesn't seems to have a very good Intellisense for Python so I ended up using PyCharm Community Edition and this IDE work like a charm.
It is easy to configure and the autocomplete always work and is fast to show (compared to Komodo's)
Komodo gives the possibility to change the behavior of the Ctrl+Space to use the Auto complete behavior but it still doesn't work the way I wanted because it doesn't always shows and when it does, it does it slowly
You can change your key bindings preferences with :
Edit > Preference > Editor > Key Bindings >
change the command "Editor : Trigger preceding AutoComplete list or CallTipe" key sequence to be "Ctrl + Space"
the Ctrl+Space is normally assigned to the "Code : Complete Word" command
But anyone who's using Python should definitly give a try to Pycharm.

Why does powershell freeze for a bit when running my python scripts

Sometime I look back at my terminal when there is a python script running and the console output has frozen, then I right-click on the terminal and the console output (printing to screen) beings again.
Its a bit disconcerting because sometimes I think my script has broken.
Do others also experience this? Anybody know a fix?
Thanks in advance for any responses
If it's intermittent with all other factors being unchanged, it sounds like you've inadvertently selected some text in the PowerShell console and it's halted updating output so that you can do something with it.
Next time, be careful to look to see if you have something selected before clicking.
I agree with #alroc's suggestion; i.e. the cause could be accidentally clicking on the console.
A solution to prevent this is to right click on the powershell console window's title bar, select properties, uncheck Quick Edit Mode, then click OK. This disables some features (i.e. copy by select & enter, paste by right click), but means if you accidentally click on the screen it does no harm.
Another solution's to simply press escape (or right click in the script's window) if the script's taking a while - generally that'll do no harm (i.e. it won't terminate your script), but it will exit the edit session, allowing the script to resume if it had been paused due to edit mode.
To play with these, run the below script, then click on the screen whilst it's running (this script just outputs a bunch of numbers).
1..99999999
To terminate the script completely, press ctrl+c.

Categories