Hi Jeri!

On So, 17 Okt 2010, Jeri Raye wrote:

> Hi,
>
> Is it possible to search for a keyword and change the case of it?
> I'm using vim for VHDL.
> VHDL is not case sensitive.
> I'm using keywords always in lower case, my collegue in upper case.
>
> To get to the same style I want to search my text for keywords and  
> change it to upper case.
>
> As Vim already knows it's VHDL, is it then possible to do:
> - search for keyword
> - replace it with the itself but then in upper case.
>
> so
> - end becomes END
> - entity becomes ENTITY
> - Architecture becomes ARCHITECTURE
> - std_LOGIC_vector becoms STD_LOGIC_VECTOR

:%s/\S\+/\=synIDattr(synID(line('.'), 
col('.'),0),"name")=~'vhdlStatement\|vhdlType\|vhdlOperator)'? 
toupper(submatch(0)) : submatch(0)/g

(1 line)

I tested it only barely. If you find out, that certain other types are 
not converted, you need to find out the syntax name for it. I did that 
on some items using the following command, I defined long ago in my 
.vimrc and which I find really useful, every now and then:

command! -nargs=0 WhatSyntax echomsg
  \synIDattr(synID(line("."),col("."+), 0), "name")

And then typing :WhatSyntax on an unknown Syntax item.

regards,
Christian

-- 
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 via email to