Ⅰ. 插件描述
Clojure completion/unite-source Vim plugin, using vital.ProcessManager and LeiningenⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'ujihisa/neoclojure-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'ujihisa/neoclojure-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'ujihisa/neoclojure-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/ujihisa/neoclojure.vim
Ⅳ. 文档说明
neoclojure
- Code complete (fast and sync)
quickrun (slow and async)
- libraries
- under proj: uses the project
- outside proj: uses dummy "unnamed" project
- ref (fast and sync)
- leiningen? (e.g. lein run)
- executes project.clj
- executes dependencies (including current project)
- parses current buffer
- spawns dummy unnamed project by stardup asynchronously
debugging itself
- logger
- test
- fault tolerance
neoclojure.vim
Java method-name completion works (type
(.in your clojure buffer)- no automatic
importinsertion yet (ns ...)has to be located as the first expression of the file
- no automatic
Requirement
Optional dependency plugins
- If you don't have neocomplete.vim, use omni-complete
<C-x><C-o>to trigger manual completion.
- If you don't have neocomplete.vim, use omni-complete
- NOT YET -- unite.vim
Installation
~/.vimrc
augroup vimrc-neoclojure
autocmd!
" If you use neocomplete
autocmd FileType clojure setlocal omnifunc=neoclojure#complete#omni_auto
" Otherwise
autocmd FileType clojure setlocal omnifunc=neoclojure#complete#omni
augroup ENDIf you have quickrun.vim, include this as well.
let g:quickrun_config.clojure = {
\ 'runner': 'neoclojure', 'command': 'dummy',
\ 'tempfile' : '%{tempname()}.clj'}Development progress / todo
- SECURITY WARNING! This plugin executes your clojure/java code silently.
This problem will be fixed before version 0.1 release.
(Current version is 0.1-dev)
* This plugin evaluates the first expression of the current file.
If the first expression is `ns` with `:require` or `:use`, they will be evaluated, which means neoclojure will evaluate other files.
Rest of expressions won't be evaluated though.Java completions in clojure files are available
- Class names e.g.
java.lang.String - Instance Methods e.g.
(.getLocation player) - Static Methods e.g.
(String/format) - Static Enum Constants
Thread$STATE/BLOCKED - ... They are based on
(ns (:import ...))
- Class names e.g.
Clojure completions (WIP)
First time completion may take very long time (like 4sec)
- it'll be done asynchronously in the future.
Philosophy
What neoclojure doesn't do:
neoclojure doesn't implement everything here.
- It depends on embedded libraries.
- It uses other plugins only if you already have.
- It doesn't parse Clojure in Vim script. Let Clojure does that work; it knows more about itself.
neoclojure doesn't spawn Clojure daemon.
- It just spawns Clojure process and communicate with stdout/stderr instead of socket.
- When Vim dies, Clojure process also dies. That's what it should be.
FAQ
Q. neoclojure hangs for some reason!
- A. is leiningen working? It doesn't work when clojars.org is down.
Links
Licence
GPL version 3 or any later version
Copyright (c) Tatsuhiro Ujihisa