UP_CASE_VARIABLE to UpCaseVariable

35 views
Skip to first unread message

Waters, Bill

unread,
Nov 19, 2012, 5:27:23 PM11/19/12
to vim...@googlegroups.com

Does anyone have a plugin or clever substitution that will convert from an all upper case variable (UP_CASE_VARIABLE) to a camel-case variable (UpCaseVariable), and vice versa?

 

Thanks,

Bill

 

John Beckett

unread,
Nov 19, 2012, 6:19:36 PM11/19/12
to vim...@googlegroups.com

David Fishburn

unread,
Nov 19, 2012, 8:32:16 PM11/19/12
to vim...@googlegroups.com
I am surprised that didnt reference the keepcase.vim script which I think is great.
http://www.vim.org/scripts/script.php?script_id=6

If it meets your requirements.


--
David Fishburn

Bee

unread,
Nov 19, 2012, 10:02:18 PM11/19/12
to vim_use
On Nov 19, 2:28 pm, "Waters, Bill" <wat...@ti.com> wrote:
> Does anyone have a plugin or clever substitution that will convert from an all upper case variable (UP_CASE_VARIABLE) to a camel-case variable (UpCaseVariable), and vice versa?

" Titlecase A Line Or Selection
vnoremap \<F6> :s/\%V\<\(\w\)\(\w*\)\>/\u\1\L\2/ge<cr>
nmap \<F6> V\<F6>
imap \<F6> <esc>\<F6>i

Bee

unread,
Nov 19, 2012, 10:07:29 PM11/19/12
to vim_use
Oops... I mis-read and posted title case.

John Beckett

unread,
Nov 20, 2012, 1:16:46 AM11/20/12
to vim...@googlegroups.com
David Fishburn wrote:
>> Some suggestions are at:
>> http://vim.wikia.com/wiki/Converting_variables_to_or_from_camel_case
>
> I am surprised that didnt reference the keepcase.vim script
> which I think is great.
> http://www.vim.org/scripts/script.php?script_id=6

That script is mentioned at:
http://vim.wikia.com/wiki/Search_and_replace#Special_cases

If someone could describe how it helps with regard to converting
variables to/from camel case, that could be added to the first
tip above. Example commands with a brief statement of what they
do is best.

John

Christian Brabandt

unread,
Nov 20, 2012, 1:38:22 AM11/20/12
to vim...@googlegroups.com
I added a reference to the plugin to the mentioned wiki page.

regards,
Christian

Waters, Bill

unread,
Nov 20, 2012, 6:16:49 PM11/20/12
to vim...@googlegroups.com
Thanks!

Bill
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply all
Reply to author
Forward
0 new messages