change img to image

This commit is contained in:
Igor Irianto 2021-01-18 16:50:20 -06:00
parent ca28262c27
commit 5baa406da5
27 changed files with 24 additions and 24 deletions

View File

@ -22,7 +22,7 @@ Have two empty files, `file1.js` and `file2.j` (if possible, create them with Vi
vim file1.js vim file1.js
``` ```
![one buffer displayed with highlight](./img/screen-one-buffer-file1-highlighted.png) ![one buffer displayed with highlight](./image/screen-one-buffer-file1-highlighted.png)
What you are seeing is `file1.js` *buffer*. Whenever you open a new file, Vim creates a new buffer. What you are seeing is `file1.js` *buffer*. Whenever you open a new file, Vim creates a new buffer.
@ -32,11 +32,11 @@ Exit Vim. This time, open two new files:
vim file1.js file2.js vim file1.js file2.js
``` ```
![one buffer displayed.png](./img/screen-one-buffer.png) ![one buffer displayed.png](./image/screen-one-buffer.png)
Vim displays `file1.js` buffer, but it actually creates two buffers: `file1.js` buffer and `file2.js` buffer. Run `:buffers` to see all the buffers (alternatively, you can use `:ls` or `:files` too). Vim displays `file1.js` buffer, but it actually creates two buffers: `file1.js` buffer and `file2.js` buffer. Run `:buffers` to see all the buffers (alternatively, you can use `:ls` or `:files` too).
![buffers command showing 2 buffers](./img/screen-one-buffer-buffers-command.png) ![buffers command showing 2 buffers](./image/screen-one-buffer-buffers-command.png)
There are several ways you can traverse buffers: There are several ways you can traverse buffers:
- `:bnext` to go to the next buffer (`:bprevious` to go to the previous buffer). - `:bnext` to go to the next buffer (`:bprevious` to go to the previous buffer).
@ -75,7 +75,7 @@ To save and quit all, run:
A window is a viewport on a buffer. You can have multiple windows. Most text editors have the ability to display multiple windows. Below you see a VSCode with 3 windows: A window is a viewport on a buffer. You can have multiple windows. Most text editors have the ability to display multiple windows. Below you see a VSCode with 3 windows:
![VSCode showing 3 windows](./img/screen-vscode-3-windows.png) ![VSCode showing 3 windows](./image/screen-vscode-3-windows.png)
Let's open `file1.js` from the terminal again: Let's open `file1.js` from the terminal again:
@ -83,7 +83,7 @@ Let's open `file1.js` from the terminal again:
vim file1.js vim file1.js
``` ```
![one buffer displayed.png](./img/screen-one-buffer.png) ![one buffer displayed.png](./image/screen-one-buffer.png)
Earlier I said that you're looking at `file1.js` buffer. While that was correct, it was incomplete. You are looking at `file1.js` buffer displayed through **a window**. A window is what you are seeing a buffer through. Earlier I said that you're looking at `file1.js` buffer. While that was correct, it was incomplete. You are looking at `file1.js` buffer displayed through **a window**. A window is what you are seeing a buffer through.
@ -93,7 +93,7 @@ Don't quit Vim yet. Run:
:split file2.js :split file2.js
``` ```
![split window horizontally](./img/screen-split-window.png) ![split window horizontally](./image/screen-split-window.png)
Now you are looking at two buffers through **two windows**. The top window displays `file2.js` buffer. The bottom window displays `file1.js` buffer. Now you are looking at two buffers through **two windows**. The top window displays `file2.js` buffer. The bottom window displays `file1.js` buffer.
@ -112,7 +112,7 @@ Now run:
:vsplit file3.js :vsplit file3.js
``` ```
![split window vertically and horizontally](./img/screen-split-window-vertically-and-horizontally.png) ![split window vertically and horizontally](./image/screen-split-window-vertically-and-horizontally.png)
You are now seeing three windows displaying three buffers. The top left window displays `file3.js` buffer, the top right window displays `file2.js` buffer, and the bottom window displays `file1.js` buffer. You are now seeing three windows displaying three buffers. The top left window displays `file3.js` buffer, the top right window displays `file2.js` buffer, and the bottom window displays `file1.js` buffer.
@ -121,7 +121,7 @@ You can have multiple windows displaying the same buffer. While you're on the to
``` ```
:buffer file2.js :buffer file2.js
``` ```
![split window vertically and horizontally with two file2.js](./img/screen-split-window-vertically-and-horizontally-two-file2.png) ![split window vertically and horizontally with two file2.js](./image/screen-split-window-vertically-and-horizontally-two-file2.png)
Now both top left and top right windows are displaying `file2.js` buffer. If you start typing on the top left, you can see that the content on both top left and top right window are being updated in real-time. Now both top left and top right windows are displaying `file2.js` buffer. If you start typing on the top left, you can see that the content on both top left and top right window are being updated in real-time.
@ -162,7 +162,7 @@ To open `file2.js` in a new tab:
:tabnew file2.js :tabnew file2.js
``` ```
![screen displays tab 2](./img/screen-tab2.png) ![screen displays tab 2](./image/screen-tab2.png)
You can also let Vim autocomplete the file you want to open in a *new tab* by pressing `<Tab>` (no pun intended). You can also let Vim autocomplete the file you want to open in a *new tab* by pressing `<Tab>` (no pun intended).
@ -181,9 +181,9 @@ You can also run `gt` to go to next tab page (you can go to previous tab with `g
One advantage of having multiple tabs is you can have different window arrangements in different tabs. Maybe you want your first tab to have 3 vertical windows and second tab to have a mixed horizontal and vertical windows layout. Tab is the perfect tool for the job! One advantage of having multiple tabs is you can have different window arrangements in different tabs. Maybe you want your first tab to have 3 vertical windows and second tab to have a mixed horizontal and vertical windows layout. Tab is the perfect tool for the job!
![first tab with multiple windows](./img/tabs-file1js.png) ![first tab with multiple windows](./image/tabs-file1js.png)
![second tab with multiple windows](./img/tabs-file2js.png) ![second tab with multiple windows](./image/tabs-file2js.png)
To start Vim with multiple tabs, you can do this from the terminal: To start Vim with multiple tabs, you can do this from the terminal:
@ -195,15 +195,15 @@ vim -p file1.js file2.js file3.js
Moving between windows is like traveling two-dimensionally along X-Y axis in a Cartesian coordinate. You can move to the top, right, bottom, and left window with `Ctrl-W H/J/K/L`. Moving between windows is like traveling two-dimensionally along X-Y axis in a Cartesian coordinate. You can move to the top, right, bottom, and left window with `Ctrl-W H/J/K/L`.
![cartesian movement in x and y axis](./img/cartesian-xy.png) ![cartesian movement in x and y axis](./image/cartesian-xy.png)
Moving between buffers is like traveling across the Z axis in a Cartesian coordinate. Imagine your buffer files lining up across the Z axis. You can traverse the Z axis one buffer at a time with `:bnext` and `:bprevious`. You can jump to any coordinate in Z axis with `:buffer filename/buffernumber`. Moving between buffers is like traveling across the Z axis in a Cartesian coordinate. Imagine your buffer files lining up across the Z axis. You can traverse the Z axis one buffer at a time with `:bnext` and `:bprevious`. You can jump to any coordinate in Z axis with `:buffer filename/buffernumber`.
![cartesian movement in z axis](./img/cartesian-z.png) ![cartesian movement in z axis](./image/cartesian-z.png)
You can move in *three-dimensional space* by combining window and buffer movements. You can move to the top, right, bottom, or left window (X-Y navigations) with window navigations. Since each window contains buffers, you can move forward and backward (Z navigations) with buffer movements. You can move in *three-dimensional space* by combining window and buffer movements. You can move to the top, right, bottom, or left window (X-Y navigations) with window navigations. Since each window contains buffers, you can move forward and backward (Z navigations) with buffer movements.
![cartesian movement in x, y, and z axis](./img/cartesian-xyz.png) ![cartesian movement in x, y, and z axis](./image/cartesian-xyz.png)
## Using Buffers, Windows, and Tabs The Smart Way ## Using Buffers, Windows, and Tabs The Smart Way

View File

@ -254,7 +254,7 @@ You can mix and match these options. For example, `^hello | ^welcome friends$` w
To search for files inside Vim using fzf.vim plugin, you can use the `:Files` method. Run `:Files` from Vim and you will be prompted with fzf search prompt. To search for files inside Vim using fzf.vim plugin, you can use the `:Files` method. Run `:Files` from Vim and you will be prompted with fzf search prompt.
<p align="center"> <p align="center">
<img alt="Finding files in fzf" width="900" height="auto" src="./img/fzf-files.gif" /> <img alt="Finding files in fzf" width="900" height="auto" src="./image/fzf-files.gif" />
</p> </p>
Since you will be using this command frequently, it is good to have this mapped. I map mine to `Ctrl-f`. In my vimrc, I have this: Since you will be using this command frequently, it is good to have this mapped. I map mine to `Ctrl-f`. In my vimrc, I have this:
@ -268,7 +268,7 @@ nnoremap <silent> <C-f> :Files<CR>
To search inside files, you can use the `:Rg` command. To search inside files, you can use the `:Rg` command.
<p align="center"> <p align="center">
<img alt="Finding in Files in fzf" width="900" height="auto" src="./img/fzf-in-files.gif"/> <img alt="Finding in Files in fzf" width="900" height="auto" src="./image/fzf-in-files.gif"/>
</p> </p>
Again, since you will probably use this frequently, let's map it. I map mine to `<Leader>f`. Again, since you will probably use this frequently, let's map it. I map mine to `<Leader>f`.

View File

@ -45,7 +45,7 @@ vim -d file1.txt file2.txt
``` ```
<p align="center"> <p align="center">
<img alt="Basic diffing with Vim" width="900" height="auto" src="./img/diffing-basic.png"> <img alt="Basic diffing with Vim" width="900" height="auto" src="./image/diffing-basic.png">
</p> </p>
`vimdiff` displays two buffers side-by-side. On the left is `file1.txt` and on the right is `file2.txt`. The two differences (apples and oranges) are highlighted on both lines. `vimdiff` displays two buffers side-by-side. On the left is `file1.txt` and on the right is `file2.txt`. The two differences (apples and oranges) are highlighted on both lines.
@ -53,7 +53,7 @@ vim -d file1.txt file2.txt
Suppose you want to make the second buffer to have apples, not oranges. To transfer the content from your current position, `file1.txt`, to `file2.txt`, jump to the next diff with `]c` (to jump to the previous diff, use `[c`). The cursor should be on apples now. Run `:diffput`. Both files should now have apples. Suppose you want to make the second buffer to have apples, not oranges. To transfer the content from your current position, `file1.txt`, to `file2.txt`, jump to the next diff with `]c` (to jump to the previous diff, use `[c`). The cursor should be on apples now. Run `:diffput`. Both files should now have apples.
<p align="center"> <p align="center">
<img alt="Finding files in FZF" width="900" height="auto" src="./img/diffing-apples.png"> <img alt="Finding files in FZF" width="900" height="auto" src="./image/diffing-apples.png">
</p> </p>
If you need to transfer the text from the other buffer (orange juice) to replace the text on the current buffer (apple juice), first jump to the next diff with `]c`. Your cursor now should be on apple juice. Run `:diffget` to get the orange juice from another buffer to replace apple juice in our buffer. If you need to transfer the text from the other buffer (orange juice) to replace the text on the current buffer (apple juice), first jump to the next diff with `]c`. Your cursor now should be on apple juice. Run `:diffget` to get the orange juice from another buffer to replace apple juice in our buffer.
@ -170,7 +170,7 @@ git mergetool
``` ```
<p align="center"> <p align="center">
<img alt="Three-way mergetool with Vim" width="900" height="auto" src="./img/mergetool-initial.png"> <img alt="Three-way mergetool with Vim" width="900" height="auto" src="./image/mergetool-initial.png">
</p> </p>
Vim displays four windows. Pay attention to the top three: Vim displays four windows. Pay attention to the top three:
@ -254,7 +254,7 @@ When you run the `:Git` command without any parameters, vim-fugitive displays a
- `>` / `<` to display or hide an inline diff of the file name under the cursor. - `>` / `<` to display or hide an inline diff of the file name under the cursor.
<p align="center"> <p align="center">
<img alt="Finding files in FZF" width="900" height="auto" src="./img/fugitive-git.png"> <img alt="Finding files in FZF" width="900" height="auto" src="./image/fugitive-git.png">
</p> </p>
For more, check out `:h fugitive-staging-maps`. For more, check out `:h fugitive-staging-maps`.
@ -273,7 +273,7 @@ Some things you can do while in this `"git blame"` mode:
For more, check out `:h :Git_blame`. For more, check out `:h :Git_blame`.
<p align="center"> <p align="center">
<img alt="Finding files in FZF" width="900" height="auto" src="./img/fugitive-git-blame.png"> <img alt="Finding files in FZF" width="900" height="auto" src="./image/fugitive-git-blame.png">
</p> </p>
## Gdiffsplit ## Gdiffsplit
@ -281,7 +281,7 @@ For more, check out `:h :Git_blame`.
When you run the `:Gdiffsplit` command, vim-fugitive runs a `vimdiff` of the current file's latest changes against the index or work tree. If you run `:Gdiffsplit <commit>`, vim-fugitive runs a `vimdiff` against that file inside `<commit>`. When you run the `:Gdiffsplit` command, vim-fugitive runs a `vimdiff` of the current file's latest changes against the index or work tree. If you run `:Gdiffsplit <commit>`, vim-fugitive runs a `vimdiff` against that file inside `<commit>`.
<p align="center"> <p align="center">
<img alt="Finding files in FZF" width="900" height="auto" src="./img/fugitive-gdiffsplit.png"> <img alt="Finding files in FZF" width="900" height="auto" src="./image/fugitive-gdiffsplit.png">
</p> </p>
Because you are in a `vimdiff` mode, you can *get* or *put* the diff with `:diffput` and `:diffget`. Because you are in a `vimdiff` mode, you can *get* or *put* the diff with `:diffput` and `:diffget`.
@ -297,7 +297,7 @@ When you run the `:Gread` command in a file after you make changes, vim-fugitive
When you run the `:Gclog` command, vim-fugitive displays the commit history. It is like running the `git log` command. Vim-fugitive uses Vim's quickfix to accomplish this, so you can use `:cnext` and `:cprevious` to traverse to the next or previous log information. You can open and close the log list with `:copen` and `:cclose`. When you run the `:Gclog` command, vim-fugitive displays the commit history. It is like running the `git log` command. Vim-fugitive uses Vim's quickfix to accomplish this, so you can use `:cnext` and `:cprevious` to traverse to the next or previous log information. You can open and close the log list with `:copen` and `:cclose`.
<p align="center"> <p align="center">
<img alt="Finding files in FZF" width="900" height="auto" src="./img/fugitive-git-log.png"> <img alt="Finding files in FZF" width="900" height="auto" src="./image/fugitive-git-log.png">
</p> </p>
While in this `"git log"` mode, you can do two things: While in this `"git log"` mode, you can do two things:

View File

@ -220,7 +220,7 @@ baz10
And you've been working on these 3 files for a while, so that your windows layout look like (using strategically placed `split` and `vsplit`): And you've been working on these 3 files for a while, so that your windows layout look like (using strategically placed `split` and `vsplit`):
![./img/session-layout.png](./img/session-layout.png) ![./image/session-layout.png](./image/session-layout.png)
To save the Session, run: To save the Session, run:

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB