Raimondi / delimitMate

Vim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
http://www.vim.org/scripts/script.php?script_id=2754
1.98k stars 117 forks source link

Pressing } (left brace) while inside a string jumps to closing brace #200

Closed linduxed closed 9 years ago

linduxed commented 9 years ago

When writing Rust code, you could have a function looking like this:

fn main() {
    let bar = "bar"
    println!("foo{}", bar);
}

The problem is that unless I've added let delimitMate_excluded_regions = "String" to my vimrc, what will happen is that at first that when typing the third line, things will look like this:

fn main() {
    let bar = "bar"
    println!("{|");
}

...where the | is where the cursor is. Now if you write }, the cursor will jump all the way down to the last line, right after the already existing right brace.

In this code, if you do the same with [] and () the closing (right) bracket/parenthesis will be entered after the opening character resulting in something like this (as expected and wanted):

    println!("[]|");

However, if on the last line there's, for instance, a ) then the problem previously demonstrated with } will now apply to ).

These jumps make string interpolation in this particular language harder, but it might also affect other languages.

linduxed commented 9 years ago

Thank you for fixing this!