Quick Vim Macro for Sass @import

Since Sass @import doesn’t support globbing (without this gem), here’s a quick Vim macro for importing the contents of a directory.

  • :r !ls modules/ — “read” output of command into the buffer
  • qq — record macro
  • Insert @import modules/ before filename
  • ysiW" — surround WORD with ” (using vim-surround)
  • q — stop recording
  • V7j - enter linewise visual and select 7 lines down
  • :norm @q — execute macro on selected lines