MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
July
Sun Mon Tue Wed Thu Fri Sat
 
17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
2024
Months
JulAug Sep
Oct Nov Dec


Wed, Apr 15, 2020 2:04 pm

Gvim stuck in insert mode

While editing a file with the gVim text editor on a Microsoft Windows 10 system, I found I was stuck in insert mode. Hitting the Esc key would no longer take me out of insert mode and when I closed and reopened the editor I would be put in insert mode as soon as the editor opened. I switched to another user account on the system and opened gVim from that account. I could use the escape key on that account to exit insert mode, which proved that there wasn't a problem with the escape key on the keyboard. I was able to resolve the problem by clicking on Edit, selecting Global Settings, and then Toogle Insert Mode.

gVim toggle insert mode

After I selected Toogle Insert Mode, the editor was taken out of insert mode and I was then able to enter editor commands. I could re-enter insert mode by hitting the i key as usual. Though I could now move in and out of insert mode with the Esc and i keys as usual, when I closed and reopened gVim, I found it was not exiting insert mode when I hit the Esc key, so I had to select the Toggle Insert Mode option again from the menu. I'll have to check the gVim Startup Settings later to see why it is not responding to the Esc key on the one account, though there may be an issue outside of gVim as I found that I can no longer type URLs in the address field of Microsoft Edge tabs, though I could type in the search field of an already open Wikipedia tab in the browser.

[/editors/vi] permanent link

Thu, Nov 07, 2013 8:15 pm

Replacing a character with a newline character using vi

If you wish to replace all occurrences of a character with a newline character, which is used on Linux/Unix systems to indicate the start of a new line, you can represent the new line with a \r in a vi command; think of the "r" as representing a carriage return. E.g., if I had a long line with items on the line separated by commas, I could use the command below to remove each comma and start another line where the comma occurred, instead.

:s/,/\r/g

[/editors/vi] permanent link

Thu, Nov 07, 2013 7:54 pm

Sorting lines in a file using the vi editor

If you need to sort all the lines in a file alphabetically with the vi editor, you can use ! sort. E.g., you could sort lines 10 to 20 with the following command:

:10,20 ! sort

You can sort all lines in the file with 1,$ ! sort.

[/editors/vi] permanent link

Mon, Aug 15, 2005 5:42 pm

Vi

When I'm on a Unix or Linux system, I prefer to use the vi editor, though I also sometimes use the pico editor as well. I also much prefer the Vi IMproved (VIM) editor, which is a vi clone, to Notepad on windows systems. I've lost information I was entering in Notepad countless times on Windows systems when the system crashed or locked up. With Vim, I have a much better chance of recovering my data. Notepad also lacks the robust search and replace features of Vim, which allows you to use "regular expressions" for manipulating text. However, for someone used to only working in a Windows GUI, learning to use the capabilities of Vim will probably take a fair amount of time and would likely be difficult. But if you use Vi on a Unix or Linux system, it certainly is a much more powerful editor than Notepad when you have to use a Windows system.

I've started creating my own Vi tips to help me remember commands that I may not use frequently, but am likely to need again.

[/editors/vi] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo