How to continue using GitBash after calling gitk? - github

After using some commands e.g. gitk I can't keep using the terminal. I need to terminate gitk and then I can keep typing commands. Is there a way to open a program and keep using the terminal? I'm using GitBash on Windows.

gitk &
The & causes the command to run in the background.
As an alternative, you can interrupt a program by pressing Control-Z in the terminal. This gives you back control of the command-line, but pauses the program. You can continue it in the background by typing
bg

Related

VS Code Integrated terminal does not execute commands from extensions

Ideally, the integrated VS Code terminal, depending on the context, the type of the folder and the extension, executes some commands. For example, when opening a folder containing a Python virtual environment in VS code, the environment is recognized and activated (by the python extension) by default when opening a new integrated terminal instance (situation 1). This is done by running some command similar to source /path/to/venv/bin/activate.
Or, when using the ROS extension to debug nodes, selecting "Start Debugging (F5)" uses the launch.json file to start some nodes and finally starts debugging the desired code. To do so also, there is some command that is executed (also by he ROS extension, I assume) in the integrated terminal (situation 2) to start the debugging process. In case of debugging ROS nodes, the command usually looks something like /usr/bin/env /bin/sh /tmp/someFileName.
But, unfortunately, both of the above mentioned situations fail. I believe this happens because while the extension tries to run these two commands within their respective integrated terminals, the commands do not actually get executed in either situation. Instead, these commands are printed on the top of the terminal, but the state of the terminal is unchanged (as opposed to when the commands would have been executed, in which case depending on the commands some actions are performed). Here are two images to show what I mean. Top, situation 1 and bottom, situation 2.
The fact that these two commands are printed on top of the terminal as soon as the a new terminal instance is opened tells me that the extension tries to execute them, but they do not work for some unknown reasons.
Just to be clear, both of them are run in a seperate VC Code window, they have nothing to do with each other. When I manually run both the commands in their respective terminals I do get the desired results.
Now, I am unsure exactly how to name this issue. But I think this is surely an issue with the integrated terminal, and not a problem of the extensions. I am not sure how one could reproduce this problem.
I did a clean reinstall of VS code by deleting %APPDATA%\Code and %USERPROFILE%\.vscode. Because I am using this on WSL, there is only ~/.vscode-server on the ubuntu side. I manually uninstalled all extensions on WSL but did not delete this folder, in fear of breaking something. The problem still persisted. I have also created an issue on the VS Code GitHub page with nearly the same information.
I am unsure if this is a bug or is there something wrong with my settings. Does anyone know how I could fix this? For smaller use-cases I can still manually enter the command in the terminal. But I am trying to debug a ROS application with nearly 10 different terminals opening up and I cannot be manually entering the command each time to restart the process.
Please let me know if you need any more information. Many thanks in advance.
Edit: both edits to frame the question properly.
Although not related to WSL, I dug a little deeper today as to why in my case the extension commands were not being executed or were being chopped.
I'm an iTerm2 user. iTerm2 has something called Shell Integrations, which allow iTerm to behave differently under certain circumstances, for example, adding markers to each prompt or coloring output with certain text (e.g. WARNING or ERROR)
From time to time, I also use the VSCode Integrated Terminal, which recently added support for reporting whether the previous command errored out with an indicator on the gutter of the Integrated Terminal panel using the exit code.
iTerm can do something similar but the shell integrations mess up completely the VSCode functionality and therefore I changed my .bashrc file to detect if the terminal emulator was iTerm2 or not (which can be done with the it2check utility of iTerm2) so that it only sourced the shell integrations if I was using iTerm2.
The problem is that it2check "eats" some STDIN bytes using dd, specifically, until it finds an n so that it can obtain the name of the emulator. This of course chops the commands on the STDIN until the first n and makes VSCode Extension Terminal commands unusable
The workaround I came up with is to use the value of "$TERM_PROGRAM" as means to distinguish between the different programs. The only caveat is that the value won't be passed if you're inside of a tmux session or similar, but I can live with that.
In your case, I'd check for any process that is either not passing the STDIN to the WSL process or any dot files or shell profile scripts eating up the STDIN they receive.
I suspect that the real problem is that the local process doesn't relay the STDIN contents to the WSL and as a workaround you may try to create a VSCode Integrated Terminal profile that uses SSH to connect to the WSL host so that the STDIN is preserved

IntelliJ no longer reacts to CTRL-C to interrupt terminal processes

For the last 2 month or so IntelliJ (Ultimate) no longer responds to CTRL-C interrupts.
I use powershell as integrated terminal (tried all other available terminals as well), and no luck.
If I use powershell separately (so not the integrated terminal) it works just fine...
My current workaround is closing the terminal tab and run the command again.
These are my terminal settings:
Anyone has any clue?

NeoVim make terminal window automatically close when program exits

The vim version has a ++close option that automatically closes the terminal when the job terminates, but since the NeoVim terminal came first it doesn't have that feature.
I need this because i am trying to run programs directly from vim, but i regularly make
curses applications which the popup window you get from :!python % can't handle, so i need the terminal window.
I am using NeoVim on arch linux if that's relevant.

VS Code Terminal Not Allowing Typing

My VS code terminal was working fine, until one day when I tried to work on a project, that was still open in VS code, my terminal didn't allow me to type any commands. I couldn't type anything. This is the screen that I get.
Okay, for those of you struggling with the same problem, I've managed to solve it by clicking on the drop-down menu that says powershell and changing it to cmd.
this happened to me and simply
close vs code
right click on it
run as administrator
open the terminal and it will work
this problem happened when I changed the default path of CMD
For me, I tried using Powershell/CMD/Bash and I was having errors/blank terminal. I found typing echo hello and pressing CTRL + C made it appear. So in fact, everything was working, my terminal was just blank/glitched out, but was really accepting input.
I had a similar issue when running ionic serve command which runs the development server on the localhost. I paid attention after executing the command above, and it said:
Use Ctrl+C to quit this process
Pressing Ctrl+C then displays:
Terminate batch job (Y/N)?
Type Y or y
then the command prompt is shown again!
Here is a sample terminal window - trimmed for brevity:
For who has this problem using React. This happens when you start a live version using npm start. The terminal that handles the live version of the app cannot be used for anything else.
So to continue using the terminal you need to open a new terminal to use in parallel. To do so just click on the plus icon in the top right corner of the terminal panel then choose the "Power Shell" option. This will open a new terminal without restarting visual studio.
In Mac, when working with Python, this helped me: instead of clicking on the "Run Code" option, click on "Run Python file", in the right corner.
For Ubuntu users this is solved by this solution:
File -> Preferences -> Setting -> Features -> Terminal -> Inherit Env
I found two vscode on my desktop, I opened the other one and it worked. Looks like I updated it but the older one didn't disappear.
If typing Ctrl+C can help to get out of this frozen state, that will be easier to do with VSCode 1.64 (Jan. 2022)
The terminal can type the answer for you.
Terminal -- Auto-reply
The terminal is now able to automatically reply when a specific sequences of characters is received.
A good example of where this is useful, which is also the only default case, is the Windows batch script message Terminate batch job (Y/N)? after hitting Ctrl+C when running a batch script.
This typically just ends up causing problems for the user.
The terminal will now automatically reply with Y and enter (\r) which makes Ctrl+C in Windows feel much better.
Pressing Ctrl+C will immediately reply to the question and return to the prompt:
Theme: Sapphire
The feature was made generically so you can setup custom replies for other thing, just be careful when doing this as you are sending text to the process automatically.
For example you could use it to automatically update Oh My Zsh when prompted:
"terminal.integrated.autoReplies": {
"[Oh My Zsh] Would you like to check for updates? [Y/n]": "Y\r"
}
If you use Clink and enable their similar feature, you can disable it in Clink or in VS Code by setting the reply to null to avoid the two features conflicting with each other:
"terminal.integrated.autoReplies": {
"Terminate batch job (Y/N)": null
}
Go to terminal, preferences, settings.
Check "run code in terminal"
Restart VS.
I changed from bash to powershell in terminal first but the command prompt still not shown.
Then I navigate to File -> Perferences -> Settings and it starts working (command prompt shown)
This seems to just be a display problem. It happened to me when I changed my display settings for desktop icon and app scaling settings.
I managed to fix the problem by simply restarting my computer and re-opening VS code
I had the same problem ... In my case just run vs-code as administrator and works

How to disable emacs console messages

When I open emacs from a terminal with the emacs& command, I get a lot of debug messages on that terminal. This obscures what I was doing before. Is there a way of suppressing debug message output to the terminal?
Thanks!
Redirect stderr to /dev/null.
emacs 2>/dev/null& command
This alias should to the trick, just put in in .bashrc or your shells rc file.
alias emacs="emacs 2>/dev/null"
It depends on your OS, but you seem to be on Linux.
If it is the case, create a launcher icon, eg for Ubuntu.
This way the desktop environment, like Gnome or KDE, starts the process instead of the terminal, and messages do not appear.