Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probably a stupid question, but does this only work in .html files? #139

Open
alrhalford opened this issue Feb 6, 2019 · 2 comments
Open

Comments

@alrhalford
Copy link

I'm using this as a plugin for vim, and it's amazing, but I'm having a problem. I write a lot of html, but almost exclusively as part of React JSX, meaning that it is in .js files. I haven't managed to get sparkup to expand anything in JSX. Is this possible?

@joeytwiddle
Copy link

joeytwiddle commented Feb 7, 2019

In this folder we can see that the plugin only loads for html, htmldjango, smarty and xml filetypes (the last three being symlinks to the first).

If you want it for JSX files then you could:

  1. Create an extra symlink in the plugin's folder for your desired filetype

    cd sparkup/vim/ftplugin
    ln -s html javascript.jsx
    

    (You might want to ask vim what your filetype is for JSX files: :set filetype?)
    (For me it is javascript.jsx)

  2. Alternatively, add an event handler to your ~/.vimrc that loads the plugin when desired

    autocmd FileType javascript.jsx runtime ftplugin/html/sparkup.vim
    " or
    autocmd BufReadPost,BufNewFile *.js runtime ftplugin/html/sparkup.vim
    

I think those should work, but I haven't tested yet.

It might be a good idea to open a PR with the new symlink, for the benefit of other users.

@voldikss
Copy link

Actually this plugin also works in markdown files... It somehow weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants