===================
vim-tips-and-tricks
===================

.. raw:: html

   <table class="provenance-header" style="border: 0; border-collapse: collapse; margin: 0 0 16px 0; width: 100%;">

.. raw:: html

   <tr style="border: 0;">

.. raw:: html

   <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
   | **Snapshot:** 2026-09-14T11:10:42Z
   | **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.*

.. raw:: html

   </td>

.. raw:: html

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

.. figure:: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKQAAACkAQAAAAAxzrjsAAABaUlEQVR42tVXQQ4CQQxq/AD//yU/qEBNvHgx4aCzZmd3DthQSruzHxbnh09nBjvAguTCr3zMp/XN6Sx2jeu7QOGHDq6wvGEVLvNaw0XYAAdd3BHRYncUbg93j9fZ3Gr8hoH3qunBSzkTnJ4tB6mvw6+yRUXKXSHnrYHLHWYTnpFVKiVcy3fopHnTr4M7QhKnLgsrma16uyoWqu3CYbd0diFbwM6Zr05duNY2gSIpLPGLM501HS66Vt5cYxLbXrFNi1/az7XwCrzGb/JlIlJtYrsUrxVgjxhvvqFVxzhu4W6Hlj8gjj5hOf5Q8zNaX0zcPinpLM6AXEx7a+G6MqJag26aXcd3MjiYhqijx++1tRjZhV+Kl2e+UoVrhK1646kgNXeTVK0fn7tf55gSvzdPbiYSN3o05x2bQ5qQ/6I5n1lsAiz6b3CRzDHtfqtzaqapNM7ivE6cs7vlT3GetBwi5Xxh9ObJ//nOegL4fsgV+eHpdQAAAABJRU5ErkJggg==
   :alt: Scan for living source

   Scan for living source

.. raw:: html

   </td>

.. raw:: html

   </tr>

.. raw:: html

   </table>

Vim Tips and Tricks
===================

.. container::

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

.. container::

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

.. container::

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

.. container::

[c
   move focus to previous difference.

.. container::

]c
   move focus to next difference.

.. container::

:diffupdate
   diff update

.. container::

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

.. container::

:diffput <window number>
   put changes from current window into specified window number.

.. container::

zo
   open folded text

.. container::

zc
   close folded text

.. container::

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
| **Snapshot:** 2026-09-14T11:10:42Z
| **Generator:** Remarkbox ``695de26``
