Skip to content

Instantly share code, notes, and snippets.

View Kyure-A's full-sized avatar

Kyure_A Kyure-A

View GitHub Profile
@Kyure-A
Kyure-A / zod-union-from-ts-union.el
Last active April 4, 2024 12:36
TypeScript の Union を Zod の Union に変換する関数
(require 's)
(require 'cl-lib)
(defun zod-union-from-ts-union (region-start region-end)
(interactive "r")
(let ((str (buffer-substring region-start region-end)))
(insert "z.union([\n")
(delete-region region-start region-end)
(mapcar #'insert (mapcar #'(lambda (x) (s-concat "z.literal(" x "),\n")) (remove-if #'s-blank? (mapcar #'s-trim (s-split "|" str)))))
(insert "])")))
@Kyure-A
Kyure-A / eglot-codelens.el
Created March 21, 2024 16:16 — forked from Gavinok/eglot-codelens.el
Add support for code lenses in eglot for emacs
;; eglot-codelens.el --- Add support for codelenses to eglot -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
;;; Extending eglot to support lenses
;;;; Findings
;; Lenses often support the option to be used as a code action
;; some servers rely on custom code actions implemented by the client
;; - [[https://github.com/emacs-lsp/lsp-mode/issues/2250]] mentions this
@Kyure-A
Kyure-A / predict-on.md
Created November 23, 2023 14:06
zsh predict-on を読む

https://github.com/zsh-users/zsh/blob/master/Functions/Zle/predict-on を GPT-3.5 に投げて説明をつけてみた

# このセットの関数は、ある種の魔法の履歴検索を実装しています。
# predict-on 後、文字を入力すると、エディタは履歴を逆に検索し、入力された文字列で始まる最初の行を見つけます。
# predict-off 後、編集は通常のモードに戻り、見つかった行を元に戻します。
# 実際、predict-off を使わなくても十分です。なぜなら、行が履歴に一致しない場合、キーを追加すると通常の補完が実行されるからです。
# ただし、行の中で編集すると、残りの部分が削除される可能性があるため注意が必要です。

# 関数ベースの補完システム(これが必要です)を使用すると、ほとんどどこでもTABを入力して
# カーソルを次の「興味深い」文字位置(通常は現在の単語の終わりですが、時には単語の途中になります)に進めるはずです。

Keybase proof

I hereby claim:

  • I am kyure-a on github.
  • I am kyure_a (https://keybase.io/kyure_a) on keybase.
  • I have a public key ASAXh1e-9tC6Ls0VNIO8rPU7RIYxI6RbMzd4uaCfIY7TyAo

To claim this, I am signing this object: