mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-16 02:14:17 +00:00
* First implementation of snippet-commands, looks promising.
* Optimization: read lisp expressions only once, eval many times. * auto-load .yas-setup.el instead of setup.el to prevent loading it as a snippet
This commit is contained in:
27
extras/imported/ruby-mode/.yas-setup.el
Normal file
27
extras/imported/ruby-mode/.yas-setup.el
Normal file
@@ -0,0 +1,27 @@
|
||||
(defvar yas/ruby-snippet-open-paren " "
|
||||
"The open parenthesis used in ruby-mode snippets. Normally blank but could be (")
|
||||
(defvar yas/ruby-snippet-close-paren " "
|
||||
"The close parenthesis used in ruby-mode snippets. Normally blank but could be )")
|
||||
(defun yas/ruby-snippet-paren (&optional arg)
|
||||
"Defaults to returning the open paren. If arg equals t then shows close paren."
|
||||
(if arg
|
||||
yas/ruby-snippet-close-paren
|
||||
yas/ruby-snippet-open-paren))
|
||||
|
||||
(defun yas/ruby-infer-class-name ()
|
||||
"Infer the class name from the buffer. Thanks to hitesh <hitesh.jasani@gmail.com>"
|
||||
(let ((fn (capitalize (file-name-nondirectory
|
||||
(file-name-sans-extension
|
||||
(buffer-file-name))))))
|
||||
(cond
|
||||
((string-match "_" fn) (replace-match "" nil nil fn))
|
||||
(t fn))))
|
||||
|
||||
(defun yas/ruby-in-interpolated-string-p ()
|
||||
(eq (fourth (syntax-ppss))
|
||||
?\"))
|
||||
|
||||
(defun yas/ruby-in-comment-p ()
|
||||
(fifth (syntax-ppss)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user