Re: How to catch a write command in a butype=nofile buffer

2015-11-12 Thread Ben Fritz
On Wednesday, November 11, 2015 at 11:11:02 AM UTC-6, Jérôme Reybert wrote: > > I already tried the 'acwrite' mode. But the buffer content can be modified by > both the user and the plugin. Then, if I set the 'acwrite' mode, I get a > warning when I close the buffer. If you expect the user to

Re: How to catch a write command in a butype=nofile buffer

2015-11-11 Thread Jérôme Reybert
On Wednesday, November 11, 2015 at 5:05:06 PM UTC+1, Ben Fritz wrote: > On Wednesday, November 11, 2015 at 9:32:55 AM UTC-6, Jérôme Reybert wrote: > > I am trying to catch write commands, to perform some specific commands when > > user enters a write command (:w, :x, o

How to catch a write command in a butype=nofile buffer

2015-11-11 Thread Jérôme Reybert
I am trying to catch write commands, to perform some specific commands when user enters a write command (:w, :x, or anything else). In my plugin, I use a buffer with parameter buftype=nofile I tried BufWriteCmd and BufWritePre, but these hooks come too late, I always get: > E382: Cannot wr

Re: How to catch a write command in a butype=nofile buffer

2015-11-11 Thread Ben Fritz
On Wednesday, November 11, 2015 at 9:32:55 AM UTC-6, Jérôme Reybert wrote: > I am trying to catch write commands, to perform some specific commands when > user enters a write command (:w, :x, or anything else). > > In my plugin, I use a buffer with parameter buftype=nofile

Catch error E123: is help correct?

2012-05-06 Thread John Beckett
At ':help :catch' we see this example to catch error E123: :catch /^Vim\%((\a\+)\)\=:E123/ Isn't the above wrong? Why not just: :catch /E123:/ The help example has ':E123' but it means 'E123:'? What is the '^Vim...' stuff for? The messages on my system do not start with 'Vim' (use :s

Re: Catch error E123: is help correct?

2012-05-06 Thread Tony Mechelynck
On 07/05/12 04:08, John Beckett wrote: At ':help :catch' we see this example to catch error E123: :catch /^Vim\%((\a\+)\)\=:E123/ Isn't the above wrong? Why not just: :catch /E123:/ The help example has ':E123' but it means 'E123:'? What is the '^Vim...' stuff for? The messages

catch ?

2011-04-12 Thread Rostyslaw Lewyckyj
to continue What has happened to the expected output of the catch /E486:/ command. Why am I getting the regular E486: error message? = xxx file follows From - Mon Feb 28 22:58:36 2011 X-Account-Key: account2 X-UIDL: AG1ck0UAASZMTWxp+Q0nlBRtsX8 X-Mozilla-Status: X

Re: catch ?

2011-04-12 Thread Benjamin R. Haskell
come up with smaller examples. For this one: == xxx == a b c === == zzz == try g/notfound/d catch /E486:/ echo 'this is not caught' endtry === If it weren't obvious where the error was occurring, you could systematically add: finish to each line

If/Else for a Catch statement?

2011-03-31 Thread howard Schwartz
Hi, I would like to do something like this, to process exceptions: try if catch /pattern/ do this and that else do the ordinary thing endif endtry Of course this is not real code, but catches do act like an ``if'', but I do not know of a clean way to do

Re: If/Else for a Catch statement?

2011-03-31 Thread Tony Mechelynck
On 31/03/11 08:13, howard Schwartz wrote: Hi, I would like to do something like this, to process exceptions: try if catch /pattern/ do this and that else do the ordinary thing endif endtry Of course this is not real code, but catches do act like an ``if'', but I do not know of a clean way

Unable to catch specific error [was: Re: delete lines from while loop]

2010-06-02 Thread Andrei Popescu
/^#,\(.*,\)\=\s*fuzzy/s/,\s*fuzzy//' catch /^Vim\%((\a\+)\)\=:E486/ based on example from :help catch endtry but I still get: E486: Pattern not found: ^#,\(.*,\)\=\s*fuzzy I can work around it by reversing the order, let the substitute global do its work and then remove any '^#$' lines left

Re: Unable to catch specific error [was: Re: delete lines from while loop]

2010-06-02 Thread Andrei Popescu
' call setline(linenum, substitute(line, ',\s*fuzzy', '', )) endif endfor endf I tried (no pun intended) to replace the 'for' loop with: try execute ':'',''global/^#,\(.*,\)\=\s*fuzzy/s/,\s*fuzzy//' catch /^Vim\%((\a\+)\)\=:E486/ based on example from :help catch

Re: How to catch interrupts when block in input()?

2009-03-17 Thread Bram Moolenaar
Dasn wrote: On 16/03/09 22:18 +0100, Bram Moolenaar wrote: This works just fine for me: try let reply = input(what ) catch /Vim:Interrupt/ let reply = caught . v:exception endtry echo reply It seems not work for me, When I press C-c

Re: How to catch interrupts when block in input()?

2009-03-17 Thread Dasn
On 17/03/09 20:19 +0100, Bram Moolenaar wrote: Dasn wrote: On 16/03/09 22:18 +0100, Bram Moolenaar wrote: This works just fine for me: try let reply = input(what ) catch /Vim:Interrupt/ let reply = caught . v:exception endtry echo reply

How to catch interrupts when block in input()?

2009-03-14 Thread Dasn
Hi, :h catch-interrupt shows an example of catching interrupts, but it works not as it was described. The document says: If you press CTRL-C at the prompt, the script is terminated. But the problem is: when I press CTRL-C at the prompt, the script is not terminated, instead, it will give you

Re: How to catch interrupts when block in input()?

2009-03-14 Thread Dasn
() else echo \nIllegal command: command continue endif catch /^Vim:Interrupt$/ echo \nThis is the nested try/catch/endtry echo Command interrupted endtry catch