-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
function! OnWorking(job, msg) | ||
echomsg 'well work doing:' . a:msg | ||
let g:dir_list .= a:msg . "\n" | ||
endfunction | ||
|
||
function! DoneWork(job) | ||
echomsg 'well work done:' | ||
echomsg g:dir_list | ||
" echo g:dir_list | ||
endfunction | ||
|
||
function! StartWork() | ||
let g:dir_list = '' | ||
let l:option = {'callback': 'OnWorking', 'close_cb': 'DoneWork'} | ||
let g:job_ls = job_start('ls', l:option) | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function! SlowWork() | ||
call timer_start(5*1000, 'DoneWork') | ||
endfunction | ||
|
||
function! DoneWork(timer) | ||
echo "done!!" | ||
endfunction | ||
|
||
call SlowWork() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#! /usr/bin/env perl | ||
# 为文本行编号,按标准输入输出,适于 vim 过滤器 | ||
# 可选参数一指定分隔符,参数二指定间隔空白量(默认一个 tab) | ||
|
||
my $sep = shift || ""; | ||
my $num = shift || 0; | ||
$sep .= ($num > 0) ? (" " x $num) : "\t"; | ||
while (<>) { print "$.$sep$_"; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
function! s:execute(a:code) abort | ||
let l:perl = 'perl ' . a:code | ||
let l:ifstdout = '' | ||
let v:errmsg = '' | ||
redir => l:ifstdout | ||
silent! execute l:perl | ||
redir END | ||
if v:errmsg | ||
return '' | ||
endif | ||
return l:ifstdout | ||
endfunction | ||
|
||
function! s:call(func, ...) abort | ||
let l:args = join(a:000, ',') | ||
let l:code = printf('%s(%s);', a:func, l:args) | ||
return s:execute(l:code) | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
if !has('perl') | ||
finish | ||
endif | ||
|
||
function! PerlFunc() | ||
if has('perl') | ||
perl << EOF | ||
print $^V; # 打印版本号 | ||
print "$_\n" for @INC; # 打印所有模块搜索路径 | ||
print "$_ = $ENV{$_}" for sort keys %ENV; # 打印所有环境变量 | ||
EOF | ||
endif | ||
endfunction | ||
|
||
if has('perl') | ||
|
||
function! PerlFunc1() | ||
" todo | ||
endfunction | ||
|
||
function! PerlFunc2() | ||
" todo | ||
endfunction | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
" let 命令定义默认变量值 | ||
" 用户可以在 ~/.vim 相应目录下提供自己的配置 | ||
|
||
function! vip#config#load() | ||
return 1 | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
call vip#plugin#load() | ||
|
||
function! vip#ftplugin#onft(filetype, ...) | ||
if a:filetype ==? 'cpp' | ||
return vip#ftplugin#onCPP() | ||
endif | ||
endfunction | ||
|
||
function! vip#ftplugin#onCPP() | ||
" setlocal ... | ||
" map <buffer> ... | ||
" command -beffur ... | ||
endfunction | ||
|
||
function! vip#ftplugin#load() | ||
return 1 | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
call vip#config#load() | ||
|
||
" map 映射定义 | ||
" command 命令定义,调用其他 vip# 函数 | ||
|
||
augroup VIP_FILETYPE | ||
autocmd! | ||
autocmd BufNewFile,BufRead *.vip,*.vip.txt setlocal filetype=vip | ||
augroup END | ||
|
||
function! vip#plugin#load() | ||
return 1 | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if !exists('g:plugin_name_argument') | ||
let g:plugin_name_argument = s:default_argument_value | ||
endif | ||
|
||
function! s:optdef(argument, default) | ||
if !has_key(g:, a:argument) | ||
let g:{a:argument} = a:default | ||
end | ||
endfunction |