5 ms·
Oh that's lovely! I'm an Emacs user, and I've got two yasnippets that do roughly the same thing: https://gist.github.com/ashton314/f0a90a46e39b103635f2be8d8e6a
by ashton314 5y ago
Oh that's lovely! I'm an Emacs user, and I've got two yasnippets that do roughly the same thing:
https://gist.github.com/ashton314/f0a90a46e39b103635f2be8d8e6aeefd https://gist.github.com/ashton314/f0a90a46e39b103635f2be8d8e...
The second one adds a pipe in front, which is super handy. Yours gives me some ideas though…
- bostonvaulter2 5y agoDo you know if you can insert the current line number with yasnippet? I have two snippets that look almost identical to yours, although my non-pipe version leaves the cursor at the beginning of the label since I've found that I often want to customize the label because I may be inspecting similar variables at different points in the code. Ah, figured it out. It's very powerful to be able to call elisp inside snippets. Here's my new Labeled Inspect snippet: # -*- mode: snippet -*- # name: Labeled Inspect # key: lin # -- IO.inspect($1, label: "$2$1 (`(buffer-name)`:`(line-number-at-pos))`") and a piped version: # -*- mode: snippet -*- # name: Piped Inspect # key: pin # -- |> IO.inspect(label: "$2$1 (`(buffer-name)`:`(line-number-at-pos))`")
- ashton314 5y agoExcellent! I'm going to have to extend mine. Emacs ftw