Skip to content

arozbiz/titular.el

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

titular.el 🔠

Emacs has convenient functions for upcasing and downcasing, but why not title casing? This package provides just that. Based on the code originally developed in this blog post.

Installation

This package isn’t on MELPA yet.

If you aren’t using Doom Emacs, the easiest way is probably to use straight.el like this:

(straight-use-package
 '(titular :type git :host github :repo "hungyiloo/titular.el"))

If you are using Doom like me, put this snippet in your packages.el then run doom sync:

(package! titular
  :recipe (:host github :repo "hungyiloo/titular.el"))

Usage & examples

titlecase-dwim will title case the selection region, or the entire line if no region is selected. titlecase-region will strictly title case the selected region only.

This will convert text to title case like:

original texttitle cased text
the quick brown fox jumps over the lazy dogThe Quick Brown Fox Jumps Over the Lazy Dog
“To be, or not to be, that is the question”“To Be, or Not to Be, That Is the Question”
they told me I could be anything I wanted; so I became an emacs lisp packageThey Told Me I Could Be Anything I Wanted; So I Became an Emacs Lisp Package

Bonus Doom + evil integration

Put this in your config.el somewhere:

(evil-define-operator my/evil-titlecase-operator (beg end)
  (interactive "<r>")
  (save-excursion
    (set-mark beg)
    (goto-char end)
    (titlecase-dwim)))

(after! evil
  (map! :nv "g`" #'my/evil-titlecase-operator))

Now in normal mode you can use g`` to title case a whole line, or in visual mode g` to title case the actively selected region.

Testing

Execute the bash script test.sh, which runs the ERT tests defined in titular-test.el.

About

🔠 Smart title casing in Emacs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 99.3%
  • Shell 0.7%