Showing posts with label gvim. Show all posts
Showing posts with label gvim. Show all posts

Wednesday, August 25, 2010

How to password protect a text file using vim?

I heard this tip very recently. For password protecting a file(may be a text file contains some secure password) using vim just open it using "x" option. ie., vim -x <filename>. Or you can do this in some other way while saving it using :X instead of :w

How to enable visual block mode in gvim


This post is for friends who LEARNED vim in linux machine and now using a windows gvim. For friends who used with Linux vim will know "ctrl+v" enables visual block mode. But this key combinations are used to paste the clipboard contents in windows gvim. So, how to enable that visual block mode in windows gvim? It is easy :) press "ctrl+q" thats it. Now don't forget to hold shift key to select block of text for editing.

How to remove end of line using vim/gvim

I was just wondering how to remove all the end of line "\n" or "\n\r" characters and make the entire content into one line.  It is very simple. Go to command mode by pressing the escape key and press "shift + j".  Okay if you want this to be done by a search and replacing command then type :%s/\n//gc in command mode.

How to remove empty lines usgin gvim in windows/Linux

I am searching for this in the internet but with no luck :( And some what managed to make it work. So i just post it for the sake of people who search for deleting or removing blank or empty lines from a file. I tested this on gvim in windows machine and also vim in linux machine.

Steps:

  1. Go to command mode by pressing esc.
  2. Then type - ":%s/^[\ \t]*\n//g" with out quotes. :)