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

Arrow functions indentation with K & R style breaks #305

Open eavdmeer opened 1 year ago

eavdmeer commented 1 year ago

Auto-indenting works fine with end-of-line braces:

fs.readFile('whatever', (err, content) => {<CR>
  // do something useful<CR>
}<CR>

However, this breaks when using K & R style:

fs.readFile('whatever', (err, content) =><CR>
  {<CR>
    // do something<CR>
  }

Indentation of the function body is initially correct, but as soon as you press the '{' key, the indentation level is incremented. Looks like this is happening due to the indentkeys including 0{. Removing it from indentkeys makes delimitMate work, but that results in this:

if (x < 2)<CR>
  {<CR>
    // more stuff<CR>
  }

Auto-indentation no longer removes the extra indentation level on the { key press.