styled-components / vim-styled-components

Vim bundle for http://styled-components.com based javascript files.
300 stars 24 forks source link

conflict with neoformat #15

Closed sourcesoft closed 7 years ago

sourcesoft commented 7 years ago

related to https://github.com/sbdchd/neoformat/issues/55

seems like using neoformat with vim-styled-components makes the cursor jump to import statement on every save, which gets solved after removing this plugin.

fleischie commented 7 years ago

@sourcesoft OK, this is a rather exotic behavior. :thinking:

If you put the import statement in another line (e.g. the 20th instead of the 1st), does this jump the cursor to the import-line as well?

Is this only when using prettier as the reformatter? Did you try to go back to the cursor position with <C-o><C-o>?

I have no experience with neoformat and I am not sure, whether this has anything to do with the plugin itself or with any formatting backend. If you have additional input, I'd be glad to test it out.

sourcesoft commented 7 years ago

does this jump the cursor to the import-line as well?

always jumps to the line with import statement

Is this only when using prettier as the reformatter?

happens without prettier too

Did you try to go back to the cursor position with ?

just ran :Neoformat manually inside vim and it jumps

fleischie commented 7 years ago

@sourcesoft I think I managed to find the culprit of the issue. It's the following line/lines: syntax/javascript.vim#L56,L57

I will keep you updated on the progress.

fleischie commented 7 years ago

@sourcesoft I have found and fixed the issue, will upload shortly.

P.S.: I had to supply the 'n' flag to the search call. Thanks vim-docs. :slightly_smiling_face: