utils 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +3 -0
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/bin/chroot-libs +1 -1
- data/bin/discover +10 -95
- data/bin/edit +53 -38
- data/bin/search +10 -156
- data/bin/strip_spaces +17 -5
- data/bin/xmp +1 -1
- data/lib/utils.rb +3 -0
- data/lib/utils/config/gdb/ruby +1 -15
- data/lib/utils/config/irbrc +5 -3
- data/lib/utils/config/vim/autoload/Align.vim +6 -6
- data/lib/utils/config/vim/autoload/rails.vim +16 -16
- data/lib/utils/config/vim/autoload/sqlcomplete.vim +48 -48
- data/lib/utils/config/vim/autoload/vimball.vim +7 -7
- data/lib/utils/config/vim/ftplugin/xml.vim +26 -26
- data/lib/utils/config/vim/indent/IndentAnything_html.vim +1 -1
- data/lib/utils/config/vim/indent/javascript.vim +4 -4
- data/lib/utils/config/vim/plugin/Decho.vim +14 -14
- data/lib/utils/config/vim/plugin/IndentAnything.vim +26 -26
- data/lib/utils/config/vim/plugin/bufexplorer.vim +16 -16
- data/lib/utils/config/vim/plugin/cecutil.vim +16 -16
- data/lib/utils/config/vim/plugin/rubyextra.vim +11 -11
- data/lib/utils/config/vim/plugin/taglist.vim +4 -4
- data/lib/utils/config/vim/plugin/test/IndentAnything/test.js +2 -2
- data/lib/utils/config/vim/syntax/javascript.vim +2 -2
- data/lib/utils/config/vim/syntax/ragel.vim +3 -3
- data/lib/utils/config/vimrc +1 -1
- data/lib/utils/editor.rb +138 -0
- data/lib/utils/finder.rb +92 -0
- data/lib/utils/grepper.rb +156 -0
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +15 -15
- metadata +67 -93
- data/lib/utils/edit.rb +0 -33
@@ -122,7 +122,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
|
122
122
|
while linenr <= a:line2
|
123
123
|
let svfile = getline(linenr)
|
124
124
|
" call Decho("svfile<".svfile.">")
|
125
|
-
|
125
|
+
|
126
126
|
if !filereadable(svfile)
|
127
127
|
call vimball#ShowMesg(s:ERROR,"unable to read file<".svfile.">")
|
128
128
|
call s:ChgDir(curdir)
|
@@ -130,7 +130,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
|
130
130
|
" call Dret("MkVimball")
|
131
131
|
return
|
132
132
|
endif
|
133
|
-
|
133
|
+
|
134
134
|
" create/switch to mkvimball tab
|
135
135
|
if !exists("vbtabnr")
|
136
136
|
tabnew
|
@@ -139,7 +139,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
|
|
139
139
|
else
|
140
140
|
exe "tabn ".vbtabnr
|
141
141
|
endif
|
142
|
-
|
142
|
+
|
143
143
|
let lastline= line("$") + 1
|
144
144
|
if lastline == 2 && getline("$") == ""
|
145
145
|
call setline(1,'" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.')
|
@@ -189,7 +189,7 @@ endfun
|
|
189
189
|
|
190
190
|
" ---------------------------------------------------------------------
|
191
191
|
" vimball#Vimball: extract and distribute contents from a vimball {{{2
|
192
|
-
" (invoked the the UseVimball command embedded in
|
192
|
+
" (invoked the the UseVimball command embedded in
|
193
193
|
" vimballs' prologue)
|
194
194
|
fun! vimball#Vimball(really,...)
|
195
195
|
" call Dfunc("vimball#Vimball(really=".a:really.") a:0=".a:0)
|
@@ -242,7 +242,7 @@ fun! vimball#Vimball(really,...)
|
|
242
242
|
" give title to listing of (extracted) files from Vimball Archive
|
243
243
|
if a:really
|
244
244
|
echohl Title | echomsg "Vimball Archive" | echohl None
|
245
|
-
else
|
245
|
+
else
|
246
246
|
echohl Title | echomsg "Vimball Archive Listing" | echohl None
|
247
247
|
echohl Statement | echomsg "files would be placed under: ".home | echohl None
|
248
248
|
endif
|
@@ -421,7 +421,7 @@ fun! vimball#RmVimball(...)
|
|
421
421
|
if filereadable(".VimballRecord")
|
422
422
|
" call Decho(".VimballRecord is readable")
|
423
423
|
" call Decho("curfile<".curfile.">")
|
424
|
-
keepalt keepjumps 1split
|
424
|
+
keepalt keepjumps 1split
|
425
425
|
sil! keepalt keepjumps e .VimballRecord
|
426
426
|
let keepsrch= @/
|
427
427
|
" call Decho('search for ^\M'.curfile.'.\m: ')
|
@@ -606,7 +606,7 @@ fun! s:RecordInFile(home)
|
|
606
606
|
if exists("s:recordfile") || exists("s:recorddir")
|
607
607
|
let curdir= getcwd()
|
608
608
|
call s:ChgDir(a:home)
|
609
|
-
keepalt keepjumps 1split
|
609
|
+
keepalt keepjumps 1split
|
610
610
|
|
611
611
|
let cmd= expand("%:tr").": "
|
612
612
|
" call Decho("cmd<".cmd.">")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
" Vim script file vim600:fdm=marker:
|
2
2
|
" FileType: XML
|
3
|
-
" Author: Devin Weaver <vim (at) tritarget.com>
|
3
|
+
" Author: Devin Weaver <vim (at) tritarget.com>
|
4
4
|
" Maintainer: Devin Weaver <vim (at) tritarget.com>
|
5
5
|
" Last Change: $Date: 2008-10-16 10:01:12 -0400 (Thu, 16 Oct 2008) $
|
6
6
|
" Version: $Revision: 78 $
|
@@ -16,14 +16,14 @@
|
|
16
16
|
" install documentation code and providing good bug fixes.
|
17
17
|
" Guo-Peng Wen for the self install documentation code.
|
18
18
|
" Shawn Boles <ickybots (at) gmail.com> for fixing the
|
19
|
-
" <Leader>x cancelation bug.
|
19
|
+
" <Leader>x cancelation bug.
|
20
20
|
" Martijn van der Kwast <mvdkwast@gmx.net> for patching
|
21
21
|
" problems with multi-languages (XML and PHP).
|
22
22
|
|
23
23
|
" This script provides some convenience when editing XML (and some SGML)
|
24
24
|
" formated documents.
|
25
25
|
|
26
|
-
" Section: Documentation
|
26
|
+
" Section: Documentation
|
27
27
|
" ----------------------
|
28
28
|
"
|
29
29
|
" Documentation should be available by ":help xml-plugin" command, once the
|
@@ -31,11 +31,11 @@
|
|
31
31
|
"
|
32
32
|
" You still can read the documentation at the end of this file. Locate it by
|
33
33
|
" searching the "xml-plugin" string (and set ft=help to have
|
34
|
-
" appropriate syntaxic coloration).
|
34
|
+
" appropriate syntaxic coloration).
|
35
35
|
|
36
36
|
" Note: If you used the 5.x version of this file (xmledit.vim) you'll need to
|
37
37
|
" comment out the section where you called it since it is no longer used in
|
38
|
-
" version 6.x.
|
38
|
+
" version 6.x.
|
39
39
|
|
40
40
|
" TODO: Revamp ParseTag to pull appart a tag a rebuild it properly.
|
41
41
|
" a tag like: < test nowrap testatt=foo >
|
@@ -53,9 +53,9 @@ let b:last_wrap_atts_used = ""
|
|
53
53
|
|
54
54
|
" WrapTag -> Places an XML tag around a visual selection. {{{1
|
55
55
|
" Brad Phelan: Wrap the argument in an XML tag
|
56
|
-
" Added nice GUI support to the dialogs.
|
56
|
+
" Added nice GUI support to the dialogs.
|
57
57
|
" Rewrote function to implement new algorythem that addresses several bugs.
|
58
|
-
if !exists("*s:WrapTag")
|
58
|
+
if !exists("*s:WrapTag")
|
59
59
|
function s:WrapTag(text)
|
60
60
|
if (line(".") < line("'<"))
|
61
61
|
let insert_cmd = "o"
|
@@ -125,7 +125,7 @@ function s:Callback( xml_tag, isHtml )
|
|
125
125
|
let text = HtmlAttribCallback (a:xml_tag)
|
126
126
|
elseif exists ("*XmlAttribCallback")
|
127
127
|
let text = XmlAttribCallback (a:xml_tag)
|
128
|
-
endif
|
128
|
+
endif
|
129
129
|
if text != '0'
|
130
130
|
execute "normal! i " . text ."\<Esc>l"
|
131
131
|
endif
|
@@ -148,7 +148,7 @@ function s:IsParsableTag( tag )
|
|
148
148
|
if strpart (a:tag, strlen (a:tag) - 2, 1) == '/'
|
149
149
|
let parse = 0
|
150
150
|
endif
|
151
|
-
|
151
|
+
|
152
152
|
return parse
|
153
153
|
endfunction
|
154
154
|
endif
|
@@ -257,7 +257,7 @@ function s:BuildTagName( )
|
|
257
257
|
"forwards command will jump to the next tag otherwise
|
258
258
|
|
259
259
|
" Store contents of register x in a variable
|
260
|
-
let b:xreg = @x
|
260
|
+
let b:xreg = @x
|
261
261
|
|
262
262
|
exec "normal! v\"xy"
|
263
263
|
if @x=='>'
|
@@ -289,7 +289,7 @@ function s:BuildTagName( )
|
|
289
289
|
endfunction
|
290
290
|
endif
|
291
291
|
|
292
|
-
" TagMatch1 -> First step in tag matching. {{{1
|
292
|
+
" TagMatch1 -> First step in tag matching. {{{1
|
293
293
|
" Brad Phelan: First step in tag matching.
|
294
294
|
if !exists("*s:TagMatch1")
|
295
295
|
function s:TagMatch1()
|
@@ -306,13 +306,13 @@ function s:TagMatch1()
|
|
306
306
|
if match(b:xreg, '^/')==-1
|
307
307
|
let endtag = 0
|
308
308
|
else
|
309
|
-
let endtag = 1
|
309
|
+
let endtag = 1
|
310
310
|
endif
|
311
311
|
|
312
312
|
" Extract the tag from the whole tag block
|
313
313
|
" eg if the block =
|
314
314
|
" tag attrib1=blah attrib2=blah
|
315
|
-
" we will end up with
|
315
|
+
" we will end up with
|
316
316
|
" tag
|
317
317
|
" with no trailing or leading spaces
|
318
318
|
let b:xreg=substitute(b:xreg,'^/','','g')
|
@@ -320,7 +320,7 @@ function s:TagMatch1()
|
|
320
320
|
" Make sure the tag is valid.
|
321
321
|
" Malformed tags could be <?xml ?>, <![CDATA[]]>, etc.
|
322
322
|
if match(b:xreg,'^[[:alnum:]_:\-]') != -1
|
323
|
-
" Pass the tag to the matching
|
323
|
+
" Pass the tag to the matching
|
324
324
|
" routine
|
325
325
|
call <SID>TagMatch2(b:xreg, endtag)
|
326
326
|
endif
|
@@ -349,7 +349,7 @@ function s:TagMatch2(tag,endtag)
|
|
349
349
|
endif
|
350
350
|
|
351
351
|
if a:endtag==0
|
352
|
-
let stk = 1
|
352
|
+
let stk = 1
|
353
353
|
else
|
354
354
|
let stk = 1
|
355
355
|
end
|
@@ -360,7 +360,7 @@ function s:TagMatch2(tag,endtag)
|
|
360
360
|
let wrapval = &wrapscan
|
361
361
|
let &wrapscan = 1
|
362
362
|
|
363
|
-
"Get the current location of the cursor so we can
|
363
|
+
"Get the current location of the cursor so we can
|
364
364
|
"detect if we wrap on ourselves
|
365
365
|
let lpos = line(".")
|
366
366
|
let cpos = col(".")
|
@@ -375,8 +375,8 @@ function s:TagMatch2(tag,endtag)
|
|
375
375
|
let iter = -1
|
376
376
|
endif
|
377
377
|
|
378
|
-
"Loop until stk == 0.
|
379
|
-
while 1
|
378
|
+
"Loop until stk == 0.
|
379
|
+
while 1
|
380
380
|
" exec search.
|
381
381
|
" Make sure to avoid />$/ as well as /\s$/ and /$/.
|
382
382
|
exec "normal! " . match_type . '<\s*\/*\s*' . a:tag . '\([[:blank:]>]\|$\)' . "\<Cr>"
|
@@ -404,7 +404,7 @@ function s:TagMatch2(tag,endtag)
|
|
404
404
|
|
405
405
|
if match(b:xreg,'^/')==-1
|
406
406
|
" Found start tag
|
407
|
-
let stk = stk + iter
|
407
|
+
let stk = stk + iter
|
408
408
|
else
|
409
409
|
" Found end tag
|
410
410
|
let stk = stk - iter
|
@@ -412,7 +412,7 @@ function s:TagMatch2(tag,endtag)
|
|
412
412
|
|
413
413
|
if stk == 0
|
414
414
|
break
|
415
|
-
endif
|
415
|
+
endif
|
416
416
|
endwhile
|
417
417
|
|
418
418
|
let &wrapscan = wrapval
|
@@ -453,7 +453,7 @@ endif
|
|
453
453
|
" VisualTag -> Selects Tag body in a visual selection. {{{1
|
454
454
|
" Modifies mark z
|
455
455
|
if !exists("*s:VisualTag")
|
456
|
-
function s:VisualTag( )
|
456
|
+
function s:VisualTag( )
|
457
457
|
if strpart (getline ("."), col (".") - 1, 1) == "<"
|
458
458
|
normal! l
|
459
459
|
endif
|
@@ -467,7 +467,7 @@ function s:VisualTag( )
|
|
467
467
|
normal! `z
|
468
468
|
endfunction
|
469
469
|
endif
|
470
|
-
|
470
|
+
|
471
471
|
" InsertGt -> close tags only if the cursor is in a HTML or XML context {{{1
|
472
472
|
" Else continue editing
|
473
473
|
if !exists("*s:InsertGt")
|
@@ -488,7 +488,7 @@ function s:InsertGt( )
|
|
488
488
|
else
|
489
489
|
if col(".") == col("$") - 1
|
490
490
|
startinsert!
|
491
|
-
else
|
491
|
+
else
|
492
492
|
execute "normal! l"
|
493
493
|
startinsert
|
494
494
|
endif
|
@@ -559,7 +559,7 @@ function! s:XmlInstallDocumentation(full_name, revision)
|
|
559
559
|
" Figure out document path based on full name of this script:
|
560
560
|
let l:vim_plugin_path = fnamemodify(a:full_name, ':h')
|
561
561
|
"let l:vim_doc_path = fnamemodify(a:full_name, ':h:h') . l:doc_path
|
562
|
-
let l:vim_doc_path = matchstr(l:vim_plugin_path,
|
562
|
+
let l:vim_doc_path = matchstr(l:vim_plugin_path,
|
563
563
|
\ '.\{-}\ze\%(\%(ft\)\=plugin\|macros\)') . l:doc_path
|
564
564
|
if (!(filewritable(l:vim_doc_path) == 2))
|
565
565
|
echomsg "Doc path: " . l:vim_doc_path
|
@@ -740,7 +740,7 @@ ex. <hr> becomes <hr /> (see |xml-plugin-settings|)
|
|
740
740
|
|
741
741
|
NOTE: If you used the VIM 5.x version of this file (xmledit.vim) you'll need
|
742
742
|
to comment out the section where you called it. It is no longer used in the
|
743
|
-
VIM 6.x version.
|
743
|
+
VIM 6.x version.
|
744
744
|
|
745
745
|
Known Bugs {{{2 ~
|
746
746
|
|
@@ -938,4 +938,4 @@ The following is a sample html.vim file type plugin you could use:
|
|
938
938
|
=== END_DOC
|
939
939
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
940
940
|
" vim: set tabstop=8 shiftwidth=4 softtabstop=4 smartindent
|
941
|
-
" vim600: set foldmethod=marker smarttab fileencoding=iso-8859-15
|
941
|
+
" vim600: set foldmethod=marker smarttab fileencoding=iso-8859-15
|
@@ -1,17 +1,17 @@
|
|
1
1
|
"
|
2
|
-
" Copyright 2006 Tye Zdrojewski
|
2
|
+
" Copyright 2006 Tye Zdrojewski
|
3
3
|
"
|
4
4
|
" Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
5
5
|
" use this file except in compliance with the License. You may obtain a copy of
|
6
6
|
" the License at
|
7
|
-
"
|
7
|
+
"
|
8
8
|
" http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
"
|
9
|
+
"
|
10
10
|
" Unless required by applicable law or agreed to in writing, software distributed
|
11
11
|
" under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
12
12
|
" CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
13
13
|
" specific language governing permissions and limitations under the License.
|
14
|
-
"
|
14
|
+
"
|
15
15
|
"
|
16
16
|
"
|
17
17
|
" Script:
|
@@ -89,7 +89,7 @@ au Filetype Decho nmap <silent> <buffer> <F1> :setlocal noro ma<cr>
|
|
89
89
|
" writes messages to a small window (g:decho_winheight lines)
|
90
90
|
" on the bottom of the screen
|
91
91
|
fun! Decho(...)
|
92
|
-
|
92
|
+
|
93
93
|
" make sure that SaveWinPosn() and RestoreWinPosn() are available
|
94
94
|
if !exists("g:loaded_cecutil")
|
95
95
|
runtime plugin/cecutil.vim
|
@@ -111,7 +111,7 @@ fun! Decho(...)
|
|
111
111
|
let eakeep= &ea
|
112
112
|
set ei=BufEnter,WinEnter,WinLeave,ShellCmdPost,FocusGained noea
|
113
113
|
endif
|
114
|
-
|
114
|
+
|
115
115
|
" As needed, create/switch-to the DBG buffer
|
116
116
|
if !bufexists(g:decho_bufname) && bufnr("*/".g:decho_bufname."$") == -1
|
117
117
|
" if requested DBG-buffer doesn't exist, create a new one
|
@@ -119,13 +119,13 @@ fun! Decho(...)
|
|
119
119
|
exe "keepjumps silent! bot ".g:decho_winheight."new ".fnameescape(g:decho_bufname)
|
120
120
|
setlocal noswf
|
121
121
|
keepjumps silent! %d
|
122
|
-
|
122
|
+
|
123
123
|
elseif bufwinnr(g:decho_bufname) > 0
|
124
124
|
" if requested DBG-buffer exists in a window,
|
125
125
|
" go to that window (by window number)
|
126
126
|
exe "keepjumps ".bufwinnr(g:decho_bufname)."wincmd W"
|
127
127
|
exe "res ".g:decho_winheight
|
128
|
-
|
128
|
+
|
129
129
|
else
|
130
130
|
" user must have closed the DBG-buffer window.
|
131
131
|
" create a new one at the bottom of the screen.
|
@@ -133,10 +133,10 @@ fun! Decho(...)
|
|
133
133
|
setlocal noswf
|
134
134
|
exe "keepjumps b ".bufnr(g:decho_bufname)
|
135
135
|
endif
|
136
|
-
|
136
|
+
|
137
137
|
set ft=Decho
|
138
138
|
setlocal noswapfile noro nobl fo=n2croql
|
139
|
-
|
139
|
+
|
140
140
|
" make sure DBG window is on the bottom
|
141
141
|
wincmd J
|
142
142
|
endif
|
@@ -235,7 +235,7 @@ fun! Decho(...)
|
|
235
235
|
keepjumps $
|
236
236
|
keepjumps let res= append("$",smsg)
|
237
237
|
setlocal nomod
|
238
|
-
|
238
|
+
|
239
239
|
" Put cursor at bottom of DBG window, then return to original window
|
240
240
|
exe "res ".g:decho_winheight
|
241
241
|
keepjumps norm! G
|
@@ -247,7 +247,7 @@ fun! Decho(...)
|
|
247
247
|
if exists("swp")
|
248
248
|
call RestoreWinPosn(swp)
|
249
249
|
endif
|
250
|
-
|
250
|
+
|
251
251
|
if g:decho_bufenter
|
252
252
|
let &ei= eikeep
|
253
253
|
let &ea= eakeep
|
@@ -478,7 +478,7 @@ if has("clientserver") && executable("gvim")
|
|
478
478
|
if g:dechomode == s:DECHOREM
|
479
479
|
let g:dechomode= s:DECHOWIN
|
480
480
|
endif
|
481
|
-
|
481
|
+
|
482
482
|
elseif a:mode == 1
|
483
483
|
" turn remote debugging on
|
484
484
|
if g:dechomode != s:DECHOREM
|
@@ -511,11 +511,11 @@ if has("clientserver") && executable("gvim")
|
|
511
511
|
endtry
|
512
512
|
endwhile
|
513
513
|
endif
|
514
|
-
|
514
|
+
|
515
515
|
else
|
516
516
|
echohl Warning | echomsg "DechoRemote(".a:mode.") not supported" | echohl None
|
517
517
|
endif
|
518
|
-
|
518
|
+
|
519
519
|
endfun
|
520
520
|
endif
|
521
521
|
|
@@ -524,7 +524,7 @@ endif
|
|
524
524
|
" by the user; DechoVarOn [varname]
|
525
525
|
fun! s:DechoVarOn(...)
|
526
526
|
let g:dechomode= s:DECHOVAR
|
527
|
-
|
527
|
+
|
528
528
|
if a:0 > 0
|
529
529
|
let g:dechofile= a:1
|
530
530
|
if a:2 =~ '^g:'
|
@@ -553,7 +553,7 @@ endfun
|
|
553
553
|
if v:version >= 700
|
554
554
|
fun! s:DechoTab(mode,...)
|
555
555
|
" call Dfunc("DechoTab(mode=".a:mode.") a:0=".a:0)
|
556
|
-
|
556
|
+
|
557
557
|
if a:mode
|
558
558
|
let g:dechomode = s:DECHOTAB
|
559
559
|
let g:dechofile = (a:0 > 0)? a:1 : ""
|
@@ -579,7 +579,7 @@ if v:version >= 700
|
|
579
579
|
else
|
580
580
|
let g:dechomode= s:DECHOWIN
|
581
581
|
endif
|
582
|
-
|
582
|
+
|
583
583
|
" call Dret("DechoTab")
|
584
584
|
endfun
|
585
585
|
endif
|
@@ -1,12 +1,12 @@
|
|
1
1
|
"
|
2
|
-
" Copyright 2006 Tye Zdrojewski
|
2
|
+
" Copyright 2006 Tye Zdrojewski
|
3
3
|
"
|
4
4
|
" Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
5
5
|
" use this file except in compliance with the License. You may obtain a copy of
|
6
6
|
" the License at
|
7
|
-
"
|
7
|
+
"
|
8
8
|
" http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
"
|
9
|
+
"
|
10
10
|
" Unless required by applicable law or agreed to in writing, software distributed
|
11
11
|
" under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
12
12
|
" CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
@@ -240,7 +240,7 @@ function! IndentAnything()
|
|
240
240
|
" Find non-blank lines above the current line.
|
241
241
|
let lastlnum = prevnonblank(currlnum - 1)
|
242
242
|
let prevlnum = prevnonblank(lastlnum - 1)
|
243
|
-
if lastlnum != 0
|
243
|
+
if lastlnum != 0
|
244
244
|
let lastline = getline(lastlnum)
|
245
245
|
endif
|
246
246
|
if prevlnum != 0
|
@@ -249,7 +249,7 @@ function! IndentAnything()
|
|
249
249
|
if b:contTraversesLineComments
|
250
250
|
let lastcodelnum = GetPrevNonBlankNonComment(currlnum - 1)
|
251
251
|
let prevcodelnum = GetPrevNonBlankNonComment(lastcodelnum - 1)
|
252
|
-
if lastcodelnum !=0
|
252
|
+
if lastcodelnum !=0
|
253
253
|
let lastcodeline = getline(lastcodelnum)
|
254
254
|
endif
|
255
255
|
endif
|
@@ -281,7 +281,7 @@ function! IndentAnything()
|
|
281
281
|
" If we're not in the middle of a block comment (because we haven't
|
282
282
|
" made any adjustments for that), then process block indentation.
|
283
283
|
for trio in b:indentTrios
|
284
|
-
let b:pairadj += s:GetPairIndent(currline, lastline, lastlnum,
|
284
|
+
let b:pairadj += s:GetPairIndent(currline, lastline, lastlnum,
|
285
285
|
\ trio[0], trio[1], trio[2])
|
286
286
|
endfor
|
287
287
|
endif
|
@@ -392,8 +392,8 @@ function! s:GetPostBlockCommentIndent(LastLNum)
|
|
392
392
|
|
393
393
|
let l:ind = indent(l:comment_start_lnum)
|
394
394
|
|
395
|
-
if 1 || l:ind != 0 && b:indent_anything_echo
|
396
|
-
let g:lastindent = g:lastindent .
|
395
|
+
if 1 || l:ind != 0 && b:indent_anything_echo
|
396
|
+
let g:lastindent = g:lastindent .
|
397
397
|
\ "GetPostBlockCommentIndent: " . l:ind
|
398
398
|
endif
|
399
399
|
|
@@ -460,7 +460,7 @@ function! s:GetPairIndent(CurrLine, LastLine, LastLNum, Head, Mid, Tail)
|
|
460
460
|
" If the line starts with an open, The close shouldn't be counted as
|
461
461
|
" such, because we're looking for closes that didn't start on this
|
462
462
|
" line.
|
463
|
-
if a:LastLine =~ '^\s*' . a:Head ||
|
463
|
+
if a:LastLine =~ '^\s*' . a:Head ||
|
464
464
|
\ (a:Mid != '' && a:LastLine =~ '^\s*' . a:Mid)
|
465
465
|
let levels = 1
|
466
466
|
endif
|
@@ -479,19 +479,19 @@ function! s:GetPairIndent(CurrLine, LastLine, LastLNum, Head, Mid, Tail)
|
|
479
479
|
" *if* there was a match, and not worry about where it is.
|
480
480
|
"
|
481
481
|
"let pairend = searchpair(a:Head, a:Mid, a:Tail, 'W')
|
482
|
-
"if pairend == 0 || a:LastLNum != pairend
|
482
|
+
"if pairend == 0 || a:LastLNum != pairend
|
483
483
|
"let pairend = searchpair(a:Head, a:Mid, a:Tail, 'W', '', a:LastLNum)
|
484
484
|
let pairend = searchpair(a:Head, a:Mid, a:Tail, 'W',
|
485
485
|
\'InCommentOrString()', a:LastLNum)
|
486
|
-
if pairend == 0 "|| a:LastLNum != pairend
|
486
|
+
if pairend == 0 "|| a:LastLNum != pairend
|
487
487
|
|
488
488
|
" STARTS with a:Tail, since we already know the line
|
489
489
|
" matches it.
|
490
490
|
if b:lastclosed.at < col('.') && (
|
491
|
-
\ a:LastLine =~ '^\s*' . a:Tail
|
491
|
+
\ a:LastLine =~ '^\s*' . a:Tail
|
492
492
|
\ || (a:Mid != '' && a:LastLine =~ '^\s*' . a:Mid) )
|
493
|
-
let b:lastclosed = {
|
494
|
-
\ 'at' : col('.'),
|
493
|
+
let b:lastclosed = {
|
494
|
+
\ 'at' : col('.'),
|
495
495
|
\ 'head' : a:Head,
|
496
496
|
\ 'mid' : a:Mid,
|
497
497
|
\ 'tail' : a:Tail }
|
@@ -511,8 +511,8 @@ function! s:GetPairIndent(CurrLine, LastLine, LastLNum, Head, Mid, Tail)
|
|
511
511
|
" Track the last close to try to match pairs that start on
|
512
512
|
" line continuations
|
513
513
|
if b:lastclosed.at < col('.')
|
514
|
-
let b:lastclosed = {
|
515
|
-
\ 'at' : col('.'),
|
514
|
+
let b:lastclosed = {
|
515
|
+
\ 'at' : col('.'),
|
516
516
|
\ 'head' : a:Head,
|
517
517
|
\ 'mid' : a:Mid,
|
518
518
|
\ 'tail' : a:Tail }
|
@@ -525,7 +525,7 @@ function! s:GetPairIndent(CurrLine, LastLine, LastLNum, Head, Mid, Tail)
|
|
525
525
|
" If the current line starts with a close, count it. It won't effect the
|
526
526
|
" indentation of the next line because it is the first thing on the line
|
527
527
|
" and won't be counted as a "close on the last line".
|
528
|
-
if a:CurrLine =~ '^\s*' . a:Tail
|
528
|
+
if a:CurrLine =~ '^\s*' . a:Tail
|
529
529
|
\ || (a:Mid != '' && a:CurrLine =~ '^\s*' . a:Mid)
|
530
530
|
let levels -= 1
|
531
531
|
endif
|
@@ -535,7 +535,7 @@ function! s:GetPairIndent(CurrLine, LastLine, LastLNum, Head, Mid, Tail)
|
|
535
535
|
|
536
536
|
let adj = &sw*levels
|
537
537
|
if adj != 0 && b:indent_anything_echo
|
538
|
-
let g:lastindent = g:lastindent .
|
538
|
+
let g:lastindent = g:lastindent .
|
539
539
|
\ "GetPairIndent(" . a:Head . "/" . b:lastclosed.at . "):" . adj . " "
|
540
540
|
endif
|
541
541
|
|
@@ -571,7 +571,7 @@ function! s:GetContIndent(Rule, CurrLine, LastLine, LastLNum, PrevLNum)
|
|
571
571
|
|
572
572
|
" Should be able to just search to the line....
|
573
573
|
" " Figure out the last and previous continuation status
|
574
|
-
" if lastmatchlnum && lastmatchlnum == a:LastLNum
|
574
|
+
" if lastmatchlnum && lastmatchlnum == a:LastLNum
|
575
575
|
" let lastcont = 1
|
576
576
|
" endif
|
577
577
|
if lastmatchlnum == a:LastLNum
|
@@ -612,7 +612,7 @@ function! s:GetContIndent(Rule, CurrLine, LastLine, LastLNum, PrevLNum)
|
|
612
612
|
endif
|
613
613
|
|
614
614
|
" Should be able to just search to the line....
|
615
|
-
" if ( lastmatchlnum && lastmatchlnum == a:PrevLNum )
|
615
|
+
" if ( lastmatchlnum && lastmatchlnum == a:PrevLNum )
|
616
616
|
" \ || ( prevmatchlnum && prevmatchlnum == l:prevlnum )
|
617
617
|
" let prevcont = 1
|
618
618
|
" endif
|
@@ -626,11 +626,11 @@ function! s:GetContIndent(Rule, CurrLine, LastLine, LastLNum, PrevLNum)
|
|
626
626
|
let prevcont = 1
|
627
627
|
endif
|
628
628
|
|
629
|
-
"echom "lastcont: " . lastcont .
|
630
|
-
" \ ", prevcont: " . prevcont .
|
629
|
+
"echom "lastcont: " . lastcont .
|
630
|
+
" \ ", prevcont: " . prevcont .
|
631
631
|
" \ ", lastmatchlnum: " . lastmatchlnum .
|
632
632
|
" \ ", prevmatchlnum: " . prevmatchlnum .
|
633
|
-
" \ ", lastlnum: " . a:LastLNum .
|
633
|
+
" \ ", lastlnum: " . a:LastLNum .
|
634
634
|
" \ ", PrevLNum: " . a:PrevLNum
|
635
635
|
let firstcont = (lastcont && !prevcont)
|
636
636
|
let firstcont = ((lastcont && !prevcont) || (lastcont && b:pairadj))
|
@@ -645,14 +645,14 @@ function! s:GetContIndent(Rule, CurrLine, LastLine, LastLNum, PrevLNum)
|
|
645
645
|
|
646
646
|
|
647
647
|
"if firstcont && a:CurrLine !~ '^\s*{'
|
648
|
-
if firstcont
|
648
|
+
if firstcont
|
649
649
|
if has_key(a:Rule, 'ignore') && a:CurrLine =~ a:Rule.ignore
|
650
650
|
let g:lastindent .= "(ignoring '" . a:Rule.ignore . "') "
|
651
651
|
else
|
652
652
|
let adj = adj + &sw
|
653
653
|
endif
|
654
654
|
"elseif postcont && a:LastLine !~ '^\s*{' "&& !b:pairadj
|
655
|
-
elseif postcont
|
655
|
+
elseif postcont
|
656
656
|
if has_key(a:Rule, 'ignore') && a:LastLine =~ a:Rule.ignore
|
657
657
|
let g:lastindent .= "(ignoring '" . a:Rule.ignore . "') "
|
658
658
|
else
|
@@ -663,7 +663,7 @@ function! s:GetContIndent(Rule, CurrLine, LastLine, LastLNum, PrevLNum)
|
|
663
663
|
call cursor(origline, origcol)
|
664
664
|
|
665
665
|
if adj != 0 && b:indent_anything_echo
|
666
|
-
let g:lastindent = g:lastindent .
|
666
|
+
let g:lastindent = g:lastindent .
|
667
667
|
\ "GetContIndent('" . a:Rule.pattern . "'):" . adj . " "
|
668
668
|
endif
|
669
669
|
return adj
|