Is it possible to make inline comments in LaTeX that do not extend until the end of the line?

The actual problem I'm trying to solve is vim's annoying highlighting of the non-curly end-bracket here:

\renewcommand{\thesubsection}{
\arabic{section}.
\alph{subsection})
}


Update

-
VIM does not highlight ) in any way for me. Also note that your definition introduces three spaces, which will appear when the command is used. Add % at line ends to remove the spaces. Finally, how about trying titlesec for this task? – Andrey Vihrov Mar 6 '11 at 10:47
Wouldn't \renewcommand...{%( fix your paren problem? – Ulrich Schwarz Mar 6 '11 at 10:51
@Andrey: I added a picture. Thanks for the % tip; I didn't think it would work because of the indentation. I'll look inteo titlesec. – Tim N Mar 6 '11 at 10:55
@Ulrich: For some reason, it does not. I figured that vim is smart enough to understand that it is commented out. – Tim N Mar 6 '11 at 10:55

You could create a command, which gobbles its argument, such as in the comment here: Control command arguments:

\newcommand{\comment}[1]{}


If you just wish to gobble a character, name it so and use it like

\newcommand*{\commentchar}[1]{}
Text \commentchar()


which results in Text ).

Another way, shown by Joseph on LaTeX-Community.org is defining an active character for that, such as in this minimal example:

\documentclass{article}
\catcode\|=\active
\def|#1|{}
\begin{document}
Text |ignored|Text
\end{document}


You have to take care of the spacing (blanks before and after) and possible side effects. This environment-way is fine, though again vim might unserstand that it's commented out, unlinke the \commentchar way.

-
Thanks, this is exactly what I was looking for. What does the asterisk in your \commentchar definition do? – Tim N Mar 6 '11 at 11:06
@Tim It defines a macro that is not \long`, meaning that TeX will fail with an error if the paragraph ends while reading the argument. – Andrey Vihrov Mar 6 '11 at 11:27