howaboutqiu

How to migrate Alfred snippets to Raycast

Update on 2023-12-13: Hugo is going to remove --verbose flag in the future, so we updated the snippet accordingly.

I aim to migrate all my daily routines from Alfred to Raycast due to its more powerful extension support. Plus, to be honest I’ve never exploit the full potential of Alfred’s workflows though been a Powerpack purchaser for years.

The most frequent use scenario for me is to expand some snippets. Here is a list of my typical snippets.

Name Keyword Snippet
R assignment ;; <-
awesome git log ;gitlog git log --graph --oneline --all --decorate --topo-order
hugo server local ;hugo hugo server --gc -D --disableFastRender --buildFuture
Lorem sample text ;lorem Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
markdown-image-insert ;image <img class="special-img-class" style="width:100%" src="" />
R package requirement ;require if (!require("pacman")) install.packages("pacman") pacman::p_load(package1, package2, package_n)
Update all brew-casks-installed ;cup brew cask list | xargs brew cask install --force
Update all outdated brews… ;bruo brew update && brew upgrade brew outdated

Bulk import

Honestly, it will be a pain to retype everything manually in Raycast. In David Brownman’s blog post Migrating Alfred Snippets to Raycast, he mentioned a relatively elegant way to bulk import snippets from Alfred to Raycast:

jq -s 'map(.alfredsnippet | {name, keyword, text: .snippet})' *.json > ../output.json

One last thing I don’t like about Raycast is there is no way to automatically synchronize settings between deivces. Instead, a manual export/import is required to keep everything update to date. Wish it could be implemented in the future.

#snippet