Skip to main content

Practice Linux vim in Windows using gVim

Vim is a cool and powerful editor in Linux system.

It is also available for Windows via this download page: https://www.vim.org/download.php

Choose: gvim_9.2.0000_x64.exe (64bit installer) or any format of your choice.

After downloading and installing, the installer it will create two desktop icons; something similar to the image shown below.



Why there are two icons? As the name suggests "gVim Easy 9.2", gVim Easy is the filename suggests it's "easy", upon opening or clicking the icon it will open gVim in "insert" mode and start typing immediately.

While the other icon "gVim Read only 9.2", upon clicking or opening this icon. This will open gVim on "read only" as it names suggest. It's quite good if you only need to review or read the file.
However, it says "read only" it doesn't mean that you cannot edit, modify or add text to the file.

While inside "gVim Read only", press "insert" key or press "i" on the keyboard. This tells gVim that you want to insert or edit the file and the "insert" text will be displayed on the status bar or status line which is shown at the left bottom pane of the status bar. 

gVim image in "Insert" mode:


In "Insert" mode which can be activated by pressing "i" key or "insert key" on the keyboard, once in insert mode then a file can be modified or a new file can be created.

To go back to "normal mode" just press "ESC" or escape key, then the "Insert" status line, will disappear. Which technically means, that gVim is in normal mode.

Basic scenarios when editing a file with any text editor or even Microsoft word, you either "save" the file, "save as" which give you an option to save the file give it another filename or change the location where the file will be saved, or simply do "save and exit".

How to do this in gVim?

To save a file or whatever work you've done in gVim, of course doing it via the GUI by clicking "File" then "save".  To simulate or practice how it's done in Linux, is to activate command mode.
To activate command mode, make sure gVim is in "normal mode", press "ESC" key and the status bar should not display anything like "INSERT", "REPLACE", "VISUAL" or any other text.

While in "Normal mode", press the colon key on the keyboard or this symbol ":" which is just beside the "L" key on a US keyboard layout.

Once in command mode, type "w" key, it's a small "w" not the capital "W" key. w means write or save.

Image below shows how it should look like:


If "W" or the capital "W" is type, gVim will not recognize it and will show an error.



Yes, typing:  ":w" key in gVim is the same command that can be used in Linux vim. Yay, a good way to practice in gVim Windows.

How to do "save as" in gVim? 
It can be done via the GUI, "File" then "Save as". Using the command mode, it can be done like this: 
:w newfilename.txt

Image below, shows how to do "save as" in gVim or vim.


To verify of course, is to open the file. However, gVim itself will show some updates on the status bar that the file has been written with the new filename as specified. Image below shows after gVim successfully written the file or after doing "save as".



How to do "save and exit" in gVim or vim?

In gVim it can be done via the GUI, click "File" and chose "save-exit". And it can also be done via the command mode, by just typing: :x or :wq

:x - means save and exit
:wq - two letters which means write and quit vim

Of course, :x is a slay option, just one letter and does "save and exit".

Here's the image on how it's done, make sure gVim is in command mode when typing or :x or any commands.


:x will save the file and exit gvim.

To do "save as" and "exit" in gvim, can only be done via command mode, please check image below on how to do it.



That's it, when that command shown on the image gVim or vim will perform "save as" then "exit".

As some bonus tip, while in "insert mode" press "Ctrl Key and press x f" hold the control key while pressing x and f and gVim needs to be in insert mode.

This will show on gVim all the files on the current directory where files are saved and there will be a drop down, any filename selected will be shown in gVim.

vim commands in Linux can be used in gVim, yes, WSL Ubuntu Linux or a virtual machine with Linux box is the best way to learn Linux. Of course, correct practice makes perfect. So, doing it in gVim while in Windows is way to go also.






Doing or getting thru life, without calling or asking help from up above is a difficult way to live. It's written come to me all who are weary and burdened, and I will give you rest. Yes, ask God for strength to overcome whatever obstacle you have right now in your life. Trust is all you need.

Comments

Popular posts from this blog

Print error 016-799 - Fuji Film Xerox

016-799 Fuji Xerox or Fuji Film print error code. That shows a description error as “Print instruction Fail detected in decomposer.” The error code and error description are alien languages for users and even system administrators who are not familiar with Fuji Xerox error code. The error code is quite simple and easy to fix, if the job print goes to the printer but print out doesn’t come out. So, basically the print job was received by the printer, but the printer just doesn’t know what type of paper or what size to use or which tray to utilize for the print out. In some instances, this is just a paper mismatch but the error description; if using Windows 10 to print does not exactly points to what is the issue. First thing to check, is the paper size selected by the user to print. Example, if the printer configuration is A3 and A4 sizes only. But then the person printing the file accidentally chooses “A4 Cover” then this error 016-799 will occur. ...

WMIC get computer name

WMIC get computer model, manufacturer, computer name and  username. WMIC is a command-line tool and that can generate information about computer model, its manufacturer, its username and other informations depending on the parameters provided. Why would you need a command line tool if there’s a GUI to check? If you have 20 or 100 computers, or even more. It’s quite a big task just checking the GUI to check the computer model and username. If you have remote computers, you need to delegate someone in the remote office or location to check. Or you can just write a batch file or script to automate the task. Here’s the code below on how get computer model, manufacturer and the username. Open an elevated command prompt and type:     wmic computersystem get "Model","Manufacturer", "Name", "UserName" Just copy and paste the code above, the word “computersystem” does not need to be change to a computer name. A...

PowerShell GUI with buttons, textbox and combobox

GUI makes life easier, but of course command line has a power of its own. How to add a form in PowerShell with Buttons, TextBox and ComboBox? Adding GUI forms in PowerShell must be done manually by code. It’s not that hard, you just need to love PowerShell and see what it can do to automate IT administration and makes your life easier. Anyway, code below introduces how to add GUI to PowerShell and it also illustrates how to make use of those GUI buttons and send a command to remote computers. Code to add buttons, textbox and combobox in PowerShell, and how to execute a command after the button is clicked. #initialize the main form $form = new-object Windows.forms.form $form . text = "Server Selection Form" $form . minimumSize = New-Object System.Drawing.Size ( 600 , 300 ) $form . maximumSize = New-Object System.Drawing.Size ( 600 , 300 ) #add a button to the form $button = new-object windows.forms.button $button . text...