mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 23:49:19 +08:00
Lang vim eval cursor (#2358)
This commit is contained in:
parent
1b92d31fc4
commit
e16572ef1e
@ -6,6 +6,10 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
" Load SpaceVim API
|
||||
|
||||
let s:SID = SpaceVim#api#import('vim#sid')
|
||||
|
||||
function! SpaceVim#layers#lang#vim#plugins() abort
|
||||
let plugins = [
|
||||
\ ['syngan/vim-vimlint', { 'on_ft' : 'vim'}],
|
||||
@ -46,11 +50,32 @@ endfunction
|
||||
function! s:eval_cursor() abort
|
||||
let is_keyword = &iskeyword
|
||||
set iskeyword+=:
|
||||
set iskeyword+=(
|
||||
let cword = expand('<cword>')
|
||||
if cword =~# '^g:'
|
||||
echo cword . ' is ' eval(cword)
|
||||
elseif cword =~# '^s:'
|
||||
" if is script function
|
||||
elseif cword =~# '^s:' && cword =~# '('
|
||||
let sid = s:SID.get_sid_from_path(expand('%'))
|
||||
if sid >= 1
|
||||
let func = '<SNR>' . sid . '_' . split(cword, '(')[0][2:] . '()'
|
||||
try
|
||||
echon 'Calling func:' . func . ', result is:' . eval(func)
|
||||
catch
|
||||
echohl WarningMsg
|
||||
echo 'failed to call func: ' . func
|
||||
echohl None
|
||||
endtry
|
||||
else
|
||||
echohl WarningMsg
|
||||
echo 'can not find SID for current script'
|
||||
echohl None
|
||||
endif
|
||||
else
|
||||
echohl WarningMsg
|
||||
echon 'can not eval script val:'
|
||||
echohl None
|
||||
echon cword
|
||||
endif
|
||||
let &iskeyword = is_keyword
|
||||
endfunction
|
||||
|
@ -20,6 +20,7 @@
|
||||
- Add doc for how run run spacevim in docker ([#2238](https://github.com/SpaceVim/SpaceVim/pull/2238))
|
||||
- Improve error key bindings ([#2336](https://github.com/SpaceVim/SpaceVim/pull/2336))
|
||||
- Improve spacevim debug info ([#2349](https://github.com/SpaceVim/SpaceVim/pull/2349))
|
||||
- Improve cursor eval in `lang#vim` layer ([#2358](https://github.com/SpaceVim/SpaceVim/pull/2358))
|
||||
|
||||
### 非兼容性变动
|
||||
|
||||
@ -36,6 +37,7 @@
|
||||
- Fix comment paragraphs key bindings ([#2340](https://github.com/SpaceVim/SpaceVim/pull/2340))
|
||||
- Fix dein-ui error, add syntax ([#2352](https://github.com/SpaceVim/SpaceVim/pull/2352), [`c9e1d4c`](https://github.com/SpaceVim/SpaceVim/commit/c9e1d4c9635c483bb3334c00ed36026d18950070))
|
||||
- Fix fullscreen key binding ([#2351](https://github.com/SpaceVim/SpaceVim/pull/2351))
|
||||
- Added missed syntax for detached FlyGrep ([#2353](https://github.com/SpaceVim/SpaceVim/pull/2353), [`08d0713`](https://github.com/SpaceVim/SpaceVim/commit/08d0713c4494ca401942a6ca10a48a1ac8484ce1))
|
||||
|
||||
### 移除的功能
|
||||
|
||||
|
@ -20,6 +20,7 @@ The next release is v1.0.0.
|
||||
- Add doc for how run run spacevim in docker ([#2238](https://github.com/SpaceVim/SpaceVim/pull/2238))
|
||||
- Improve error key bindings ([#2336](https://github.com/SpaceVim/SpaceVim/pull/2336))
|
||||
- Improve spacevim debug info ([#2349](https://github.com/SpaceVim/SpaceVim/pull/2349))
|
||||
- Improve cursor eval in `lang#vim` layer ([#2358](https://github.com/SpaceVim/SpaceVim/pull/2358))
|
||||
|
||||
### Changed
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user