vim-jsx-pretty
vim-jsx-pretty copied to clipboard
[Question] Is there an easy way to disable autoindenting and only get the syntax highlighting?
None of the traditional means of disabling autoindenting seem to be working.
You are right, but may I know the situation where you want to disable the auto-indentation?
...all situations?
I guess I could provide some background if you want: I prefer the vim standard "auto indent to the same indent level as the previous line" and would like syntax highlighting (of which this tool seems to have the best) but don't want to change the normal vim indenting behaviour. So I was wondering if there was a way to disable it for this plugin. There doesn't seem to be any decent "highlighting only" plugins out there, they all have the autoindent too. Which means I have to think about indenting and guess how the tool is going to indent and I'd prefer to not have to think about it at all, which means turning it off.
But the Vim standard auto-indent doesn't support the JSX indent convention well. So it extended the default indent behavior by adding the indentation logic for JSX.
BTW, if you are using vim-plug to manage the plugin, you can add finish at the start of the ~/.vim/plugged/vim-jsx-pretty/after/indent/javascript.vim or ~/.vim/plugged/vim-jsx-pretty/after/indent/tsx.vim to disable the indentation temporarily and to see whether the behavior is you expected.
What key do I need to press to format the code? In fact, I don't want to format the code function, but I don't know which key was pressed, which caused my code to be formatted. Now my code is in a mess
It's the same as the Vim's indentation key bindings. Press == will indent the current line, press gg=G to indent the entire file.
BTW, it only fixes the indentation.
But the Vim standard auto-indent doesn't support the JSX indent convention well. So it extended the default indent behavior by adding the indentation logic for JSX.
BTW, if you are using vim-plug to manage the plugin, you can add
finishat the start of the~/.vim/plugged/vim-jsx-pretty/after/indent/javascript.vimor~/.vim/plugged/vim-jsx-pretty/after/indent/tsx.vimto disable the indentation temporarily and to see whether the behavior is you expected.
This worked for me. Thanks!!
Context: I'm using this plugin along with vim-javascript and vim-pathogen as my package manager Question: How do I get the syntax highlighting and indenting to work?
It seems that vim-javascript is taking precedence so 'gg=G' doesn't indent the jsx code at all, and I don't see the nice colors and lines linking begin and end groups.
The only feature of vim-jsx that seems to be working is if I create a badly formated jsx section, e.g. 2 root tags. Then it complains.
Any ideas? Should I remove vim-javascript?