-
Notifications
You must be signed in to change notification settings - Fork 0
/
vim-tricks.html
128 lines (111 loc) · 5.52 KB
/
vim-tricks.html
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
<!DOCTYPE HTML>
<!--
Twenty by HTML5 UP
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>Vim Tricks - Adrian Wan</title>
<meta charset="utf-8" />
<meta name="description" content="A collection of useful Vim tricks." />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="stylesheet" href="assets/css/keys.css" type="text/css" />
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]-->
<!-- Google analytics script -->
<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-69121908-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body class="no-sidebar">
<div id="page-wrapper">
<!-- Header -->
<header id="header">
<h1 id="logo"><a href="index.html">Adrian <span>Wan</span></a></h1>
<nav id="nav">
<ul>
<li class="current"><a href="index.html">Welcome</a></li>
<li class="submenu">
<a href="#">More</a>
<ul>
<li><a href="resume.html">Resumé</a></li>
<li class="submenu">
<a href="#">Posts</a>
<ul>
<li><a href="posts.html">Top</a></li>
<li><a href="vim-tricks.html">Vim Tricks</a></li>
<li><a href="success-in-swat-cs.html">Success in Swat CS</a></li>
<li><a href="subl-floo-tutorial.html">Floobits & Sublime</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="contact.html" class="button special">Contact Me</a></li>
</ul>
</nav>
</header>
<!-- Main -->
<article id="main">
<header class="special container">
<span class="icon fa-gears"></span>
<h2><strong>Vim</strong> Tricks</h2>
<p>Ways to make Vim even better.</p>
</header>
<!-- One -->
<section class="wrapper style4 container">
<!-- Content -->
<div class="content">
<section>
<header>
<h2 id="preamble">Preamble</h2>
</header>
<p>I love Vim. I use more powerful editors all the time (Sublime, PyCharm) and my first customization is always to get Vim emulation set up. Here's a collection of useful tricks I've picked up; some are Vim movements, others are just for the Vim editor.</p>
<p>(Last update: 2014-12-17)</p>
<h2 id="tabs">Tabs (Vim editor)</h2>
<p>Open multiple files in the same window with shared buffers. It's really easy:
<ul class="inline">
<li> <tt>$ vim -p file1 file2 file3</tt> opens three files in different tabs. </li>
<li>Switch between tabs with <tt>gt</tt> and <tt>gT</tt> in command mode, or <tt>ngt</tt> (where <tt>n</tt> is the index of the tab starting at 1).</li>
<li>The buffer is the same across tabs, so yanking/pasting across tabs is easy (just use <tt>y</tt> and <tt>p</tt> as you would in a single document).</li>
<li>Close a tab with the usual <tt>:wq</tt> or <tt>:q!</tt></li>
<li>Add a tab with <tt>:tabe filename</tt>.</li>
</ul>
<p>This information was gleaned from <a href="http://stackoverflow.com/a/53668/2452770">this Stack Overflow post</a>. Happy tabbing!</p>
</div>
</section>
</article>
<!-- Footer -->
<footer id="footer">
<ul class="icons">
<!-- <li><a href="#" class="icon circle fa-twitter"><span class="label">Twitter</span></a></li> -->
<!-- <li><a href="#" class="icon circle fa-facebook"><span class="label">Facebook</span></a></li> -->
<li><a href="http://www.linkedin.com/in/adrianwan2" class="icon circle fa-linkedin"><span class="label">LinkedIn</span></a></li>
<!-- <li><a href="#" class="icon circle fa-google-plus"><span class="label">Google+</span></a></li> -->
<li><a href="http://www.github.com/awan1" class="icon circle fa-github"><span class="label">Github</span></a></li>
<li><a href="http://stackoverflow.com/users/2452770/a-wan" class="icon circle fa-stack-overflow"><span class="label">StackOverflow</span></a></li>
<li><a href="https://soundcloud.com/adrian-wan" class="icon circle fa-soundcloud"><span class="label">Soundcloud</span></a></li>
</ul>
<ul class="copyright">
<li>© Adrian Wan 2015--2018</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</footer>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.dropotron.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/jquery.scrollgress.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]-->
<script src="assets/js/main.js"></script>
</body>
</html>