4

I would like to be able to create and edit the text of a file, all from the command line. No pop-up window (like with notepad), just create the file and start editing. I know this can be done with Nano on Mac.

My current command line is "Command Prompt with Ruby and Rails," which I'm using on Windows 8. Apparently I have VIM installed, or VI. When I commit to git, I am entered into an excellent text edit space - within my current window. Great! But how do I do it if not committing anything, and just want to >make file>edit file>. Something like >vim file_name.

So the VIM command would be appreciated. If not available, what else can I install? I tried the Nano binary. I ran the nano.exe and it works, but calling >nano file_name from cmd doesn't work. I already copy-pasted the cygwin1.dll to the folder nano asks for in the readme. No luck. I'm using the WinNT/9x binary, .zip format download.

I'm using x64 Windows 8 OS.

Kevin Panko
  • 7,466

5 Answers5

5

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.

Kevin Panko
  • 7,466
2

edit is still available in Windows 7. Microsoft removed it in Windows 8 and up.

If you want to create a simple file from the command prompt use:

c:> copy con filename.txt

Use CTRL+Z to save the file.

You can also use echo and pipe it to a file.

Sun
  • 6,480
2

I always use Cygwin with Git and Vim installed to be like on a Unix term and it works perfectly (with a bashrc and alisases ....) and of course ou can install ruby and irb.

Hettomei
  • 182
1

It just depends what editor you install. I like UltraEdit, but it's not free for long-term use. Some people like XPad, which is apparently free. There is a program called "WinVI" which is a Windows editor similar to VI, of course. You just have to decide what type of editor you want. For that matter, you could use the XP EDIT program, just copy it to Win7 from an XP system. However, I'm not sure that there's any advantage to using a text-based "DOS" style editor in Windows 7; it may look retro, but there's not likely to be any upside to it.

I think if I had to recommend something DOS-like, I'd go with Emacs-for-Windows: http://ftp.gnu.org/gnu/emacs/windows/

Whatever editor you want to use, put the installation folder into your PATH variable, which is found with Control Panel > System > Advanced System Settings > click on Environment Variables box. Select the PATH variable, and Edit, to add a colon at the end & then the path to the newly-installed program (i.e. "C:\Program Files (X86)\Editco"

This path change will then allow you to just type the program name, instead of the specific location, i.e. instead of

C:\Program Files (X86)\Editco\Myeditor.exe  filename.ext

you'd just type

Myeditor.exe filename.ext
Debra
  • 4,326
  • 1
  • 19
  • 24
1

You could try one of the following options: