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

JavaScript Object Method Indentation #156

Closed walkdoer closed 9 years ago

walkdoer commented 10 years ago

Hi @Raimondi :

I use vim to edit javascript file,and came across to this problem.

Problem Description:

step 1:

   var obj = {|} 

step 2: press enter

  var obj = {
      |
  }

step 3: after I input " a: ",

  var obj = {
a:|
  }

I can not figure out why. Hope to get some help from you @Raimondi This is my .vimrc file

and This is the test result

Thanks!

Raimondi commented 10 years ago

It works as expected for me. Go into delimitMate's dir and run the following:

vim -N -u test/_setup.vim -c 'filetype indent plugin on' -c 'let delimitMate_expand_cr=1' -c 'e foo.js'

then see if the issue remains. That'll open vim with just delimitMate as the only plugin and no extra settings.

walkdoer commented 10 years ago

hi @Raimondi , when I run vim just with delimiMate. everything is just fine.

So I run command verbose map : to check if there's a shortcut key map to : (because in step 3 i type a: into the buffer ), But the result is no mapping found.

Do you have some clue?

walkdoer commented 10 years ago

And the error is only happen when inside curly brackets {}, other like () [] is just fine.

walkdoer commented 10 years ago

:laughing: Finally, I found. because set cindent , But after delete cindent config, new problem pop up :cry:

Open: (|)
Delete: |
Exit: ()|
Car return: (
|
)
Delete car return: (|
)
Raimondi commented 10 years ago

I still can't reproduce the problem with cindent on, which is the default for the javascript fileype. I need step by step instruction to reproduce it and see if I can fix it.