📜 ⬆️ ⬇️

Tube Linux-like terminal in Windows

Introduction (lyric)


Hi, Habr!

For me, the Linux automator, using Windows on the main workstation at first was just pain and suffering. But I couldn’t do anything about it: corporate standards and software that only works on Windows. In an attempt to find a middle ground, I went through three stages. At first, I only occasionally switched to Windows as needed. Then virtualka on virtualbox with X-server. After that, I wanted at least a little of the console comfort that was on Linux (I used Terminator as the main terminal).

After violently googling and installing all terminal emulators for Windows that I could find, it turned out that there was not a single one that matched me. And I wanted the terminal to behave as close as possible to the Linux options. For example, you naturally need tabs, split, text selection with scrolling (when you need to select more than one screen), copying text to the buffer immediately upon selection, etc.
')
In the end, I got a "combine" as in the screenshot below. How to configure it, you can find out by looking under the cat.




Before getting a result, I even seriously thought about my bike (porting, writing my own). But laziness and common sense took their toll ...

In the process of finding a good terminal, I came across a habr-topic: Alternate Terminal for Windows . ConEmu - the app is really cool, but it is not for those who have used Linux terminals for a long time. Then I stumbled upon Mintty (was installed along with Cygwin). The program is excellent, behaves as close as possible to such terminals as Gnome-terminal and Terminator, but there are no tabs.

It turned out that the aforementioned ConEmu can run GUI applications inside its tabs! And then a spark of hope began to flare up ... But enough of the lyrics, it's time to get down to business!

Install the necessary programs


ConEmu set from here: code.google.com/p/conemu-maximus5
I put Mintty with Cygwin: cygwin.com/install.html

Customization


In ConEmu, go to Settings-> Tasks and, by clicking the plus sign, add the necessary task as in the screenshot:



In our case it is:
Name taskaTeam
cygwinC: \ Cygwin \ bin \ mintty.exe
ssh_localC: \ Cygwin \ bin \ mintty.exe D: \ Work \ VMssh.bat
cmdcmd
powershellpowershell

Caution! Hell CMD!

VMssh.bat:
@ECHO OFF SET VMNAME=xubuntu CALL D:\Work\VMstart.bat %VMNAME% ssh user@localhost 

Calls the virtualics start script, replace the VMNAME with the one you need.

VMstart.bat:
 @ECHO OFF SET VMNAME="%1" SET isVMRun= IF [%1] == [] ( echo Empty parameter VMNAME. Usage: %0 [name of vm] EXIT /B 1 ) FOR /F %%i IN ('VBoxManage list runningvms') DO SET isVMRun=%%i IF NOT "%isVMRun%" == "%VMNAME%" ( Vboxmanage startvm %VMNAME% --type headless ) 

Checks if the virtual is running and if not, then starts it. Thus, I do not need to remember whether the virtual is running, running VirtualBox separately and making additional clicks.

Little "whistle"


Xoria-like theme for Mintty (~ / .minttyrc):
 ForegroundColour=208,208,208 BackgroundColour=28,28,28 CursorColour=255,175,0 IMECursorColour=128,224,160 Black=12,12,12 BoldBlack=10,10,10 Red=215,135,135 BoldRed=223,135,135 Green=175,215,135 BoldGreen=175,223,135 Yellow=247,247,175 BoldYellow=255,255,175 Blue=135,175,215 BoldBlue=135,175,223 Magenta=215,175,215 BoldMagenta=223,175,223 Cyan=175,215,215 BoldCyan=175,223,223 White=230,230,230 BoldWhite=238,238,238 BoldAsFont=no Font=Consolas FontHeight=11 CursorType=block FontSmoothing=full Term=xterm-256color Scrollbar=none Locale= Charset= 


Shared working folder (files are available on Windows and virtual) - need to be configured in VirualBox-e as follows:



You also need to register in fstab on a virtual machine so that it is automatically mounted at the start.

Conclusion


As a result, I received a terminal in which at least you can live. I by no means claim the exclusiveness of this decision, but I hope someone will come in handy. A separate advantage of this solution is a shared text buffer and shared folders. Thus, we work with a Linux virtual as well as with the other tabs in the terminal.

Scripts and mynttyrc config uploaded to git-hub : github.com/morkot/windows-terminal-mutant.git

For those who do not need GUI tabs and who use tmux, there is an article by my colleague about the same sore subject: habrahabr.ru/post/196128 .

Special thanks to Maximus5 for excellent Windows ConEmu terminal!

Source: https://habr.com/ru/post/204368/


All Articles