作用域

:h :internal-variables

  1. 3. Internal variable internal-variables E461
  2. An internal variable name can be made up of letters, digits and '_'. But it
  3. cannot start with a digit. It's also possible to use curly braces, see
  4. curly-braces-names.
  5. An internal variable is created with the ":let" command :let.
  6. An internal variable is explicitly destroyed with the ":unlet" command
  7. :unlet.
  8. Using a name that is not an internal variable or refers to a variable that has
  9. been destroyed results in an error.
  10. There are several name spaces for variables. Which one is to be used is
  11. specified by what is prepended:
  12. (nothing) In a function: local to a function; otherwise: global
  13. buffer-variable b: Local to the current buffer.
  14. window-variable w: Local to the current window.
  15. tabpage-variable t: Local to the current tab page.
  16. global-variable g: Global.
  17. local-variable l: Local to a function.
  18. script-variable s: Local to a :source'ed Vim script.
  19. function-argument a: Function argument (only inside a function).
  20. vim-variable v: Global, predefined by Vim.

编写帮助文档

  1. :help help-writing

https://learnvimscriptthehardway.stevelosh.com/chapters/54.html