Posts with the tag vim

Automatic Line Breaks With vim

First set the textwidth:

:set textwidth=76

Reformatting

If you want to reformat a block of text, format it and press gq. For example to format the following 4 lines from the current cursor position, press v4jgq (v4j to enter markup mode and mark the following 4 lines).

References

...

Read on

Install a Git Plugin for VIM: git-vim

To install git-vim run:

cd ~/Downloads
git clone https://github.com/myw/git-vim.git
cd git-vim
# by default, the Makefile is set up for Mac OS. If you use a different OS change it using:
cat Makefile | sed "s|#INSTALL=install|INSTALL=install|g" | grep -v ginstall > Makefile
# then install the plugin:
make install

This will copy the following files to...

Read on

Enable Syntax Highlighting etc. with the shipped version of vi (vim)

How to make vim more comfortable (the version shipped with Mac OS X 10.6):

cd /usr/share/vim
sudo vim vimrc

add set:

set ai                  " auto indenting
set history=100     ...

Read on