-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 48c59c9
Showing
2 changed files
with
79 additions
and
0 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,39 @@ | ||
# Kibit-vim | ||
|
||
[kibit](https://github.com/jonase/kibit) is a static code analyzer for Clojure, ClojureScript, cljx and other Clojure variants. | ||
|
||
## Usage | ||
|
||
vim-kibit allows you to analyze the current opened file by running: | ||
|
||
`:KibitCheck` | ||
|
||
|
||
## Installation | ||
|
||
### Requirements | ||
|
||
You'll want to have [kibit](https://github.com/jonase/kibit) and [vim-fireplace](https://github.com/tpope/vim-fireplace/) installed, and you'll need to make sure Kibit is somewhere on your project's classpath. I'd recommend adding the following to your `~/.lein/profiles.clj`: | ||
|
||
```clojure | ||
{:dependencies [[jonase/kibit "0.1.5" :exclusions [org.clojure/clojure]]]} | ||
``` | ||
|
||
You'll also need to have a REPL connection open through fireplace. | ||
|
||
After that, the rest should take care of itself. | ||
|
||
### Installing with Pathogen | ||
|
||
Assuming you already have [Pathogen](https://github.com/tpope/vim-pathogen) installed, you should be good to go with the following: | ||
|
||
``` | ||
cd ~/.vim/bundle && \ | ||
git clone https://github.com/humorless/vim-kibit.git | ||
``` | ||
|
||
## License | ||
|
||
Copyright © 2018 Laurence Chen | ||
|
||
Distributed under the Eclipse Public License, the same as Clojure. |
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,40 @@ | ||
let g:kibit_required = 0 | ||
|
||
function! s:RequireKibit() | ||
let l:cmd = "(require 'kibit.check)" | ||
try | ||
silent! call fireplace#session_eval(l:cmd) | ||
return 1 | ||
catch /^Clojure: class java.io.FileNotFoundException*/ | ||
echom "vim-kibit: Could not locate kibit/core__init.class" | ||
return 0 | ||
catch /^Fireplace:.*/ | ||
echom v:exception | ||
return 0 | ||
endtry | ||
endfunction | ||
|
||
function! s:KibitCommand(CurrentFileName) | ||
return '(print (kibit.check/check-file "' . a:CurrentFileName .'"))' | ||
endfunction | ||
|
||
function! s:KibitCheck() | ||
let g:kibit_required = s:RequireKibit() | ||
" If kibit.check has already been required, or was successfully imported | ||
" above | ||
let l:CurrentFileName = expand("%") | ||
if g:kibit_required | ||
try | ||
call fireplace#session_eval(s:KibitCommand(l:CurrentFileName)) | ||
return 1 | ||
catch /^Clojure: */ | ||
echom "kibit check-file failed" | ||
return 0 | ||
catch /^Fireplace:.*/ | ||
echom v:exception | ||
return 0 | ||
endtry | ||
endif | ||
endfunction | ||
|
||
command! KibitCheck call s:KibitCheck() |