The ciiiircle of liiiife

This commit is contained in:
Henrik Lissner 2015-11-25 06:00:49 -05:00
parent 0923903e93
commit 03c6c05677
29 changed files with 287 additions and 465 deletions

View file

@ -3,16 +3,14 @@
;;;###autoload
(defun narf|yas-before-expand ()
"Switch to insert mode when expanding a template via backtab, or go back to
normal mode if there are no fields."
;; Strip out the shitespace before a line selection.
"Strip out the shitespace before a line selection."
(when (narf/evil-visual-line-state-p)
(setq yas-selected-text
(replace-regexp-in-string
"\\(^ *\\|\n? $\\)" ""
(buffer-substring-no-properties (region-beginning)
(1- (region-end))))))
(evil-insert-state +1))
(setq-local
yas-selected-text
(replace-regexp-in-string
"\\(^ *\\|\n? $\\)" ""
(buffer-substring-no-properties (region-beginning)
(1- (region-end)))))))
;;;###autoload
(defun narf|yas-after-expand ()
@ -26,7 +24,10 @@ normal mode if there are no fields."
normal mode if there are no fields."
(interactive)
(yas-insert-snippet)
(evil-insert-state +1))
(let* ((snippet (first (yas--snippets-at-point)))
(fields (yas--snippet-fields snippet)))
(evil-insert-state +1)
(when fields (evil-change-state 'normal))))
;;;###autoload
(defun narf/yas-goto-start-of-field ()