forked from wlangstroth/vim-racket
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pr-75-racket-gui
Conflicts: ftplugin/racket.vim lispwords moved to indent/racket.vim. Resolution: add the new word there.
- Loading branch information
Showing
14 changed files
with
519 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
let current_compiler = 'raco' | ||
|
||
if exists(":CompilerSet") != 2 | ||
command -nargs=* CompilerSet setlocal <args> | ||
endif | ||
|
||
CompilerSet makeprg=raco |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
let current_compiler = 'racomake' | ||
|
||
if exists(":CompilerSet") != 2 | ||
command -nargs=* CompilerSet setlocal <args> | ||
endif | ||
|
||
CompilerSet makeprg=raco\ make\ --\ % |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let current_compiler = 'racotest' | ||
|
||
if exists(":CompilerSet") != 2 | ||
command -nargs=* CompilerSet setlocal <args> | ||
endif | ||
|
||
CompilerSet makeprg=raco\ test\ % | ||
CompilerSet errorformat=location:%f:%l:%c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
" Language: jsond | ||
|
||
if exists("b:did_ftplugin") | ||
finish | ||
endif | ||
let b:did_ftplugin = 1 | ||
|
||
" Enable auto begin new comment line when continuing from an old comment line | ||
setl comments=:;;;;,:;;;,:;;,:; | ||
setl formatoptions+=r | ||
|
||
"setl commentstring=;;%s | ||
setl commentstring=#\|\ %s\ \|# | ||
|
||
let b:ale_linter_aliases = ['racket'] | ||
|
||
" Undo our settings when the filetype changes away from jsond | ||
" (this should be amended if settings/mappings are added above!) | ||
let b:undo_ftplugin = | ||
\ "setl comments< formatoptions<" | ||
\. "| setl commentstring<" | ||
\. "| unlet b:ale_linter_aliases" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
" Language: info | ||
|
||
if exists("b:did_ftplugin") | ||
finish | ||
endif | ||
let b:did_ftplugin = 1 | ||
|
||
" quick hack to allow adding values | ||
setlocal iskeyword=@,!,#-',*-:,<-Z,a-z,~,_,94 | ||
|
||
" Enable auto begin new comment line when continuing from an old comment line | ||
setl comments=:;;;;,:;;;,:;;,:; | ||
setl formatoptions+=r | ||
|
||
" Simply setting keywordprg like this works: | ||
" setl keywordprg=raco\ docs | ||
" but then vim says: | ||
" "press ENTER or type a command to continue" | ||
" We avoid the annoyance of having to hit enter by remapping K directly. | ||
function s:RacketDoc(word) abort | ||
execute 'silent !raco docs --' shellescape(a:word) | ||
redraw! | ||
endfunction | ||
nnoremap <buffer> <Plug>RacketDoc :call <SID>RacketDoc(expand('<cword>'))<CR> | ||
if maparg("K", "n") == "" | ||
nmap <buffer> K <Plug>RacketDoc | ||
endif | ||
|
||
" For the visual mode K mapping, it's slightly more convoluted to get the | ||
" selected text: | ||
function! s:Racket_visual_doc() | ||
try | ||
let l:old_a = @a | ||
normal! gv"ay | ||
call system("raco docs '". @a . "'") | ||
redraw! | ||
return @a | ||
finally | ||
let @a = l:old_a | ||
endtry | ||
endfunction | ||
|
||
vnoremap <buffer> <Plug>RacketDoc :call <SID>Racket_visual_doc()<cr> | ||
if maparg("K", "v") == "" | ||
vmap <buffer> K <Plug>RacketDoc | ||
endif | ||
|
||
"setl commentstring=;;%s | ||
setl commentstring=#\|\ %s\ \|# | ||
|
||
let b:ale_linter_aliases = ['racket'] | ||
|
||
" Undo our settings when the filetype changes away from Racket | ||
" (this should be amended if settings/mappings are added above!) | ||
let b:undo_ftplugin = | ||
\ "setl iskeyword< lispwords< lisp< comments< formatoptions<" | ||
\. "| setl commentstring<" | ||
\. "| nunmap <buffer> K" | ||
\. "| vunmap <buffer> K" | ||
\. "| unlet b:ale_linter_aliases" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if exists("b:did_indent") | ||
finish | ||
endif | ||
let b:did_indent = 1 | ||
|
||
setlocal lisp autoindent nosmartindent | ||
setlocal lispwords=define | ||
|
||
let b:undo_indent = "setlocal lisp< ai< si< lw<" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
" Vim syntax file | ||
" Language: #lang jsond | ||
|
||
if exists("b:current_syntax") | ||
finish | ||
endif | ||
|
||
" Hack: the syntax/json.vim file only permits numbers followed by blanks | ||
" followed by some kind of object or array delimiter | ||
" JSON the spec says a JSON is an element is a whitespace-delimited value, which | ||
" can be any of an object, an array, a string, a number, or the keywords | ||
" true/false/null | ||
" Ref: https://www.json.org/json-en.html | ||
syntax match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" | ||
syntax keyword jsonBoolean true false | ||
syntax keyword jsonNull null | ||
|
||
syntax cluster json contains=jsonObject,jsonArray,jsonNumber,jsonStringMatch,jsonBoolean,jsonNull | ||
|
||
syntax region jsonArray matchgroup=jsonBraces start=/\[/ end=/]/ contains=@json fold | ||
syntax region jsonObject matchgroup=jsonBraces start=/{/ end=/}/ contains=jsonKeyMatch fold | ||
|
||
syntax match jsonKeyMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*:/ contains=jsonKey nextgroup=@json skipwhite | ||
syntax region jsonKey start=/"/ end=/"\ze[[:blank:]\r\n]*:/ contained | ||
|
||
syntax match jsonStringMatch /"\([^"]\|\\\"\)\+"/ contains=jsonString | ||
syntax region jsonString oneline start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained | ||
|
||
syntax match jsonEscape ,\\["\\/bfnrt], contained | ||
syntax match jsonEscape /\\u\x\{4\}/ contained | ||
|
||
" syntax iskeyword 33,35-39,42-58,60-90,94,95,97-122,126,_ | ||
" converted from decimal to char | ||
" :s/\d\+/\=submatch(0)->str2nr()->nr2char()/g | ||
" but corrected to remove duplicate _, move ^ to end | ||
" also exclude comma, for JSON | ||
syntax iskeyword @,!,#-',*-:,<-Z,a-z,~,_,^,,^ | ||
" expanded | ||
" syntax iskeyword !,#,$,%,&,',*,+,,,-,.,/,0-9,:,<,=,>,?,@,A-Z,_,a-z,~,^,,^ | ||
|
||
syntax match jsondSyntax "#lang " nextgroup=jsondLang | ||
syntax keyword jsondLang jsond | ||
|
||
syntax keyword jsondName #:name nextgroup=jsondVarName skipwhite skipempty | ||
syntax match jsondVarName ,\<\k\+\>, contained nextgroup=@json skipwhite skipempty | ||
|
||
" Comments | ||
syntax match jsondComment /;.*$/ contains=jsondTodo,jsondNote,@Spell | ||
syntax region jsondMultilineComment start=/#|/ end=/|#/ contains=jsondMultilineComment,jsondTodo,jsondNote,@Spell | ||
|
||
syntax keyword jsondTodo FIXME TODO XXX contained | ||
syntax match jsondNote /\CNOTE\ze:\?/ contained | ||
|
||
highlight default link jsondSyntax Statement | ||
highlight default link jsondName Type | ||
|
||
highlight default link jsondComment Comment | ||
highlight default link jsondMultilineComment Comment | ||
|
||
highlight default link jsondTodo Todo | ||
highlight default link jsondNote SpecialComment | ||
|
||
highlight default link jsonNumber Number | ||
highlight default link jsonBoolean Boolean | ||
highlight default link jsonNull Constant | ||
highlight default link jsonString String | ||
highlight default link jsonEscape Special | ||
highlight default link jsonKey Label | ||
|
||
let b:current_syntax = "jsond" |
Oops, something went wrong.