Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8cebbbb

Browse files
committed
initial changes
1 parentb2faef1 commit8cebbbb

File tree

3 files changed

+161
-191
lines changed

3 files changed

+161
-191
lines changed

‎ftdetect/moon.vim‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
" Language: CoffeeScript
2-
" Maintainer: Mick Koch <kchmck@gmail.com>
3-
" URL: http://github.com/kchmck/vim-coffee-script
1+
" Language: MoonScript
2+
" Maintainer: leafo <leafot@gmail.com>
3+
" Based On: CoffeeScript by Mick Koch <kchmck@gmail.com>
4+
" URL: http://github.com/leafo/moonscript-vim
45
" License: WTFPL
56

6-
autocmdBufNewFile,BufRead*.coffeesetfiletype=coffee
7-
autocmdBufNewFile,BufRead*Cakefilesetfiletype=coffee
7+
autocmdBufNewFile,BufRead*.moonsetfiletype=moon

‎indent/moon.vim‎

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
" Language: CoffeeScript
2-
" Maintainer: Mick Koch <kchmck@gmail.com>
3-
" URL: http://github.com/kchmck/vim-coffee-script
1+
" Language: MoonScript
2+
" Maintainer: leafo <leafot@gmail.com>
3+
" Based On: CoffeeScript by Mick Koch <kchmck@gmail.com>
4+
" URL: http://github.com/leafo/moonscript-vim
45
" License: WTFPL
56

67
ifexists("b:did_indent")
@@ -10,19 +11,18 @@ endif
1011
letb:did_indent=1
1112

1213
setlocalautoindent
13-
setlocalindentexpr=GetCoffeeIndent(v:lnum)
14-
" Make sureGetCoffeeIndent is run when these are typed so they can be
14+
setlocalindentexpr=GetMoonIndent(v:lnum)
15+
" Make sureGetMoonIndent is run when these are typed so they can be
1516
" indented or outdented.
16-
setlocalindentkeys+=0],0),0.,=else,=when,=catch,=finally
17+
setlocalindentkeys+=0],0),0.,=else,=elseif
1718

1819
" Only define the function once.
19-
ifexists("*GetCoffeeIndent")
20+
ifexists("*GetMoonIndent")
2021
finish
2122
endif
2223

2324
" Keywords to indent after
24-
lets:INDENT_AFTER_KEYWORD='^\%(if\|unless\|else\|for\|while\|until\|'
25-
\ .'loop\|switch\|when\|try\|catch\|finally\|'
25+
lets:INDENT_AFTER_KEYWORD='^\%(if\|else\|for\|while\|with\|elseif\|'
2626
\ .'class\)\>'
2727

2828
" Operators to indent after
@@ -41,27 +41,27 @@ let s:CONTINUATION_BLOCK = '[([{:=]$'
4141
lets:DOT_ACCESS='^\.'
4242

4343
" Keywords to outdent after
44-
lets:OUTDENT_AFTER='^\%(return\|break\|continue\|throw\)\>'
44+
lets:OUTDENT_AFTER='^\%(return\|break\)\>'
4545

4646
" A compound assignment like `... = if ...`
47-
lets:COMPOUND_ASSIGNMENT='[:=]\s*\%(if\|unless\|for\|while\|until\|'
48-
\ .'switch\|try\|class\)\>'
47+
lets:COMPOUND_ASSIGNMENT='[:=]\s*\%(if\|for\|while\|'
48+
\ .'with\|class\)\>'
4949

5050
" A postfix condition like `return ... if ...`.
51-
lets:POSTFIX_CONDITION='\S\s\+\zs\<\%(if\|unless\)\>'
51+
lets:POSTFIX_CONDITION='\S\s\+\zs\<\%(if\)\>'
5252

5353
" A single-line else statement like `else ...` but not `else if ...
54-
lets:SINGLE_LINE_ELSE='^else\s\+\%(\<\%(if\|unless\)\>\)\@!'
54+
lets:SINGLE_LINE_ELSE='^else\s\+\%(\<\%(if\)\>\)\@!'
5555

5656
" Max lines to look back for a match
5757
lets:MAX_LOOKBACK=50
5858

5959
" Syntax names for strings
60-
lets:SYNTAX_STRING='coffee\%(String\|AssignString\|Embed\|Regex\|Heregex\|'
60+
lets:SYNTAX_STRING='moon\%(String\|AssignString\|Embed\|Regex\|Heregex\|'
6161
\ .'Heredoc\)'
6262

6363
" Syntax names for comments
64-
lets:SYNTAX_COMMENT='coffee\%(Comment\|BlockComment\|HeregexComment\)'
64+
lets:SYNTAX_COMMENT='moon\%(Comment\|BlockComment\|HeregexComment\)'
6565

6666
" Syntax names for strings and comments
6767
lets:SYNTAX_STRING_COMMENT=s:SYNTAX_STRING .'\|' .s:SYNTAX_COMMENT
@@ -173,10 +173,10 @@ function! s:GetMatch(curline)
173173
returns:SearchPair('\[','\]')
174174
elseifa:curline=~'^else\>'
175175
returns:SearchPair('\<\%(if\|unless\|when\)\>','\<else\>')
176-
elseifa:curline=~'^catch\>'
177-
returns:SearchPair('\<try\>','\<catch\>')
178-
elseifa:curline=~'^finally\>'
179-
returns:SearchPair('\<try\>','\<finally\>')
176+
" elseif a:curline =~ '^catch\>'
177+
" return s:SearchPair('\<try\>', '\<catch\>')
178+
" elseif a:curline =~ '^finally\>'
179+
" return s:SearchPair('\<try\>', '\<finally\>')
180180
endif
181181

182182
return0
@@ -232,7 +232,7 @@ function! s:GetTrimmedLine(linenum)
232232
\'\s\+$','','')
233233
endfunction
234234

235-
function!s:GetCoffeeIndent(curlinenum)
235+
function!s:GetMoonIndent(curlinenum)
236236
let prevlinenum=s:GetPrevNormalLine(a:curlinenum)
237237

238238
" Don't do anything if there's no previous line.
@@ -249,20 +249,20 @@ function! s:GetCoffeeIndent(curlinenum)
249249
returnindent(matchlinenum)
250250
endif
251251

252-
" Try to find a matching `when`.
253-
if curline=~'^when\>'&&!s:SmartSearch(prevlinenum,'\<switch\>')
254-
let linenum=a:curlinenum
255-
256-
while linenum >0
257-
let linenum=s:GetPrevNormalLine(linenum)
258-
259-
ifgetline(linenum)=~'^\s*when\>'
260-
returnindent(linenum)
261-
endif
262-
endwhile
263-
264-
return-1
265-
endif
252+
" " Try to find a matching `when`.
253+
" if curline =~ '^when\>' && !s:SmartSearch(prevlinenum, '\<switch\>')
254+
" let linenum = a:curlinenum
255+
"
256+
" while linenum > 0
257+
" let linenum = s:GetPrevNormalLine(linenum)
258+
"
259+
" if getline(linenum) =~ '^\s*when\>'
260+
" return indent(linenum)
261+
" endif
262+
" endwhile
263+
"
264+
" return -1
265+
" endif
266266

267267
let prevline=s:GetTrimmedLine(prevlinenum)
268268
let previndent=indent(prevlinenum)
@@ -312,10 +312,10 @@ function! s:GetCoffeeIndent(curlinenum)
312312
return-1
313313
endfunction
314314

315-
" Wrap s:GetCoffeeIndent to keep the cursor position.
316-
function!GetCoffeeIndent(curlinenum)
315+
" Wrap s:GetMoonIndent to keep the cursor position.
316+
function!GetMoonIndent(curlinenum)
317317
let oldcursor=getpos('.')
318-
letindent=s:GetCoffeeIndent(a:curlinenum)
318+
letindent=s:GetMoonIndent(a:curlinenum)
319319
callsetpos('.', oldcursor)
320320

321321
returnindent

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp