|
126 | 126 | (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) |
127 | 127 | (add-to-list 'auto-mode-alist '("\\.rust\\'" . rust-ts-mode)) |
128 | 128 | (add-to-list 'auto-mode-alist '("\\.typ\\'" . typst-ts-mode)) |
| 129 | + (add-to-list 'auto-mode-alist '("\\.dat$" . ledger-mode)) |
| 130 | + (add-to-list 'auto-mode-alist '("\\.yaml" . yaml-ts-mode)) |
| 131 | + (add-to-list 'auto-mode-alist '("\\.yml" . yaml-ts-mode)) |
| 132 | + (add-to-list 'auto-mode-alist '("templates" . lisp-data-mode)) |
129 | 133 | (add-to-list 'auto-mode-alist '("Dockerfile" . dockerfile-ts-mode)) |
130 | 134 |
|
131 | 135 | (setq treesit-font-lock-level 4)) |
|
158 | 162 | '(("d" "Diary" plain (file diary-file-path) |
159 | 163 | "** 今日やったこと\n\n** 明日以降やりたいこと") |
160 | 164 | ("m" "Memo" plain (file memo-file-path) "") |
161 | | - |
162 | | - ;; ("t" "Todo" entry (file+headline "/home/coma/.ghq/github.com/Comamoca/org/todo.org" "INBOX") |
163 | | - ;; "* TODO %?\n") |
164 | 165 | )) |
165 | 166 |
|
166 | 167 | (setq diary-path (concat org-directory "/diary")) |
167 | 168 |
|
168 | 169 | (setq org-publish-use-timestamps-flag nil) |
169 | 170 | (setq org-publish-project-alist |
170 | | - '(("Diary" |
171 | | - :base-directory "~/.ghq/github.com/Comamoca/org/diary" |
172 | | - :base-extension "org" |
173 | | - :recursive t |
174 | | - :publishing-directory "~/.ghq/github.com/Comamoca/org/dist" |
175 | | - :publishing-function org-html-publish-to-html |
176 | | - :include ("index.org") |
177 | | - :exclude ()) |
| 171 | + '(("Diary" |
| 172 | + :base-directory "~/.ghq/github.com/Comamoca/org/diary" |
| 173 | + :base-extension "org" |
| 174 | + :recursive t |
| 175 | + :publishing-directory "~/.ghq/github.com/Comamoca/org/dist" |
| 176 | + :publishing-function org-html-publish-to-html |
| 177 | + :include ("index.org") |
| 178 | + :exclude ()) |
178 | 179 |
|
179 | | - ("Note" |
180 | | - :base-directory "~/.ghq/github.com/Comamoca/org/note" |
181 | | - :base-extension "org" |
182 | | - :recursive t |
183 | | - :publishing-directory "~/.ghq/github.com/Comamoca/org/note/dist" |
184 | | - :publishing-function org-html-publish-to-html |
185 | | - :auto-sitemap t |
186 | | - :include ("index.org") |
187 | | - :exclude () |
188 | | - :html-head "<link rel=\"stylesheet\" href=\"https://unpkg.com/mvp.css\">"))) |
189 | | - |
190 | | -;; org-babel |
191 | | -(setq org-confirm-babel-evaluate nil) |
192 | | -(setq python-shell-interpreter "python3") |
| 180 | + ("Note" |
| 181 | + :base-directory "~/.ghq/github.com/Comamoca/org/note" |
| 182 | + :base-extension "org" |
| 183 | + :recursive t |
| 184 | + :publishing-directory "~/.ghq/github.com/Comamoca/org/note/dist" |
| 185 | + :publishing-function org-html-publish-to-html |
| 186 | + :auto-sitemap t |
| 187 | + :include ("index.org") |
| 188 | + :exclude () |
| 189 | + :html-head "<link rel=\"stylesheet\" href=\"https://unpkg.com/mvp.css\">"))) |
| 190 | + |
| 191 | + ;; org-babel |
| 192 | + (setq org-confirm-babel-evaluate nil) |
| 193 | + (setq python-shell-interpreter "python3") |
193 | 194 | (org-babel-do-load-languages |
194 | 195 | 'org-babel-load-languages |
195 | | - '( |
196 | | - (C . t) |
| 196 | + '((C . t) |
197 | 197 | (shell . t) |
198 | 198 | (python . t) |
199 | 199 | (clojure . t) |
200 | 200 | (hy . t) |
201 | 201 | (ruby . t) |
202 | | - ))) |
| 202 | + (ledger . t)))) |
203 | 203 |
|
204 | 204 | ;; (add-hook 'org-mode-hook (lambda () |
205 | 205 | ;; (define-key 'evil-normal-state-map (kbd "M-v") #'org-paste-image))) |
|
431 | 431 | ;; Cursor moation |
432 | 432 | (leaf avy) |
433 | 433 |
|
434 | | -;; Completin soruce |
435 | | -(leaf cape |
436 | | - :init |
437 | | - (add-to-list 'completion-at-point-functions #'cape-elisp-block) |
438 | | - (add-to-list 'completion-at-point-functions #'cape-dabbrev) |
439 | | - (add-to-list 'completion-at-point-functions #'cape-file) |
440 | | - (add-to-list 'completion-at-point-functions #'cape-history) |
441 | | - (add-to-list 'completion-at-point-functions #'cape-keyword) |
442 | | - (add-to-list 'completion-at-point-functions #'yasnippet-capf)) |
| 434 | +;; Completion soruce |
| 435 | +(leaf cape :after corfu) |
| 436 | + |
| 437 | + |
443 | 438 | ;; (add-to-list 'completion-at-point-functions #'cape-line) |
444 | 439 |
|
445 | 440 |
|
|
529 | 524 | (progn |
530 | 525 | (evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide) |
531 | 526 | (evil-define-key 'normal neotree-mode-map (kbd "l") 'neotree-enter) |
| 527 | + (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter) |
532 | 528 | (evil-define-key 'normal neotree-mode-map (kbd "h") 'neotree-enter) |
533 | 529 | (evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh) |
534 | 530 | (evil-define-key 'normal neotree-mode-map (kbd "j") 'neotree-next-line) |
|
663 | 659 | (nyan-start-animation))) |
664 | 660 |
|
665 | 661 | ;; Snippets |
666 | | -(leaf yasnippet |
667 | | - :config |
668 | | - (setq yas-snippet-dirs '("~/emacs.d/snippets/")) |
669 | | - (setq yas-trigger-key nil) |
670 | | - (yas-global-mode 1)) |
671 | | - |
672 | | -;; Snippet collections |
673 | | -(leaf yasnippet-snippets) |
674 | 662 |
|
675 | | -;; Templates |
676 | | -(leaf yatemplate) |
677 | | -(leaf auto-insert |
| 663 | +(leaf tempel |
678 | 664 | :config |
679 | | - (setq auto-insert-directory "~/.emacs.d/templates/") |
680 | | - (setq auto-insert-alist |
681 | | - (append '( |
682 | | - ((expand-file-name "~/.ghq/github.com/Comamoca/blog/src/blog/.*\\-diary.md$") . "diary.md") |
683 | | - ) auto-insert-alist)) |
684 | | - :init |
685 | | - (auto-insert 1)) |
686 | | - |
687 | | -;; Complation |
688 | | -(leaf yasnippet-capf) |
| 665 | + (defun tempel-setup-capf () |
| 666 | + (setq-local completion-at-point-functions |
| 667 | + (cons #'tempel-complete |
| 668 | + completion-at-point-functions))) |
| 669 | + |
| 670 | + (add-hook 'conf-mode-hook 'tempel-setup-capf) |
| 671 | + (add-hook 'prog-mode-hook 'tempel-setup-capf) |
| 672 | + (add-hook 'text-mode-hook 'tempel-setup-capf) |
| 673 | + |
| 674 | + (add-hook 'markdown-mode-hook (lambda () |
| 675 | + (setq-local |
| 676 | + completion-at-point-functions |
| 677 | + #'tempel-complete |
| 678 | + ))) |
| 679 | + |
| 680 | + (add-hook 'git-commit-mode-hook (lambda () |
| 681 | + (setup-gitmoji) |
| 682 | + (setq-local completion-at-point-functions |
| 683 | + (list (cape-capf-super |
| 684 | + #'tempel-complete |
| 685 | + #'gitmoji-completion)))))) |
| 686 | + |
| 687 | +(leaf tempel-collection) |
689 | 688 |
|
690 | 689 | ;; HTTP Request |
691 | 690 | (leaf request) |
|
761 | 760 | (reformatter-define deno |
762 | 761 | :program "deno" :args `("fmt" ,buffer-file-name))) |
763 | 762 |
|
764 | | -;; ================ My extentions ================ |
| 763 | +(leaf ledger |
| 764 | + :config) |
765 | 765 |
|
766 | | -;; Incriment/Decriment like Vim |
767 | | -(defun replace-at-point (callback) |
768 | | - (interactive) |
769 | | - (let ((word (thing-at-point 'word t)) |
770 | | - (word-at (bounds-of-thing-at-point 'word))) |
| 766 | +(leaf grugru |
| 767 | + :config |
| 768 | + ;; ref: https://github.com/ROCKTAKEY/grugru/issues/44 |
| 769 | + (defun +grugru--getter-number () |
| 770 | + (if (string-match-p "^-?\\(?:[0-9]*[.]\\)?[0-9]+$" (thing-at-point 'word)) |
| 771 | + (bounds-of-thing-at-point 'number))) |
771 | 772 |
|
772 | | - (delete-region (car word-at) (cdr word-at)) |
773 | | - (insert (funcall callback word)))) |
| 773 | + (add-to-list 'grugru-getter-alist '(number . +grugru--getter-number)) |
774 | 774 |
|
775 | | -(defun incr-point () |
776 | | - (interactive) |
777 | | - (replace-at-point (lambda (word) |
778 | | - (number-to-string (+ (string-to-number word) 1))))) |
| 775 | + (grugru-define-global |
| 776 | + 'number |
| 777 | + (lambda (arg &optional rev) |
| 778 | + (let ((num (string-to-number arg))) |
| 779 | + (number-to-string (if rev (- num 1) (+ num 1)))))) |
| 780 | + |
| 781 | + (define-key evil-normal-state-map (kbd "C-a") 'grugru) |
| 782 | + (define-key evil-normal-state-map (kbd "C-x") 'grugru-backward) |
| 783 | + ) |
| 784 | + |
| 785 | +(leaf good-scroll |
| 786 | + :init |
| 787 | + (good-scroll-mode 1)) |
| 788 | + |
| 789 | +(leaf sublimity |
| 790 | + ) |
| 791 | + |
| 792 | +(leaf iscroll) |
| 793 | + |
| 794 | + |
| 795 | +;; ================ My extentions ================ |
779 | 796 |
|
780 | | -(defun decr-point () |
781 | | - (interactive) |
782 | | - (replace-at-point (lambda (word) |
783 | | - (let* ((num (string-to-number word)) |
784 | | - (incr-num (- num 1))) |
785 | | - (if (> 0 incr-num) |
786 | | - word |
787 | | - (number-to-string incr-num)))))) |
788 | 797 |
|
789 | 798 | (defun nyan-region () |
790 | 799 | "選択範囲をにゃーんで置換する" |
|
883 | 892 | ;; Collect gitmoji when startup |
884 | 893 | ;; (add-hook 'emacs-startup-hook 'setup-gitmoji) |
885 | 894 | ;; Enable at git-commit-mode |
886 | | -(add-hook 'git-commit-mode-hook (lambda () |
887 | | - (setup-gitmoji |
888 | | - (setq-local completion-at-point-functions (list #'gitmoji-completion))))) |
889 | 895 |
|
890 | 896 | ;; Display character count in modeline |
891 | 897 | (defun update-buffer-char-count () |
|
916 | 922 | (interactive) |
917 | 923 | (let* ((date (format-time-string "%Y-%m-%d")) |
918 | 924 | (file-name (format "%s-diary.md" date)) |
919 | | - (path (concat (expand-file-name "src/blog/" blog-repo) file-name))) |
| 925 | + (path (concat (expand-file-name "src/blog/" blog-repo) file-name)) |
| 926 | + (buf (find-file path))) |
920 | 927 | ;; (projectile-switch-project-by-name "blog") |
921 | | - (find-file path))) |
| 928 | + |
| 929 | + (if (= (buffer-size) 0) |
| 930 | + (tempel-insert 'diary)))) |
922 | 931 |
|
923 | 932 | (defun new-blog-article () |
924 | 933 | "Open latest diary. This function call in `src/blog/` directory at blog repository." |
|
1063 | 1072 | (setq create-lockfiles nil) |
1064 | 1073 |
|
1065 | 1074 | ;; Key mapping |
1066 | | -(define-key evil-normal-state-map (kbd "C-a") 'incr-point) |
1067 | | -(define-key evil-normal-state-map (kbd "C-x") 'decr-point) |
1068 | 1075 | (define-key global-map (kbd "C-x s") 'blackening-region) |
| 1076 | +(define-key global-map (kbd "C-;") 'comment-dwim) |
1069 | 1077 |
|
1070 | 1078 | ;; Enable debug |
1071 | 1079 | ;; (setq debug-on-error t) |
|
0 commit comments