Commit 0bb0fb9a authored by Pallav Agarwal's avatar Pallav Agarwal

Quick Tip added

parent 2d69cbcd
......@@ -73,6 +73,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......
......@@ -69,6 +69,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......
......@@ -71,6 +71,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......
......@@ -73,6 +73,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......@@ -147,7 +151,7 @@ my personal favorites in this post.</em></p>
<p><br /></p>
<p><strong>3. MAPPINGS:</strong></p>
<p><a href="/2015/07/01/Vim-Mappings/"><strong>3. MAPPINGS:</strong></a></p>
<p><em>This is where vim - specific awesomeness starts.
You can (literally) ask your editor to do what
......
<title>Quick intro to custom Vim Mappings - VARSTACK</title>
<meta charset="utf-8"/>
<link href='http://fonts.googleapis.com/css?family=Courgette' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<link href="/css/bootstrap.css" rel="stylesheet">
<link href="/css/highlighting.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">
<script src="/js/jquery-1.11.3.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/SmoothScroll.js"></script>
<script src="/js/script.js"></script>
<script src="/js/tips.js"></script>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "7839e2af-f9d1-4f68-9304-dcf13d3352ea", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
<!-- 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]-->
<div class="container">
<div class="row" id="menu">
<div class="table_this" id="tableRow">
<div class="col-sm-3 vcenter" id="site_title"><a href="/" style="color:black;">VARSTACK</a></div>
<div class="col-sm-6 vcenter">
<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>
<div class="col-sm-3 vcenter">
<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="content">
<div class="col-sm-3" id="recent">
<h4>RECENT POSTS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
<li>
<a href="/2015/06/18/IIT-Kanpur/" class="color_change">IIT Kanpur: The First Year</a>
</li>
</ul>
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
</div>
<div class="col-sm-7">
<div class="row" id="data">
<br />
<h3>Quick intro to custom Vim Mappings</h3>
<hr />
<div class="row text-justify" id="content-holder">
<p>One of the best things about vim is its ability to create
custom mappings for <em>almost</em> any key in all modes.</p>
<p>Suppose you want Ctrl+S to save your document while you are
in insert mode, because pressing</p>
<pre><code>&lt;Esc&gt;:w&lt;Enter&gt;i
</code></pre>
<p>to switch to normal mode, save the file, and return back
to insert mode is a bit too much. According to vim philosophy,
it actually <strong>IS</strong> too much, and thus you can map Ctrl+S to
those keys just as easily.</p>
<p>For this, add the following to your vimrc</p>
<pre><code>inoremap &lt;C-S&gt; &lt;Esc&gt;:w&lt;Enter&gt;i
</code></pre>
<h4>EXPLANATION:</h4>
<p>The command has separate parts but follows the format</p>
<pre><code>&lt;cmd&gt; &lt;lhs&gt; &lt;rhs&gt;
</code></pre>
<p>The command maps lhs to rhs in the mode specified by cmd.
<code>&lt;cmd&gt;</code> can be further broken down in the following format:</p>
<p><code>&lt;mode&gt;[nore]map</code></p>
<p>where the following modes are common (All
modes are covered in the following post)</p>
<pre><code>(none): normal, visual, operator mode
i: insert mode
v: visual mode
n: normal mode
</code></pre>
<p><code>nore</code> is used for no-remapping, i.e. the default functions
of <code>rhs</code> and not their aliases will be used. When skipped,
The <code>rhs</code> will be further resolved if a remapping is found.
Vim, even has a max resolve-depth in case of an infinite loop.</p>
<p>For <code>lhs</code> and <code>rhs</code> the keys are named as follows:</p>
<pre><code>&lt;C-a&gt; : Ctrl + a
&lt;S-a&gt; : Shift + a
&lt;A-a&gt; : Alt + a
&lt;C-S-a&gt; : Ctrl + Shift + a
&lt;Enter&gt;
&lt;BS&gt; : Backspace
etc..
</code></pre>
<p>The whole list can be viewed
<a href="http://vimdoc.sourceforge.net/htmldoc/intro.html#key-notation">here</a>
or using the <code>:help key-notation</code> command inside vim.</p>
</div>
</div>
<hr /><br />
<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>
<script type="text/javascript">
/* * * 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);
})();
(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');
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
</div>
<div class="col-sm-2">
</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>
......@@ -71,6 +71,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......
......@@ -71,6 +71,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......
......@@ -73,6 +73,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......@@ -86,6 +90,15 @@
<hr />
<div class="row text-justify" id="content-holder">
<a href="/2015/07/01/Vim-Mappings/">QUICK INTRO TO CUSTOM VIM MAPPINGS</a>
<p class="author" style="text-align: right;">
<span class="date">Jul 01, 2015</span>
</p>
<div class="content">
<p>One of the best things about vim is its ability to create custom mappings for <em>almost</em> any key in all modes.</p> <p>Suppose you want Ctrl+S to save your document while you are in insert mode, because pressing</p> <pre><code>&lt;Esc&gt;:w&lt;Enter&gt;i </code></pre> <p>to switch to normal mode, save the file, and return back to insert mode is a bit too much. According to vim philosophy, it actually <strong>IS</strong> too much, and thus you can map Ctrl+S to those keys just as easily.</p> <p>For this, add the following to your vimrc</p> <pre><code>inoremap &lt;C-S&gt; &lt;Esc&gt;:w&lt;Enter&gt;i </code></pre> <h4>EXPLANATION:</h4> <p>The command has separate parts but follows the...
</div>
<br /><br />
<a href="/2015/07/01/Vim-Customization/">VIM CUSTOMIZATION: GUIDE TO WRITING YOUR OWN VIMRC</a>
<p class="author" style="text-align: right;">
<span class="date">Jul 01, 2015</span>
......
......@@ -73,6 +73,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......@@ -86,6 +90,22 @@
<hr />
<div class="row text-justify" id="content-holder">
<div class="post">
<a href="/2015/07/01/Vim-Mappings/" class='shead'>
Quick intro to custom Vim Mappings
</a>
<br />
<div class="excerpt">
One of the best things about vim is its ability to create custom mappings for almost any key in all modes. Suppose you want Ctrl+S.......Ctrl + Shift + a &lt;Enter&gt; &lt;BS&gt; : Backspace etc.. The whole list can be viewed here or using the :help key-notation command inside vim.
</div>
<br />
<div class='tags'>
mode:12, rh:5, Ctrl:4, vim:3, lh:3, command:3, cmd:3, Ctrl S:2, vimrc inoremap:1, vim philosophy:1, operator mode i:1, none:1, mode v:1, mode nore:1, mode nore:1, mode n:1, max resolve depth:1, key notation command:1, default functions:1, custom mappings:1, command maps lhs:1, Esc w EXPLANATION:1, Esc w:1,
</div>
</div>
<div class="post">
<a href="/2015/07/01/Vim-Customization/" class='shead'>
Vim Customization: Guide to writing your own VIMRC
......
......@@ -71,6 +71,10 @@
<h4>RECENT TIPS</h4>
<ul class="nav nav-pills nav-stacked">
<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>
......@@ -83,7 +87,16 @@
<h3>Tips</h3>
<hr />
<div class="row text-justify" id="content-holder">
<p><strong><a href="/2015/06/30/Mouse-with-vim/">USING MOUSE WITH VIM IN THE TERMINAL</a></strong></p>
<p><strong><a href="/2015/07/01/Vim-Mappings/">QUICK INTRO TO CUSTOM VIM MAPPINGS</a></strong></p>
<p>One of the best things about vim is its ability to create custom mappings for <em>almost</em> any key in all modes.</p>
<p> <p>Suppose you want Ctrl+S to save your document while you are in insert mode, because pressing</p> <pre><code>&lt;Esc&gt;:w&lt;Enter&gt;i </code></pre> <p>to switch to normal mode, save the file, and return back to insert mode is a bit too much. According to vim philosophy, it actually <strong>IS</strong> too much, and thus you...</p>
<p><br /></p>
<p><strong><a href="/2015/06/30/Mouse-with-vim/">USING MOUSE WITH VIM IN THE TERMINAL</a></strong></p>
<p>Just when you thought vim couldn't surprise you anymore, vim strikes again. As it turns out, vim supports mouse integration even in the terminal. Not only that, the support is mind blowingly simple and amazing. You can move your cursor, select text and even resize your panes in a split screen.</p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment