index.html 10.7 KB
Newer Older
1 2 3 4 5 6 7 8
<title>Vim Customization: Guide to writing your own VIMRC - VARSTACK</title>
<meta charset="utf-8"/>

<link href="/css/bootstrap.css" rel="stylesheet">
<link href="/css/highlighting.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">


9 10 11 12
<script src="/js/jquery-1.11.3.min.js" async></script>
<script src="/js/bootstrap.min.js" async></script>
<script src="/js/SmoothScroll.js" async></script>
<script src="/js/script.js" async></script>
13 14


15 16
<script type="text/javascript" async>var switchTo5x=true;</script>
<script type="text/javascript" async>stLight.options({publisher: "7839e2af-f9d1-4f68-9304-dcf13d3352ea", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
17 18 19 20 21 22 23 24 25 26 27 28

<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    
    <img src="/img/vim.jpg" id="bg-img" alt="Screenshot of my vim configuration">
    
    <div class="container">
        <div class="row" id="menu">
            <div class="table_this" id="tableRow">
Pallav Agarwal's avatar
Pallav Agarwal committed
29 30
                <div class="col-md-3 vcenter" id="site_title"><a href="/" style="color:black;">VARSTACK</a></div>
                <div class="col-md-6 vcenter">
31 32 33 34 35 36 37 38 39
                    <div class="row" id="top_menu">
                        <ul class="nav nav-pills">
                            <li class="active" id="blog"><a class="color_change" href="/">Blog</a></li>
                            <li id="tips"><a class="color_change" href="/tips/">Tips</a></li>
                            <li id="algo"><a class="color_change" href="/algo/">Behind The Scenes</a></li>
                            <li id="about"><a class="color_change" href="/about_me/">About Me</a></li>
                        </ul>
                    </div>
                </div>
Pallav Agarwal's avatar
Pallav Agarwal committed
40
                <div class="col-md-3 vcenter">
41 42 43 44 45 46 47 48 49 50 51 52
                    <div class="row">
                        <form action="/search/" id='search-form'>
                            <input id="search-box" type="text" name="query" placeholder="Search..">
                        </form>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row" id="image"> </div>
        
        <div class="row" id="content">
Pallav Agarwal's avatar
Pallav Agarwal committed
53
            <div class="col-md-7 col-md-push-3">
54
                <div class="row" id="data">
Pallav Agarwal's avatar
Pallav Agarwal committed
55 56 57 58 59 60 61
                    <div class="col-md-12">
                        <br />
                        <h3>Vim Customization: Guide to writing your own VIMRC</h3>
                        <hr />
                        <div class="row text-justify" id="content-holder">
                            <div class="col-md-12">
                                <p>Vim is all about customization. It comes from a long line
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
of ancestors starting from ed (1971), ex (1976), vi (1979),
and finally VIM (1991).</p>

<p>Vim is designed with the philosophy of speed and minimal
keystrokes. But I guess, if you're on this page, you
already know that.</p>

<p>The screenshot in above banner is how my vim looks currently.
(In case you can't see it, click <a href="/img/vim.jpg">here</a>)
If you'd notice, there's a bar on the top showing the buffers I
have currently open, the bottom bar shows the mode, character
encoding, github branch (when I'm inside a project). The code
is color highlighted, the indentation happens automatically
based on the language of the program, brackets match themselves,
it offers syntax completion, word completion, and even points
out errors in my programs. All in all, it is pretty much
everything you can ever want from a text editor.</p>

<p>Note that it is still running inside my terminal. I am
NOT running gvim. All of vim (even inside a console) can
be tweaked and configured to your liking.</p>

<p>Unfortunately, none of these customizations are on by default.
When you open vim for the first time, it looks somewhat like
this:</p>

<p><img src="/img/vim-old.png" img-alt="vim before customizations" class="img-responsive"></p>

<p>Sadly, this is also the reason, many users don't try it
out. I mean who would guess that this is the same editor
as the one shown on the top.</p>

<p>Anyway, we will see how to customize your vim, so that
it doesn't just look like a premium text editor, but
functions better than one too.</p>

<p><br /></p>

<p><strong>The rest of the post is split into multiple Tips and Posts,
each acting to explain a specific section of the vimrc.</strong></p>

<p><br /></p>

Pallav Agarwal's avatar
Pallav Agarwal committed
105
<p><a href="/2015/07/03/Vim-Plug-Plugin-Manager/"><strong>1. PACKAGE MANAGER:</strong></a></p>
106 107 108 109 110 111 112 113

<p><em>For any good vimrc, package management is a must. You
have multiple options to choose from, including
vim-plug, vundle, neobundle, pathogen etc. Follow the link
to get a quick rundown.</em></p>

<p><br /></p>

114
<p><a href="/2015/07/08/Vim-Colorscheme/"><strong>2. COLORSCHEME:</strong></a></p>
115 116 117 118 119 120 121 122

<p><em>Your vim colorscheme defines you. Whether you like
a dark background or light, whether you like comments
to be emphasised or dulled down. I cover some of
my personal favorites in this post.</em></p>

<p><br /></p>

Pallav Agarwal's avatar
Pallav Agarwal committed
123
<p><a href="/2015/07/01/Vim-Mappings/"><strong>3. MAPPINGS:</strong></a></p>
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141

<p><em>This is where vim - specific awesomeness starts.
You can (literally) ask your editor to do what
you want with the keys that YOU want. I've covered
the basic ways of making vim keybindings in the above
link.</em></p>

<p><br /></p>

<p><a href="/2015/06/30/Mouse-with-vim/"><strong>4. MOUSE CONTROL:</strong></a></p>

<p><em>If you are using vim, you probably shouldn't be
using mouse at all. Yet, I sometimes find it convinient
to quickly resize panes and windows with my mouse.
It is good to know that vim has mouse support built in.</em></p>

<p><br /></p>

142
<p><a href="/2015/07/09/Vim-Plugins/"><strong>5. PLUGINS:</strong></a></p>
143 144 145 146 147 148 149 150 151 152 153 154

<p><em>What's a plugin manager, without all the lovely
plugins? As it turns out, some of the plugins can
be almost essential for an efficient workflow.</em></p>

<p><br /></p>

<p>Now that you've learnt the secrets of your editor,
it is time to customize your own.</p>

<p>Happy VIMMING.</p>

Pallav Agarwal's avatar
Pallav Agarwal committed
155 156
                            </div>
                        </div>
157 158 159
                    </div>
                </div>
                <hr /><br />
Pallav Agarwal's avatar
Pallav Agarwal committed
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
            </div>
            <div class="col-md-3 col-md-pull-7" id="recent">
                <h4>RECENT POSTS</h4>
                <ul class="nav nav-pills nav-stacked">
                    
                    <li>
                        <a href="/2015/07/09/Vim-Plugins/" class="color_change">Essential VIM plugins</a>
                    </li>
                    
                    <li>
                        <a href="/2015/07/08/Vim-Colorscheme/" class="color_change">VIM: Setting a colorscheme</a>
                    </li>
                    
                    <li>
                        <a href="/2015/07/03/Vim-Plug-Plugin-Manager/" class="color_change">Plugin Management in VIM</a>
                    </li>
                    
                    <li>
                        <a href="/2015/07/01/Vim-Customization/" class="color_change">Vim Customization: Guide to writing your...</a>
                    </li>
                    
                    <li>
                        <a href="/2015/06/26/Linuxbrew/" class="color_change">Package Management without root access -...</a>
                    </li>
                    
                </ul>
                <h4>RECENT TIPS</h4>
                <ul class="nav nav-pills nav-stacked">
                    
                    <li>
                        <a href="/2015/07/09/Wrath-of-Linux-Package-Managers/" class="color_change">Wrath of Linux Package Managers</a>
                    </li>
                    
                    <li>
                        <a href="/2015/07/01/Vim-Mappings/" class="color_change">Quick intro to custom Vim Mappings...</a>
                    </li>
                    
                    <li>
                        <a href="/2015/06/30/Mouse-with-vim/" class="color_change">Using Mouse with VIM in the...</a>
                    </li>
                    
                </ul>
                <br />
                <br />
            </div>
            <div class="col-md-2">
            </div>
            <div class="row">
                <div class="col-md-8 col-md-offset-2">
                    <span class='st_sharethis_large' displayText='ShareThis'></span>
                    <span class='st_facebook_large' displayText='Facebook'></span>
                    <span class='st_twitter_large' displayText='Tweet'></span>
                    <span class='st_googleplus_large' displayText='Google +'></span>
                    <span class='st_linkedin_large' displayText='LinkedIn'></span>
                    <span class='st_pinterest_large' displayText='Pinterest'></span>
                    <div id="disqus_thread"></div>
216
                    <script type="text/javascript" async>
217 218 219 220 221 222 223 224 225
/* * * CONFIGURATION VARIABLES * * */
var disqus_shortname = 'varstack';

/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
Pallav Agarwal's avatar
Pallav Agarwal committed
226 227 228 229 230 231 232
(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-21768487-2', 'auto');
ga('send', 'pageview');
Pallav Agarwal's avatar
Pallav Agarwal committed
233
                    </script>
234
                    <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js" async></script>
Pallav Agarwal's avatar
Pallav Agarwal committed
235 236
                    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
                </div>
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
            </div>
        </div>
    </div>


    <div class="modal fade" id="imagemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span>
                        <span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        Image Preview
                    </h4>
                </div>
                <div class="modal-body">
                    <img src="" id="imagepreview" style="max-height: 100%; max-width: 100%;">
                </div>
            </div>
        </div>
    </div>