Howto configureedit++ as system text editor for ipython's magicCommand %edit - ipython

In ipython the magic-command %edit opens the default text editor on microsoft windows. On window-7 this is notepad, a robust, but somewhat limited text editor.
I'd like to have started notedpad++ my favorite editor for scripting. I changed already the association of py/txt/ etc. files to notedpad++. Thus doubleclicking such files works well. Anyhow in ipython %edit still starts the notepad.exe.
Is there a way to change this configuration of ipython?
regards
olippuner

The %edit command will invoke the editor set in your environment as EDITOR. If this variable is not set, it will default to notepad under Windows.
You can also control the editor by setting TerminalInteractiveShell.editor in ipython_config.py.
Source: IPython documentation

Related

Does VS code have variable explorer object like we have it in spyder?

I will post the picture of what exactly I am asking variable explorer in spyder
So do we have this feature in VS code?
I tried a lot to find it on google but was unhappy to not find it.
Open your .py script in vscode
Right click anywhere on the script > Run current File in interactive Window
In the toolbar of the interactive window click on the variable icon
You can now consult the values of variables created by your script
spyder is probably running a REPL (Jupyter is doing that also). From that python process they show the local and global variables, just like a debugger would do on a breakpoint.
If you use Python Interactive you have similar functionality with the Variables Explorer and Data Viewer or use Jupyter notebooks
You can now find all variables in a Jupyter Notebook in VS Code in the Output panel under Jupyter: Variables

Where is settings.json for powershell configuration in Windows Terminal?

I'm new to Windows 10, having spent a lot of time on Mac OS X and some on Ubuntu, and I've read a lot about the types of things that are good to put in the settings.json file for my PowerShell, but I can't seem to find anything that tells me where this file resides.
For example, the "Set up Powerline in PowerShell" section in this Microsoft document tells you to edit your settings.json file (specifically in the subsection titled "Set Cascadia Code PL as fontFace in settings"), and points you to this document telling you about the layout of this file, but it doesn't seem to tell you where to find it!
In case the subsection gets changed, this is the first two paragraphs of that section:
To set the Cascadia Code PL font for use with PowerLine (after
downloading, unzipping, and installing on your system), you will need
to open your profile settings in your settings.json file by selecting
Settings (Ctrl+,) from your Windows Terminal drop-down menu.
Once your settings.json file opens, find the Windows PowerShell
profile and add: "fontFace": "Cascadia Code PL" to designate Cascadia
Code PL as the font. This will provide those nice Cascadia Code
Powerline glyphs. You should notice the change in your terminal as
soon as you select Save in your editor.
Where is the settings.json file?
You can find the location of the settings.json file with the following Powershell commands:
$settings = (Get-Item "C:\users\$env:UserName\AppData\Local\Packages\Microsoft.WindowsTerminal_*\LocalState\settings.json")
$settings.DirectoryName
To open it from the Windows Terminal directly:
Ctrl + ,
Edit the settings.json file.
Save settings.json file.

how to disable jupyter editor in vscode

like the title mentioned, how to disable jupyter editor in vscode?
every time,I want to new a file just for text or markdown,I do not like to appear a choice between two, but just default for the inner editor applied by vscode. and how can I configure this.
for right now,I never need to use jupyter notebook.
It seems to be appeared unexpected after vscode update or installed some python package.
This can be disabled by python.dataScience.useNotebookEditor if you are using the Python extension.
Source: https://github.com/microsoft/vscode/issues/103526
Update:
You also need the Jupyter extension along with Python extension for VS Code. The setting key has been renamed from python.dataScience.useNotebookEditor to jupyter.useNotebookEditor^update
With the July/August 2021 introduction of the new Native Notebook Support in VS Code, the answers involving your settings.json are now obsolete. Now the Notebook editor will be used to open .*ipynb files even if you've never installed the Python or Jupyter extensions.
However, you can open a *.ipynb file in the regular text editor by right-clicking on the file in the VS Code File Explorer, doing "Open With", and then selecting the "Text Editor".

Does VSCode has a console like the Sublime Text console?

On the Sublime Text console we can run python commands, use the Sublime Text api. See the error messages from the packages, and much more. Does VSCode has such feature?
Yes, it has Integrated Terminal and you can chose what to use in it - PowerShell/Bash/CMD, also Debug Console, code Output and Problems tab for the current workspace

External editor for IPython notebook

I am using IPython notebook and I want to edit programs in an external editor.
How do I get the %edit file_name.py to open an editor such as Notepad++.
Running %edit? will give you the help for the %edit magic function.
You need to set c.TerminalInteractiveShell.editor, which is in your ipython_config.py. I'm not quite sure where this is located in Windows; on OS X and Linux, it is in ~/.ipython. You'll want to set the variable to be the full path of the editor you want.
Alternatively, you can create an environment variable EDITOR in Windows itself, and set that equal to the full path of the editor you want. iPython should use that.
I'm using Windows 7 and 8 (and 10TP) and Python 3.4.2.
I started with ipython locate to tell me where ipython thought config files suggested elsewhere should be. When I saw it was different I read around and came up with the following:
On my system, the ipython locate gave me c:\users\osmith\.ipython, not the _ipython you'll see mentioned in the YouTube videos done with Windows XP,
Look in the directory ipython locate specifies for a profile directory; if you aren't actively doing anything with ipython profiles, it should be .ipython\profile_default, if you are using profiles, then I leave it to you to s/profile_default/${YOUR_PROFILE_NAME}/g
Check the profile_default directory for a ipython_config.py file, if it's not there, tell IPython to initialize itself: ipython profile create
Open the config file in a text editor,
If you are the kind of person who hasn't messed around with their console overly much and installs things in standard places, you can skip straight to this step by typing: ipython profile create followed by start notepad .ipython\profile_default\ipython_config.py.
Search for the string c.TerminalInteractiveShell.editor,
The comment above this indicates you can also use the EDITOR environment variable, but hard coding file paths never hurt anyone so lets do eet:
Copy the line and remove the leading hash and spaces from the copy.
Replace the text between the apostrophes ('notepad') with the path of our desired editor, e.g.
c.TerminalInteractiveShell.editor = 'c:/program files (x86)/noddyeditor/noddy.exe'
There is a catch here, though; some modern editors get a bit fancy and automatically and, when invoked like this, detach from the console. Notepad++ and Sublime Text, for example. Sublime accepts a "--wait" option, which works some of the time; this tells the command invocation to hang around until you close the file, for some definition of until and some other definition of close.
However, the following setting will work most of the time for sublime text:
c.TerminalInteractiveShell.editor = '"c:/program files/sublime text 3/subl.exe" --wait'
(assuming c:\program files\ is where your sublime text 3 directory is)
Try the 'Pycharm' editor
This works for me.