mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 23:49:19 +08:00
Add function for get sid (#2350)
* Add function for get sid * Add sid func * Update wiki
This commit is contained in:
parent
b34febce91
commit
8989f86023
@ -13,6 +13,8 @@
|
||||
|
||||
let s:self = {}
|
||||
|
||||
let s:DICT = SpaceVim#api#import('data#dict')
|
||||
|
||||
let s:self._cache = {}
|
||||
|
||||
function! s:self._capture(command) abort
|
||||
@ -44,6 +46,17 @@ function! s:self.scriptnames() abort
|
||||
endfor
|
||||
return sdict
|
||||
endfunction
|
||||
|
||||
function! s:self.get_sid_from_path(path) abort
|
||||
let path = self._unify_path(a:path)
|
||||
let scriptnames = s:DICT.swap(self.scriptnames())
|
||||
if has_key(scriptnames, path)
|
||||
return scriptnames[path]
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#api#vim#sid#get() abort
|
||||
return deepcopy(s:self)
|
||||
endfunction
|
||||
|
@ -46,7 +46,12 @@ endfunction
|
||||
function! s:eval_cursor() abort
|
||||
let is_keyword = &iskeyword
|
||||
set iskeyword+=:
|
||||
echo expand('<cword>') 'is' eval(expand('<cword>'))
|
||||
let cword = expand('<cword>')
|
||||
if cword =~# '^g:'
|
||||
echo cword . ' is ' eval(cword)
|
||||
elseif cword =~# '^s:'
|
||||
else
|
||||
endif
|
||||
let &iskeyword = is_keyword
|
||||
endfunction
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
- Add `lang#scheme` layer ([#2248](https://github.com/SpaceVim/SpaceVim/pull/2248))
|
||||
- Add log for bootstrap function ([#2232](https://github.com/SpaceVim/SpaceVim/pull/2323))
|
||||
- Add findstr support in flygrep ([#2344](https://github.com/SpaceVim/SpaceVim/pull/2344))
|
||||
- Add API: `get_sid_from_path` ([#2350](https://github.com/SpaceVim/SpaceVim/pull/2350))
|
||||
|
||||
### 功能改进
|
||||
|
||||
|
@ -12,6 +12,7 @@ The next release is v1.0.0.
|
||||
- Add `lang#scheme` layer ([#2248](https://github.com/SpaceVim/SpaceVim/pull/2248))
|
||||
- Add log for bootstrap function ([#2232](https://github.com/SpaceVim/SpaceVim/pull/2323))
|
||||
- Add findstr support in flygrep ([#2344](https://github.com/SpaceVim/SpaceVim/pull/2344))
|
||||
- Add API: `get_sid_from_path` ([#2350](https://github.com/SpaceVim/SpaceVim/pull/2350))
|
||||
|
||||
### Improvement
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user