Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ITKEY_
Vim Sql Workbench
提交
bf089b0d
V
Vim Sql Workbench
项目概览
ITKEY_
/
Vim Sql Workbench
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vim Sql Workbench
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
bf089b0d
编写于
7月 31, 2017
作者:
C
Cosmin Popescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
version 7.1
上级
f2e1a253
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
8 deletion
+19
-8
autoload/sw/background.vim
autoload/sw/background.vim
+5
-3
autoload/sw/server.vim
autoload/sw/server.vim
+7
-5
resources/airline/sw.vim
resources/airline/sw.vim
+7
-0
未找到文件。
autoload/sw/background.vim
浏览文件 @
bf089b0d
...
...
@@ -6,7 +6,7 @@ let s:channels = {}
function
!
sw
#
background
#run
(
profile
,
cmd
,
handler
)
let
channel
=
sw
#server#start_sqlwb
(
'sw#background#message_handler'
,
1
)
let
s:channels
[
channel
]
=
{
'profile'
:
a:profile
,
'txt'
:
''
,
'handler'
:
a:handler
}
call
ch_setoptions
(
channel
,
{
'close_cb'
:
'sw#background#close'
})
""
call ch_setoptions(channel, {'close_cb': 'sw#background#close'})
if
a:profile
!=
''
let
command
=
sw
#get_connect_command
(
a:profile
)
call
sw
#server#execute_sql
(
command
,
channel
)
...
...
@@ -21,11 +21,13 @@ function! sw#background#message_handler(channel, message)
endif
endfunction
function
!
sw
#
background
#
close
(
channel
)
let
channel
=
sw
#find_channel
(
s:channels
,
a:channel
)
function
!
sw
#
background
#
close
(
args
)
let
channel
=
sw
#find_channel
(
s:channels
,
a:
args
.
channel
)
if
channel
!=
''
let
Func
=
function
(
s:channels
[
channel
].
handler
)
call
Func
(
s:channels
[
channel
].
profile
,
s:channels
[
channel
].
txt
)
endif
endfunction
call
sw
#server#add_event
(
'exit'
,
'sw#background#close'
)
autoload/sw/server.vim
浏览文件 @
bf089b0d
...
...
@@ -68,7 +68,7 @@ endfunction
function
!
s:log_channel
(
channel
,
txt
)
if
g:sw_log_to_file
let
file
=
s:channel_handlers
[
a:channel
].
log
let
mode
=
filereadable
(
file
)
?
'ab'
:
'wb'
let
mode
=
filereadable
(
file
)
||
s:nvim
?
'ab'
:
'wb'
call
writefile
(
split
(
a:txt
,
"\n"
),
file
,
mode
)
else
let
s:channel_handlers
[
a:channel
].
log
.=
a:txt
...
...
@@ -259,7 +259,8 @@ function! sw#server#execute_sql(sql, ...)
endfunction
function
s:trigger_event
(
channel
,
event
,
args
)
if
s:channel_handlers
[
a:channel
].
background
let
key
=
sw
#find_channel
(
s:channel_handlers
,
a:channel
)
if
key
!=
''
&&
s:channel_handlers
[
key
].
background
&&
a:event
!=
'exit'
return
endif
if
has_key
(
s:events
,
a:event
)
...
...
@@ -302,13 +303,14 @@ function! sw#server#disconnect_buffer(...)
endif
let
key
=
substitute
(
channel
,
'\v^channel ([0-9]+).*$'
,
'channel \1 open'
,
'g'
)
if
has_key
(
s:channel_handlers
,
key
)
call
s:trigger_event
(
channel
,
'exit'
,
{
'channel'
:
key
})
unlet
s:channel_handlers
[
key
]
endif
call
s:init_timer
()
if
exists
(
'g:sw_airline_support'
)
&&
g:sw_airline_support
==
1
call
airline#update_statusline
()
endif
""
if exists('g:sw_airline_support') && g:sw_airline_support == 1
""
call airline#update_statusline()
""
endif
endfunction
function
!
sw
#server#kill_statement
(...)
...
...
resources/airline/sw.vim
浏览文件 @
bf089b0d
...
...
@@ -35,3 +35,10 @@ function! airline#extensions#sw#apply(...)
let
g:airline_section_c
=
s:airline_section_c
endif
endfunction
function
!
airline#extensions#
sw
#on_exit
(
channel
)
call
airline#update_statusline
()
endfunction
call
sw
#server#add_event
(
'exit'
,
'airline#extensions#sw#on_exit'
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录