• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionf9f547dea6263078f9672bf69a813a6a1bdbf732 (tree)
Time2023-03-27 16:32:31
Authorbadcoff33
Commiterbadcoff33

Log Message

made Scope autoload-able

Change Summary

Incremental Difference

diff -r 6975b47f5792 -r f9f547dea626 autoload/scope.vim
--- a/autoload/scope.vim Mon Mar 27 09:17:44 2023 +0200
+++ b/autoload/scope.vim Mon Mar 27 09:32:31 2023 +0200
@@ -7,44 +7,37 @@
77 let d = #{ pos: "topright",
88 \ line: "cursor",
99 \ col: win_screenpos(win_getid())[1] + winwidth(0),
10- \ highlight: 'ErrorMsg',
10+ \ highlight: 'Search',
1111 \ padding: [0, 1, 0, 1],
12- \ time: 3500 }
12+ \ time: 2000 }
1313 return d
1414 endfunction
1515
16-function! ScopePopup()
16+function! scope#PopupScope()
1717 let g:scope_previous = get(g:, "scope_previous", "")
1818 let text = scope#GetScope()
1919 if text != g:scope_previous && text != ""
20- echo "<" .. text .. ">"
2120 call popup_create(text, g:WinoptsScope())
2221 endif
2322 let g:scope_previous = text
2423 endfunction
2524
26-augroup GroupScope
27- au!
28- au CursorHold *.vim call ScopePopup()
29-augroup END
30-
31-"
32-" Description: If a function 'scope#Parser'..&ft exists, call it. The returned
25+" Description: If a function 'scope#GetScope'..&ft exists, call it. The returned
3326 " string can be used by 'statusline'. Recommended way to add new parser
34-" functions is to add it in this file. Most
35-" important is that the function ScopeParser&ft exists.
27+" functions is to add it in this file. Most important is that the function
28+" ScopeParser&ft exists.
3629 function! scope#GetScope()
37- let parser_fname = 'scope#Parser' . toupper(&ft[0]) . &ft[1:]
30+ let parser_fname = 'scope#GetScope' . toupper(&ft[0]) . &ft[1:]
3831 try
39- let Parser = function(parser_fname)
40- return Parser()
32+ let FuncRef = function(parser_fname)
33+ return FuncRef()
4134 catch
4235 return ''
4336 endtry
4437 endfunction
4538
4639 " Description: A scope parser for C files.
47-function! scope#ParserC() abort
40+function! scope#GetScopeC() abort
4841 " Regular expressions to find head and bottom lines of a C function.
4942 let regexpHead = '^[a-zA-Z_].*\(\<[0-9a-zA-Z_]\+\)\s*(.*'
5043 let regexpTail = '^}.*$'
@@ -63,7 +56,7 @@
6356 endfun
6457
6558 " Description: A simple scope parser for Python files.
66-function! scope#ParserPython() abort
59+function! scope#GetScopePython() abort
6760 let regexpHead = '^\s*\(class\|def\)\s\+\(\w\+\).*$'
6861 let lineHead = search(regexpHead, 'bnWe')
6962 if lineHead > 0
@@ -74,7 +67,7 @@
7467 endfun
7568
7669 " Description: A simple scope parser for Markdown files.
77-function! scope#ParserMarkdown() abort
70+function! scope#GetScopeMarkdown() abort
7871 let fNum = search('^#\{1,\}', 'bcnWez')
7972 if fNum > 0
8073 let chapter_str = substitute(getline(fNum), '^\(#\{1,\}\)\s\+\(.*\)$', '\=len(submatch(1)).."|"..submatch(2)', '')
@@ -89,7 +82,7 @@
8982 endfun
9083
9184 " Description: A scope parser for Vim files.
92-function! scope#ParserVim() abort
85+function! scope#GetScopeVim() abort
9386 " Regular expressions to find head and bottom lines of a Vim function.
9487 let regexpHead = '^\(func\|def\|export def\).*\ \+\([A-Za-z0-9#:<>]\+\)(.*$'
9588 let regexpTail = '^end.*$'
diff -r 6975b47f5792 -r f9f547dea626 plugin/scope.vim
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plugin/scope.vim Mon Mar 27 09:32:31 2023 +0200
@@ -0,0 +1,9 @@
1+
2+augroup GroupScope
3+ au!
4+ au CursorHold *.vim call scope#PopupScope()
5+ au CursorHold *.c,*.h call scope#PopupScope()
6+ au CursorHold *.py call scope#PopupScope()
7+ au CursorHold *.markdown,*.md,*.txt call scope#PopupScope()
8+augroup END
9+