continuar trad cap15 y copiar el texto original actualizado desde upstream

This commit is contained in:
Victorhck 2021-01-25 20:28:51 +01:00
parent 5c27cd4a94
commit b77237d9b8

View file

@ -22,9 +22,7 @@ Para dejar el modo línea de comandos, puedes utilizar `<esc>`, `Ctrl-C, o Ctrl-
Puedes repetir tanto el comando o comando externo ejecutado previamente medianto `@:`.
Si ejecutaste previamente `:s/foo/bar/g`, ahora ejecutando `@:` repetirá esa sustitución.
Si ejecutaste `:.!tr '[a-z]' '[A-Z]'`, ejecutando `@:` repetirá el último filtro del comando externo de traducción.
Si ejecutaste previamente `:s/foo/bar/g`, ahora ejecutando `@:` repetirá esa sustitución. Si ejecutaste `:.!tr '[a-z]' '[A-Z]'`, ejecutando `@:` repetirá el último filtro del comando externo de traducción.
## Atajos de teclado del modo línea de comandos
@ -42,60 +40,57 @@ Ctrl-W Elimina una palabra
Ctrl-U Elimina la línea entera
```
## Register and Autocomplete
Finalmente, si quieres editar el comando como si fuera un archivo de texto normal, utiliza `Ctrl-f`.
When programming, whenever possible, do not repeat if you can autocomplete it. This mindset will not only save you time but reduces the chances of typing the wrong characters.
Esto también te permite buscar entre comandos previos, editarlos y volverlos a ejecutar pulsando `<Enter` en el "modo normal de edición de línea de comandos".
You can insert texts from Vim register with `Ctrl-R` (the same way as the insert mode). If you have the string "foo" saved in the register "a" (`"a`), you can insert it by running `Ctrl-R a`. Everything that you can get from the register in the insert mode, you can do the same from the command-line mode.
## Registro y autocompletado
You can also autocomplete commands. To autocomplete the `echo` command, while in the command-line mode, type "ec", then press `<Tab>`. You should see on the bottom left Vim commands starting with "ec" (example: `echo echoerr echohl echomsg econ`). To go to the next option, press either `<Tab>` or `Ctrl-N`. To go the previous option, press either `<Shift-Tab>` or `Ctrl-P`.
Mientras estás en el modo de línea de comandos, puedes insertar textos desde los registros de Vim con `Ctrl-R` de la misma manera que lo haces en el modo insertar. Si tienes la cadena "foo" guardada en el registro "a", puedes insertarlo ejecutando `Ctrl-R a`. Todo lo que puedes hacer desde los registros en el modo normal, también puedes hacerlo en el modo línea de comandos.
Some command-line commands accept file names as arguments. One example is `edit`. After typing the command, `:e ` (don't forget the space), press `<Tab>`. Vim will list all the relevant file names.
In addition, you can also get the word under the cursor with `Ctrl-R Ctrl-W` (`Ctrl-R Ctrl-A` for the WORD under cursor). To get the line under the cursor, use `Ctrl-R Ctrl-L`. To get the filename under the cursor, use `Ctrl-R Ctrl-F`.
## History Window
You can also autocomplete existing commands. To autocomplete the `echo` command, while in the command-line mode, type "ec", then press `<Tab>`. You should see on the bottom left Vim commands starting with "ec" (example: `echo echoerr echohl echomsg econ`). To go to the next option, press either `<Tab>` or `Ctrl-N`. To go the previous option, press either `<Shift-Tab>` or `Ctrl-P`.
You can view the histoy of command-line commands and search terms (make sure that your Vim build has `+cmdline_hist` when you run `vim --version`).
Some command-line commands accept file names as arguments. One example is `edit`. You can autocomplete here too. After typing the command, `:e ` (don't forget the space), press `<Tab>`. Vim will list all the relevant file names that you can choose from so you don't have to type it from scratch.
To open the command-line history, run `:his :`:
## History Window And Command-line Window
You can view the histoy of command-line commands and search terms (this requires the `+cmdline_hist` feature).
To open the command-line history, run `:his :`. You should see something like the following:
```
# cmd history
## cmd History
2 e file1.txt
3 g/foo/d
4 s/foo/bar/g
```
Vim lists the history of all the `:` commands you run. By default, Vim stores the last 50 commands. To change the amount of the entries that Vim remembers to 100, you can run `:set history=100`.
Vim lists the history of all the `:` commands you run. By default, Vim stores the last 50 commands. To change the amount of the entries that Vim remembers to 100, you run `set history=100`.
When you are in the command-line mode, you can traverse this history list by pressing `Up` and `Down` button. Suppose you had the command-line command history that looks like:
```
51 s/foo/bar/g
52 s/foo/baz/g
53 s/foo//g
```
If you press `:` then press `Up` once, you'll see `:s/foo//g`. Press `Up` one more time to see `:s/foo/baz/g`. Vim goes up the history list.
Similarly, to view the search history, run `:his /`. You can also traverse the history stack by pressing `Up` or `Down` after running the history command `/`.
Vim is smart enough to distinguish different histories. If you press `Up` or `Down` after pressing `:`, Vim automatically the command history. If you press `Up` or `Down` after pressing `/`, Vim automatically searches the search history.
## Command-line Window
The history window displays the list of previously used command-line commands, but you can't execute the command from the history window. To execute a command while browsing, use the *command-line window*. There are three different command-line windows:
A more useful use of the command-line history is through the command-line window,`q:`. This will open a searchable, editable history window. Suppose you have these expressions in the history when you press `q:`:
```
q: Command-line window
q/ Forward search window
q? Backward search window
51 s/verylongsubstitutionpattern/pancake/g
52 his :
53 wq
```
Run `q:` to launch the command-line window for command-line commands. Vim will launch a new window at the bottom of the screen. You can traverse upward with the `Up` or `Ctrl-P` keys and traverse downward with the `Down` or `Ctrl-N` keys. If you press `<Return>`, Vim executes that command. To quit the command-line window, either press `Ctrl-C`, `Ctrl-W C`, or type `:quit`.
If your current task is to do `s/verylongsubstitutionpattern/donut/g`, instead of typing the command from scratch, why don't you reuse `s/verylongsubstitutionpattern/pancake/g`? After all, the only thing that's different is the word substitute, "donut" vs "pancake". Everything else is the same.
Similarly, to launch the command-line window for search, run `q/` to search forward and `q?` to search backward.
After you ran `q:`, find that `s/verylongsubstitutionpattern/pancake/g` in the history (you can use the Vim navigation in this environment) and edit it directly! Change "pancake" to "donut" inside the history window, then press `<Enter>`. Boom! Vim executes `s/verylongsubstitutionpattern/donut/g` for you. Super convenient!
## Learn Command-line Mode the Smart Way
Similarly, to view the search history, run `:his /` or `:his ?`. To open the search history window where you can search and edit past history, run `q/` or `q?`.
To quit this window, press `Ctrl-C`, `Ctrl-W C`, or type `:quit`.
## More Command-line Commands
Vim has hundreds of built-in commands. To see all the commands Vim have, check out `:h ex-cmd-index` or `:h :index`.
## Learn Command-line Mode The Smart Way
Compared to the other three modes, the command-line mode is like the Swiss Army knife of text editing. You can edit text, modify files, and execute commands, just to name a few. This chapter is a collection of odds and ends of the command-line mode. It also brings Vim modes into closure. Now that you know how to use the normal, insert, visual, and command-line mode you can edit text with Vim faster than ever.
It's time to move away from Vim modes and learn how to do a faster navigation with Vim tags.
It's time to move away from Vim modes and learn how to do an even faster navigation with Vim tags.