Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
2.0 KiB

5 years ago
  1. # -*- mode: snippet -*-
  2. # contributor: sh-ow <sh-ow@users.noreply.github.com>
  3. # name: commentblock
  4. # key: cob
  5. # --
  6. ${1:$(let* ((col (current-column))
  7. (str "")
  8. (lastcom (substring (yas-trimmed-comment-start) -1))
  9. (start (yas-trimmed-comment-start))
  10. (end (yas-trimmed-comment-end))
  11. (over (- (+ (string-width yas-text) (length start) (length end) col) 77)))
  12. (while (< (length str) (+ (- 79 (length start) (length end) col) (if (> over 0) over 0)))
  13. (setq str (concat str lastcom)))
  14. (concat start str end))}
  15. ${1:$(let* ((col (current-column))
  16. (str "")
  17. (start (yas-trimmed-comment-start))
  18. (end (yas-trimmed-comment-end)))
  19. (while (< (length str) (ffloor (/ (- 78.0 (+ col (length start) (string-width yas-text) (length end))) 2.0)))
  20. (setq str (concat str " ")))
  21. (concat start str))} ${1:comment} ${1:$(let* ((col (current-column))
  22. (str "")
  23. (start (yas-trimmed-comment-start))
  24. (end (yas-trimmed-comment-end)))
  25. (while (< (length str) (- 79.0 (if (eq (mod (string-width yas-text) 2) 1) (- col 1) col) (length end)))
  26. (setq str (concat str " ")))
  27. (concat str end))}
  28. ${1:$(let* ((col (current-column))
  29. (str "")
  30. (lastcom (substring (yas-trimmed-comment-start) -1))
  31. (start (yas-trimmed-comment-start))
  32. (end (yas-trimmed-comment-end))
  33. (over (- (+ (string-width yas-text) (length start) (length end) col) 77)))
  34. (while (< (length str) (+ (- 79 (length start) (length end) col) (if (> over 0) over 0)))
  35. (setq str (concat str lastcom)))
  36. (concat start str end))}$0