GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — fullstackpython.com/vim.html at gh-pages · shafi-/fullstackpython.com Expand file tree/ Copy pathvim.htmlMore file actions 352 lines (340 loc) · 20 KB / Copy pathvim.htmlFile metadata and controls352 lines (340 loc) · 20 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="author" content="Matt Makai"> <meta name="description" content="Vim is a text editor with powerful string manipulation capabilities. Find out more about Vim on Full Stack Python."> <link rel="shortcut icon" href="//static.fullstackpython.com/fsp-fav.png"> <title>Vim - Full Stack Python</title> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> <link href="theme/css/f.min.css" rel="stylesheet"> </head> <body> <div style="padding: 0 0 20px 0; margin: 0 0 20px 0; background-color: #22B24C;"> <div class="container"> <p class="banner"><a href="https://www.gumroad.com/l/python-deployments" style="color: #fff">Learning Python web development? Check out the just-updated Guide to Deployments book</a>!</p> </div> </div> <a href="https://github.com/makaimc/fullstackpython.com"><img style="position: absolute; top: 0; right: 0; border: 0;" src="/theme/img/fork.png" alt="Fork me on GitHub"></a> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="logo-header-section"> <a href="/" style="text-decoration: none; border: none;"><img src="theme/img/logo.png" height="52" width="52" class="logo-image" style="padding-top: 1px;" alt="Full Stack Python logo"></a> <span class="logo-title"><a href="/">Full Stack Python</a></span> </div> </div> </div><div class="row"> <div class="col-md-8"> <h1>Vim</h1> <p>Vim, short for Vi IMproved, is a configurable text editor often used as a Python development environment. Vim proponents commonly cite the numerous plugins, Vimscript and logical command language as major Vim strengths.</p> <h2>Why is Vim a good Python development environment?</h2> <p>Vim's philosophy is that developers are more productive when they avoid taking their hands off the keyboard. Code should flow naturally from the developer's thoughts through the keyboard and onto the screen. Using a mouse or other peripheral is a detriment to the rate at which a developer's thoughts become code.</p> <p>Vim has a logical, structured command language. When a beginner is learning the editor she may feel like it is impossible to understand all the key commands. However, the commands stack together in a logical way so that over time the editor becomes predictable.</p> <div class="well see-also">If you're interested in Vim you'll also want to read about <a href="/development-environments.html">development environments for coding</a> and learn <a href="/why-use-python.html">what makes Python a great programming language</a>.</div> <h2>Configuring Vim with a Vimrc file</h2> <p>The Vimrc file is used to configure the Vim editor. A Vimrc file can range from nothing in it to very complicated with hundreds or thousands of lines of configuration commands.</p> <p>Here's a short, commented example .vimrc file I use for Python development to get a feel for some of the configuration statements:</p> <div class="highlight"><pre>" enable syntax highlighting syntax enable " show line numbers set number " set tabs to have 4 spaces set ts=4 " 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><img src="/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 <a href="https://github.com/makaimc/choose-your-own-adventure-presentations">Choose Your Own Adventures Presentations</a> project.</p> <p><img src="/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><a href="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><a href="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><a href="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><a href="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><a href="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 <a href="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 <a href="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>Vimrc resources</h2> <p>These are a few resources for learning how to structure a <code>.vimrc</code> file. I recommend adding configuration options one at a time to test them individually instead of going whole hog with a Vimrc you are unfamiliar with.</p> <ul> <li> <p><a href="http://dougblack.io/words/a-good-vimrc.html">A Good Vimrc</a> is a fantastic, detailed overview and opinionated guide to configuring Vim. Highly recommended for new and experienced Vim users.</p> </li> <li> <p><a href="https://justin.abrah.ms/vim/vim_and_python.html">Vim and Python</a> shows and explains many Python-specific .vimrc options.</p> </li> <li> <p>This <a href="https://github.com/amix/vimrc/tree/master/vimrcs">repository's folder with Vimrc files</a> has example configurations that are well commented and easy to learn from.</p> </li> <li> <p>For people who are having trouble getting started with Vim, check out this blog post on the <a href="http://adamdelong.com/two-simple-steps-helped-me-learn-vim/">two simple steps that helped this author learn Vim</a>.</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><a href="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 <a href="http://brew.sh/">Homebrew</a>.</p> </li> <li> <p>The easiest way to install Vim on Windows 7+ is to download and run the <a href="http://www.vim.org/download.php#pc">gvim74.exe</a> file.</p> </li> <li> <p>On Linux make sure to install the <a href="https://launchpad.net/ubuntu/+source/vim">vim package</a> with <code>sudo apt-get install vim</code>.</p> </li> <li> <p>If you're using PyCharm as your IDE you won't need to install Vim as a separate text editor - instead use the <a href="https://plugins.jetbrains.com/plugin/164">IdeaVim</a> PyCharm plugin to get Vim keybindings, visual/insert mode, configuration with ~/.ideavimrc and other Vim emulation features.</p> </li> </ul> <h2>Using Vim as a Python IDE</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><a href="https://realpython.com/blog/python/vim-and-python-a-match-made-in-heaven/">VIM and Python - a Match Made in Heaven</a> details how to set up a powerful VIM environment geared towards wrangling Python day in and day out.</p> </li> <li> <p>The <a href="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><a href="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><a href="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><a href="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> <li> <p>If you're writing your documentation in Markdown using Vim, be sure to read this <a href="http://www.swamphogg.com/2015/vim-setup/">insightful post on a Vim setup for Markdown</a>.</p> </li> </ul> <h2>Vim Plugin Managers</h2> <ul> <li> <p><a href="https://github.com/gmarik/Vundle.vim">Vundle</a> comes highly recommended as a plugin manager for Vim.</p> </li> <li> <p><a href="https://github.com/tpope/vim-pathogen">Pathogen</a> is a widely used used plugin manager.</p> </li> <li> <p><a href="https://github.com/junegunn/vim-plug">Vim-plug</a> bills itself as a minimalistic Vim plugin manager.</p> </li> </ul> <h2>Vim Plugin resources</h2> <ul> <li> <p><a href="http://joelhooks.com/blog/2013/04/23/5-essential-vim-plugins/">5 Essential VIM Plugins That Greatly Increase my Productivity</a> covers the author's experience with the Vundle, NERDTree, ctrlp, Syntastic and EasyMotion Vim plugins.</p> </li> <li> <p><a href="http://benmccormick.org/2014/07/21/learning-vim-in-2014-getting-more-from-vim-with-plugins/">Getting more from Vim with plugins</a> provides a list of plugins with a description for each one on its usefulness. The comments at the bottom are also interesting as people have suggested alternatives to some of the plugins mentioned in the post.</p> </li> <li> <p><a href="https://github.com/powerline/powerline">Powerline</a> is a popular statusline plugin for Vim that works with both Python 2 and 3.</p> </li> </ul> <h3>Now that you know about Vim, what do you want to develop in it?</h3> <div class="row"> <div class="col-md-4"> <div class="well select-next"> <a href="/data.html" class="btn btn-success btn-full"><svg width="28" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M63 1536h-63v-1408h63v1408zm63-1h-32v-1407h32v1407zm94 0h-31v-1407h31v1407zm157 0h-31v-1407h31v1407zm157 0h-62v-1407h62v1407zm126 0h-31v-1407h31v1407zm63 0h-31v-1407h31v1407zm63 0h-31v-1407h31v1407zm157 0h-63v-1407h63v1407zm157 0h-63v-1407h63v1407zm126 0h-63v-1407h63v1407zm126 0h-63v-1407h63v1407zm94 0h-63v-1407h63v1407zm189 0h-94v-1407h94v1407zm63 0h-32v-1407h32v1407zm94 1h-63v-1408h63v1408z" fill="#fff"/></svg></a> <p class="under-btn">I want to know about working with data in Python.</p> </div> </div> <div class="col-md-4"> <div class="well select-next"> <a href="/web-frameworks.html" class="btn btn-success btn-full"><svg width="28" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M553 1399l-50 50q-10 10-23 10t-23-10l-466-466q-10-10-10-23t10-23l466-466q10-10 23-10t23 10l50 50q10 10 10 23t-10 23l-393 393 393 393q10 10 10 23t-10 23zm591-1067l-373 1291q-4 13-15.5 19.5t-23.5 2.5l-62-17q-13-4-19.5-15.5t-2.5-24.5l373-1291q4-13 15.5-19.5t23.5-2.5l62 17q13 4 19.5 15.5t2.5 24.5zm657 651l-466 466q-10 10-23 10t-23-10l-50-50q-10-10-10-23t10-23l393-393-393-393q-10-10-10-23t10-23l50-50q10-10 23-10t23 10l466 466q10 10 10 23t-10 23z" fill="#fff"/></svg></a> <p class="under-btn">I want to learn how to code a Python web application using a framework.</p> </div> </div> <div class="col-md-4"> <div class="well select-next"> <a href="/deployment.html" class="btn btn-success btn-full"><svg width="28" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1792 640q0 26-19 45l-512 512q-19 19-45 19t-45-19-19-45v-256h-224q-98 0-175.5 6t-154 21.5-133 42.5-105.5 69.5-80 101-48.5 138.5-17.5 181q0 55 5 123 0 6 2.5 23.5t2.5 26.5q0 15-8.5 25t-23.5 10q-16 0-28-17-7-9-13-22t-13.5-30-10.5-24q-127-285-127-451 0-199 53-333 162-403 875-403h224v-256q0-26 19-45t45-19 45 19l512 512q19 19 19 45z" fill="#fff"/></svg></a> <p class="under-btn">I've built a Python web app, now how do I deploy it?</p> </div> </div> </div><div id="mc_embed_signup"> <form action="//mattmakai.us2.list-manage.com/subscribe/post?u=b7e774f0c4f05dcebbfee183d&id=b22335388d" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> <div id="mc_embed_signup_scroll"> <h4>Sign up here to receive an email with major updates to this site and Python tutorials delivered to your inbox once a month.</h4> <div class="row"> <div class="col-md-9"> <input type="email" value="" name="EMAIL" class="email form-control" id="mce-EMAIL" placeholder="email address" required> <div style="position: absolute; left: -5000px;"><input type="text" name="b_b7e774f0c4f05dcebbfee183d_b22335388d" tabindex="-1" value=""></div> </div> <div class="col-md-3"> <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="btn btn-success" style="font-family: 'Helvetica Neue';"></div> </div> </div> </div> </form> </div> </div> <div class="col-md-offset-1 col-md-3" id="sidebar"> <div class="panel panel-success"> <div class="panel-body"> <a href="http://www.deploypython.com/"><img src="//static.fullstackpython.com/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a> <p style="font-size: .8em; margin-top: 10px;">Searching for a complete, step-by-step deployment walkthrough? Learn more about <a href="http://www.deploypython.com/">The Full Stack Python Guide to Deployments book</a>. </p> </div> </div><div class="panel panel-success"> <div class="panel-heading"> <h3 class="panel-head">Email Updates</h3> </div> <div class="panel-body"> <div id="mc_embed_signup"> <form action="//mattmakai.us2.list-manage.com/subscribe/post?u=b7e774f0c4f05dcebbfee183d&id=b22335388d" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> <div id="mc_embed_signup_scroll"> <h5>Sign up to get a monthly email with Python tutorials and major updates to this site.</h5> <input type="email" value="" name="EMAIL" class="email form-control" id="mce-EMAIL" placeholder="email address" required> <div style="position: absolute; left: -5000px;"><input type="text" name="b_b7e774f0c4f05dcebbfee183d_b22335388d" tabindex="-1" value=""></div> <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="btn btn-success" style="font-family: 'Helvetica Neue'; margin-top: 5px;"> </div> </form> </div> </div> </div> <div class="panel panel-success"> <div class="panel-heading"> <h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Chapters</a></h3> </div> <div class="list-group"> <a href="/introduction.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>1. Introduction</a><a href="/development-environments.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>2. Development Environments</a> <a href="/vim.html" class="list-group-item smaller-item active" style='font-family: "Helvetica Neue",sans-serif;'>» Vim</a> <a href="/python-programming-language.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>3. Core Language</a><a href="/web-development.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>4. Web Development</a><a href="/web-frameworks.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>5. Web Frameworks</a><a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>6. Data</a><a href="/application-programming-interfaces.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>7. Web APIs</a><a href="/deployment.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>8. Deployment</a><a href="/testing.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>9. Testing</a><a href="/change-log.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>13. Change Log</a><a href="/table-of-contents.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",san-serif;background-color:#22B24C; color: #fff;'>...or <span style="border-bottom: 1px dotted;">view the full table of contents</span>.</a> </div> </div> <div class="panel panel-success"> <div class="panel-heading"><h3 class="panel-head">Vim</h3></div> <div class="panel-body"> Major updates are tweeted via <a href="https://twitter.com/fullstackpython">@fullstackpython</a>. <hr/> Need more detailed tutorials than you see here? <a href="http://www.deploypython.com/">Learn more about The Full Stack Python Guide to Deployments book.</a> </div> </div> </div></div> <hr/> </div> <div class="container"> <div class="footer pull-right"> <a href="http://www.mattmakai.com/" class="underline">Matt Makai</a> 2016 </div> </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-19910497-7', 'auto'); ga('send', 'pageview'); </script> <script type='text/javascript'> var trackOutboundLink = function(url) { ga('send', 'event', 'outbound', 'click', url, {'hitCallback': function () { document.location = url; } }); } </script> </body> </html> |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |