Skip to content

Instantly share code, notes, and snippets.

@kiwanami
Created January 20, 2017 06:11
Show Gist options
  • Save kiwanami/aeb45b81564cf147bb138a63dabf5633 to your computer and use it in GitHub Desktop.
Save kiwanami/aeb45b81564cf147bb138a63dabf5633 to your computer and use it in GitHub Desktop.
メソッドの関数定義を展開して、近所のレシーバーを自動で入れる
# -*- mode: snippet -*-
# name: golang method receiver
# key: sf
# --
func (${1:`(save-excursion
(let ((re "^func (\\([^\\)]*\\))"))
(cond
((or
(re-search-backward re nil t)
(re-search-forward re nil t))
(match-string 1))
(t ""))))`}) ${2:name} (${3:args}) ${4:result-type} {
$0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment