Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ITKEY_
Vim Sql Workbench
提交
56a726dd
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,发现更多精彩内容 >>
提交
56a726dd
编写于
2月 28, 2015
作者:
C
Cosmin Popescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added sw_delete_tmp option and improved autocomplete regexp patterns
上级
1cb395b2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
14 deletion
+27
-14
autoload/sw.vim
autoload/sw.vim
+12
-12
autoload/sw/autocomplete.vim
autoload/sw/autocomplete.vim
+11
-2
plugin/sw.vim
plugin/sw.vim
+4
-0
未找到文件。
autoload/sw.vim
浏览文件 @
56a726dd
...
...
@@ -70,6 +70,15 @@ function! s:get_wake_vim_cmd()
return
s:wake_vim_cmd
.
' --remote-expr "sw#got_async_result('
.
s:get_buff_unique_id
()
.
')"'
endfunction
function
!
s:delete_tmp
()
if
(
g:sw_delete_tmp
)
call
delete
(
g:sw_tmp
.
'/'
.
s:input_file
())
call
delete
(
g:sw_tmp
.
'/'
.
s:output_file
())
call
delete
(
g:sw_tmp
.
'/'
.
s:async_input_file
())
endif
endfunction
function
!
sw
#async_end
()
let
idx
=
index
(
g:sw_async_ended
,
s:get_buff_unique_id
())
if
idx
!=
-1
...
...
@@ -81,10 +90,7 @@ function! sw#async_end()
let
func
=
b:on_async_result
execute
"call "
.
func
.
"()"
endif
call
delete
(
g:sw_tmp
.
'/'
.
s:input_file
())
call
delete
(
g:sw_tmp
.
'/'
.
s:output_file
())
call
delete
(
g:sw_tmp
.
'/'
.
s:async_input_file
())
call
s:delete_tmp
()
endif
endfunction
...
...
@@ -96,10 +102,7 @@ function! sw#reset_current_command()
if
exists
(
'b:async_on_progress'
)
unlet
b:async_on_progress
endif
call
delete
(
g:sw_tmp
.
'/'
.
s:input_file
())
call
delete
(
g:sw_tmp
.
'/'
.
s:output_file
())
call
delete
(
g:sw_tmp
.
'/'
.
s:async_input_file
())
call
s:delete_tmp
()
endfunction
function
!
sw
#kill_current_command
()
...
...
@@ -118,10 +121,7 @@ function! sw#kill_current_command()
call
sw
#session#unset_buffer_variable
(
'on_async_kill'
)
execute
"call "
.
func
.
"()"
endif
call
delete
(
g:sw_tmp
.
'/'
.
s:input_file
())
call
delete
(
g:sw_tmp
.
'/'
.
s:output_file
())
call
delete
(
g:sw_tmp
.
'/'
.
s:async_input_file
())
call
s:delete_tmp
()
endfunction
function
!
sw
#check_async_result
()
...
...
autoload/sw/autocomplete.vim
浏览文件 @
56a726dd
...
...
@@ -22,7 +22,7 @@ let s:pattern_identifier = '\v' . s:_pattern_identifier
let
s:pattern_reserved_word
=
'\v\c<(inner|outer|right|left|join|as|using|where|group|order|and|or|not)>'
let
s:pattern_subquery
=
'\v#sq([0-9]+)#'
let
s:script_path
=
expand
(
'<sfile>:p:h'
)
.
'/../../'
let
s:pattern_expressions
=
'\v\c\(([\s\t ]*select)@![^\)]{-}\)'
let
s:pattern_expressions
=
'\v\c\(([\s\t ]*select)@![^\
(\
)]{-}\)'
function
!
s:eliminate_sql_comments
(
sql
)
let
sql
=
sw
#get_sql_canonical
(
a:sql
)[
0
]
...
...
@@ -455,6 +455,9 @@ endfunction
function
!
s:extract_subqueries
(
sql
)
let
pattern
=
'\v\c(\([ \s\t]*select[^\(\)]+\))'
let
s
=
substitute
(
a:sql
,
s:pattern_expressions
,
'#values#'
,
'g'
)
while
s
=~
s:pattern_expressions
let
s
=
substitute
(
s
,
s:pattern_expressions
,
'#values#'
,
'g'
)
endwhile
let
matches
=
[]
let
n
=
0
let
m
=
matchstr
(
s
,
pattern
,
''
)
...
...
@@ -538,7 +541,13 @@ function! s:get_subquery_fields(sql, subqueries)
" get my_id, and then return the autocomplete with alias.my_id.
" That's why we eliminate everything before the point
" If the field does not contain *, we just get the last identifier
let
f
=
matchstr
(
field
,
'\v([^ \t\s]+)$'
)
if
field
=~
'\v\.'
let
f
=
matchstr
(
field
,
'\v([^\.]+)$'
)
elseif
field
=~
'\v[ ]'
let
f
=
matchstr
(
field
,
'\v([^ ]+)$'
)
else
let
f
=
field
endif
call
add
(
result
,
f
)
elseif
field
==
'*'
" If the field is *, we need to get the tables of this subquery
...
...
plugin/sw.vim
浏览文件 @
56a726dd
...
...
@@ -152,6 +152,10 @@ if !exists('g:sw_tab_switches_between_bottom_panels')
let
g:sw_tab_switches_between_bottom_panels
=
1
endif
if
!
exists
(
'g:sw_delete_tmp'
)
let
g:sw_delete_tmp
=
1
endif
"if !exists('g:sw_overwrite_current_command')
" let g:sw_overwrite_current_command = 0
"endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录