for example when i open vim appear ~ how SpecialComment, other example is when put :set list lcs=tab:\|\ appear the tabs how | SpecialComment but how do i insert SpecialComment using keyboard, it is possible?

i want to make plugin that put SpecialComments for example create a box in any language

|print('hello') |


|printf("hello word")|

but i want to make inserting SpecialComment, SepecialComment only appear when uses vim. it is possible insert special comments whit keyboard?

  • Try open vim with vim -Nu NONE. Does SpecialComment appear? Now try open vim as usual vim. Does SpecialComment appear? – Sunny Pun Nov 18 '17 at 10:10
  • You question is not really clear: could you please specify exactly what appears on your screen and what is your actual problem? SpecialComment is a syntax group name, are you asking what should be highlighted with this group? I feel lijke your question is a duplicate of this one but I'm not sure what you are looking for. – statox Nov 18 '17 at 12:58
  • i know how highlighted, hi SpecialComment ctermfg=242, but how insert SpecialComment whit a keyboard? the SpecialComment only appear in vim – ramses_ATK Nov 18 '17 at 17:29

It depends. Highlighting is applied based on the current set of syntax highlighting rules. You can't open a random file and just know how to enter text "with keyboard" that will get highlighted with SpecialComment coloring. You must be familiar with the rules for the current file type.

For example, if I open a file with extension .java I know one way to see SpecialComment highlighting is to enter the first line of text in a javadoc comment:

 * This text is highlighted as a SpecialComment
 * This text is not.
public void foo() {

The rules are stored in files under $VIMRUNTIME/syntax. For the example above it would be java.vim where you'll find:

hi def link javaCommentTitle        SpecialComment

syn region  javaCommentTitle    contained matchgroup=javaDocComment start="/\*\*"   matchgroup=javaCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,@Spell,javaDocTags,javaDocSeeTag

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.