## Marvin's Blog【程式人生】

Ability will never catch up with the demand for it

Windows is notorious for its unfriendly and limited terminal environment. All you get is the CMD.exe, which has been the default terminal emulator in Windows for roughly twenty years. There have been several initiatives for improving the situation and providing a better terminal environment on Windows, for example, Cmder, ConEmu, MinTTY etc. But now, everything is going to be different, a new challenger has come, that is Vim (and gVIM, the GUI version of Vim on Windows).

You may jump up and say: isn’t Vim just a text editor. True, it is just a text editor. However, text editors can have integrated terminals. Emacs has had it for decades. VisualStudio Code, a modern, open source, code editor developed by Microsoft has an integrated terminal too. You see, having an integrated terminal has become a kind of fashion. Why should Vim resist it? Nevertheless, the concept for integrating a terminal in Vim has been verified by neovim, a young and adventurous clone of Vim.

Integrating terminal is a big deal, the first patch that introduces the terminal emulator support has 11,693 additions and 13 deletions. That must be the reason why Vim was hesitated on having it for a long time. The patch was delivered on Jul 7, 2017, which is 10 months ago. By now, I should expect this feature has become mature enough for practical use.

You can give it a try by using the vim-win32-installer, which is fresh and updated frequently (Thanks for the maintainers, you are great!). Spawning a terminal window is quite simple, open gVim and type the command Ex :terminal, then you can see the good old CMD.exe running in a split window in gVim, with its cursor blinking like a beating hard. :terminal can be used to do many things, check out the help with :h :terminal, or see the document here: doc/terminal.txt

Well, I’m might get too excited about this feature. But it is really good to see Vim keeps evolving, even 27 years after it was born. The original Vim makes you never leave your terminal when editing code. Now, with the advent of this new feature, you shall never leave Vim for terminal. Actually, you can run another Vim instance right inside Vim’s terminal emulator. And remember, what Vim gives you is not just an ordinary terminal emulator. It also comes with color highlighting, multiplexing using windows and tabs, as well as Vim’s powerful scripting capability.

Categories

Tags