mirror of
https://github.com/iggredible/Learn-Vim
synced 2024-11-10 13:10:40 +00:00
commit
b12fed5e31
@ -130,7 +130,7 @@ You can launch Vim on split horizontal and vertical windows with `o` and `O`, re
|
||||
To open Vim with two horizontal windows, run:
|
||||
|
||||
```bash
|
||||
vim -o
|
||||
vim -o2
|
||||
```
|
||||
|
||||
To open Vim with 5 horizontal windows, run:
|
||||
|
@ -42,7 +42,7 @@ There are several ways you can traverse buffers:
|
||||
- `:bnext` to go to the next buffer (`:bprevious` to go to the previous buffer).
|
||||
- `:buffer` + filename. Vim can autocomplete filename with `<Tab>`.
|
||||
- `:buffer` + `n`, where `n` is the buffer number. For example, typing `:buffer 2` will take you to buffer #2.
|
||||
- Jump to the older position in jump list with `Ctrl-o` and to the newer position with `Ctrl-i`. These are not buffer specific methods, but they can be used to jump between different buffers. I will talk more about jumps in Chapter 5.
|
||||
- Jump to the older position in jump list with `Ctrl-O` and to the newer position with `Ctrl-I`. These are not buffer specific methods, but they can be used to jump between different buffers. I will talk more about jumps in Chapter 5.
|
||||
- Go to the previously edited buffer with `Ctrl-^`.
|
||||
|
||||
Once Vim creates a buffer, it will remain in your buffers list. To remove it, you can type `:bdelete`. It accepts either a buffer number (`:bdelete 3` to delete buffer #3) or a filename (`:bdelete` then use `<Tab>` to autocomplete).
|
||||
|
@ -149,10 +149,10 @@ You may notice that running internal grep (`:vim`) can get slow if you have a la
|
||||
Let's talk about external grep. By default, it uses `grep` terminal command. To search for "lunch" inside a ruby file inside `app/controllers/` directory, you can do this:
|
||||
|
||||
```
|
||||
:grep "lunch" app/controllers/**/*.rb
|
||||
:grep -R "lunch" app/controllers/
|
||||
```
|
||||
|
||||
Note that instead of using `/pattern/`, it follows the terminal grep syntax `"pattern"`. Just like `:vim`, `:grep` accepts `*` and `**` wildcards. It also displays all matches using `quickfix`.
|
||||
Note that instead of using `/pattern/`, it follows the terminal grep syntax `"pattern"`. It also displays all matches using `quickfix`.
|
||||
|
||||
Vim uses `grepprg` variable to determine which external program to run when running `:grep` so you don't have to always use the terminal `grep` command. Later I will show you how to change default the grep external program.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user