<table class="provenance-header" style="border: 0; border-collapse: collapse; margin: 0 0 16px 0; width: 100%;">
<tr style="border: 0;">
<td style="border: 0; vertical-align: top; padding: 0 24px 0 0;">

> **Source:** [https://foxhop.net/f33d4f88-2f95-11f1-821d-e86a64d24d78/vim-tips-and-tricks](https://foxhop.net/f33d4f88-2f95-11f1-821d-e86a64d24d78/vim-tips-and-tricks)  
> **Snapshot:** 2026-09-14T12:18:04Z  
> **Generator:** Remarkbox `695de26`  
>
> *This is a thread snapshot. The living document lives at the source URI above — it may have been edited, extended, or replied-to since.*

</td>
<td style="border: 0; vertical-align: top; width: 200px; text-align: right;">

![Scan for living source](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAACkAQAAAAAxzrjsAAABaUlEQVR42tVXQQ4CQQxq/AD//yU/qEBNvHgx4aCzZmd3DthQSruzHxbnh09nBjvAguTCr3zMp/XN6Sx2jeu7QOGHDq6wvGEVLvNaw0XYAAdd3BHRYncUbg93j9fZ3Gr8hoH3qunBSzkTnJ4tB6mvw6+yRUXKXSHnrYHLHWYTnpFVKiVcy3fopHnTr4M7QhKnLgsrma16uyoWqu3CYbd0diFbwM6Zr05duNY2gSIpLPGLM501HS66Vt5cYxLbXrFNi1/az7XwCrzGb/JlIlJtYrsUrxVgjxhvvqFVxzhu4W6Hlj8gjj5hOf5Q8zNaX0zcPinpLM6AXEx7a+G6MqJag26aXcd3MjiYhqijx++1tRjZhV+Kl2e+UoVrhK1646kgNXeTVK0fn7tf55gSvzdPbiYSN3o05x2bQ5qQ/6I5n1lsAiz6b3CRzDHtfqtzaqapNM7ivE6cs7vlT3GetBwi5Xxh9ObJ//nOegL4fsgV+eHpdQAAAABJRU5ErkJggg==)

</td>
</tr>
</table>

# Vim Tips and Tricks

<div>

</div>

As I learn more about vim, I plan to document the tips and tricks I
learn here.

## how to set tab to 4 spaces in vim

Add the following into your .vimrc file:

    set tabstop=4
    set shiftwidth=4
    set expandtab

## how to set replace all tabs with a space

    :%s/\t/ /g

## how to highlight spelling errors

    set spell spelllang=en_us

## vimdiff or hg merge

This is a list of some common commands when using vimdiff:

ctrl w (twice)

:   switch windows

<div>

</div>

do

:   diff obtain, take the other window\'s differences. Pull the change.

<div>

</div>

dp

:   diff put, give the other window our differences. Push the change.

<div>

</div>

\[c

:   move focus to previous difference.

<div>

</div>

\]c

:   move focus to next difference.

<div>

</div>

:diffupdate

:   diff update

<div>

</div>

:diffget \<window number\>

:   get changes from specified window number and place them into current
    window.

<div>

</div>

:diffput \<window number\>

:   put changes from current window into specified window number.

<div>

</div>

zo

:   open folded text

<div>

</div>

zc

:   close folded text

<div>

</div>

## bgolemon — [Mar 27, 2011 10:05 am](https://foxhop.net/f33d4f88-2f95-11f1-821d-e86a64d24d78/vim-tips-and-tricks#f49ae6f5-2f95-11f1-a479-e86a64d24d78)

You should take a look at my vimrc
`here <http://bukzor.hopto.org/hgroot/home/file/c0078b4417f2/.vimrc>`\_.
It solves some common annoyances without changing the way vim works
much.


---

**Source:** [https://foxhop.net/f33d4f88-2f95-11f1-821d-e86a64d24d78/vim-tips-and-tricks](https://foxhop.net/f33d4f88-2f95-11f1-821d-e86a64d24d78/vim-tips-and-tricks)  
**Snapshot:** 2026-09-14T12:18:04Z  
**Generator:** Remarkbox `695de26`
