• Stars
    star
    245
  • Rank 165,304 (Top 4 %)
  • Language
    Emacs Lisp
  • Created about 12 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

underscore -> UPCASE -> CamelCase conversion of names

underscore -> UPCASE -> CamelCase conversion of names



Change History

Configuration Examples

Example 1

(require 'string-inflection)

;; C-q C-u is similar to the keybinding used by Vz Editor.
(global-unset-key (kbd "C-q"))
(global-set-key (kbd "C-q C-u") 'my-string-inflection-cycle-auto)

(defun my-string-inflection-cycle-auto ()
  "switching by major-mode"
  (interactive)
  (cond
   ;; for emacs-lisp-mode
   ((eq major-mode 'emacs-lisp-mode)
    (string-inflection-all-cycle))
   ;; for python
   ((eq major-mode 'python-mode)
    (string-inflection-python-style-cycle))
   ;; for java
   ((eq major-mode 'java-mode)
    (string-inflection-java-style-cycle))
   ;; for elixir
   ((eq major-mode 'elixir-mode)
    (string-inflection-elixir-style-cycle))
   (t
    ;; default
    (string-inflection-ruby-style-cycle))))

Example 2

(require 'string-inflection)

;; default
(global-set-key (kbd "C-c C-u") 'string-inflection-all-cycle)

;; for ruby
(add-hook 'ruby-mode-hook
          '(lambda ()
             (local-set-key (kbd "C-c C-u") 'string-inflection-ruby-style-cycle)))

;; for elixir
(add-hook 'elixir-mode-hook
          '(lambda ()
             (local-set-key (kbd "C-c C-u") 'string-inflection-elixir-style-cycle)))

;; for java
(add-hook 'java-mode-hook
          '(lambda ()
             (local-set-key (kbd "C-c C-u") 'string-inflection-java-style-cycle)))

;; for python
(add-hook 'python-mode-hook
          '(lambda ()
             (local-set-key (kbd "C-c C-u") 'string-inflection-python-style-cycle)))

How to Use

For each of the following, place the cursor at emacs_lisp and type C-q C-u, the results will be as follows:

In the case of string-inflection-ruby-style-cycle

emacs_lisp => EMACS_LISP => EmacsLisp => emacs_lisp

In the case of string-inflection-elixir-style-cycle

emacs_lisp => EmacsLisp => emacs_lisp

In the case of string-inflection-python-style-cycle

emacs_lisp => EMACS_LISP => EmacsLisp => emacs_lisp

In the case of string-inflection-java-style-cycle

emacsLisp => EMACS_LISP => EmacsLisp => emacsLisp

In the case of string-inflection-all-cycle

emacs_lisp => EMACS_LISP => EmacsLisp => emacsLisp => emacs-lisp => Emacs_Lisp => emacs_lisp

It is recommended that the major mode functions are used instead of string-inflection-all-cycle.

Standalone Functions

(string-inflection-underscore-function "EmacsLisp")           ; => "emacs_lisp"
(string-inflection-pascal-case-function "emacs_lisp")         ; => "EmacsLisp"
(string-inflection-camelcase-function "emacs_lisp")           ; => "emacsLisp"
(string-inflection-upcase-function "emacs_lisp")              ; => "EMACS_LISP"
(string-inflection-kebab-case-function "emacs_lisp")          ; => "emacs-lisp"
(string-inflection-capital-underscore-function "emacs_lisp")  ; => "Emacs_Lisp"

(string-inflection-pascal-case-p "EmacsLisp")                 ; => t
(string-inflection-pascal-case-p "emacs_lisp")                ; => nil
; etc...

Region usage

You can also use this library to convert a region’s casing.

For that, simply select a region and perform M-x string-inflection-kebab-case (or any such other function).

More Repositories

1

shogi-player

WEBブラウザ用の将棋盤
JavaScript
55
star
2

shogi-extend

将棋関連のツール集
Ruby
53
star
3

bioshogi

将棋の棋譜読み込み・相互変換・戦法抽出・AI
Ruby
14
star
4

shogi-mode

将棋の棋譜ファイルの構文に色を付けるEmacs用のモード
Emacs Lisp
12
star
5

tree_support

Tree structure visualization function library
Ruby
9
star
6

SKK-JISYO.shogi

将棋用語辞書
Ruby
6
star
7

react-shogi-player

JavaScript
6
star
8

bootstrap_learning

Twitter Bootstrap のお勉強用
JavaScript
4
star
9

albatro

人工無脳の覚え書き
Ruby
3
star
10

org_tp

OrgTp shows text table like emacs org-table for easy reading.
Ruby
3
star
11

equation

2つの範囲を相互変換するライブラリ
Ruby
2
star
12

rain_table

Hashの配列等から直接テキストの表を作る旧ライブラリ(org_tp gem に移行しました)
Ruby
2
star
13

splatoon2_weapon_quiz

スプラトゥーン2のブキ画像を見てブキ名を当てるしょうもないクイズアプリ
Vue
2
star
14

dougubako

テキスト検索置換・ファイル名置換・ファイル検索等々の自分用ツール集
Ruby
2
star
15

jquery_plugin_learning

いろんな jQuery Plugin を試してみる
JavaScript
2
star
16

table_format

TableFormat shows text table like emacs org-table for easy reading.
Ruby
2
star
17

ecd

Easy Change Directory (for eshell, dired env)
Emacs Lisp
2
star
18

mogrin

似非死活監視ツール
Ruby
2
star
19

text-align

Text align (emacs)
Emacs Lisp
2
star
20

htmlshow

勉強用のHTMLを束ねてページネートを付加したりする
Ruby
1
star
21

file-history

File buffer history selector (for emacs)
Emacs Lisp
1
star
22

static_record

少数のレコードを簡単に扱うライブラリ
Ruby
1
star
23

memory_record

A simple library that handles a few records easily
Ruby
1
star
24

stylet_support

GUIに依存しない数学関連ライブラリ
Ruby
1
star
25

learn_sass

sass + compass + CSS3 で試行錯誤します
Ruby
1
star
26

tixy-clone-apps

Tixy clone applications using ruby, rust, sdl, nannnou.
Rust
1
star
27

ruby-yukkuri

Windows上の棒読みちゃんをMacから操作するスクリプト
Ruby
1
star
28

normalizer

ActiveRecordのカラム値をいろんな方法で正規化するライブラリ
Ruby
1
star
29

learn_node_js

Node.js の練習用
JavaScript
1
star
30

test_blockchain

ブロックチェーンの写経
Ruby
1
star
31

yasnippets-collection

Emacs my yasnippets
Roff
1
star
32

ruby_design_pattern

短いコードですぐに思い出すためのデザインパターン覚え書き
Ruby
1
star
33

js-memory-record

A simple library that handles a few records easily
JavaScript
1
star
34

vue_playground

Vue.js であれこれします
Vue
1
star
35

shogi-player-vue-cli-sample

shogi-player を vue-cli で動かすシンプルな例です
1
star