• Stars
    star
    103
  • Rank 332,048 (Top 7 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created almost 11 years ago
  • Updated 5 months ago

Reviews

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

Repository Details

Teach Vim about titlecase, with support for motions and text objects

Vim Titlecase

Titlecase is a vim plugin that adds a new operator (command that takes a text object or motion to act on) for titlecasing text.

   this is some text  |  this is Some text
 method('some args')  |  method('Some Args')
        a title line  |   A Title Line

Usage

The main interface to the plugin is via the <Plug>Titlecase operator, by default mapped to gz.

The gz mapping will wait for a text object or motion before completing the titlecase operation. This means gzi' will titlecase inside of single quotes, gzap will titlecase a paragraph, etc. gz will also work on a visual selection.

In addition, gzz will titlecase the current line.

Word Exclusion

The variable g:titlecase_excluded_words can be used to specify which will be left untouched. For example:

let g:titlecase_excluded_words = ["thoughtbot"] 

Title-Casing Rules

The plugin lowercases all the: * conjunctions * articles * prepositions

It leaves the word as is when: * It is in all caps. * It is specified in the exclusion list g:titlecase_excluded_words.

And it capitalizes everything otherwise.

When used from <Plug>TitlecaseLine it capitalises the first and last word no matter what.

Caveats

The functionality of <Plug>TitlecaseLine unfortunately has an edgecase which causes it to ignore the exclusion list for the first and last words. "the fanciful tales of HTML" will be transformed to "The Fanciful Tales of Html" while in "the ins and outs of the SPARC system" the all caps will be respected. (I made these names up on the fly)

The plugin also doesn't take into account that the word after a colon needs to be capitalized.

Mappings

Be default titlecase maps itself to gz. If you would like to disable the default maps, add the following to your vimrc:

Bundle 'christoomey/vim-titlecase'

nmap <leader>gz  <Plug>Titlecase
vmap <leader>gz  <Plug>Titlecase
nmap <leader>gzz <Plug>TitlecaseLine
<Plug>Titlecase " Titlecase the region defined by a text object or motion
<Plug>TitlecaseLine " Titlecase the entire line

More Repositories

1

vim-tmux-navigator

Seamless navigation between tmux panes and vim splits
Vim Script
5,206
star
2

dotfiles

My vim, zsh, git, tmux, and other config files and utility scripts.
Shell
466
star
3

vim-system-copy

Vim plugin for copying to the system clipboard with text-objects and motions
Vim Script
345
star
4

vim-tmux-runner

Vim and tmux, sittin' in a tree...
Vim Script
290
star
5

vim-conflicted

Easy git merge conflict resolution in Vim
Vim Script
271
star
6

vim-sort-motion

Vim mapping for sorting a range of text
Vim Script
250
star
7

your-first-vim-plugin

Samples and notes for my Aug 2014 'Your First Vim Plugin' talk
Vim Script
129
star
8

vim-quicklink

A Vim plugin for quickly looking up a topic in google and inserting the relevant link
Vim Script
55
star
9

boston-react-conf-2018-graphql-talk

Sample repo for my Boston React Conf 2018 talk on React & GraphQL
JavaScript
31
star
10

vim-run-interactive

Vim plugin to run shell commands in an interactive shell
Vim Script
26
star
11

vim-rfactory

Vim plugin for rapid navigation to FactoryBot factory definition
Ruby
23
star
12

display-table-summary

Vim Script
8
star
13

vim-presentation-mode

Vim Script
8
star
14

vim-textobj-codeblock

Vim Script
7
star
15

alfred-trello-boards

Alfred workflow for quick navigation to Trello boards
Ruby
7
star
16

vim-kata-meetup

Support repo for 2012-11-12 Boston Vim meetup
Ruby
5
star
17

ctrlp-generic

A generic list selection extension to CtrlP for vim
Vim Script
4
star
18

magictags

Automatic generation of tags file from Vim
Vim Script
4
star
19

vim-g-dot

Vim command to repeat last change over a number of lines
Vim Script
4
star
20

typescript-intro-presentation

3
star
21

live-down

Markdown rendering and live-reloading
3
star
22

conway

jQuery & coffeescript implementation of Conway's Game of Life
CoffeeScript
3
star
23

vim-colors-ctoomey

My colorschemes for vim
Vim Script
3
star
24

react-native-graphql

JavaScript
2
star
25

emit

Fun with canvas animation
Ruby
2
star
26

zero

A web app to monitor your inbox zero status over time
Ruby
2
star
27

elm-reaction

Elm
1
star
28

gsub.vim

Vim Script
1
star
29

inertia-svelte-repro

Ruby
1
star
30

vim-swiki

Vim plugin for simple wiki management
Vim Script
1
star
31

trusted-local

Vim Script
1
star