Skip to content

Commit 52afae8

Browse files
added 19th Vim tip
1 parent a85bc48 commit 52afae8

File tree

9 files changed

+62
-7
lines changed

9 files changed

+62
-7
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ I'm addicted to reading fantasy/sci-fi books, so I have a [blog](https://learnby
6262

6363
## Tips
6464

65+
* [Vim tip 19: working with buffers](https://learnbyexample.github.io/tips/vim-tip-19/)
6566
* [CLI tip 20: expand and unexpand](https://learnbyexample.github.io/tips/cli-tip-20/)
6667
* [Python tip 20: saving and loading json](https://learnbyexample.github.io/tips/python-tip-20/)
6768
* [Vim tip 18: moving within long lines](https://learnbyexample.github.io/tips/vim-tip-18/)

Diff for: atom.xml

+50-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,57 @@
55
<link href="https://learnbyexample.github.io/atom.xml" rel="self" type="application/atom+xml"/>
66
<link href="https://learnbyexample.github.io"/>
77
<generator uri="https://www.getzola.org/">Zola</generator>
8-
<updated>2022-12-14T00:00:00+00:00</updated>
8+
<updated>2022-12-20T00:00:00+00:00</updated>
99
<id>https://learnbyexample.github.io/atom.xml</id>
10+
<entry xml:lang="en">
11+
<title>Vim tip 19: working with buffers</title>
12+
<published>2022-12-20T00:00:00+00:00</published>
13+
<updated>2022-12-20T00:00:00+00:00</updated>
14+
<link rel="alternate" href="https://learnbyexample.github.io/tips/vim-tip-19/" type="text/html"/>
15+
<id>https://learnbyexample.github.io/tips/vim-tip-19/</id>
16+
<content type="html">&lt;p&gt;Multiple files can be opened in Vim within the same tab page and&#x2F;or in different tabs. From &lt;a href=&quot;https:&#x2F;&#x2F;vimhelp.org&#x2F;windows.txt.html#windows-intro&quot;&gt;:h windows-intro&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
17+
&lt;blockquote&gt;
18+
&lt;ul&gt;
19+
&lt;li&gt;A buffer is the in-memory text of a file.&lt;&#x2F;li&gt;
20+
&lt;li&gt;A window is a viewport on a buffer.&lt;&#x2F;li&gt;
21+
&lt;li&gt;A tab page is a collection of windows.&lt;&#x2F;li&gt;
22+
&lt;&#x2F;ul&gt;
23+
&lt;&#x2F;blockquote&gt;
24+
&lt;ul&gt;
25+
&lt;li&gt;&lt;kbd&gt;:e&lt;&#x2F;kbd&gt; refreshes the current buffer (&lt;code&gt;:e&lt;&#x2F;code&gt; is short for &lt;code&gt;:edit&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
26+
&lt;li&gt;&lt;kbd&gt;:e filename&lt;&#x2F;kbd&gt; open a particular file by its path, in the same window&lt;&#x2F;li&gt;
27+
&lt;li&gt;&lt;kbd&gt;:e #&lt;&#x2F;kbd&gt; switch back to the previous buffer, won&#x27;t work if that buffer is not named&lt;&#x2F;li&gt;
28+
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;&#x2F;kbd&gt;+&lt;kbd&gt;6&lt;&#x2F;kbd&gt; switch back to the previous buffer, works even if that buffer is not named
29+
&lt;ul&gt;
30+
&lt;li&gt;&lt;kbd&gt;Ctrl&lt;&#x2F;kbd&gt;+&lt;kbd&gt;^&lt;&#x2F;kbd&gt; can also be used&lt;&#x2F;li&gt;
31+
&lt;&#x2F;ul&gt;
32+
&lt;&#x2F;li&gt;
33+
&lt;li&gt;&lt;kbd&gt;:e #1&lt;&#x2F;kbd&gt; open the first buffer, and so on&lt;&#x2F;li&gt;
34+
&lt;li&gt;&lt;kbd&gt;:buffers&lt;&#x2F;kbd&gt; show all buffers
35+
&lt;ul&gt;
36+
&lt;li&gt;&lt;kbd&gt;:ls&lt;&#x2F;kbd&gt; or &lt;kbd&gt;:files&lt;&#x2F;kbd&gt; can also be used&lt;&#x2F;li&gt;
37+
&lt;&#x2F;ul&gt;
38+
&lt;&#x2F;li&gt;
39+
&lt;li&gt;&lt;kbd&gt;:bn&lt;&#x2F;kbd&gt; open the next file in the buffer list (&lt;code&gt;:bn&lt;&#x2F;code&gt; is short for &lt;code&gt;:bnext&lt;&#x2F;code&gt;)
40+
&lt;ul&gt;
41+
&lt;li&gt;opens the first buffer if you are on the last buffer&lt;&#x2F;li&gt;
42+
&lt;&#x2F;ul&gt;
43+
&lt;&#x2F;li&gt;
44+
&lt;li&gt;&lt;kbd&gt;:bp&lt;&#x2F;kbd&gt; open the previous file in the buffer list (&lt;code&gt;:bp&lt;&#x2F;code&gt; is short for &lt;code&gt;:bprevious&lt;&#x2F;code&gt;)
45+
&lt;ul&gt;
46+
&lt;li&gt;opens the last buffer if you are on the first buffer&lt;&#x2F;li&gt;
47+
&lt;&#x2F;ul&gt;
48+
&lt;&#x2F;li&gt;
49+
&lt;&#x2F;ul&gt;
50+
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;info.svg&quot; alt=&quot;info&quot; &#x2F;&gt; Use &lt;kbd&gt;:set hidden&lt;&#x2F;kbd&gt; if you want to switch to another buffer even if there are unsaved changes in the current buffer. Instead of this setting, you can also use &lt;kbd&gt;:hide edit filename&lt;&#x2F;kbd&gt; to hide the current unsaved buffer. You&#x27;ll still get an error if you try to quit Vim without saving such buffers, unless you use the &lt;code&gt;!&lt;&#x2F;code&gt; modifier.&lt;&#x2F;p&gt;
51+
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;info.svg&quot; alt=&quot;info&quot; &#x2F;&gt; See &lt;a href=&quot;https:&#x2F;&#x2F;vimhelp.org&#x2F;options.txt.html#%27autowrite%27&quot;&gt;:h &#x27;autowrite&#x27;&lt;&#x2F;a&gt; option if you want to automatically save changes when moving to another buffer.&lt;&#x2F;p&gt;
52+
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;info.svg&quot; alt=&quot;info&quot; &#x2F;&gt; See &lt;a href=&quot;https:&#x2F;&#x2F;vimhelp.org&#x2F;usr_22.txt.html#22.4&quot;&gt;:h 22.4&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;vimhelp.org&#x2F;windows.txt.html#buffer-hidden&quot;&gt;:h buffer-hidden&lt;&#x2F;a&gt; for user and reference manuals on working with buffer list.&lt;&#x2F;p&gt;
53+
&lt;p&gt;&lt;strong&gt;Video demo&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
54+
&lt;p align=&quot;center&quot;&gt;&lt;iframe width=&quot;560&quot; height=&quot;315&quot; loading=&quot;lazy&quot; src=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;embed&#x2F;dJO16IwfSko&quot; title=&quot;YouTube video player&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;&#x2F;iframe&gt;&lt;&#x2F;p&gt;
55+
&lt;br&gt;
56+
&lt;p&gt;&lt;img src=&quot;&#x2F;images&#x2F;info.svg&quot; alt=&quot;info&quot; &#x2F;&gt; See also my &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;learnbyexample&#x2F;vim_reference&quot;&gt;Vim Reference Guide&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;curated_resources&#x2F;vim.html&quot;&gt;curated list of resources for Vim&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
57+
</content>
58+
</entry>
1059
<entry xml:lang="en">
1160
<title>CLI tip 20: expand and unexpand</title>
1261
<published>2022-12-14T00:00:00+00:00</published>

Diff for: sitemap.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@
402402
</url>
403403
<url>
404404
<loc>https://learnbyexample.github.io/tips/</loc>
405-
<lastmod>2022-12-14</lastmod>
405+
<lastmod>2022-12-20</lastmod>
406406
</url>
407407
<url>
408408
<loc>https://learnbyexample.github.io/tips/cli-tip-1/</loc>
@@ -604,6 +604,10 @@
604604
<loc>https://learnbyexample.github.io/tips/vim-tip-18/</loc>
605605
<lastmod>2022-11-29</lastmod>
606606
</url>
607+
<url>
608+
<loc>https://learnbyexample.github.io/tips/vim-tip-19/</loc>
609+
<lastmod>2022-12-20</lastmod>
610+
</url>
607611
<url>
608612
<loc>https://learnbyexample.github.io/tips/vim-tip-2/</loc>
609613
<lastmod>2021-12-29</lastmod>

Diff for: tags/index.html

+1-1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)