mirror of
https://github.com/iggredible/Learn-Vim
synced 2024-11-10 13:10:40 +00:00
Update ch25_vimscript_conditionals_and_loops.md
Realign catch examples
This commit is contained in:
parent
d5122782f7
commit
6604ba8064
@ -476,14 +476,14 @@ The difference between `catch` and `finally` is that `finally` is always run, er
|
|||||||
You can catch specific error with `:catch`. According to `:h :catch`:
|
You can catch specific error with `:catch`. According to `:h :catch`:
|
||||||
|
|
||||||
```
|
```
|
||||||
catch /^Vim:Interrupt$/ " catch interrupts (CTRL-C)
|
catch /^Vim:Interrupt$/ " catch interrupts (CTRL-C)
|
||||||
catch /^Vim\\%((\\a\\+)\\)\\=:E/ " catch all Vim errors
|
catch /^Vim\\%((\\a\\+)\\)\\=:E/ " catch all Vim errors
|
||||||
catch /^Vim\\%((\\a\\+)\\)\\=:/ " catch errors and interrupts
|
catch /^Vim\\%((\\a\\+)\\)\\=:/ " catch errors and interrupts
|
||||||
catch /^Vim(write):/ " catch all errors in :write
|
catch /^Vim(write):/ " catch all errors in :write
|
||||||
catch /^Vim\\%((\\a\\+)\\)\\=:E123:/ " catch error E123
|
catch /^Vim\\%((\\a\\+)\\)\\=:E123:/ " catch error E123
|
||||||
catch /my-exception/ " catch user exception
|
catch /my-exception/ " catch user exception
|
||||||
catch /.*/ " catch everything
|
catch /.*/ " catch everything
|
||||||
catch " same as /.*/
|
catch " same as /.*/
|
||||||
```
|
```
|
||||||
|
|
||||||
If you notice from the list above, there is a catch for interrupt. Inside a `try` block, an interrupt is considered a catchable error.
|
If you notice from the list above, there is a catch for interrupt. Inside a `try` block, an interrupt is considered a catchable error.
|
||||||
|
Loading…
Reference in New Issue
Block a user