"Run command" from Shell tab in Terminal Settings overwriting .zshrc file - terminal

I created some setting on the .zshrc file to display git branches in a visual way. It runs very well.
After this settings, I went to clean my Terminal visually and decided to remove my username from every line. Found instructions to do it through the Terminal settings, on the Shell tab, by selecting the "Run command" and writing "export PROMPT="myname %1~ %#"; clear;". And it also works well.
The problem is when I close the terminal and open again, only the username removed works, but the git branches do not appear anymore, as if one overwrites the other.
Any suggestions on how to keep both settings together?

Related

Opening a project directory in PhpStorm from the Terminal

I want to open a project directory in PhpStorm using pstorm .
I am aware that there are many threads that have discussed this issue, but I have not been able to completely solve my problem with the solutions from those threads.
Using the IntelliJ Toolbox, I click the gear icon (top right) and I enable the Generate Shell Scripts option. I set the Shell script location to /usr/local/bin (which is in my PATH). The Shell Script Name is specified as pstorm.
The first issue is that the script isn't generated in /usr/local/bin. Presumably since the Toolbox doesn't have write privileges at that location. I then set it somewhere where it has write privileges - something like /home/username/.local/share/JetBrains/Toolbox/bin. The script is successfully generated there under pstorm:
# Generated by JetBrains Toolbox 1.20.7940 at 2021-03-24T16:55:42.325644
"/home/username/.local/share/JetBrains/Toolbox/apps/PhpStorm/ch-0/203.7148.74/bin/phpstorm.sh" "$#"
I then copy that file to /usr/local/bin: sudo cp pstorm /usr/local/bin
I then open a terminal and navigate to my desired directory, opening said directory in PhpStorm with pstorm .
PhpStorm then opens the directory. However, PhpStorm is then 'locked' as a child to the (parent) terminal instance and closing the terminal also closes PhpStorm. A more complete explanation relating to this behaviour is given here
I would really prefer that PhpStorm not be dependend on a terminal instance, much like when I run code . for VSCode.
Any ideas why it is doing this and how to 'solve' this behaviour?

"git bash here" of subcontext menu opens in windows root path

Right clicking a folder in windows opens the submenu of a windows right click. Where you have the basic OS operations like "Open", "Edit", "rename" etc.
If git is installed you also have the option to "git bash here". This command should open the terminal/cmd and directly point to the right-clicked folder. But it's always openening in the root system folder.
tl;dr; clicking "git bash here" opens the system root folder instead of the right-clicked one
The way I solve my own problem is to uninstall Git, and delete .bashrc manually (cause uninstall Git doesn't remove that file), and install Git again. And the terminal open correctly in my working folder rather than root system folder. Thanks to Todd.
As one of the comments suggest, the .bashrc file is the one to "blame".
Deleting it would solve the issue.
However, it contains valuable declarations. So "don't throw the baby out with the bathwater": a minor edit would do the trick:
Open Git Bash window. While the bash is active, enter the following:
vim ~/.bashrc
In my case, the bottom line (scroll using arrows) was:
cd /c
Just delete it (press twice on d), and then quit with saving, by pressing :, and then wqEnter.
That's it! The next time you open Git Bash Here - you should see the shell active on the relevant folder.

Closing a Terminal File

I'm working on Git Immersion lab 8. enter link description here
I ran "git commit" and it opened the editor. I understand how to write on the editor, but once I am done what do I do? How do I save and close this editor while maintaining my terminal work?
Thanks!
my current terminal
You appear to be in vim and are in insert mode.
To save and close, you have to get out of insert mode. Hit the 'escape' key (or control-[, which I personally like since I don't have to pull my fingers away from the keyboard. I'm not currently at a mac, so I'm not sure if it's control-[ or command-[ in your terminal).
Now type ':wq', without the quotes. Don't forget the colon. This is a vim command which will (w)rite and (q)uit.
I believe git has opened this file for you as a temp file, and once you've finished writing to it, git will use that file automatically for your commit message. No worries about where to save it.

How to disable/remove Terminal script?

A while ago I wrote a Terminal script that executes cd Desktop every time I start Terminal.
With the release of Lion, this is no longer necessary as Terminal remembers where I last left off. I can't figure out how to disable/delete the script because I can't find it. There are also no options in the Terminal preferences that can help me. How do I disable or delete this script?
Probably controlled by one of the following files in your home directory, which you can edit/delete to remove this behavior:
.bashrc
.bash_profile
.profile

Delete gnome terminal configuration

I made a mistake in my gnome terminal configuration. I entered a command to start with in the preferences, but that command fails, and now all I get is a window that opens and closes right away, and I basically can't use gnome terminal anymore :-( Is there any way I can remove the configuration file and restart fresh??
Thanks!
Open the XTerm (Standard terminal for linux) and enter this command
gnome-terminal -e bash
It opens the gnome-terminal. Open profile preferences and configure your terminal to "Hold the terminal open".
Editing preferences
$HOME/.gconfd/saved_state
the above file might be of interest depending on exactly what configuration you changed. Of course, it holds configuration from other programs as well.
If you are on the newer gnome terminal that uses dconf, it's a little trickier, but still doable:
Profiles are stored with a UUID, you need to find the UUID of the profile to remove:
dconf dump /org/gnome/terminal/ | less
Search for a visible-name='...' entry matching the profile you want to remove. Look above that for the section header like [legacy/profiles:/:...]. The full name of the item you want to delete is thus /org/gnome/terminal/legacy/profiles:/:.... Delete it thus:
dconf reset -f /org/gnome/terminal/legacy/profiles:/:...
Side note: This Q&A probably should be moved to unix.stackexchange.com.

Resources