mirror of
https://github.com/mhinz/vim-galore.git
synced 2025-02-24 01:59:28 +08:00
Basics: argument list
This commit is contained in:
parent
8ebee48a3f
commit
33932b5195
@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Intro: [Cheatsheets](README.md#cheatsheets)
|
- Intro: [Cheatsheets](README.md#cheatsheets)
|
||||||
- Intro: [The Vim Philosphy](README.md#the-vim-philosophy)
|
- Intro: [The Vim Philosphy](README.md#the-vim-philosophy)
|
||||||
- Intro: [Minimal vimrc](README.md#minimal-vimrc)
|
- Intro: [Minimal vimrc](README.md#minimal-vimrc)
|
||||||
|
- Basics: [Agument list?](README.md#argument-list)
|
||||||
- Basics: [Marks?](README.md#marks)
|
- Basics: [Marks?](README.md#marks)
|
||||||
- Basics: [Changelist?](README.md#changelist)
|
- Basics: [Changelist?](README.md#changelist)
|
||||||
- Basics: [Changelist? Jumplist?](README.md#changelist-jumplist)
|
- Basics: [Changelist? Jumplist?](README.md#changelist-jumplist)
|
||||||
|
32
README.md
32
README.md
@ -23,6 +23,7 @@ Twitter](https://twitter.com/_mhinz_). Thanks!
|
|||||||
|
|
||||||
- [Buffers, windows, tabs?](#buffers-windows-tabs)
|
- [Buffers, windows, tabs?](#buffers-windows-tabs)
|
||||||
- [Active, loaded, listed, named buffers?](#active-loaded-listed-named-buffers)
|
- [Active, loaded, listed, named buffers?](#active-loaded-listed-named-buffers)
|
||||||
|
- [Agument list?](#argument-list)
|
||||||
- [Mappings?](#mappings)
|
- [Mappings?](#mappings)
|
||||||
- [Mapleader?](#mapleader)
|
- [Mapleader?](#mapleader)
|
||||||
- [Registers?](#registers)
|
- [Registers?](#registers)
|
||||||
@ -327,6 +328,37 @@ associated filename. E.g. `:enew` will create an unnamed scratch buffer. Add
|
|||||||
some text and write it to disk via `:w /tmp/foo`, and it will become a named
|
some text and write it to disk via `:w /tmp/foo`, and it will become a named
|
||||||
buffer.
|
buffer.
|
||||||
|
|
||||||
|
#### Argument list?
|
||||||
|
|
||||||
|
The [global buffer list](#buffers-windows-tabs) is a Vim thing. Before that, in
|
||||||
|
vi, there only used to be the argument list, which is also available in Vim.
|
||||||
|
|
||||||
|
Every filename given to Vim on the shell command-line, is remembered in the
|
||||||
|
argument list. There can be multiple argument lists: by default all arguments
|
||||||
|
are put into the global argument list, but you can use `:arglocal` to create a
|
||||||
|
new argument list that is local to the window.
|
||||||
|
|
||||||
|
List the current arguments with `:args`. Switch between files from the argument
|
||||||
|
list with `:next`, `:previous`, `:first`, `:last` and friends. Alter it with
|
||||||
|
`:argadd`, `:argdelete` or `:args` with a list of files.
|
||||||
|
|
||||||
|
If you should prefer using the buffer or argument list for working with files is
|
||||||
|
a matter of taste. My impression is that most people use the buffer list
|
||||||
|
exclusively.
|
||||||
|
|
||||||
|
Nevertheless there is one huge use case for the argument list: batch processing
|
||||||
|
via `:argdo`! A simple refactoring example:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
:args **/*.[ch]
|
||||||
|
:argdo %s/foo/bar/ge | update
|
||||||
|
```
|
||||||
|
|
||||||
|
This replaces all occurrences of "foo" by "bar" in all C source and header files
|
||||||
|
from the current directory and below.
|
||||||
|
|
||||||
|
Related help: `:h argument-list`
|
||||||
|
|
||||||
#### Mappings?
|
#### Mappings?
|
||||||
|
|
||||||
You can define your own mappings with the `:map` family of commands. Each
|
You can define your own mappings with the `:map` family of commands. Each
|
||||||
|
Loading…
x
Reference in New Issue
Block a user