How do I change the prompt color of Anaconda Prompt (cmd) on Windows 10? - cmd

I've been trying to change the color of Anaconda Prompts(cmd), which is for now (base) E:\VSCodeProjects>.
I googled for this extensively but seems like:
There is no such option to do this in .condarc. I expected it to be able to change the prompt color like .zshrc.
Also, I can't find any definitive way to change the color of the prompt of native Windows' cmd. All I found were some old ANSI Escape codes someone wrote back in 2009.
The only viable and reliable way I came across is setting the %PROMPT% variable on terminal manually, by doing something like: set "PROMPT=$e[44m%PROMPT%$e[0m". This command explicitly change the color of the prompt instantly without any side-effects but the problem is that I have to execute this command everytime I open the new Anaconda Prompt instance.
At this point, it would be satisfactory enough if there's a way to just execute set "PROMPT=$e[44m%PROMPT%$e[0m" command everytime I open a new Anaconda Prompt instance. However, other more effective approaches are welcome.
Please note that I'm NOT trying to change the color of the whole Anaconda Prompt. I just want to change the color of the prompt. i.e, (base) E:\VSCodeProjects>

I realise this is an old post, but thought I'd respond in case anyone is still looking for an answer. If you right click on the top of the Anaconda Prompt window and then click 'properties' on the pop-up, you are able to access all the customisation options.
Screenshot of method explained above

Related

Make Terminal highlight recognised code as I enter them in the terminal

I have been trying to find what this feature is called. So, while using VS Code in Windows 10 I found that the "git" and "cd" commands are highlighted with yellow color as I type them. I was wondering how I can do it with my Linux setup.
Here's a picture.
What is this feature called? And how can I get my terminal to work like this?

Clear terminal without clearing first line of multi-line prompt

I'm trying to setup the terminal on my new Mac to match the behavior of my old Mac, however I have run into an issue with my multiline prompt that has me stumped. I remember having this issue when I setup my old Mac several years ago, however I don't remember how I solved it.
My prompt (without color) looks like this:
╭─username ~ 130 ↵
╰─
When I press ⌘commandK in iTerm2 on my old Mac it clears the terminal window so that both lines of the prompt are shown at the top.
When I press ⌘commandK in iTerm2 on my new Mac it clears the terminal window so that only the second line of the prompt is shown at the top.
I have tried checking everything I could think of, I have checked:
Every dot file/directory in my home directory (copied them to the new Mac).
iTerm2 settings.
System settings (primarily keyboard shortcuts).
Various websites with instructions about setting up multi-line prompts.
Interestingly I have discovered that if I type clear iTerm2 will clear the screen and leave the top line showing on both Macs. However it first clears the entire screen, including the prompt, before bringing the prompt back (looks bad imo). However since it works differently ⌘commandK does I don't think that's what my old Mac is doing.
It's possible that I installed some program/script that somehow does this, but if so I'm not finding it locally or referenced online.
Does anyone know how I can get ⌘commandK working to clear the screen while keeping the top line of my prompt? I still have the old Mac so I can check/compare anything on it to the new Mac if there are any guesses about what settings I changed.
Edit:
I was able to find something that worked, however if anyone has any other suggestions I'll be happy to try them and accept any that I can make work that are less hacky than this (e.g. don't require another 3rd party app).
Edit: This doesn't work while a command is running, nor does it clear the scrollable history. So it's better than nothing but still doesn't behave like I want it to.
After coming back to my question SO associated a new question with an answer I was able to make work, although it feels extra hacky and wasn't what I had working before.
I found this answer which suggests using ⌃controlL to clear the screen. That does exactly what I want it to do (leaves the top prompt visible and doesn't flash) but with the wrong keybinding. Fortunately I was able to use an app I already have installed (BTT) to make ⌘commandK map to ⌃controlL only in iTerm2.

Launch Jupyter Notebook in windows without command window

Is it possible to launch jupyter notebook without command console, i.e, without typing jupyter notebook and having a command window in your opened programs. I have made a batch file which I double-click to open the jupyter notebook. However, this step opens a command window and prints all the communication between jupyter and python processes. I want to eliminate this commandline window.
Instead of a batch file, one can use a shortcut.
To hide terminal you can run python scripts with pythonw.exe instead of python.exe. So I changed the Jupyter shortcut which was created after Anaconda installation accordingly. Mind that shortcut's Target field may have multiple python.exe instances, like the following:
C:\ProgramData\Anaconda3\pythonw.exe C:\ProgramData\Anaconda3\cwp.py C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\pythonw.exe C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py "%USERPROFILE%/"
Shortcut window screenshot
This thread seems to be the first to appear when googling the problem.
My solution is for Anaconda users: Launch Jupyter from the Anaconda navigator. You won't have to keep an open CMD window, as upon exiting the navigator you are given the option to close or not close Jupyter.
It appears from the following questions that what you want to do is tricky in windows:
https://superuser.com/questions/62525/run-a-batch-file-in-a-completely-hidden-way
How to call CMD without opening a window
Each of these questions has various work-arounds presented in the answers, each with their pros and cons. Perhaps one of them will meet your needs.
I use RBTray to right click the minimize button and have the window go hide in the system notification tray.

syntax colors on ipython

This is bugged me for several days and what I've found so far on the internet do not satisfy me.
I've installed ipython on two separate ubuntu boxes. The ipython prompt is different on each of the boxes.
I'm reaching the boxes through ssh via a Windows bash emulator, Cmder
This box where the config is closest to ok e.g it gives me syntax color when typing a string or else.
This is the box where the config is not what I want
Reading articles and questions, it seems that I need to add the line below in the file .bashrc in my linux account to be able to have syntax colors in ipython
export LS_COLORS = "no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:ex =00;36"
I did it but it still gives me the same grey outlook in my second box and worse, when I type a ls command in my linux box, I have this error
ls: cannot analyse the value of the environment variable LS_COLORS
Any ideas on what should I do to get color syntaxes for ipython?
Recent versions of IPython use Prompt_toolkit, which provide colors via Pygments. YOu need to pass an option to IPython to select the "theme", you'll the following.
If You issue ipython --help
--colors=<CaselessStrEnum> (InteractiveShell.colors)
Default: 'Neutral'
Choices: ['Neutral', 'NoColor', 'LightBG', 'Linux']
Set the color scheme (NoColor, Neutral, Linux, or LightBG).
meaning you can either pass the --colors flag or set the c.InteractiveShell.colors=... in your config.
You will also find the following option if you issue a In[1]: %config TerminalInteractiveShell:
TerminalInteractiveShell.highlighting_style=<Union>
Current: 'legacy'
The name or class of a Pygments style to use for syntax highlighting. To see
available styles, run `pygmentize -L styles`.
That controls the theme highlighting of IPython. (use --TerminalInteractiveShell.highlighting_style=... at the prompt , or set c.TerminalInteractiveShell.highlighting_style-... in a config file).
Keep in ind the the escape control sequences used to show color may not be compatible with all terminal emulators, and that some part of IPython (in particular tracebacks) do not respect the themes (yes we know and we are planning to fix that at some point but it's quite a bit of code to refactor).
Keep in mind also that there are 2 types of colors with ANSI code. "True color" that is to say you tell the terminal emulator the R,G,B values of a character, and "short colors". Where you tell the terminal emulator that the color of the character is one of 8 predefined colors. These 8 predefined colors depends on the terminal emulator itself and can sometime be changed from the terminal emulator preferences. See wikipedia for example of changes in colors.

How to change default Terminal in Source Tree on windows

I am working on Windows 7 with Source Tree. Because I don't like the default cmd.exe I want to change it to Console2 such that Source Tree will open Command2 instead of Cmd as terminal.
It appears you can't do it, at least in any obvious way. There are a couple of solutions/workarounds that you can use here:
Pick a different favorite terminal. ConEmu is a wrapper for CMD.exe that will act as your default terminal if you tell it to [I thought Console2 could do this as well]. Also - forgive the editorial - ConEmu is way, way, better than Console2.
You can add a custom action in the menu. From the global options go to Custom Actions tab and add an action to Open in Terminal using the console you want. This isn't quite as cool as just hitting the terminal icon, but you can easily accomplish the same outcome.
Unfortunately, these are the best there are for now.
Note: Based upon the link that #sendmoreinfo posted, waiting for Atlassian to add this by default may be better way to go for your purposes. Only problem with that may be is that according to some the newest updates to Source tree are terrible, so I haven't updated as of yet.
Note 2: Though this won't do what you want, there is an Option in the settings under the Git Tab that allows you to Set Git Bash as default prompt. That may or may not get you closer to where you want to be.
You may add Windows Terminal as Custom Action. You may run custom action in context of selected file. Define a new custom action as shown below.

Resources