Введение
Бывают ситуации, когда очень хочется использовать любимый редактор, но под рукой нету *nix операционных систем, либо разработка ведётся на Windows.
Первое что приходит на ум — использование Windows версии gVim, но в этом случае возникает куча проблем с установкой плагинов, переносом конфигов и адаптации всего и вся. Что-то не будет компилироваться без бубна (например Ctrl-p), а что-то падать во время работы.
Cygwin и Mintty спешат на помощь
Качаем с сайта и устанавливаем последнюю версию Cygwin.
При установке выбираем любое зеркало из списка доступных.
Выбираем следующие пакеты:
- git
- Vim
- ruby
- libsasl2
- ca-certificates
Пока пакеты качаются и ставятся, самое время добыть удобный терминал. Мой выбор пал на mintty. Установка осуществляется копированием mintty.exe в папку bin Cygwin-а.
Для того, чтобы всё выглядело прилично — его нужно поднастроить. Запускаем mintty, тыкаем правой кнопкой на иконку в левом верхнем углу консольки и выбираем «Options…».
Выключаем опцию Blinking, чтобы не отвлекало, выбираем привычный Block в качестве курсора.
Выбираем шрифт по вкусу, ставим сглаживание в Full, Locale — C, Character Set — UTF-8.
Очень важно поставить тип терминала в xterm-256color.
VIM
Одно несомненное преимущество данного подхода это то, что теперь можно использовать ту же самую конфигурацию Vim, что и в *nix системе. А так же мы получаем в своё распоряжение полноценную консоль и можем работать с Windows файлами с помощью утилит grep, find, ack.
Рекомендую создать приватный репозиторий со всеми конфигами совершенно бесплатно на каком-нибудь Bitbucket. Такие подборки обычно называют dotfiles.
Одним приятным открытием в плане конфигурации Vim-а для меня стал Vimified, который базируется на Vundle.
Его лучше ставить по шагам, а то мало-ли что-то пропустили во время установки Cygwin. Шаги установки подробно расписаны в описании к репозиторию.
cd
git clone git://github.com/zaiste/vimified.git
ln -sfn vimified ~/.vim
ln -sfn vimified/vimrc ~/.vimrc
cd vimified
Затем
mkdir bundle
mkdir -p tmp/backup tmp/swap tmp/undo
Клонируем Vundle
git clone https://github.com/gmarik/vundle.git bundle/vundle
Первый запуск Vim может пройти с ошибками из-за того, что предусмотренные конфигурацией пакеты ещё не установлены, но это не страшно.
vim +BundleInstall +qall
Перезапускаем Vim. И вот что у нас должно получится после небольших корректировок и правок.
Заключение
В итоге мы получили:
- Полноценный рабочий Vim
- Приятная цветовая схема и палитра, которая радует глаз
- Работает прокрутка колесом мыши (для любителей)
- Работает изменение размера панелей простым кликом и перетаскиванием
Спасибо за внимание. Надеюсь кому-нибудь пригодится.
Извещения об ошибках — хабрапочтой.
Только зарегистрированные пользователи могут участвовать в опросе. Войдите, пожалуйста.
Каким VIM-ом вы пользуетесь?
Проголосовали 588 пользователей. Воздержались 307 пользователей.
In my quest to become more familiar with using the Windows Command Prompt I have been experimenting with basic text editing and file management from the command prompt to cut the distraction between switching from an IDE to the terminal all the time. I found that working with a text editor like Sublime Text or working with an IDE like Brackets you often need to switch back and forth between your terminal and editor, well what if I could perform text editing in the command prompt just like I do with Vim or Nano in Linux? This would enable me setup my Gulp files, run my Node Package Manager commands and exit the command prompt for a good deal of time before returning.
Vim is a powerful code editor. So powerful that both Linux and Mac have it installed by default.
But if you are using Windows as your operating system, you will need to install Vim separately.
Fortunately, Microsoft makes it very easy to install Vim and get it running on your PC.
How to Download Vim
You can download the latest version of the Vim Text Editor straight from Vim themselves.
They have built a special self-executing installer that walks you through the process of installing Vim in the right location on your hard drive.
Note that for Windows you will technically download something called gVim, which is a version of Vim that includes a basic graphic user interface (GUI). You can install it by downloading this executable installer.
A screenshot of what you’ll se when you attempt to open the file. Because this is an .exe file, Windows will ask your permission first.
Once you’ve downloaded the file, you just need to run it, and you’ll see a nice installation wizard that looks like this:
A screenshot of the wizard you’ll see when you first run the Vim installer
They have a recommended «typical» installation. but if you have a reasonably large hard drive, there’s no harm in going ahead with installing everything by choosing the «full» option:
A screenshot of the Vim installer where you can choose what parts of Vim you want to install.
How to Run Vim in PowerShell
Then, once you’ve installed Vim, you should be able to launch it from your Windows command prompt.
Note that as of 2020, PowerShell has all of the same functionality as CMD, plus a whole lot more. I recommend using PowerShell for everything.
You can open PowerShell from the Windows menu bar by typing «powershell» in the search field on the start bar.
Windows will open PowerShell, and you’ll get a command prompt that looks something like this:
A screenshot of the Windows PowerShell prompt.
Once you’re in PowerShell, here’s how to run Vim itself. All you have to do is type «vim» and press enter. This will open up Vim. Once Vim is open, this is what you should see:
A screenshot of Vim when you open it for the first time.
Congratulations – you now have Vim installed.
How to run Vim inside VS Code
If you are already using VS Code, and want a lot of the speed of Vim without losing the functionality of VS Code, I have good news. It is possible to run a Vim-like experience right within VS Code.
Here is a Vim plugin for VS Code that will help you do this. At the time of me writing this, this plugin has been installed nearly 2 million times.
How to Learn How to Use Vim Properly
Vim is a powerful code editor, and it will take you a lot of practice to get comfortable with it.
Here are a few Vim tutorials that will really help you quickly grasp the basics and get your fingers flying in no time.
For starters, one way Vim is different from other code editors is that Vim has «modes». Here are all of Vim’s modes explained, with examples.
Vim can be intimidating. There is so much to learn. But this guide will show you how not to be afraid of Vim anymore.
If you’re already using VS Code and want to switch completely to Vim, this article will explain how you can do so.
And here are 7 Vim Tips That Changed #100DaysOfCode founder Alex Kallaway’s life. In this article, he not only explain these, but shows demos of these tips in action.
Vim: Learn it, live it, love it.
In the 30 years since Bram Moolenaar first created Vim, its influence has spread far and wide. And even today, the Vim project is actively maintained and constantly improving.
I’ve met so many developers over the years who swear by Vim.
I hope this guide has helped you get running Vim on your Windows PC. And I hope these other tutorials I’ve shared with you here will help you go from zero-to-sixty within the coming months.
The key is to keep practicing and not get discouraged by how many Vim shortcuts there are to remember. Eventually, all of these will become muscle memory, and you’ll be flying from one file to another, banging out code like a terminator.
There is no feeling quite as cool as being able to drop into a codebase and immediately start making changes without ever even reaching for a mouse or trackpad. That is the power that Vim promises, and delivers in spades.
Learn to code for free. freeCodeCamp’s open source curriculum has helped more than 40,000 people get jobs as developers. Get started
Step-by-step guide to Install and set vim editor on Window.
This tutorial explains how to install Vim Editor on Windows, Linux, and macOS
How to Install and setup VIM editor on Windows
Following are the steps required to install on Windows.
- Go to vim.org
- Click on the Download link on the left side for navigation
- Download the stable version or old version for the link
PC: MS-DOS and MS-Windows
- It downloads the
gvim82.exe
file to the local system - Double-click on this file and follow the installation instructions
- Select language
- privacy policy
- Choose components
Click on Next to finish the installation
How to run and open vim editor from PowerShell
there are several ways to open vi editors in Windows.
- Powershell
- Open Windows run by Windows +R command
- type PowerShell
- It opens the PowerShell window
- Windows Terminal
- Open the command prompt and type vim editor
- or you can open the file with
vim filename
.
Fixing Vim is not recognized as an internal or external command
Once you install vim on Windows, It will not run Vim from the command line by default and gives the following error.
vim is not recognized as an internal or external command, operable program, or batch file:
The reason Vim is not a recognized command to execute and it is not found in the environment path
So, you have to set environment variables to vim location.
- Go to Control Panel > System — It opens the System properties window
- Edit System environment variables
- VIM is installed on
c:\Program Files (x86)\vim
in my windows - Edit PATH environment variable, check vim path is added, if not add this to a PATH environment variable and save it.
Now, the Vim command works in terminal and PowerShell windows.
Quick Tutorial For Vim Cmd Commands Pdf Operating System Technology I wanted to use vim on the command prompt, but it gave. vim is not recognized as an internal or external command. i tried searching for a solution and found that i should edit the user specific environment variable ‘path’, but it still gives the same error. what can be the solution?. Click or invoke control panel system advanced environment variables (bottom panel, click on path) (click edit button) (click new button) and then enter «c:\program files (x86)\vim\vim82» to add the vim path at end of windows 10 path. next open of a cmd shell should be able to run vim. –.
Vim From Windows Command Prompt Agnostic Development What you want to do is launch vim.exe from the command line without specifying the full path to the file. to do that you need to add the full path to the file’s containing folder to the path environment variable. here’s how to do that: go to computer in windows explorer. Open command prompt or powershell, the «vim» command shall now work and thus you have successfully installed vim editor in your windows pc. in conclusion, we have explored the installation and configuration of the vim text editor on the windows operating system. From a windows command prompt enter copy con followed by the target file name. (copy con c:\file.txt). then enter the text you want to put in the file. end and save the file by pressing ctrl z then enter or f6 then enter. Then, once you’ve installed vim, you should be able to launch it from your windows command prompt. note that as of 2020, powershell has all of the same functionality as cmd, plus a whole lot more. i recommend using powershell for everything.

Vim Command Window Arabesque From a windows command prompt enter copy con followed by the target file name. (copy con c:\file.txt). then enter the text you want to put in the file. end and save the file by pressing ctrl z then enter or f6 then enter. Then, once you’ve installed vim, you should be able to launch it from your windows command prompt. note that as of 2020, powershell has all of the same functionality as cmd, plus a whole lot more. i recommend using powershell for everything. Vim is a lot like vi from the unix world except it has a bit more to offer, such as syntax highlighting and plugin capability. after installing vim for windows, found here, i was able to use the vim command to open and edit files with the same commands that you would use for vi. Vim will work inside the windows console window if you run it with vim.exe. if you run it with gvim.exe then it will pop up a graphical window, kind of like notepad would. therefore, you want to type the command vim or vim file name and you should get what you want. make sure your $path is set to include the folder with vim.exe. Don’t use vim from the command prompt. use the terminal that comes with git. a better way is to enable windows wsl, which is basically linux. windows will install it for you, without you having to download or run anything. it policy may or may not block. just try it. Step 3: once the installation is complete, open a cmd window and type in vim and hit enter. voila, now you are inside vim text editor. typing something won’t work because using vim is not.