Vim Error Messages

73 views
Skip to first unread message

Mike Panciera

unread,
Dec 26, 2014, 6:10:19 PM12/26/14
to vim...@googlegroups.com
Hello all,

I am working on a project to make vim compatible with screenreaders. There is some info on the project here: https://github.com/averagehat/phonim-jython
and some background here: http://goo.gl/sQIwZN

As part of this project, I want to capture error messages and send them to the screen-reading process (via netbeans protocol). i.e. when a user attempts to edit a file that has read-only permissions, I want to capture the message: "E21: Cannot make changes, 'modifiable' is off" which gets sent to the command-line window, and fire off a bit of vim script. (I also want to capture the output of ex commands, which is related). For example, I would like something like:

:au OnError * : sendMessage()

However, no such "OnError" autocommand event exists. How can I simulate such an event?

The :redir command could allow me to redirect output to a buffer which is being monitored by netbeans (which would then allow me to capture the message). However, the changes are only written when :redir END is called. And because there are no events for errors, I would never know when to call :redir END.

None of the netbeans events offer any obvious help.

I know I can send the history via :messages, but this doesn't help a user who needs to immediately know about errors they've caused. And there are problems with trying to hack an event-loop into vim.

I have considered neovim but we want something that is totally cross-platform (gvim for windows).

Christian Brabandt

unread,
Jan 4, 2015, 5:26:32 AM1/4/15
to vim...@googlegroups.com
Hi Mike!
I have previously written a patch that adds an Error autocommand
handler. I am not sure, if I have ever send that patch here, but it is
available here:
https://github.com/chrisbra/vim-mq-patches/blob/master/error_aucmd

(Note: it is not thoroughly tested).

Best,
Christian
--
Die meisten Männer, die Kluges über Frauen gesagt haben, waren
schlecht Liebhaber. Die großen Praktiker reden nicht, sondern
handeln.
-- Jeanne Moreau
Reply all
Reply to author
Forward
0 new messages