2

When writing vimscript, is there any difference between things like <foo>, <Foo>, and <FOO>? I see certain words always written in lower case, e.g. <silent>, certain words always in upper case, e.g. <CR>, certain words with leading uppercase, e.g. <Leader>, and and others written in multiple ways, e.g. <TAB> and <Tab>. Are these completely case-insensitive? Is there a convention to follow?

2
  • Also, what are these things called? In the title of the question I just wrote "key symbols" for lack of a better term, but feel free to answer and edit! Commented Mar 10, 2017 at 1:31
  • Special characters delimited by angles < and > in vim are case-insensitive. Just try :help <Tab>, :help <TAB>, :help <taB>, :help <tAB> you will realize that they will yield all to the same position of the manual (i.e refering to the same thing) but it would be better to follow vim notation when writing script. Commented Mar 10, 2017 at 1:49

1 Answer 1

2

Yes, case sensitivity matters in Vim. For example p will paste something you yanked where the cursor is whereas P will paste it before the cursor. N will go to the previous occurrence of a search and n will go to the next occurrence.

However for keywords such as <Tab>, <cr>, and such, no case sensitivity does not matter. These usually refer to a key, such as the tab key, or a concert like a carriage return. The case should be consistent within a document for clarity.

Sign up to request clarification or add additional context in comments.

2 Comments

The OP is asking about using the <foo> keywords in vimscript, not about e.g. p...
Sorry thought I tried to address that. I expanded my answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.