Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous Vim improvements #12592

Closed

Conversation

chris-morgan
Copy link
Member

Just like the bare keyword `crate` is highlighted as Error (a little
dubious, actually, given macros), `mod` is invalid after `extern`: it's
obsolete syntax.
This means it gets highlighted as Error by default.
(Expressed another way: make `[[` et al. work with the curly brace at
the end of a line as is standard Rust style, not just at the start is it
is by default in Vim, from K&R style.)

This came out of rust-lang#11492, where a simpler but less effective technique
was initially proposed; some discussion of the techniques, ways and
means can be found there.

There are still a few caveats:

- Operator-pending mode behaves differently to the standard behaviour:
  if inside curly braces, it should delete up to and including the
  closing of the outermost curly brace (that doesn't seem to me
  consistent with documented behaviour, but it's what it does). Actual
  behaviour (the more logical and consistent, in my opinion): up to the
  start of the next outermost curly brace.

- With folding enabled (`set fdm=syntax`), `[[` and `]]` do not behave
  as they should: the default behaviour treats an entire closed fold as
  one line for these purposes while this code does not (I explicitly
  `set nofoldenable` in the function—the side-effects are worse with
  folds enabled), leading to unexpected behaviour, the worst of which is
  `[[` and/or `]]` not working in visual mode on a closed fold (visual
  mode keeps it at the extreme end of the region line of the folded
  region, so it's always going back to the opening line of that fold and
  immediately being shoved back to the end by visual mode).

- `[[` and `]]` are operating inside comments, whereas the standard
  behaviour skips comments.

- The viewport position is sometimes changed when it should not be
  necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants