Browse Source

Refactored

Shougo Matsushita 2 years ago
parent
commit
382f68dbd0

+ 1
- 7
autoload/neocomplcache/sources/snippets_complete.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: snippets_complete.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 let s:source = {
11 8
       \ 'name' : 'snippets_complete',
12 9
       \ 'kind' : 'complfunc',
@@ -74,7 +71,4 @@ function! neocomplcache#sources#snippets_complete#define() abort "{{{
74 71
   return s:source
75 72
 endfunction"}}}
76 73
 
77
-let &cpo = s:save_cpo
78
-unlet s:save_cpo
79
-
80 74
 " vim: foldmethod=marker

+ 1
- 7
autoload/neocomplete/sources/neosnippet.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: neosnippet.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 let s:source = {
11 8
       \ 'name' : 'neosnippet',
12 9
       \ 'kind' : 'keyword',
@@ -42,7 +39,4 @@ function! neocomplete#sources#neosnippet#define() abort "{{{
42 39
   return s:source
43 40
 endfunction"}}}
44 41
 
45
-let &cpo = s:save_cpo
46
-unlet s:save_cpo
47
-
48 42
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: neosnippet.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 " Global options definition. "{{{
11 8
 call neosnippet#util#set_default(
12 9
       \ 'g:neosnippet#disable_runtime_snippets', {})
@@ -92,7 +89,4 @@ function! neosnippet#get_mirror_placeholder_marker_substitute_pattern() abort "{
92 89
   return '\\\@<!\$\(\d\+\)'
93 90
 endfunction"}}}
94 91
 
95
-let &cpo = s:save_cpo
96
-unlet s:save_cpo
97
-
98 92
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet/commands.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: commands.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 " Variables  "{{{
11 8
 let s:edit_options = [
12 9
       \ '-runtime',
@@ -205,7 +202,4 @@ function! s:get_snippet_files(path, filetype) abort "{{{
205 202
   return reverse(s:get_list().uniq(snippet_files))
206 203
 endfunction"}}}
207 204
 
208
-let &cpo = s:save_cpo
209
-unlet s:save_cpo
210
-
211 205
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet/handlers.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: handlers.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! neosnippet#handlers#_cursor_moved() abort "{{{
11 8
   let expand_stack = neosnippet#variables#expand_stack()
12 9
 
@@ -51,7 +48,4 @@ function! neosnippet#handlers#_restore_unnamed_register() abort "{{{
51 48
   endif
52 49
 endfunction"}}}
53 50
 
54
-let &cpo = s:save_cpo
55
-unlet s:save_cpo
56
-
57 51
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet/helpers.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: helpers.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! neosnippet#helpers#get_cursor_snippet(snippets, cur_text) abort "{{{
11 8
   let cur_word = matchstr(a:cur_text, '\S\+$')
12 9
   if cur_word != '' && has_key(a:snippets, cur_word)
@@ -184,7 +181,4 @@ function! s:get_sources_filetypes(filetype) abort "{{{
184 181
   return ['_'] + filetypes
185 182
 endfunction"}}}
186 183
 
187
-let &cpo = s:save_cpo
188
-unlet s:save_cpo
189
-
190 184
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet/init.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: init.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! neosnippet#init#_initialize() abort "{{{
11 8
   let s:is_initialized = 1
12 9
 
@@ -90,7 +87,4 @@ function! s:initialize_others() abort "{{{
90 87
   endif"}}}
91 88
 endfunction"}}}
92 89
 
93
-let &cpo = s:save_cpo
94
-unlet s:save_cpo
95
-
96 90
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet/mappings.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: mappings.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! neosnippet#mappings#expandable_or_jumpable() abort "{{{
11 8
   return neosnippet#mappings#expandable() || neosnippet#mappings#jumpable()
12 9
 endfunction"}}}
@@ -247,7 +244,4 @@ function! neosnippet#mappings#jump_impl() abort
247 244
   return neosnippet#mappings#_trigger('neosnippet#view#_jump')
248 245
 endfunction
249 246
 
250
-let &cpo = s:save_cpo
251
-unlet s:save_cpo
252
-
253 247
 " vim: foldmethod=marker

+ 1
- 8
autoload/neosnippet/parser.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: parser.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 let s:Cache = neosnippet#util#get_vital().import('System.Cache.Deprecated')
11 8
 
12 9
 function! neosnippet#parser#_parse_snippets(filename) abort "{{{
@@ -409,8 +406,4 @@ function! neosnippet#parser#_get_in_paren(key, pair, str) abort "{{{
409 406
   return ''
410 407
 endfunction"}}}
411 408
 
412
-
413
-let &cpo = s:save_cpo
414
-unlet s:save_cpo
415
-
416 409
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet/util.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: util.vim
3
-" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! neosnippet#util#get_vital() abort "{{{
11 8
   if !exists('s:V')
12 9
     let s:V = vital#neosnippet#new()
@@ -147,7 +144,4 @@ function! neosnippet#util#option2list(str) abort "{{{
147 144
   return type(a:str) == type('') ? split(a:str, '\s*,\s*') : a:str
148 145
 endfunction"}}}
149 146
 
150
-let &cpo = s:save_cpo
151
-unlet s:save_cpo
152
-
153 147
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet/variables.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: variables.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! neosnippet#variables#current_neosnippet() abort "{{{
11 8
   if !exists('b:neosnippet')
12 9
     let b:neosnippet = {
@@ -89,7 +86,4 @@ function! neosnippet#variables#data_dir() abort "{{{
89 86
   return g:neosnippet#data_directory
90 87
 endfunction"}}}
91 88
 
92
-let &cpo = s:save_cpo
93
-unlet s:save_cpo
94
-
95 89
 " vim: foldmethod=marker

+ 1
- 7
autoload/neosnippet/view.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: view.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! neosnippet#view#_expand(cur_text, col, trigger_name) abort "{{{
11 8
   let snippets = neosnippet#helpers#get_snippets()
12 9
 
@@ -557,7 +554,4 @@ function! s:skip_next_auto_completion() abort "{{{
557 554
   endif
558 555
 endfunction"}}}
559 556
 
560
-let &cpo = s:save_cpo
561
-unlet s:save_cpo
562
-
563 557
 " vim: foldmethod=marker

+ 1
- 7
autoload/unite/sources/neosnippet.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: neosnippet.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! unite#sources#neosnippet#define() abort "{{{
11 8
   let kind = {
12 9
         \ 'name' : 'neosnippet',
@@ -140,7 +137,4 @@ function! s:get_keyword_pos(cur_text) abort "{{{
140 137
   return cur_keyword_pos
141 138
 endfunction"}}}
142 139
 
143
-let &cpo = s:save_cpo
144
-unlet s:save_cpo
145
-
146 140
 " vim: foldmethod=marker

+ 1
- 7
autoload/unite/sources/neosnippet_file.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: neosnippet_file.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 function! unite#sources#neosnippet_file#define() abort "{{{
11 8
   return [s:source_user, s:source_runtime]
12 9
 endfunction "}}}
@@ -91,7 +88,4 @@ function! s:get_snippet_candidates(dirs) abort "{{{
91 88
   return _
92 89
 endfunction "}}}
93 90
 
94
-let &cpo = s:save_cpo
95
-unlet s:save_cpo
96
-
97 91
 " vim: foldmethod=marker

+ 1
- 1
doc/neosnippet.txt View File

@@ -2,7 +2,7 @@
2 2
 		The neo-snippet plugin contains snippet source
3 3
 
4 4
 Version: 5.0
5
-Author: Shougo <Shougo.Matsu@gmail.com>
5
+Author: Shougo <Shougo.Matsu at gmail.com>
6 6
 License: MIT license
7 7
 
8 8
 CONTENTS			*neosnippet-contents*

+ 1
- 7
ftplugin/neosnippet.vim View File

@@ -1,12 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: snippets.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
7
-let s:save_cpo = &cpo
8
-set cpo&vim
9
-
10 7
 if !exists('b:undo_ftplugin')
11 8
     let b:undo_ftplugin = ''
12 9
 else
@@ -21,6 +18,3 @@ let &l:commentstring="#%s"
21 18
 let b:undo_ftplugin .= '
22 19
     \ setlocal expandtab< shiftwidth< softtabstop< tabstop< commentstring<
23 20
     \'
24
-
25
-let &cpo = s:save_cpo
26
-unlet s:save_cpo

+ 24
- 49
indent/neosnippet.vim View File

@@ -1,26 +1,7 @@
1 1
 "=============================================================================
2 2
 " FILE: snippets.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
4
-" License: MIT license  {{{
5
-"     Permission is hereby granted, free of charge, to any person obtaining
6
-"     a copy of this software and associated documentation files (the
7
-"     "Software"), to deal in the Software without restriction, including
8
-"     without limitation the rights to use, copy, modify, merge, publish,
9
-"     distribute, sublicense, and/or sell copies of the Software, and to
10
-"     permit persons to whom the Software is furnished to do so, subject to
11
-"     the following conditions:
12
-"
13
-"     The above copyright notice and this permission notice shall be included
14
-"     in all copies or substantial portions of the Software.
15
-"
16
-"     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
-"     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
-"     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
-"     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
-"     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
-"     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
-"     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
-" }}}
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4
+" License: MIT license
24 5
 "=============================================================================
25 6
 
26 7
 " Only load this indent file when no other was loaded.
@@ -29,13 +10,10 @@ if exists('b:did_indent')
29 10
 endif
30 11
 let b:did_indent = 1
31 12
 
32
-let s:save_cpo = &cpo
33
-set cpo&vim
34
-
35 13
 if !exists('b:undo_indent')
36
-    let b:undo_indent = ''
14
+  let b:undo_indent = ''
37 15
 else
38
-    let b:undo_indent .= '|'
16
+  let b:undo_indent .= '|'
39 17
 endif
40 18
 
41 19
 setlocal autoindent
@@ -49,34 +27,31 @@ let b:undo_indent .= 'setlocal
49 27
     \'
50 28
 
51 29
 function! SnippetsIndent() abort "{{{
52
-    let line = getline('.')
53
-    let prev_line = (line('.') == 1)? '' : getline(line('.')-1)
54
-    let syntax = '\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options\|regexp\)\s'
55
-    let defining = '\%(snippet\|abbr\|prev_word\|alias\|options\|regexp\)\s'
56
-
57
-    "for indentkeys o,O
58
-    if s:is_empty(line)
59
-        if prev_line =~ '^' . defining
60
-            return shiftwidth()
61
-        else
62
-            return -1
63
-        endif
30
+  let line = getline('.')
31
+  let prev_line = (line('.') == 1)? '' : getline(line('.')-1)
32
+  let syntax = '\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options\|regexp\)\s'
33
+  let defining = '\%(snippet\|abbr\|prev_word\|alias\|options\|regexp\)\s'
34
+
35
+  "for indentkeys o,O
36
+  if s:is_empty(line)
37
+    if prev_line =~ '^' . defining
38
+      return shiftwidth()
39
+    else
40
+      return -1
41
+    endif
64 42
 
65 43
     "for indentkeys =words
44
+  else
45
+    if line =~ '^\s*' . syntax
46
+          \ && (s:is_empty(prev_line)
47
+          \ || prev_line =~ '^' . defining)
48
+      return 0
66 49
     else
67
-        if line =~ '^\s*' . syntax
68
-           \ && (s:is_empty(prev_line)
69
-                \ || prev_line =~ '^' . defining)
70
-            return 0
71
-        else
72
-            return -1
73
-        endif
50
+      return -1
74 51
     endif
52
+  endif
75 53
 endfunction"}}}
76 54
 
77 55
 function! s:is_empty(line)
78
-    return a:line =~ '^\s*$'
56
+  return a:line =~ '^\s*$'
79 57
 endfunction
80
-
81
-let &cpo = s:save_cpo
82
-unlet s:save_cpo

+ 1
- 7
plugin/neosnippet.vim View File

@@ -1,6 +1,6 @@
1 1
 "=============================================================================
2 2
 " FILE: neosnippet.vim
3
-" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
3
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu at gmail.com>
4 4
 " License: MIT license
5 5
 "=============================================================================
6 6
 
@@ -11,9 +11,6 @@ elseif v:version < 704
11 11
   finish
12 12
 endif
13 13
 
14
-let s:save_cpo = &cpo
15
-set cpo&vim
16
-
17 14
 " Plugin key-mappings. "{{{
18 15
 inoremap <silent><expr> <Plug>(neosnippet_expand_or_jump)
19 16
       \ neosnippet#mappings#expand_or_jump_impl()
@@ -69,8 +66,5 @@ command! -bar NeoSnippetClearMarkers
69 66
 
70 67
 let g:loaded_neosnippet = 1
71 68
 
72
-let &cpo = s:save_cpo
73
-unlet s:save_cpo
74
-
75 69
 " __END__
76 70
 " vim: foldmethod=marker

+ 3
- 28
syntax/neosnippet.vim View File

@@ -1,31 +1,9 @@
1 1
 "=============================================================================
2 2
 " FILE: syntaxtax/snippet.vim
3
-" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
4
-" License: MIT license  {{{
5
-"     Permission is hereby granted, free of charge, to any person obtaining
6
-"     a copy of this software and associated documentation files (the
7
-"     "Software"), to deal in the Software without restriction, including
8
-"     without limitation the rights to use, copy, modify, merge, publish,
9
-"     distribute, sublicense, and/or sell copies of the Software, and to
10
-"     permit persons to whom the Software is furnished to do so, subject to
11
-"     the following conditions:
12
-"
13
-"     The above copyright notice and this permission notice shall be included
14
-"     in all copies or substantial portions of the Software.
15
-"
16
-"     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
-"     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
-"     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
-"     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
-"     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
-"     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
-"     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
-" }}}
3
+" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
4
+" License: MIT license
24 5
 "=============================================================================
25 6
 
26
-let s:save_cpo = &cpo
27
-set cpo&vim
28
-
29 7
 if version < 700
30 8
   syntax clear
31 9
 elseif exists("b:current_syntax")
@@ -109,7 +87,4 @@ highlight def link neosnippetOption PreProc
109 87
 highlight def link neosnippetAlias Identifier
110 88
 highlight def link neosnippetEscape Special
111 89
 
112
-let b:current_syntax = "snippet"
113
-
114
-let &cpo = s:save_cpo
115
-unlet s:save_cpo
90
+let b:current_syntax = 'snippet'