" indent when moving to the next line while writing code
set autoindent
" expand tabs into spaces
set expandtab
" when using the >> or << commands, shift lines by 4 spaces
set shiftwidth=4
" show a visual line under the cursor's current line
set cursorline
" show the matching part of the pair for [] {} and ()
set showmatch
" enable all Python syntax highlighting features
let python_highlight_all = 1
</pre></div>
<p>Here is how these configuration options look with a dark background on
Mac OS X while editing the markdown for this webpage (how meta!).</p>
<p><imgsrc="theme/img/vim-dark-bg.jpg" width="100%" alt="Vim with basic configuration options on a dark background." class="technical-diagram" style="border-radius: 5px;"></p>
<p>Take a look at another example using these configuration options, this time
with a light background and editing Python code from my
<ahref="https://github.com/makaimc/choose-your-own-adventure-presentations">Choose Your Own Adventures Presentations</a>
project.</p>
<p><imgsrc="theme/img/vim-white-bg.png" width="100%" alt="Vim with basic configuration options on a white background." class="technical-diagram" style="border-radius: 5px; border: 1px solid #999;"></p>
<p>The Vimrc file lives under the home directory of the user account running
Vim. For example, when my user account is 'matt', on Mac OS X my Vimrc
file is found at <code>/Users/matt/.vimrc</code>. On Ubuntu Linux my .vimrc file
can be found within the <code>/home/matt/</code> directory. </p>
<p>If a Vimrc file does not already exist, just create it within the user's
home directory and it will be picked up by Vim the next time you open the
editor.</p>
<h2>Vim tutorials</h2>
<p>Vim has a reputation for a difficult learning curve, but it's much easier
to get started with these tutorials.</p>
<ul>
<li>
<p><ahref="http://vim-adventures.com/">Vim Adventures</a> is a cute, fun browser-based
game that helps you learn Vim commands by playing through the adventure.</p>
</li>
<li>
<p><ahref="http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/">Learn Vim Progressively</a>
is a wonderful tutorial that follows the path I took when learning Vim:
learn just enough to survive with it as your day-to-day editor then begin
adding more advanced commands on top.</p>
</li>
<li>
<p><ahref="https://danielmiessler.com/study/vim/">A vim Tutorial and Primer</a> is an
incredibly deep study in how to go from beginner to knowledgeable in Vim.</p>
</li>
<li>
<p><ahref="http://benmccormick.org/2014/07/02/learning-vim-in-2014-vim-as-language/">Vim as a Language</a>
explains the language syntax and how you can build up over time to master
the editor.</p>
</li>
<li>
<p><ahref="https://www.digitalocean.com/community/tutorials/installing-and-using-the-vim-text-editor-on-a-cloud-server">How to install and use Vim on a cloud server</a>
along with <ahref="https://www.digitalocean.com/community/tutorials/how-to-use-vim-for-advanced-editing-of-plain-text-or-code-on-a-vps--2">How to use Vim for advanced editing of code on a VPS</a>
are two detailed Digital Ocean guides for getting up and running with Vim,
regardless of whether you're using it locally or on a cloud server.</p>
</li>
<li>
<p>In <ahref="http://mislav.uniqpath.com/2011/12/vim-revisited/">Vim: revisited</a> the
author explains his on-again off-again relationship with using Vim. He then
shows how he configures and uses the editor so it sticks as his primary
code editing tool.</p>
</li>
</ul>
<h2>Vim Python IDE bundles and resources</h2>
<p>Once you get comfortable with Vim as an editor, there are several
configuration options and plugins you can use to enhance your Python
productivity. These are the resources and tutorials to read when you're
ready to take that step.</p>
<ul>
<li>
<p>The <ahref="https://github.com/klen/python-mode">python-mode</a> project is a Vim
plugin with syntax highlighting, breakpoints, PEP8 linting, code completion
and many other features you'd expect from an integrated development
environment.</p>
</li>
<li>
<p><ahref="https://github.com/gmarik/Vundle.vim">Vundle</a> comes highly recommended
as a plug-in manager for Vim.</p>
</li>
<li>
<p><ahref="http://haridas.in/vim-as-your-ide.html">Vim as Your IDE</a> discusses how to
set up Vim for greater productivity once you learn the initial Vim language
for using the editor.</p>
</li>
<li>
<p><ahref="http://unlogic.co.uk/2013/02/08/vim-as-a-python-ide/">Vim as a Python IDE</a>
goes through the steps necessary to make Vim into a more comfortable
environment for Python development.</p>
</li>
<li>
<p><ahref="http://stackoverflow.com/questions/9172802/setting-up-vim-for-python">Setting up Vim for Python</a>
has a well written answer on Stack Overflow for getting started with Vim.</p>
</li>
</ul>
<h2>Vim installation guides</h2>
<p>These installation guides will help you get Vim up and running on Mac OS X,
Linux and Windows.</p>
<ul>
<li>
<p><ahref="http://prioritized.net/blog/upgrading-vim-on-os-x/">Upgrading Vim on OS X</a>
explains why to upgrade from Vim 7.2 to 7.3+ and how to do it using
<ahref="http://brew.sh/">Homebrew</a>.</p>
</li>
<li>
<p>The easiest way to install Vim on Windows 7+ is to download and run the
<ahref="http://www.deploypython.com/"><imgsrc="theme/img/sponsored/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<pstyle="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <ahref="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>.
</p>
</div>
</div><divclass="panel panel-success">
<divclass="panel-heading">
<h3class="panel-head"><ahref="/table-of-contents.html" style="color: #fff;">Table of Contents</a></h3>
<ahref="/about-author.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>About the Author</a>
</div>
</div>
<divclass="panel panel-success">
<divclass="panel-body">
<ahref="http://www.deploypython.com/"><imgsrc="theme/img/sponsored/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<pstyle="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <ahref="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>.