An open API service indexing awesome lists of open source software.

https://github.com/todesking/metascope.vim


https://github.com/todesking/metascope.vim

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

          

# metascope.vim: User-defined scope for variables

## Usage

Example: Define the "current-filetype" scope

```vim
" from plugin/metascope.vim

let s:def = {'name': 'filetype'}

function! s:def.scope_identifier() abort " {{{
return &filetype
endfunction " }}}

call metascope#register(s:def)

unlet s:def

```

```vim
call metascope#set('filetype:foo', 10)

echo metascope#get('filetype:foo')

set ft = xxx

echo metascope#get('filetype:foo') " error: filetype:foo is not found in this scope
```

## Default scopes

* `b`, `w`, `t`, `g`
* Same as VimL's `b:`, `w:`, `t:`, `g:` scope
* `filetype`