3

I am using Vim for Rust development. I have a custom error format that works very well, except that newline characters in error messages are suppressed when scrolling through errors with :cn. This is a problem because rustc's error messages are usually multiple lines.

Is it possible to get Vim to display all of the lines in the error messages, on multiple lines, as they would be displayed on a terminal?

Edit: My error format is

CompilerSet errorformat=
     \%+E%f:%l:%c:\ %*\\d:%*\\d\ error:\ %m,
     \%+W%f:%l:%c:\ %*\\d:%*\\d\ warning:\ %m,
     \%+A%f:%l:%c:\ %*\\d:%*\\d\ note:\ %m,
     \%+C%f:%l:%c:\ error:\ %m,
     \%+C%f:%l:%c:\ warning:\ %m,
     \%+C%f:%l:%c:\ note:\ %m,
     \%+C%f:%l\ %s,
     \%+C\ %m,
     \%+C\(%m,
     \%+G%*[\ ]^,
     \%+G%*[\ ]^%*[~],
     \%+G%*[\ ]...

where :CompilerSet is defined as:

   command -nargs=* CompilerSet setlocal <args>

The error message is

read.rs:439:26: 439:74 error: mismatched types [E0308]
read.rs:439                     *x = State::DottedList { isSquare: a, depth: length }
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
read.rs:439:26: 439:74 help: run `rustc --explain E0308` to see a detailed explanation
read.rs:439:26: 439:74 note: expected type `&read::read::State` 
read.rs:439:26: 439:74 note:    found type `read::read::State` 
read.rs:439:26: 439:74 note: expected &-ptr, found enum `read::read::State` 
read.rs:439                     *x = State::DottedList { isSquare: a, depth: length }
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • 2
    You should show us your efm and a sample error. – romainl Jun 19 '16 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.