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

how can i use in vim? #75

Open
gcxfd opened this issue Aug 20, 2020 · 1 comment
Open

how can i use in vim? #75

gcxfd opened this issue Aug 20, 2020 · 1 comment

Comments

@gcxfd
Copy link

gcxfd commented Aug 20, 2020

how can i use in vim?

@dklymenk
Copy link

dklymenk commented Oct 4, 2020

You might want to create a custom function that writes the file, runs the cli version of this tool(asuming you have one installed) and reloads the file.

Here is my crappy implementation:

if (&ft=='stylus')
  function StylusSupremacy()
    :w "saves the file
    "run the actual command
    execute "!(~/.yarn/bin/stylus-supremacy format " . expand('%') .  " --replace --options ~/.stylus.json)" 
    :e "reloads the file
  endfunction
  command! StylusSupremacy call StylusSupremacy()
  map <leader>p :StylusSupremacy<CR>
endif

You might want to update the path to executable and path to config file, but other than that it should do the trick for you. The keybind is \p assuming you haven't remapped your leader key.

P.S. You should probably put your configs into separate files for each filetype instead of doing if (&ft=='.stylus')

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

2 participants