This commit is contained in:
Rico Sta. Cruz 2015-04-16 23:29:23 +08:00
parent 103d3f1684
commit fc888012a5
1 changed files with 17 additions and 7 deletions

View File

@ -10,11 +10,17 @@ let var = "hello"
``` ```
### Variable prefixes ### Variable prefixes
The `s:` prefix is also available in function names.
```vim ```vim
let g:ack_options = '-s -H' " g: global let g:ack_options = '-s -H' " g: global
let s:ack_program = 'ack' " s: local to script let s:ack_program = 'ack' " s: local (to script)
let l:foo = 'bar' " l: local to function let l:foo = 'bar' " l: local (to function)
```
### Other prefixes
```vim
let w:foo = 'bar' " w: window let w:foo = 'bar' " w: window
let b:state = 'on' " b: buffer let b:state = 'on' " b: buffer
let t:state = 'off' " t: tab let t:state = 'off' " t: tab
@ -22,13 +28,10 @@ echo v:var " v: vim special
let @/ = '' " @ register (this clears last search patterN) let @/ = '' " @ register (this clears last search patterN)
echo $PATH " $ env echo $PATH " $ env
" they're actually a dictionary
keys(s:)
``` ```
### Vim options ### Vim options
Prefix with `&` Prefix with `&`.
```vim ```vim
echo 'tabstop is ' . &tabstop echo 'tabstop is ' . &tabstop
@ -245,9 +248,16 @@ keys(dict)
len(dict) len(dict)
``` ```
### Prefixes
Prefixes (`s:`, `g:`, `l:`, etc) are actually dictionaries
```vim
keys(s:)
```
### Extending ### Extending
``` ```vim
" Extending with more " Extending with more
let extend(s:fruits, { ... }) let extend(s:fruits, { ... })
``` ```