vim : The term 'vim' is not recognized as the name of a cmdlet?

Viewed 16735

I'm following a tutorial on Laravel. I've never used it before. The tutorial say I should use create a file with vim database/database.sql but when I do I get the error:

vim : The term 'vim' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ vim
+ ~~~
    + CategoryInfo          : ObjectNotFound: (vim:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I've tried to install vim from vim.org but don't know if this is right. Any help is greatly appreciated. I'm using windows 10.

5 Answers

In addition to installing Vim from vim.org, you also need to make sure it's added to $PATH in order to use it from the command line without using the full path. On Windows, you can do this with

Control Panel -> System -> Edit the system environment variables -> Click Environment Variables -> Find the PATH variable -> Click "edit" -> Check if Vim is here, otherwise click "new" -> Click "browse" -> Navigate to the Vim executable that you installed

After vim has been added to PATH, you should be able to use it from the command line. You will need to close and re-open Cmd/PowerShell.

In my case resetting/adding environment variable for VIM didn't help.

I managed to resolve this issue installing Chocolatey Windows Package Manager.

In Powershell with admin rights run:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

then:
choco install vim and refreshenv

Your Vim is ready to run within Powershell.

If you're using Windows and you didn't change the installation path when installing vim, these are the steps to perform:

  1. Press Ctrl+R to open the Run command window
  2. Type sysdm.cpl to open the System Properties window
    enter image description here
  3. Click the Advanced tab
  4. Click Environment Variables... button
    enter image description here
  5. Choose either User variable for [Your user name] or System variables, click the row with Path variable
  6. Click Browse... to find the Vim executable. If the version of vim installed is 8.2.XXXX, it should be located at C:\Program Files (x86)\Vim\vim82, else change the vim82 into the appropriate folder name where your gvim.exe is located at.

You could simply try: start vim yourFileName

I believe you basically want to open a sql file. You can open it with any editor. You can just execute the below commands in your command prompt :

cd database
notepad database.sql

If working with vim is essential in your case, then I would suggest installing gvim for your windows.

Related