Thanks to visit codestin.com
Credit goes to github.com

Skip to content

HKey/caseformat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caseformat

Build Status Coverage Status MELPA MELPA Stable

Caseformat is a format based letter case converter.

screencast

This tool helps you to insert uppercase alphabetical characters without shift keys. This is inspired by sticky, sequential-command and electric-case.

Requirements

  • Emacs 24 or later
  • cl-lib
  • dash
  • s

Installation

You can install caseformat from MELPA or MELPA Stable by following steps:

  1. Setup the Emacs built-in package manager to use MELPA or MELPA Stable.
    MELPA's documentation is here.

  2. Install caseformat.
    M-x package-install caseformat

Basic usage

  1. Enable caseformat-mode with M-x caseformat-mode or M-x global-caseformat-mode

  2. Press M-l after insertion of a string that you want to convert

Mechanism of conversion

Caseformat converts prefixed alphabetical characters with converter functions. For example, "camel-case-string" will be converted to "camelCaseString" by caseformat-convert.

(caseformat-convert "camel-case-string") ; => "camelCaseString"

Internally caseformat-convert splits an input string into prefixed strings. Then caseformat converts them with converter functions corresponding to prefixes and returns a concatenated string.

prefixed string prefix converter result
camel nothing nothing camel
-case "-" capitalize Case
-string "-" capitalize String

Prefixes and corresponding converters are determined by caseformat-converter-table. So only registered strings in the value of it are handled as prefixes. The default value of it is below:

caseformat-converter-table
;; => (("-" capitalize)
;;     (":" upcase)
;;     (t downcase))

Conversion of a no-prefix string

A function which corresponds to t in caseformat-converter-table, it is called to convert a string if the string has no prefix.

By default, "FOOBAR" is converted to "foobar" by downcase but "FOO-BAR" is converted to "FOOBar".

Versioning

The versioning of caseformat follows Semantic Versioning 2.0.0.

About

Format based letter case converter

Resources

Stars

Watchers

Forks

Packages

No packages published