mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.41k stars 411 forks source link

Question: How to expand css in JSX file? #388

Closed samumist closed 6 years ago

samumist commented 6 years ago

When I try to expand css abbreviation in a .jsx file, it only expands like html tag. For example:

m10<trigger>
<m10></m10>

desired result:
margin: 10px;

I'm wondering if this could be done and how? Many thanks

danbruegge commented 6 years ago

Currently my workaround is that i have mappings that toggle between :set ft=css and :set ft=javascript.jsx.

samumist commented 6 years ago

Thanks @danbruegge for the workaround.

danbruegge commented 6 years ago
function! ToggleJsxCssFt()
    if &filetype == 'javascript.jsx'
        set filetype=css
    else
        set filetype=javascript.jsx
    endif
endfunction

nnoremap <leader>T :call ToggleJsxCssFt()<cr>

Forgot to put the code into the comment. ;) Its not the best solution for for a quick workaround it will do the job.

mattn commented 6 years ago

If you still have issue for jsx file, please try to fix with this issue? https://github.com/mattn/emmet-vim/issues/350