Chap 11 - Buffer-Local Options and Mappings

Shadowing (???? Fail to attempt)

Before we move on, let's look at a particularly interesting property of local mappings. Switch over to foo and run the following commands:

:nnoremap Q x :nnoremap Q dd

Now type Q. What happens?

When you press Q, Vim will run the first mapping, not the second, because the first mapping is more specific than the second.

Switch to file bar and type Q to see that Vim uses the second mapping, because it's not shadowed by the first in this buffer. Exercises

Read :help local-options.

Read :help setlocal.

Read :help map-local.

Last updated

Was this helpful?