---
title: "string-inflection 문자열 변환 - 대문자 카멜 케밥 케이스"
url: "https://notes.junghanacs.com/notes/20250304T194513"
author: "Junghan Kim"
date: "2025-03-04T19:45:00+09:00"
lastmod: "2025-03-04T19:45:00+09:00"
tags: ["bib"]
description: "string-inflection과 evil-string-inflection으로 문자열 케이스를 바꾸는 노트이다."
---

> [!abstract] 이 노트에 대하여
> 
> camelCase와 kebab-case, snake_case, UPPER_CASE를 Emacs 안에서 빠르게 순환 변환하는 방법을 정리한다. 이름 바꾸기와 코드 편집 감각을 매끄럽게 해 주는 작은 도구 노트다.

## BIBLIOGRAPHY

- “Akicho8/String-Inflection.” 2025. <https://github.com/akicho8/string-inflection>.

## 관련노트

-   [@HowardAbrams 구루 리터레이트 이맥스 - hamacs](https://notes.junghanacs.com/bib/20250220T095750) 구루

## 히스토리

-   [2025-03-04 Tue 19:45] string-inflection 반영

## [2025-03-04 W09](https://notes.junghanacs.com/journal/20250303T000000)

@user 이맥스에서 string-inflection을 지원하는 evil 패키지를 찾아줄래?

@assistant 이맥스에서 **string-inflection** 을 지원하는 **evil** 패키지는 **evil-string-inflection** 입니다. 이 패키지는 텍스트 객체를 camelCase, kebab-case, snake_case, UPPER_CASE로 변환하는 기능을 제공합니다. **string-inflection** 패키지를 래핑하여 이 기능을 구현합니다[5].

설치 방법은 다음과 같습니다:

1.  **M-x package-install** 을 실행하여 패키지 목록을 열고,
2.  **evil-string-inflection** 을 검색하여 설치합니다.

설치 후에는 evil 모드에서 해당 기능을 사용할 수 있습니다. 예를 들어, `g~` 키를 사용하여 문자열의 케이스를 순환할 수 있습니다[4].

```emacs-lisp
(define-key evil-normal-state-map (kbd "g~") 'evil-operator-string-inflection)
```

Citations: [1] <https://coldnew.github.io/coldnew-emacs/init.el.html> [2] <https://github.com/ninrod/evil-string-inflection/issues/1> [3] <https://notes.justin.vc/config> [4] <https://tecosaur.github.io/emacs-config/config.html> [5] <https://github.com/ninrod/evil-string-inflection>

@user

## from ha-programming

/home/junghan/sync/man/dotsamples/vanilla/hamacs-evil/ha-programming.org

-   [@HowardAbrams 구루 리터레이트 이맥스 - hamacs](https://notes.junghanacs.com/bib/20250220T095750)

### Case Conversion

The [string-inflection](https://github.com/akicho8/string-inflection) project (see [this overview](http://sodaware.sdf.org/notes/converting-to-snake-case-in-emacs/)) converts symbol variables to _appropriate format_ for the mode. This replaces my home-brewed functions.

string-inflection

```emacs-lisp
(use-package string-inflection
  :general
  (:states '(normal visual motion operator)
           "z s" '("to snake case" . string-inflection-underscore)
           "z S" '("to Snake Case" . string-inflection-upcase)
           "z c" '("to camelCase" . string-inflection-lower-camelcase)
           "z C" '("to CamelCase" . string-inflection-camelcase)
           "z -" '("to kebab case" . string-inflection-kebab-case)
           "z z" '("toggle snake/camel" . string-inflection-all-cycle)))
```

### default 'g' bindings

I would like to have this bound on the `g` sequence, but that is crowded.

Note that `g u` (for lower-casing stuff), and `g U` (for up-casing) requires _something_, for instance `g U i o` upper-cases the symbol at point. These functions, however, only work with a symbol (which is the typical case).

-   evil-upcase
-   evil-downcase

## `doomemacs` config

[2025-03-04 Tue 22:30]

```elisp
(map! :leader
      "x" nil
      (:prefix ("x" ."text")
               "x" #'jinx-correct-word
               ;; (:prefix ("l" . "language")
               ;;  :desc "define" "d" #'define-it-at-point
               ;;  :desc "grammarly check" "g" #'lsp-grammarly-check-grammar
               ;;  :desc "sdcv" "l" #'sdcv-search-pointer
               ;;  :desc "Merriam Webster" "m" #'mw-thesaurus-lookup-dwim
               ;;  :desc "wiktionary" "w" #'wiktionary-bro-dwim)
               (:prefix ("i" . "string-inflection")
                        "C" #'string-inflection-camelcase
                        "i" #'string-inflection-all-cycle
                        "-" #'string-inflection-kebab-case
                        "k" #'string-inflection-kebab-case
                        "_" #'string-inflection-underscore
                        "u" #'string-inflection-underscore
                        "U" #'string-inflection-upcase)
      ))
```

## akicho8/string-inflection

([“Akicho8/String-Inflection” 2025](https://notes.junghanacs.com/notes/20250304T194513#citeproc_bib_item_1))

-   Ikeda, Akira
-   underscore -{\\(>\\)} UPCASE -{\\(>\\)} CamelCase conversion of names
-   2025

둠이맥스는 citeproc 때문에 이미 들어가 있다. 그러니 활용하라

## string inflection

1.  **English Translation**: "string inflection"
2.  **Korean Response**: "문자열 변형"

3.  Citations: [1] <https://sequel.jeremyevans.net/rdoc-plugins/classes/String/Inflections.html> [2] <https://docs.laminas.dev/laminas-filter/v2/inflector/> [3] <https://github.com/piotrmurach/strings-inflection> [4] <https://docs.rs/inflections> [5] <https://inflection.readthedocs.io>
