Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ch26_vimscript_conditionals_and_loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

```
catch /^Vim:Interrupt$/. " catch interrupts (CTRL-C)
catch /^Vim\\%((\\a\\+)\\)\\=:E/. " catch all Vim errors
catch /^Vim\\%((\\a\\+)\\)\\=:/. " catch errors and interrupts
catch /^Vim(write):/. " catch all errors in :write
catch /^Vim\\%((\\a\\+)\\)\\=:E123:/ " catch error E123
catch /my-exception/. " catch user exception
catch /.*/ " catch everything
catch. " same as /.*/
catch /^Vim:Interrupt$/. " catch interrupts (CTRL-C)
catch /^Vim\\%((\a\+)\)\=:E/. " catch all Vim errors
catch /^Vim\%((\a\+)\)\=:/. " catch errors and interrupts
catch /^Vim(write):/. " catch all errors in :write
catch /^Vim\%((\a\+)\)\=:E123:/ " catch error E123
catch /my-exception/. " catch user exception
catch /.*/ " catch everything
catch. " same as /.*/
```

Inside a `try` block, an interrupt is considered a catchable error.
Expand Down