January 2015
Beginner to intermediate
85 pages
1h 58m
English
Because our mappings are going to be specific to our plugin, what are some ways in which we can distinguish them from the mappings a user might already have? And I did say that we were going to see how a user could reconfigure our mappings to his own liking. Let’s see that.
Remember those two variables back in Constructing a Statusline, that were using that special scope? That was the script scope, and we were using that for variables—we had s:count and s:settings. We can use the script scope for function definitions, too:
| mappings/map.vim | |
| | function! s:ColorfulCuteAnimals() |
| | let animals = ["Phil", "Tom", "Barb", "Bob", "Stacy", "Peary", "Mark", |
| | \ "Michael"] |
| | for a in animals ... |
Read now
Unlock full access