|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | +<meta charset="utf-8"> |
| 5 | +<style class="text/css"> |
| 6 | +@import url("html4css1.css"); |
| 7 | +@import url("nikola_rst.css"); |
| 8 | + |
| 9 | +</style> |
| 10 | +</head> |
| 11 | +<body> |
| 12 | +<a class="reference external image-reference" href="LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square"></a> |
| 13 | +<p>This is an ongoing project of that sets up |
| 14 | +a particular configuration for improved productivity.</p> |
| 15 | +<p>The goal is to develop a good configuration for the Vim editor, tailored |
| 16 | +for Python development.</p> |
| 17 | +<p>It does not change the behaviour of VIM, since this configuration only |
| 18 | +adds comfortable shortcuts, and settings that are recommended for |
| 19 | +software development (coding good practices).</p> |
| 20 | +<div class="contents topic" id="contents"> |
| 21 | +<p class="topic-title first">Contents</p> |
| 22 | +<ul class="simple"> |
| 23 | +<li> |
| 24 | +<a class="reference internal" href="#installation" id="id1">Installation</a><ul> |
| 25 | +<li><a class="reference internal" href="#instant" id="id2">Instant</a></li> |
| 26 | +<li><a class="reference internal" href="#automatic" id="id3">Automatic</a></li> |
| 27 | +</ul> |
| 28 | +</li> |
| 29 | +<li><a class="reference internal" href="#features" id="id4">Features</a></li> |
| 30 | +<li> |
| 31 | +<a class="reference internal" href="#colour-scheme" id="id5">Colour scheme</a><ul> |
| 32 | +<li><a class="reference internal" href="#captures" id="id6">Captures</a></li> |
| 33 | +</ul> |
| 34 | +</li> |
| 35 | +<li><a class="reference internal" href="#contributing" id="id7">Contributing</a></li> |
| 36 | +<li> |
| 37 | +<a class="reference internal" href="#dependencies" id="id8">Dependencies</a><ul> |
| 38 | +<li><a class="reference internal" href="#external-plug-ins" id="id9">External plug-ins</a></li> |
| 39 | +</ul> |
| 40 | +</li> |
| 41 | +</ul> |
| 42 | +</div> |
| 43 | +<div class="section" id="installation"> |
| 44 | +<h1><a class="toc-backref" href="#id1">Installation</a></h1> |
| 45 | +<div class="section" id="instant"> |
| 46 | +<h2><a class="toc-backref" href="#id2">Instant</a></h2> |
| 47 | +<p>Copy and paste the following command in your terminal:</p> |
| 48 | +<pre class="code bash"><a name="rest_code_9d5f9e035f31444a9e91758b06cf090d-1"></a>mkdir -p ~/.vim <span class="o">&&</span> wget -O ~/.vim/Makefile -N https://raw.github.com/rmariano/vim-config/master/Makefile <span class="o">&&</span> make -C ~/.vim install |
| 49 | +</pre> |
| 50 | +</div> |
| 51 | +<div class="section" id="automatic"> |
| 52 | +<h2><a class="toc-backref" href="#id3">Automatic</a></h2> |
| 53 | +<p>Use the included <a class="reference external" href="Makefile">Makefile</a> script which downloads and replaces the |
| 54 | +files on their latest versions. Bear in mind that requires <tt class="docutils literal">wget</tt> and |
| 55 | +<tt class="docutils literal">Makefile</tt> which comes installed in most of the distributions.</p> |
| 56 | +<pre class="code bash"><a name="rest_code_4246abb8456244a6961535a1ee037dae-1"></a>make install |
| 57 | +</pre> |
| 58 | +<p>Or, if you want to install a particular version (tag or branch).</p> |
| 59 | +<pre class="code bash"><a name="rest_code_4551a52827984279b78fb177999fe000-1"></a>make install <span class="nv">BRANCH</span><span class="o">=</span><tag_or_branch> |
| 60 | +</pre> |
| 61 | +<p>Note: this is supported from version <tt class="docutils literal">>=v0.4</tt>.</p> |
| 62 | +<p>The previous methods rely on getting the files from the Internet, but |
| 63 | +alternatively, if you have already downloaded the project, and unpacked it |
| 64 | +somewhere in your file system, you can install it by running:</p> |
| 65 | +<pre class="code bash"><a name="rest_code_ea0956a0961845d0935928af9a4e131d-1"></a>make deploy |
| 66 | +</pre> |
| 67 | +<p>That will copy the files to their respective locations. Note that this will |
| 68 | +replace any previous instances of those file you might have had there. If you |
| 69 | +want to start over, you could simply run <tt class="docutils literal">make clean</tt>, which will remove the |
| 70 | +files for this project (not the extra packages, though).</p> |
| 71 | +</div> |
| 72 | +</div> |
| 73 | +<div class="section" id="features"> |
| 74 | +<h1><a class="toc-backref" href="#id4">Features</a></h1> |
| 75 | +<ul class="simple"> |
| 76 | +<li> |
| 77 | +<a class="reference external" href="https://www.python.org/dev/peps/pep-0008/">PEP-8</a> general rules of text: |
| 78 | +automatically handling spaces instead of tabs, proper indentation, wrap text |
| 79 | +to 79 columns, margin set (toggle-able), etc.</li> |
| 80 | +<li> |
| 81 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">tw</tt> will highlight trailing white spaces.</li> |
| 82 | +<li> |
| 83 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">w</tt> will remove them (they'll also be automatically removed |
| 84 | +when saving :-)</li> |
| 85 | +<li> |
| 86 | +<tt class="docutils literal">autoindent</tt> & <tt class="docutils literal">smartindent</tt>.</li> |
| 87 | +<li>Function keys<ul> |
| 88 | +<li> |
| 89 | +<tt class="docutils literal"><F2></tt>: toggle spell check.</li> |
| 90 | +<li> |
| 91 | +<tt class="docutils literal"><F3></tt>: Correct files automatically<ul> |
| 92 | +<li>XML: auto-format & indent.</li> |
| 93 | +<li>Python: PEP-8, sort imports, and run <tt class="docutils literal">flake8</tt> checks.</li> |
| 94 | +</ul> |
| 95 | +</li> |
| 96 | +<li> |
| 97 | +<tt class="docutils literal"><F4></tt>: toggle paste mode</li> |
| 98 | +</ul> |
| 99 | +</li> |
| 100 | +<li> |
| 101 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">nh</tt> as a shortcut for <tt class="docutils literal">:nohlsearch</tt> |
| 102 | +</li> |
| 103 | +<li> |
| 104 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">p</tt> is mapped to toggle paste mode, with the label |
| 105 | +indicating in the status bar if is active or not.</li> |
| 106 | +<li>A colour scheme I like.</li> |
| 107 | +<li>A status line with useful information (file name with path, modification |
| 108 | +flag, file type, column, lines, and position (in %).</li> |
| 109 | +<li> |
| 110 | +<tt class="docutils literal">;t</tt> available for searching development tags, such as <tt class="docutils literal">TODO</tt> or |
| 111 | +<tt class="docutils literal">FIXME</tt>, rendering the results in a quick fix window. Warning: searches |
| 112 | +recursively.</li> |
| 113 | +<li> |
| 114 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">n</tt>, <tt class="docutils literal"><leader></tt> + <tt class="docutils literal">p</tt> for moving to the next and |
| 115 | +previous entries in the quick-fix window, respectively. <tt class="docutils literal"><leader></tt> + <tt class="docutils literal">q</tt> |
| 116 | +for closing it.</li> |
| 117 | +<li> |
| 118 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">e</tt> to toggle line numbers (enabled by default).</li> |
| 119 | +<li>Can save files with <tt class="docutils literal">sudo</tt> that were opened with less permissions: <tt class="docutils literal">:w!!</tt> |
| 120 | +to <tt class="docutils literal">sudo</tt> save the file.</li> |
| 121 | +<li>Mappings for managing tabs<ul> |
| 122 | +<li> |
| 123 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">tn</tt>: <strong>T</strong>ab <strong>N</strong>ew, opens a new tab to the right.</li> |
| 124 | +<li> |
| 125 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">to</tt>: <strong>T</strong>ab <strong>O</strong>nly, close all tabs but the current one.</li> |
| 126 | +<li> |
| 127 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">tc</tt>: <strong>T</strong>ab <strong>C</strong>lose, close current tab.</li> |
| 128 | +<li> |
| 129 | +<tt class="docutils literal"><leader></tt> + <tt class="docutils literal">tm</tt>: <strong>T</strong>ab <strong>M</strong>ove, current to the end.</li> |
| 130 | +</ul> |
| 131 | +</li> |
| 132 | +<li>Window splits properly configured<ul> |
| 133 | +<li>New vertical splits, to the right</li> |
| 134 | +<li>New horizontal splits, below.</li> |
| 135 | +<li> |
| 136 | +<tt class="docutils literal"><span class="pre"><C-j></span></tt>: for moving between splits (instead of <tt class="docutils literal"><span class="pre"><C-W><C-j></span></tt>). |
| 137 | +Same for <tt class="docutils literal">h</tt>, <tt class="docutils literal">k</tt>, or <tt class="docutils literal">l</tt> respectively.</li> |
| 138 | +</ul> |
| 139 | +</li> |
| 140 | +<li>Other features<ul> |
| 141 | +<li> |
| 142 | +<tt class="docutils literal">scrolloff=10</tt>: offset of 10 lines when scrolling</li> |
| 143 | +<li>Performance improvements</li> |
| 144 | +<li>Silent bells</li> |
| 145 | +<li>Set hidden buffers</li> |
| 146 | +</ul> |
| 147 | +</li> |
| 148 | +</ul> |
| 149 | +</div> |
| 150 | +<div class="section" id="colour-scheme"> |
| 151 | +<h1><a class="toc-backref" href="#id5">Colour scheme</a></h1> |
| 152 | +<p>The colour scheme requires the terminal to support 256 colours. Most of the |
| 153 | +terminals already support this, but some terminal multiplexers like <tt class="docutils literal">tmux</tt> |
| 154 | +might require to be run as: <tt class="docutils literal">tmux <span class="pre">-2</span></tt> in order to support this.</p> |
| 155 | +<p>In addition, just the command-line classic Vim version is supported, so no |
| 156 | +support for <tt class="docutils literal">Gvim</tt> or graphical versions is included for the colour scheme, |
| 157 | +although pull requests are welcomed.</p> |
| 158 | +<div class="section" id="captures"> |
| 159 | +<h2><a class="toc-backref" href="#id6">Captures</a></h2> |
| 160 | +<p>Here are some examples of how the colour scheme looks like.</p> |
| 161 | +<a class="reference external image-reference" href="https://rmariano.github.io/itarch/vim-capture1.png"><img alt="Vim capture 1" class="align-center" src="https://rmariano.github.io/itarch/vim-capture1.png" style="width: 883px; height: 391px;"></a> |
| 162 | +<p>Please note this might depend on the configuration of your terminal as well.</p> |
| 163 | +<a class="reference external image-reference" href="https://rmariano.github.io/itarch/vim-capture2.png"><img alt="Vim capture 2" class="align-center" src="https://rmariano.github.io/itarch/vim-capture2.png" style="width: 574px; height: 596px;"></a> |
| 164 | +</div> |
| 165 | +</div> |
| 166 | +<div class="section" id="contributing"> |
| 167 | +<h1><a class="toc-backref" href="#id7">Contributing</a></h1> |
| 168 | +<p>If you want to try the project, and tweak the settings, I would recommend you |
| 169 | +to clone the repository, and use the development deployment, which creates |
| 170 | +symlinks of the files in this project, like:</p> |
| 171 | +<pre class="code bash"><a name="rest_code_de056f420b134e1a8e914124083ecae4-1"></a>make dev-deploy |
| 172 | +</pre> |
| 173 | +<p>In addition, take a moment to read the contributing guidelines.</p> |
| 174 | +</div> |
| 175 | +<div class="section" id="dependencies"> |
| 176 | +<h1><a class="toc-backref" href="#id8">Dependencies</a></h1> |
| 177 | +<ul class="simple"> |
| 178 | +<li>Vim 7.4+</li> |
| 179 | +<li>Linux (Other platforms are supported on a best-effort basis).</li> |
| 180 | +</ul> |
| 181 | +<div class="section" id="external-plug-ins"> |
| 182 | +<h2><a class="toc-backref" href="#id9">External plug-ins</a></h2> |
| 183 | +<p>I prefer to keep the <tt class="docutils literal">.vimrc</tt> configuration as simple as possible, so this |
| 184 | +project is a collection of settings, configurations, and helpers. That |
| 185 | +maintains the Vim installation as general as possible.</p> |
| 186 | +<p>However, on a daily basis, we might want some extra, few plug-ins.</p> |
| 187 | +<p>These are <a class="reference external" href="https://github.com/nvie/vim-flake8">flake8</a>, |
| 188 | +<a class="reference external" href="https://github.com/tpope/vim-fugitive">fugitive vim</a>, and |
| 189 | +<a class="reference external" href="https://github.com/scrooloose/nerdtree">NERDTree</a>.</p> |
| 190 | +<p><strong>Please note</strong>: The installation of the extra dependencies requires <tt class="docutils literal">Vim |
| 191 | +8.0</tt> or newer, since it install the external projects as packages.</p> |
| 192 | +<p>They can be installed with:</p> |
| 193 | +<pre class="code bash"><a name="rest_code_d0a6582caa3d4368816227c73521e40d-1"></a>make extras |
| 194 | +</pre> |
| 195 | +<p>Enjoy!</p> |
| 196 | +</div> |
| 197 | +</div> |
| 198 | + |
| 199 | +</body> |
| 200 | +</html> |
| 201 | + |
0 commit comments