├── README.md ├── autoload └── pathogen.vim ├── bundle ├── paredit-0.9.7 │ ├── doc │ │ └── paredit.txt │ └── plugin │ │ └── paredit.vim └── vimclojure-2.3.6 │ ├── LICENSE.txt │ ├── README.markdown │ ├── autoload │ ├── vimclojure.vim │ └── vimclojure │ │ └── util.vim │ ├── bin │ ├── clj │ ├── clj.bat │ ├── ng-server │ └── ng-server.bat │ ├── doc │ └── clojure.txt │ ├── ftdetect │ └── clojure.vim │ ├── ftplugin │ ├── clojure.vim │ └── clojure │ │ ├── completions-clojure.core.txt │ │ ├── completions-clojure.data.txt │ │ ├── completions-clojure.inspector.txt │ │ ├── completions-clojure.java.browse.txt │ │ ├── completions-clojure.java.io.txt │ │ ├── completions-clojure.java.javadoc.txt │ │ ├── completions-clojure.java.shell.txt │ │ ├── completions-clojure.main.txt │ │ ├── completions-clojure.pprint.txt │ │ ├── completions-clojure.repl.txt │ │ ├── completions-clojure.set.txt │ │ ├── completions-clojure.stacktrace.txt │ │ ├── completions-clojure.string.txt │ │ ├── completions-clojure.template.txt │ │ ├── completions-clojure.test.junit.txt │ │ ├── completions-clojure.test.tap.txt │ │ ├── completions-clojure.test.txt │ │ ├── completions-clojure.walk.txt │ │ ├── completions-clojure.xml.txt │ │ └── completions-clojure.zip.txt │ ├── indent │ └── clojure.vim │ ├── plugin │ └── clojure.vim │ └── syntax │ └── clojure.vim ├── lib ├── .gitignore ├── server-2.3.0.jar └── vimclojure-nailgun-client │ ├── Makefile │ ├── ng.exe │ └── ngclient │ └── ng.c ├── piglatin.clj └── vimrc.vim /README.md: -------------------------------------------------------------------------------- 1 | *NOTE!!: The future of Clojuring with Vim is tpope's [fireplace.vim](https://github.com/tpope/vim-fireplace). It's easier to set up than VimClojure making a project like this unnecessary. You can find a tutorial [here](http://clojure-doc.org/articles/tutorials/vim_fireplace.html)* 2 | 3 | # VimClojure - Easy Peasy Lemon Squeezy 4 | *Note: Did you read the note above?* 5 | 6 | This is a sample configuration for [VimClojure](http://www.vim.org/scripts/script.php?script_id=2501) to hopefully make the process of getting and using VimClojure more straightforward. It is basically a complete vim configuration with VimClojure and nothing else installed. It should be a good sanity check for setting everything up. 7 | 8 | ## Install 9 | If you have an existing vim configuration, first move it out of the way. You can bring it back in after you feel like VimClojure's working for you. 10 | 11 | $ cd 12 | $ mv .vim .vim.bak 13 | $ mv .vimrc .vimrc.bak 14 | $ mv .gvimrc .gvimrc.bak 15 | 16 | Now clone this repo into ~/.vim and set it up: 17 | 18 | $ cd 19 | $ git clone https://github.com/daveray/vimclojure-easy.git .vim 20 | $ ln -s .vim/vimrc.vim .vimrc 21 | $ make -C .vim/lib/vimclojure-nailgun-client 22 | Building ng client. To build a Windows binary, type 'make ng.exe' 23 | gcc -Wall -pedantic -s -O3 -o ng ngclient/ng.c 24 | ld: warning: option -s is obsolete and being ignored 25 | 26 | *Windows users see Windows Notes section below* 27 | 28 | ## First Test - Syntax Highlight and Stuff 29 | 30 | Now open a Clojure file just to see if the plugin's basically working. Conveniently, there's one in this repo: 31 | 32 | $ cd 33 | $ vim .vim/piglatin.clj 34 | 35 | You should see the syntax highlighted source code as well as an error window telling you that VimClojure couldn't find the nailgun server. That's our next step. 36 | 37 | If syntax highlighting doesn't work, make sure `.vim` is in your home directory and `~/.vimrc` is a symlink to `~/.vim/vimrc.vim`. 38 | 39 | ## Starting the Nailgun Server 40 | 41 | Now we want to get to the serious stuff. We'll need to start a nailgun server to get the most use out of VimClojure. There are (at least) two options. 42 | 43 | The best option is Daniel Solano Gómez's [lein-tarsier plugin] (https://github.com/sattvik/lein-tarsier). First you'll need to install the plugin: 44 | 45 | For Leiningen 1.x: 46 | 47 | $ lein plugin install lein-tarsier 0.9.1 48 | 49 | For Leiningen 2.x add this to the plugins vector of your `:user` profile located in `~/.lein/profiles.clj`: 50 | 51 | {:user {:plugins [[lein-tarsier "0.10.0"]]]}} 52 | 53 | Now you can create a new project and run the plugin: 54 | 55 | $ lein new nailgun-test 56 | $ cd nailgun-test 57 | $ lein vimclojure 58 | Copying 2 files to /Users/dave/Documents/tmp/nailgun-test/lib 59 | Starting VimClojure server on 127.0.0.1, port 2113 60 | Happy hacking! 61 | 62 | Alternatively, if you hate yourself, run the server manually with the jar in this install: 63 | 64 | $ cd .vim/lib 65 | $ java -cp server-2.3.0.jar:/path/to/clojure-x.y.z.jar vimclojure.nailgun.NGServer 66 | NGServer started on all interfaces, port 2113. 67 | 68 | Note that in this case you have to provide the *absolute* path to a Clojure jar. 69 | 70 | ## Second Test - The REPL 71 | 72 | Now that our nailgun server is running, start up vim again and run the `:ClojureRepl` command. The vim screen will split and you'll see a new Clojure REPL. Try it out. Tricks worth knowing: 73 | 74 | * `,close` to exit, or just `:q` 75 | * If you're cursor's in the middle of a command, hit `ctrl-enter` to execute the command without having to jump to the end of the line first 76 | * `,st` gives the last stack trace 77 | 78 | See vimclojure.txt for more info. 79 | 80 | ## Third Test - Code 81 | 82 | Now try editing a file with the nailgun server running: 83 | 84 | $ cd 85 | $ vim .vim/piglatin.clj 86 | 87 | Hit `\ef` to evaluate the file. VimClojure will open a split window to show the result: 88 | 89 | ; Use \p to close this buffer! 90 | #'user/vowel? 91 | #'user/pig-latin 92 | "ellohay" 93 | "imclojurevay" 94 | 95 | Put your cursor on the `(set` on line 2 and hit `\lw`. VimClojure with show the docs for `set`. 96 | 97 | # What's Next? 98 | 99 | * Go read the vimclojure documentation! (You may find it here: `bundle/vimclojure-x.x.x/doc/clojure.txt`). 100 | * If you've already got vim configuration, you should be able to basically copy this directory structure over yours. Then move the Pathogen and VimClojure settings from `vimrc.vim` to your `vimrc` file. 101 | * A more elaborate setup is described [here](http://blog.darevay.com/2010/10/how-i-tamed-vimclojure/) 102 | * Enable paredit. 103 | 104 | # Paredit 105 | 106 | Paredit performs structured editing of Clojure S-expressions. To enable, edit `vimrc.vim` and set the following: 107 | 108 | let g:paredit_mode = 1 109 | 110 | The paredit documentation is here: `bundle/paredit-x.x.x/doc/paredit.txt`. 111 | 112 | # ClojureScript 113 | VimClojure doesn't have any particular support for ClojureScript, but you can at least enable syntax highlighting and stuff in `.cljs` files by adding this to your `vimrc` file: 114 | 115 | autocmd BufRead,BufNewFile *.cljs setlocal filetype=clojure 116 | 117 | # Resources 118 | 119 | * The [VimClojure google group](https://groups.google.com/group/vimclojure) 120 | * Official [VimClojure source repository](https://groups.google.com/group/vimclojure) 121 | 122 | # Windows Notes 123 | 124 | Note if you're on Windows users: 125 | 126 | * Replace `.vim` with `vimfiles`. The location of "HOME" may vary for you. 127 | * Replace symlink `.vimrc` with `_vimrc` with contents `runtime vimrc.vim`. Or just move `vimrc.vim` to `_vimrc`. 128 | * You might need to adjust the NailgunClient setting in vimrc.vim 129 | 130 | -------------------------------------------------------------------------------- /autoload/pathogen.vim: -------------------------------------------------------------------------------- 1 | " pathogen.vim - path option manipulation 2 | " Maintainer: Tim Pope 3 | " Version: 2.0 4 | 5 | " Install in ~/.vim/autoload (or ~\vimfiles\autoload). 6 | " 7 | " For management of individually installed plugins in ~/.vim/bundle (or 8 | " ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc 9 | " prior to `fileype plugin indent on` is the only other setup necessary. 10 | " 11 | " The API is documented inline below. For maximum ease of reading, 12 | " :set foldmethod=marker 13 | 14 | if exists("g:loaded_pathogen") || &cp 15 | finish 16 | endif 17 | let g:loaded_pathogen = 1 18 | 19 | " Point of entry for basic default usage. Give a directory name to invoke 20 | " pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path 21 | " to invoke pathogen#runtime_prepend_subdirectories(). Afterwards, 22 | " pathogen#cycle_filetype() is invoked. 23 | function! pathogen#infect(...) abort " {{{1 24 | let source_path = a:0 ? a:1 : 'bundle' 25 | if source_path =~# '[\\/]' 26 | call pathogen#runtime_prepend_subdirectories(source_path) 27 | else 28 | call pathogen#runtime_append_all_bundles(source_path) 29 | endif 30 | call pathogen#cycle_filetype() 31 | endfunction " }}}1 32 | 33 | " Split a path into a list. 34 | function! pathogen#split(path) abort " {{{1 35 | if type(a:path) == type([]) | return a:path | endif 36 | let split = split(a:path,'\\\@,'edit',) 222 | command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',) 223 | command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',) 224 | command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',) 225 | command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',) 226 | command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',) 227 | command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',) 228 | command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,'lcd') 229 | 230 | " vim:set ft=vim ts=8 sw=2 sts=2: 231 | -------------------------------------------------------------------------------- /bundle/paredit-0.9.7/doc/paredit.txt: -------------------------------------------------------------------------------- 1 | *paredit.txt* Paredit Last Change: 22 May 2012 2 | 3 | Paredit Mode for Vim *paredit* *slimv-paredit* 4 | Version 0.9.7 5 | 6 | The paredit.vim plugin performs structured editing of s-expressions used in 7 | the Lisp, Clojure, Scheme programming languages. It may come as part of Slimv 8 | but it is also distributed separately as a standalone plugin. 9 | 10 | |paredit-mode| Paredit mode 11 | |paredit-keys| Paredit keybindings 12 | |paredit-options| Paredit options 13 | 14 | =============================================================================== 15 | PAREDIT MODE *paredit-mode* 16 | 17 | Paredit mode is a special editing mode that keeps all matched characters 18 | (parentheses, square and curly braces, double quotes) balanced, i.e. all opening 19 | characters have a matching closing character. Most text entering and erasing 20 | commands try to maintain the balanced state, so no single matched character is 21 | added or deleted, they are entered or removed in pairs. 22 | The function takes care of strings and comments, so no parenthesis and square 23 | bracket balancing is performed inside a string or comment. 24 | Please note that [] and {} pairs are not balanced for Lisp filetypes, only 25 | for Clojure. 26 | 27 | The idea is taken from the paredit mode of Emacs, but not all paredit.el 28 | editing functions are implemented or behave exactly the same way as they do 29 | in Emacs. 30 | 31 | When you enter a '(' then a matching ')' is automatically inserted. 32 | If needed, spaces before and/or after the '()' pair are added. 33 | 34 | When you press ')' in insert mode then there's no need to insert a closing 35 | parenthesis mark (it is already there), so the cursor is simply advanced past 36 | the next closing parenthesis (then the next outer closing parenthesis, etc.). 37 | The result of this is however that when entering text with paredit mode 38 | you can use the same keystrokes as without paredit mode and you get the same 39 | result. Of course you can choose to not enter the closing parenthesis (as 40 | required without paredit mode), because it is already there. 41 | 42 | When you are trying to delete a ')' alone then it is not possible, the cursor 43 | is simply moved inside the list, where all regular characters can be deleted. 44 | When the list is finally empty: '()', then the deletion of the opening '(' 45 | makes both parentheses erased at once, so the balanced state is maintained. 46 | 47 | All the above holds for [...] and "..." character pairs. 48 | 49 | When you are deleting multiple characters at once, e.g. deleting a whole line, 50 | or deleting till the end of the line, etc, then the deletion logic of a single 51 | character is iterated. This means that the whole line or the characters till 52 | the end of the line, etc are not necessarily deleted all. Depending on the 53 | number of open/close parentheses, square or curly braces, double quotes some 54 | of them might be kept in order to maintain the balanced state. 55 | For example if you press D in Normal mode to delete till the end of line 56 | between the a and b parameters of the following Clojure function definition: 57 | 58 | (defn myfunc [a b c] (+ a b c)) 59 | ^--- press D here 60 | 61 | then the closing ] as well as the last closing ) will not be deleted, because 62 | in the list you have an ( and a [ to be matched, so the result will be: 63 | 64 | (defn myfunc [a]) 65 | 66 | If you are deleting multiple lines, then the above process is performed for 67 | all lines involved. If a line was not completely cleared, then it is joined 68 | with the next line and the process continues. 69 | 70 | 71 | Of course not all Vim commands are compatible with the paredit mode (e.g. 72 | you can yank and paste unbalanced code snippet, or comment out an asymmetrical 73 | part of the code), and there is also the possibility to edit the source code 74 | with paredit mode switched off or with another editor to make it unbalanced. 75 | When paredit mode detects that the underlying code is not balanced, then the 76 | paredit functionality is suspended until the top level form balance is fixed. 77 | As soon as all parens are matched, the paredit mode is automatically resumed. 78 | Paredit needs "syntax on" to identify the syntax elements of the underlying 79 | code, so if syntax is switched off, then paredit will not be suspended inside 80 | comments or strings. 81 | 82 | 83 | Slurpage and Barfage known from Emacs is also possible but in a different 84 | fashion: you don't move the symbols but move the opening or closing parenthesis 85 | over the symbol or a sub-list. This way you can move any symbol or sub-list 86 | into or out of the current list. It is not possible to move the parenthesis 87 | over its pair, so for example if you move the opening parenthesis to the right, 88 | then it will stop at the matched closing parenthesis. 89 | 90 | 91 | Paredit mode is set by default for .lisp, .cl, .clj, cljs, .scm and .rkt files, 92 | but it is possible to switch it off by putting the following statement in the 93 | .vimrc file: 94 | 95 | let g:paredit_mode = 0 96 | 97 | You can enable paredit mode for other file types as well. Here is how to set 98 | it for Arc files (meant to be added to your .vimrc file): 99 | 100 | au BufNewFile,BufRead *.arc call PareditInitBuffer() 101 | 102 | Paredit is part of Slimv, but it is also distributed separately as a standalone 103 | plugin. If you indend to use the SWANK client and/or Slimv's indentation and 104 | syntax functions, then please install the Slimv plugin. Otherwise you may want 105 | to install the Paredit plugin thus omitting other unnecessary files. 106 | 107 | 108 | =============================================================================== 109 | PAREDIT KEYBINDINGS *paredit-keys* 110 | 111 | Here follows a list of paredit keybindings: 112 | 113 | 114 | Insert Mode: 115 | 116 | ( Inserts '()' and moves the cursor inside. Also adds leading 117 | or trailing spaces when needed. 118 | Inserts '(' when inside comment or string. 119 | 120 | ) Moves the cursor to the next closing parenthesis mark of 121 | the current list. When pressed again then moves to the next 122 | outer closing parenthesis, etc, until the closing of the 123 | top level form is reached. 124 | Inserts ')' when inside comment or string. 125 | If |g:paredit_electric_return| is on then it also re-gathers 126 | electric returns when appropriate. 127 | 128 | [ Inserts '[]' and moves the cursor inside. Also adds leading 129 | or trailing spaces when needed. 130 | Inserts '[' when inside comment or string. 131 | 132 | ] Moves the cursor to the next closing square bracket of the 133 | current list. When pressed again then moves to the next 134 | outer closing square bracket, etc, until the closing of the 135 | top level form is reached. 136 | Inserts ']' when inside comment or string. 137 | If |g:paredit_electric_return| is on then it also re-gathers 138 | electric returns when appropriate. 139 | 140 | { Inserts '{}' and moves the cursor inside. Also adds leading 141 | or trailing spaces when needed. 142 | Inserts '{' when inside comment or string. 143 | 144 | } Moves the cursor to the next closing curly brace of the 145 | current list. When pressed again then moves to the next 146 | outer closing curly brace, etc, until the closing of the 147 | top level form is reached. 148 | Inserts '}' when inside comment or string. 149 | If |g:paredit_electric_return| is on then it also re-gathers 150 | electric returns when appropriate. 151 | 152 | " When outside of string, inserts '""' and moves the cursor 153 | inside. When inside string then moves to the closing '"'. 154 | Inserts '"' when inside comment. Also insert '"' when inside 155 | string and preceded by a '\'. 156 | 157 | When about to delete a (, ), [, ], or " and there are other 158 | characters inside, then just skip it to the left. When 159 | about to delete the opening part of the matched character 160 | with nothing inside, then the whole empty list is removed. 161 | 162 | When about to delete a (, ), [, ], or " and there are other 163 | characters inside, then just skip it to the right. When 164 | about to delete the closing part of the matched character 165 | with nothing inside, then the whole empty list is removed. 166 | 167 | If |g:paredit_electric_return| is on then insert an 168 | "electric return", i.e. create an empty line by inserting 169 | two newline characters. 170 | 171 | 172 | Normal Mode: 173 | 174 | ( Finds opening '(' of the current list. Can be pressed 175 | repeatedly until the opening of the top level form reached. 176 | 177 | ) Finds closing ')' of the current list. Can be pressed 178 | repeatedly until the closing of the top level form reached. 179 | 180 | [[ Go to the start of current/previous defun. 181 | 182 | ]] Go to the start of next defun. 183 | 184 | < If standing on a delimiter (parenthesis or square bracket) 185 | then moves it to the left by slurping or barfing the 186 | s-expression to the left, depending on the direction of the 187 | delimiter: 188 | Pressing '<' when standing on a ')' makes the s-expression 189 | to the left of the ')' going out of the current list. 190 | Pressing '<' when standing on a '(' makes the s-expression 191 | to the left of the '(' coming into the current list. 192 | For example pressing < at position marked with |: 193 | (aaa bbb|) ---> (aaa|) bbb 194 | aaa |(bbb) ---> |(aaa bbb) 195 | 196 | > If standing on a delimiter (parenthesis or square bracket) 197 | then moves it to the right by slurping or barfing the 198 | s-expression to the right, depending on the direction of the 199 | delimiter: 200 | Pressing '>' when standing on a '(' makes the s-expression 201 | to the right of the '(' going out of the current list. 202 | Pressing '>' when standing on a ')' makes the s-expression 203 | to the right of the ')' coming into the current list. 204 | For example pressing < at position marked with |: 205 | (aaa|) bbb ---> (aaa bbb|) 206 | |(aaa bbb) ---> aaa |(bbb) 207 | 208 | J Join two subsequent lists or strings. The first one must end 209 | before the cursor, the second one must start after the 210 | cursor position. 211 | For example pressing J at position marked with |: 212 | (aaa)| (bbb) ---> (aaa |bbb) 213 | "aaa"| "bbb" ---> "aaa |bbb" 214 | 215 | O Split ("Open") current list or string at the cursor position. 216 | Opposite of Join. Key O is selected because for the original 217 | Vim mapping J and O are also kind of opposites. 218 | For example pressing O at position marked with |: 219 | (aaa |bbb) ---> (aaa) |(bbb) 220 | "aaa|bbb" ---> "aaa" |"bbb" 221 | 222 | W Wrap the current symbol in a pair of parentheses. The cursor 223 | w( is then positioned on the opening parenthesis, as wrapping 224 | is usually done because one wants to call a function with 225 | the symbol as parameter, so by pressing "a" one can enter 226 | the function name right after the newly inserted "(". 227 | For example pressing W at position marked with |: 228 | (aaa b|bb ccc) ---> (aaa |(bbb) ccc) 229 | 230 | w[ Wrap the current symbol in a pair of square brackets, 231 | similarly to W. 232 | For example pressing w[ at position marked with |: 233 | (aaa b|bb ccc) ---> (aaa |[bbb] ccc) 234 | 235 | w{ Wrap the current symbol in a pair of curly braces, 236 | similarly to W. 237 | For example pressing w{ at position marked with |: 238 | (aaa b|bb ccc) ---> (aaa |{bbb} ccc) 239 | 240 | w" Wrap the current symbol in a pair of double quotes, 241 | similarly to W. 242 | For example pressing w" at position marked with |: 243 | (aaa b|bb ccc) ---> (aaa "bbb|" ccc) 244 | 245 | S Splice the current list into the containing list, i.e. 246 | remove the opening and closing parens. Opposite of wrap. 247 | For example pressing S at position marked with |: 248 | (aaa (b|bb ccc) ddd) ---> (aaa |bbb ccc ddd) 249 | 250 | Splice the current list into the containing list by deleting 251 | everything backward from the cursor position up to the 252 | opening paren. 253 | For example pressing at position marked with |: 254 | (aaa (bbb |ccc) ddd) ---> (aaa |ccc ddd) 255 | 256 | Splice the current list into the containing list by deleting 257 | everything forward from the cursor position up to the 258 | closing paren. 259 | For example pressing at position marked with |: 260 | (aaa (bbb| ccc) ddd) ---> (aaa |bbb ddd) 261 | 262 | I Raise the current symbol, i.e. replace the current list with 263 | the current symbol by deleting everything else (except the 264 | symbol) in the list, including the eclosing pair of parens. 265 | For example pressing I at position marked with |: 266 | (aaa (b|bb ccc) ddd) ---> (aaa |bbb ddd) 267 | 268 | x or When about to delete a (, ), [, ], or " and there are other 269 | characters inside, then just skip it to the right. When 270 | about to delete the closing part of the matched character 271 | with nothing inside, then the whole empty list is removed. 272 | When preceded by a value then delete this many 273 | characters. 274 | 275 | X When about to delete a (, ), [, ], or " and there are other 276 | characters inside, then just skip it to the left. When 277 | about to delete the opening part of the matched character 278 | with nothing inside, then the whole empty list is removed. 279 | 280 | D Keep deleting characters towards the end of line, 281 | maintaining the balanced state, i.e. keep the number of 282 | opening and closing parens the same. 283 | 284 | C Same as 'D' but go to insert mode at the end. 285 | 286 | s Same as 'x' but go to insert mode at the end. 287 | 288 | dd Delete whole line by keeping the balanced state, i.e. 289 | keep the number of opening and closing parens the same. 290 | When preceded by a value then delete this many 291 | lines. 292 | 293 | S Same as 'dd' but go to insert mode at the end. 294 | 295 | d{motion} Delete text till {motion}. Keeps text balanced, so if the 296 | surrounded text contains unpaired matched characters then 297 | they are not removed. 298 | 299 | c{motion} Delete text till {motion} and start insert mode. Keeps text 300 | balanced just like d{motion}. 301 | 302 | p Put the text after the cursor with all unbalanced matched 303 | characters removed. 304 | 305 | P Put the text before the cursor with all unbalanced matched 306 | characters removed. 307 | 308 | 309 | Visual Mode: 310 | 311 | ( Finds opening '(' of the current list and selects the whole 312 | list. Can be pressed repeatedly until the top level form 313 | selected. 314 | 315 | ) Finds closing ')' of the current list and selects the whole 316 | list. Can be pressed repeatedly until the top level form 317 | selected. 318 | 319 | d Delete the current visual selection. Keeps text balanced, 320 | x so the the selection contains unpaired matched characters 321 | then they are not removed. 322 | 323 | c Delete the current visual selection and start insert mode. 324 | Keeps text balanced just like the 'd' command. 325 | 326 | W Wrap the current visual selection in a pair of parentheses. 327 | w( The visual selection is kept. 328 | 329 | w[ Wrap the current visual selection in a pair of square 330 | brackets. The visual selection is kept. 331 | 332 | w{ Wrap the current visual selection in a pair of curly braces. 333 | The visual selection is kept. 334 | 335 | w" Wrap the current visual selection in a pair of double 336 | quotes. The visual selection is kept. 337 | 338 | 339 | Please note that if variable |g:paredit_shortmaps| is nonzero then the 340 | following normal mode mappings don't get a prefix, they are mapped 341 | to existing (but infrequently used) Vim functions and instead the original Vim 342 | functions are mapped with the prefix: 343 | 344 | <, >, J, O, W, S 345 | 346 | 347 | Vim has many built-in mappings for manipulating s-expressions. Here follows a 348 | list of useful commands, these are not defined by paredit.vim, they are 349 | available even when paredit mode is switched off. 350 | 351 | % Find the matching pair of the parenthesis the cursor is 352 | standing on. 353 | 354 | d% Delete till the matching parenthesis. Normally it is used 355 | when the cursor is standing on a parenthesis (works with 356 | square or curly braces as well). If not standing on a 357 | parenthesis then deletes left till the first opening paren, 358 | so this command may also be used to delete an s-expression 359 | that is right before the cursor. 360 | 361 | daw Delete a word. Can be used to delete a list element, the 362 | cursor may be placed anywhere in the element. 363 | 364 | da( Delete the innermost s-expression. The cursor may be placed 365 | anywhere inside the s-expression. 366 | 367 | di( Same as da( but does not delete the enclosing parens. 368 | 369 | 370 | =============================================================================== 371 | PAREDIT OPTIONS *paredit-options* 372 | 373 | |g:paredit_electric_return| If nonzero, electric return feature is enabled. 374 | 375 | |g:paredit_leader| Custom setting for Paredit. 376 | 377 | |g:paredit_matchlines| Number of lines to look backward and forward 378 | when checking if the current form is balanced. 379 | 380 | |g:paredit_mode| If nonzero, paredit mode is switched on. 381 | 382 | |g:paredit_shortmaps| If nonzero, paredit is remapping some one-letter 383 | Vim commands that are not frequently used. 384 | 385 | 386 | *g:paredit_electric_return* 387 | If nonzero then "electric return" feature is enabled. This means that when an 388 | is pressed before a closing paren in insert mode, paredit will actually 389 | insert two newlines creating an empty line. The extra newline is consumed at 390 | pressing the next closing paren. This feature allows linewise editing of the 391 | subform entered in the next (empty) line. 392 | In other words "opens" parenthetical expressions while editing, ')' 393 | "closes" them. 394 | Please note that electric return is disabled for the REPL buffer where 395 | is used to send the command line to the swank server for evaluation. 396 | 397 | Please find a video demonstration of the electric return feature here: 398 | http://img8.imageshack.us/img8/9479/openparen.gif 399 | 400 | *g:paredit_leader* 401 | This option allows a custom setting for the Paredit keybindings. 402 | By default it has the same value as |mapleader|. If neither g:paredit_leader 403 | nor mapleader are defined then the default is "," in Paredit. 404 | Example: 405 | let g:paredit_leader = '\' 406 | If this is set in the .vimrc then Wrap will be mapped to \W instead of ,W. 407 | 408 | There is a separate |g:slimv_leader| option for the general Slimv keybindings. 409 | 410 | *g:paredit_matchlines* 411 | Number of lines to look backward and forward when checking if the current 412 | top level form is balanced in paredit mode. Default is 100. 413 | 414 | *g:paredit_mode* 415 | If nonzero then paredit mode is switched on, i.e. the plugin tries to keep the 416 | balanced state of parens. This is the default behaviour. 417 | 418 | *g:paredit_shortmaps* 419 | If nonzero, paredit is remapping some one-letter normal mode Vim commands that 420 | are not frequently used. These are <, >, J, O, W, S. The original function of 421 | these maps then can be reached via (which is the "," character 422 | by default in Paredit). 423 | Otherwise these paredit functions can be reached via maintaining the 424 | original functions of these keys. 425 | 426 | 427 | =============================================================================== 428 | vim:tw=80:et:wrap:ft=help:norl: 429 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2008-2011 (c) Meikel Brandmeyer. 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/README.markdown: -------------------------------------------------------------------------------- 1 | # VimClojure – a Clojure environment for Vim 2 | 3 | VimClojure is one of the most sophisticated editing environments for Clojure. 4 | It provides syntax highlighting, indenting and command completion. 5 | 6 | VimClojure is not intended to be an easy to use Clojure IDE, but a plugin 7 | to make life easier for people already familiar with Vim. So you should 8 | be familiar with Vim and/or Java. Eg. VimClojure won't help you in any way 9 | to set up a correct classpath! This is the responsibility of the build 10 | system of the given project. So before using the dynamic server make 11 | yourself comfortable with Clojure, the JVM and Vim. 12 | 13 | # Requirements 14 | 15 | Please make sure that the following options are set in your .vimrc: 16 | 17 | syntax on 18 | filetype plugin indent on 19 | 20 | Otherwise the filetype is not activated, and hence VimClojure doesn't work. 21 | 22 | The following assumes a standard installation. If you have installed Vim (or 23 | are installing VimClojure) in a non-standard way, I trust that you know what 24 | you are doing. 25 | 26 | # Online Documentation 27 | 28 | Please refer to the online documentation in the doc folder for further 29 | information on how to use VimClojure, its features and its caveats. To 30 | rebuild the help tags for the online documentation issue the following 31 | command in Vim instance. 32 | 33 | " On Unix: 34 | :helptags ~/.vim/doc 35 | " On Windows: 36 | :helptags ~/vimfiles/doc 37 | 38 | # Here be Dragons 39 | 40 | If requested VimClojure also provides a SLIME like interface to dynamically 41 | work with Clojure code. For this to work the included Nailgun server must be 42 | running. Remote may be forwarded via ssh. 43 | 44 | Features of the interactive interface are: 45 | 46 | - dynamic documentation lookup 47 | - dynamic javadoc lookup (in an external browser) 48 | - Repl running in a Vim buffer 49 | - smart omni completion 50 | - easy evaluation of code in a buffer 51 | 52 | However: **This is not a requirement!** VimClojure works perfectly in 53 | _offline_ mode. That is: just unpack the distribution zip in your .vim 54 | directory and you are good to go! In fact I discourage newbies to use the 55 | server until being more comfortable with Clojure and/or the JVM. 56 | 57 | ## Configuration 58 | 59 | To activate the interactive interface define the vimclojure#WantNailgun variable 60 | in your .vimrc: `let vimclojure#WantNailgun = 1` 61 | 62 | ## Building the Nailgun interface 63 | 64 | You have to download and install the client program once. Unless there is 65 | a note in the release notes it will be compatible with future releases. The 66 | client can be downloaded from: 67 | http://kotka.de/projects/vimclojure/vimclojure-nailgun-client-.zip. 68 | 69 | After unzipping the archive, simply type `make` in the subdirectory from the 70 | zip archive. This will compile the nailgun client. For Windows the client is 71 | already pre-compiled as `ng.exe`. 72 | 73 | Configure the location of the nailgun client in your `.vimrc`: 74 | 75 | let vimclojure#NailgunClient = "/path/to/your/ng" 76 | 77 | It will default to just `ng` which should work if the client is on your PATH. 78 | 79 | Note: You might need to check the Makefile for special lib requirements 80 | to compile the nailgun client, eg. on OpenSolaris. 81 | 82 | It is **not** required to build the **server side** of the Nailgun interface 83 | and I strongly discourage to do so. The server is provided as jar file 84 | from [Clojars](http://clojars.org). Just add the artifact to your development 85 | dependencies. 86 | 87 | * For Gradle (with Clojuresque): 88 | 89 | dependencies { 90 | development 'vimclojure:server:' 91 | } 92 | 93 | * For Leiningen: 94 | 95 | (defproject … 96 | :dev-dependencies [… 97 | [vimclojure/server ""] 98 | …]) 99 | 100 | * For Ivy: 101 | 102 | 103 | 104 | * For Maven: 105 | 106 | 107 | vimclojure 108 | server 109 | 110 | 111 | 112 | 113 | For manual download: 114 | http://clojars.org/repo/vimclojure/server//server-.jar 115 | 116 | There are also launcher scripts included in the vimclojure/bin subdirectory 117 | based on Stephen C. Gilardi's clj-env-dir launcher. See information on how 118 | to use them in the corresponding files. 119 | 120 | -- 121 | Meikel Branmdeyer 122 | Erlensee, 2010 123 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/autoload/vimclojure.vim: -------------------------------------------------------------------------------- 1 | " Part of Vim filetype plugin for Clojure 2 | " Language: Clojure 3 | " Maintainer: Meikel Brandmeyer 4 | 5 | let s:save_cpo = &cpo 6 | set cpo&vim 7 | 8 | function! vimclojure#WarnDeprecated(old, new) 9 | echohl WarningMsg 10 | echomsg a:old . " is deprecated! Use " . a:new . "!" 11 | echomsg "eg. let " . a:new . " = " 12 | echohl None 13 | endfunction 14 | 15 | " Configuration 16 | if !exists("g:vimclojure#FuzzyIndent") 17 | let vimclojure#FuzzyIndent = 0 18 | endif 19 | 20 | if !exists("g:vimclojure#FuzzyIndentPatterns") 21 | let vimclojure#FuzzyIndentPatterns = "with.*,def.*,let.*" 22 | endif 23 | 24 | if !exists("g:vimclojure#HighlightBuiltins") 25 | if exists("g:clj_highlight_builtins") 26 | call vimclojure#WarnDeprecated("g:clj_highlight_builtins", 27 | \ "vimclojure#HighlightBuiltins") 28 | let vimclojure#HighlightBuiltins = g:clj_highlight_builtins 29 | else 30 | let vimclojure#HighlightBuiltins = 1 31 | endif 32 | endif 33 | 34 | if exists("g:clj_highlight_contrib") 35 | echohl WarningMsg 36 | echomsg "clj_highlight_contrib is deprecated! It's removed without replacement!" 37 | echohl None 38 | endif 39 | 40 | if !exists("g:vimclojure#DynamicHighlighting") 41 | if exists("g:clj_dynamic_highlighting") 42 | call vimclojure#WarnDeprecated("g:clj_dynamic_highlighting", 43 | \ "vimclojure#DynamicHighlighting") 44 | let vimclojure#DynamicHighlighting = g:clj_dynamic_highlighting 45 | else 46 | let vimclojure#DynamicHighlighting = 0 47 | endif 48 | endif 49 | 50 | if !exists("g:vimclojure#ParenRainbow") 51 | if exists("g:clj_paren_rainbow") 52 | call vimclojure#WarnDeprecated("g:clj_paren_rainbow", 53 | \ "vimclojure#ParenRainbow") 54 | let vimclojure#ParenRainbow = g:clj_paren_rainbow 55 | else 56 | let vimclojure#ParenRainbow = 0 57 | endif 58 | endif 59 | 60 | if !exists("g:vimclojure#WantNailgun") 61 | if exists("g:clj_want_gorilla") 62 | call vimclojure#WarnDeprecated("g:clj_want_gorilla", 63 | \ "vimclojure#WantNailgun") 64 | let vimclojure#WantNailgun = g:clj_want_gorilla 65 | else 66 | let vimclojure#WantNailgun = 0 67 | endif 68 | endif 69 | 70 | if !exists("g:vimclojure#NailgunServer") 71 | let vimclojure#NailgunServer = "127.0.0.1" 72 | endif 73 | 74 | if !exists("g:vimclojure#NailgunPort") 75 | let vimclojure#NailgunPort = "2113" 76 | endif 77 | 78 | if !exists("g:vimclojure#UseErrorBuffer") 79 | let vimclojure#UseErrorBuffer = 1 80 | endif 81 | 82 | if !exists("g:vimclojure#SetupKeyMap") 83 | let vimclojure#SetupKeyMap = 1 84 | endif 85 | 86 | if !exists("g:vimclojure#SearchThreshold") 87 | let vimclojure#SearchThreshold = 100 88 | endif 89 | 90 | function! vimclojure#ReportError(msg) 91 | if g:vimclojure#UseErrorBuffer 92 | let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer) 93 | call buf.showText(a:msg) 94 | wincmd p 95 | else 96 | echoerr substitute(a:msg, '\n\(\t\?\)', ' ', 'g') 97 | endif 98 | endfunction 99 | 100 | function! vimclojure#EscapePathForOption(path) 101 | let path = fnameescape(a:path) 102 | 103 | " Hardcore escapeing of whitespace... 104 | let path = substitute(path, '\', '\\\\', 'g') 105 | let path = substitute(path, '\ ', '\\ ', 'g') 106 | 107 | return path 108 | endfunction 109 | 110 | function! vimclojure#AddPathToOption(path, option) 111 | let path = vimclojure#EscapePathForOption(a:path) 112 | execute "setlocal " . a:option . "+=" . path 113 | endfunction 114 | 115 | function! vimclojure#AddCompletions(ns) 116 | let completions = split(globpath(&rtp, "ftplugin/clojure/completions-" . a:ns . ".txt"), '\n') 117 | if completions != [] 118 | call vimclojure#AddPathToOption('k' . completions[0], 'complete') 119 | endif 120 | endfunction 121 | 122 | function! ClojureExtractSexprWorker() dict 123 | let pos = [0, 0] 124 | let start = getpos(".") 125 | 126 | if getline(start[1])[start[2] - 1] == "(" 127 | \ && vimclojure#util#SynIdName() =~ 'clojureParen' . self.level 128 | let pos = [start[1], start[2]] 129 | endif 130 | 131 | if pos == [0, 0] 132 | let pos = searchpairpos('(', '', ')', 'bW' . self.flag, 133 | \ 'vimclojure#util#SynIdName() !~ "clojureParen\\d"') 134 | endif 135 | 136 | if pos == [0, 0] 137 | throw "Error: Not in a s-expression!" 138 | endif 139 | 140 | return [pos, vimclojure#util#Yank('l', 'normal! "ly%')] 141 | endfunction 142 | 143 | " Nailgun part: 144 | function! vimclojure#ExtractSexpr(toplevel) 145 | let closure = { 146 | \ "flag" : (a:toplevel ? "r" : ""), 147 | \ "level" : (a:toplevel ? "0" : '\d'), 148 | \ "f" : function("ClojureExtractSexprWorker") 149 | \ } 150 | 151 | return vimclojure#util#WithSavedPosition(closure) 152 | endfunction 153 | 154 | function! vimclojure#BufferName() 155 | let file = expand("%") 156 | if file == "" 157 | let file = "UNNAMED" 158 | endif 159 | return file 160 | endfunction 161 | 162 | " Key mappings and Plugs 163 | function! vimclojure#MakeProtectedPlug(mode, plug, f, args) 164 | execute a:mode . "noremap Clojure" . a:plug . "." 165 | \ . " :call vimclojure#ProtectedPlug(function(\"" 166 | \ . a:f . "\"), [ " . a:args . " ])" 167 | endfunction 168 | 169 | function! vimclojure#MakeCommandPlug(mode, plug, f, args) 170 | execute a:mode . "noremap Clojure" . a:plug . "." 171 | \ . " :call vimclojure#ProtectedPlug(" 172 | \ . " function(\"vimclojure#CommandPlug\")," 173 | \ . " [ function(\"" . a:f . "\"), [ " . a:args . " ]])" 174 | endfunction 175 | 176 | function! vimclojure#MapPlug(mode, keys, plug) 177 | if exists("g:vimclojure#SetupKeyMap" . a:plug) 178 | execute "let doSetup = g:vimclojure#SetupKeyMap" . a:plug 179 | else 180 | let doSetup = g:vimclojure#SetupKeyMap 181 | endif 182 | 183 | if doSetup && !hasmapto("Clojure" . a:plug . ".", a:mode) 184 | execute a:mode . "map " . a:keys 185 | \ . " Clojure" . a:plug . "." 186 | endif 187 | endfunction 188 | 189 | if !exists("*vimclojure#CommandPlug") 190 | function vimclojure#CommandPlug(f, args) 191 | if exists("b:vimclojure_loaded") 192 | \ && !exists("b:vimclojure_namespace") 193 | \ && g:vimclojure#WantNailgun == 1 194 | unlet b:vimclojure_loaded 195 | call vimclojure#InitBuffer("silent") 196 | endif 197 | 198 | if exists("b:vimclojure_namespace") 199 | call call(a:f, a:args) 200 | elseif g:vimclojure#WantNailgun == 1 201 | let msg = "VimClojure could not initialise the server connection.\n" 202 | \ . "That means you will not be able to use the interactive features.\n" 203 | \ . "Reasons might be that the server is not running or that there is\n" 204 | \ . "some trouble with the classpath.\n\n" 205 | \ . "VimClojure will *not* start the server for you or handle the classpath.\n" 206 | \ . "There is a plethora of tools like ivy, maven, gradle and leiningen,\n" 207 | \ . "which do this better than VimClojure could ever do it." 208 | throw msg 209 | endif 210 | endfunction 211 | endif 212 | 213 | if !exists("*vimclojure#ProtectedPlug") 214 | function vimclojure#ProtectedPlug(f, args) 215 | try 216 | return call(a:f, a:args) 217 | catch /.*/ 218 | call vimclojure#ReportError(v:exception) 219 | endtry 220 | endfunction 221 | endif 222 | 223 | " A Buffer... 224 | if !exists("g:vimclojure#SplitPos") 225 | let vimclojure#SplitPos = "top" 226 | endif 227 | 228 | if !exists("g:vimclojure#SplitSize") 229 | let vimclojure#SplitSize = "" 230 | endif 231 | 232 | let vimclojure#Object = {} 233 | 234 | function! vimclojure#Object.New(...) dict 235 | let instance = copy(self) 236 | let instance.prototype = self 237 | 238 | call call(instance.Init, a:000, instance) 239 | 240 | return instance 241 | endfunction 242 | 243 | function! vimclojure#Object.Init() dict 244 | endfunction 245 | 246 | let vimclojure#Buffer = copy(vimclojure#Object) 247 | let vimclojure#Buffer["__superObjectNew"] = vimclojure#Buffer["New"] 248 | let vimclojure#Buffer["__superObjectInit"] = vimclojure#Buffer["Init"] 249 | 250 | let vimclojure#BufferNr = 0 251 | 252 | function! vimclojure#Buffer.New(...) dict 253 | let nr = g:vimclojure#BufferNr 254 | let bufname = printf("vimclojure_buffer_%06d", nr) 255 | let g:vimclojure#BufferNr += 1 256 | 257 | execute "badd" bufname 258 | execute "buffer!" bufname 259 | 260 | return call(self.__superObjectNew, a:000, self) 261 | endfunction 262 | 263 | function! vimclojure#Buffer.Init() dict 264 | call self.__superObjectInit() 265 | let self._buf = bufnr("%") 266 | endfunction 267 | 268 | function! vimclojure#Buffer.showText(text) dict 269 | if type(a:text) == type("") 270 | " XXX: Opening the box of the pandora. 271 | " 2012-01-09: Adding Carriage Returns here. 272 | let text = split(a:text, '\r\?\n') 273 | else 274 | let text = a:text 275 | endif 276 | call append(line("$"), text) 277 | endfunction 278 | 279 | function! vimclojure#Buffer.clear() dict 280 | 1 281 | normal! "_dG 282 | endfunction 283 | 284 | function! vimclojure#Buffer.goHere() dict 285 | if bufnr("%") != self._buf 286 | execute "buffer!" self._buf 287 | endif 288 | endfunction 289 | 290 | function! vimclojure#Buffer.close() dict 291 | execute "bdelete!" self._buf 292 | endfunction 293 | 294 | let vimclojure#Window = copy(vimclojure#Object) 295 | let vimclojure#Window["__superObjectNew"] = vimclojure#Window["New"] 296 | let vimclojure#Window["__superObjectInit"] = vimclojure#Window["Init"] 297 | 298 | function! vimclojure#Window.New(...) dict 299 | if g:vimclojure#SplitPos == "left" || g:vimclojure#SplitPos == "right" 300 | let o_sr = &splitright 301 | if g:vimclojure#SplitPos == "left" 302 | set nosplitright 303 | else 304 | set splitright 305 | end 306 | execute printf("%svsplit", g:vimclojure#SplitSize) 307 | let &splitright = o_sr 308 | else 309 | let o_sb = &splitbelow 310 | if g:vimclojure#SplitPos == "bottom" 311 | set splitbelow 312 | else 313 | set nosplitbelow 314 | end 315 | execute printf("%ssplit", g:vimclojure#SplitSize) 316 | let &splitbelow = o_sb 317 | endif 318 | 319 | return call(self.__superObjectNew, a:000, self) 320 | endfunction 321 | 322 | function! vimclojure#Window.Init(buftype) dict 323 | call self.__superObjectInit() 324 | let w:vimclojure_window = self 325 | let self._buffer = a:buftype.New() 326 | endfunction 327 | 328 | function! vimclojure#Window.goHere() dict 329 | let wn = self.findThis() 330 | if wn == -1 331 | echoerr 'A crisis has arisen! Cannot find my window.' 332 | endif 333 | execute wn . "wincmd w" 334 | call self._buffer.goHere() 335 | endfunction 336 | 337 | function! vimclojure#Window.resize() dict 338 | call self.goHere() 339 | let size = line("$") 340 | if size < 3 341 | let size = 3 342 | endif 343 | execute "resize " . size 344 | endfunction 345 | 346 | function! vimclojure#Window.showText(text) dict 347 | call self.goHere() 348 | call self._buffer.showText(a:text) 349 | endfunction 350 | 351 | function! vimclojure#Window.showOutput(output) dict 352 | call self.goHere() 353 | if a:output.value == 0 354 | if a:output.stdout != "" 355 | call self._buffer.showText(a:output.stdout) 356 | endif 357 | if a:output.stderr != "" 358 | call self._buffer.showText(a:output.stderr) 359 | endif 360 | else 361 | call self._buffer.showText(a:output.value) 362 | endif 363 | endfunction 364 | 365 | function! vimclojure#Window.clear() dict 366 | call self.goHere() 367 | call self._buffer.clear() 368 | endfunction 369 | 370 | function! vimclojure#Window.close() dict 371 | call self._buffer.close() 372 | endfunction 373 | 374 | function! vimclojure#Window.findThis() dict 375 | for w in range(1, winnr("$")) 376 | if type(getwinvar(w, "vimclojure_window")) == type({}) 377 | if getwinvar(w, "vimclojure_window") == self 378 | return w 379 | endif 380 | endif 381 | endfor 382 | 383 | return -1 384 | endfunction 385 | 386 | " The transient buffer, used to display results. 387 | let vimclojure#ResultWindow = copy(vimclojure#Window) 388 | let vimclojure#ResultWindow["__superWindowNew"] = vimclojure#ResultWindow["New"] 389 | let vimclojure#ResultWindow["__superWindowClose"] = vimclojure#ResultWindow["close"] 390 | 391 | function! vimclojure#ResultWindow.New(buftype, ...) dict 392 | if exists("t:vimclojure_result_window") 393 | call t:vimclojure_result_window.goHere() 394 | 395 | if t:vimclojure_result_window._buffer.prototype != a:buftype 396 | let t:vimclojure_result_window._buffer = a:buftype.New() 397 | else 398 | call t:vimclojure_result_window.clear() 399 | endif 400 | 401 | return t:vimclojure_result_window 402 | endif 403 | 404 | let instance = call(self.__superWindowNew, [a:buftype] + a:000, self) 405 | let b:vimclojure_result_buffer = 1 406 | let t:vimclojure_result_window = instance 407 | 408 | return instance 409 | endfunction 410 | 411 | function! vimclojure#ResultWindow.close() dict 412 | unlet t:vimclojure_result_window 413 | call self.__superWindowClose() 414 | endfunction 415 | 416 | function! vimclojure#ResultWindow.CloseWindow() dict 417 | if exists("t:vimclojure_result_window") 418 | call t:vimclojure_result_window.close() 419 | endif 420 | endfunction 421 | 422 | "function! s:InvalidateResultBufferIfNecessary(buf) 423 | " " FIXME: This is incorrect. 424 | " if exists("t:vimclojure_result_window") 425 | " \ && t:vimclojure_result_window._buffer._buf == a:buf 426 | " let t:vimclojure_result_window.close() 427 | " endif 428 | "endfunction 429 | 430 | "augroup VimClojureResultWindow 431 | " au BufDelete * call s:InvalidateResultWindowIfNecessary(expand("")) 432 | "augroup END 433 | 434 | let vimclojure#ResultBuffer = copy(vimclojure#Buffer) 435 | let vimclojure#ResultBuffer["__superBufferInit"] = vimclojure#ResultBuffer.Init 436 | let vimclojure#ResultBuffer["__superBufferClear"] = vimclojure#ResultBuffer.clear 437 | 438 | function! vimclojure#ResultBuffer.Init() dict 439 | call self.__superBufferInit() 440 | setlocal noswapfile 441 | setlocal buftype=nofile 442 | setlocal bufhidden=wipe 443 | 444 | call vimclojure#MapPlug("n", "p", "CloseResultBuffer") 445 | 446 | call self.clear() 447 | endfunction 448 | 449 | function! vimclojure#ResultBuffer.clear() dict 450 | call self.__superBufferClear() 451 | let leader = exists("g:maplocalleader") ? g:maplocalleader : "\\" 452 | call append(0, "; Use " . leader . "p to close this buffer!") 453 | endfunction 454 | 455 | " A special result buffer for clojure output. 456 | let vimclojure#ClojureResultBuffer = copy(vimclojure#ResultBuffer) 457 | let vimclojure#ClojureResultBuffer["__superResultBufferInit"] = 458 | \ vimclojure#ResultBuffer["Init"] 459 | let vimclojure#ClojureResultBuffer["__superResultBufferShowText"] = 460 | \ vimclojure#ResultBuffer["showText"] 461 | 462 | function! vimclojure#ClojureResultBuffer.Init(...) dict 463 | call self.__superResultBufferInit() 464 | set filetype=vimclojure.clojure 465 | if a:0 == 1 466 | let b:vimclojure_namespace = a:1 467 | else 468 | let b:vimclojure_namespace = "user" 469 | endif 470 | endfunction 471 | 472 | function! vimclojure#ClojureResultBuffer.showText(text) dict 473 | call self.__superResultBufferShowText(a:text) 474 | normal G 475 | endfunction 476 | 477 | " Nails 478 | if !exists("vimclojure#NailgunClient") 479 | let vimclojure#NailgunClient = "ng" 480 | endif 481 | 482 | function! ClojureShellEscapeArgumentsWorker() dict 483 | set noshellslash 484 | return map(copy(self.vals), 'shellescape(v:val)') 485 | endfunction 486 | 487 | function! vimclojure#ShellEscapeArguments(vals) 488 | let closure = { 489 | \ 'vals': a:vals, 490 | \ 'f' : function("ClojureShellEscapeArgumentsWorker") 491 | \ } 492 | 493 | return vimclojure#util#WithSavedOption('shellslash', closure) 494 | endfunction 495 | 496 | function! vimclojure#ExecuteNailWithInput(nail, input, ...) 497 | if type(a:input) == type("") 498 | let input = split(a:input, '\n', 1) 499 | else 500 | let input = a:input 501 | endif 502 | 503 | let inputfile = tempname() 504 | try 505 | call writefile(input, inputfile) 506 | 507 | let cmdline = vimclojure#ShellEscapeArguments( 508 | \ [g:vimclojure#NailgunClient, 509 | \ '--nailgun-server', g:vimclojure#NailgunServer, 510 | \ '--nailgun-port', g:vimclojure#NailgunPort, 511 | \ 'vimclojure.Nail', a:nail] 512 | \ + a:000) 513 | let cmd = join(cmdline, " ") . " <" . inputfile 514 | " Add hardcore quoting for Windows 515 | if has("win32") || has("win64") 516 | let cmd = '"' . cmd . '"' 517 | endif 518 | 519 | let output = system(cmd) 520 | 521 | if v:shell_error 522 | throw "Error executing Nail! (" . v:shell_error . ")\n" . output 523 | endif 524 | finally 525 | call delete(inputfile) 526 | endtry 527 | 528 | execute "let result = " . substitute(output, '\n$', '', '') 529 | return result 530 | endfunction 531 | 532 | function! vimclojure#ExecuteNail(nail, ...) 533 | return call(function("vimclojure#ExecuteNailWithInput"), [a:nail, ""] + a:000) 534 | endfunction 535 | 536 | function! vimclojure#ShowResult(result) 537 | let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer) 538 | call buf.showOutput(a:result) 539 | wincmd p 540 | endfunction 541 | 542 | function! vimclojure#ShowClojureResult(result, nspace) 543 | let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer) 544 | let b:vimclojure_namespace = a:nspace 545 | call buf.showOutput(a:result) 546 | wincmd p 547 | endfunction 548 | 549 | function! vimclojure#DocLookup(word) 550 | if a:word == "" 551 | return 552 | endif 553 | 554 | let doc = vimclojure#ExecuteNailWithInput("DocLookup", a:word, 555 | \ "-n", b:vimclojure_namespace) 556 | call vimclojure#ShowResult(doc) 557 | endfunction 558 | 559 | function! vimclojure#FindDoc() 560 | let pattern = input("Pattern to look for: ") 561 | let doc = vimclojure#ExecuteNailWithInput("FindDoc", pattern) 562 | call vimclojure#ShowResult(doc) 563 | endfunction 564 | 565 | let s:DefaultJavadocPaths = { 566 | \ "java" : "http://java.sun.com/javase/6/docs/api/", 567 | \ "org/apache/commons/beanutils" : "http://commons.apache.org/beanutils/api/", 568 | \ "org/apache/commons/chain" : "http://commons.apache.org/chain/api-release/", 569 | \ "org/apache/commons/cli" : "http://commons.apache.org/cli/api-release/", 570 | \ "org/apache/commons/codec" : "http://commons.apache.org/codec/api-release/", 571 | \ "org/apache/commons/collections" : "http://commons.apache.org/collections/api-release/", 572 | \ "org/apache/commons/logging" : "http://commons.apache.org/logging/apidocs/", 573 | \ "org/apache/commons/mail" : "http://commons.apache.org/email/api-release/", 574 | \ "org/apache/commons/io" : "http://commons.apache.org/io/api-release/" 575 | \ } 576 | 577 | if !exists("vimclojure#JavadocPathMap") 578 | let vimclojure#JavadocPathMap = {} 579 | endif 580 | 581 | for k in keys(s:DefaultJavadocPaths) 582 | if !has_key(vimclojure#JavadocPathMap, k) 583 | let vimclojure#JavadocPathMap[k] = s:DefaultJavadocPaths[k] 584 | endif 585 | endfor 586 | 587 | if !exists("vimclojure#Browser") 588 | if has("win32") || has("win64") 589 | let vimclojure#Browser = "start" 590 | elseif has("mac") 591 | let vimclojure#Browser = "open" 592 | else 593 | " some freedesktop thing, whatever, issue #67 594 | let vimclojure#Browser = "xdg-open" 595 | endif 596 | endif 597 | 598 | function! vimclojure#JavadocLookup(word) 599 | let word = substitute(a:word, "\\.$", "", "") 600 | let path = vimclojure#ExecuteNailWithInput("JavadocPath", word, 601 | \ "-n", b:vimclojure_namespace) 602 | 603 | if path.stderr != "" 604 | call vimclojure#ShowResult(path) 605 | return 606 | endif 607 | 608 | let match = "" 609 | for pattern in keys(g:vimclojure#JavadocPathMap) 610 | if path.value =~ "^" . pattern && len(match) < len(pattern) 611 | let match = pattern 612 | endif 613 | endfor 614 | 615 | if match == "" 616 | echoerr "No matching Javadoc URL found for " . path.value 617 | endif 618 | 619 | let url = g:vimclojure#JavadocPathMap[match] . path.value 620 | call system(join([g:vimclojure#Browser, url], " ")) 621 | endfunction 622 | 623 | function! vimclojure#SourceLookup(word) 624 | let source = vimclojure#ExecuteNailWithInput("SourceLookup", a:word, 625 | \ "-n", b:vimclojure_namespace) 626 | call vimclojure#ShowClojureResult(source, b:vimclojure_namespace) 627 | endfunction 628 | 629 | function! vimclojure#MetaLookup(word) 630 | let meta = vimclojure#ExecuteNailWithInput("MetaLookup", a:word, 631 | \ "-n", b:vimclojure_namespace) 632 | call vimclojure#ShowClojureResult(meta, b:vimclojure_namespace) 633 | endfunction 634 | 635 | function! vimclojure#GotoSource(word) 636 | let pos = vimclojure#ExecuteNailWithInput("SourceLocation", a:word, 637 | \ "-n", b:vimclojure_namespace) 638 | 639 | if pos.stderr != "" 640 | call vimclojure#ShowResult(pos) 641 | return 642 | endif 643 | 644 | if !filereadable(pos.value.file) 645 | let file = findfile(pos.value.file) 646 | if file == "" 647 | echoerr pos.value.file . " not found in 'path'" 648 | return 649 | endif 650 | let pos.value.file = file 651 | endif 652 | 653 | execute "edit " . pos.value.file 654 | execute pos.value.line 655 | endfunction 656 | 657 | " Evaluators 658 | function! vimclojure#MacroExpand(firstOnly) 659 | let [unused, sexp] = vimclojure#ExtractSexpr(0) 660 | let ns = b:vimclojure_namespace 661 | 662 | let cmd = ["MacroExpand", sexp, "-n", ns] 663 | if a:firstOnly 664 | let cmd = cmd + [ "-o" ] 665 | endif 666 | 667 | let expanded = call(function("vimclojure#ExecuteNailWithInput"), cmd) 668 | 669 | call vimclojure#ShowClojureResult(expanded, ns) 670 | endfunction 671 | 672 | function! vimclojure#RequireFile(all) 673 | let ns = b:vimclojure_namespace 674 | let all = a:all ? "-all" : "" 675 | 676 | let require = "(require :reload" . all . " :verbose '". ns. ")" 677 | let result = vimclojure#ExecuteNailWithInput("Repl", require, "-r") 678 | 679 | call vimclojure#ShowClojureResult(result, ns) 680 | endfunction 681 | 682 | function! vimclojure#RunTests(all) 683 | let ns = b:vimclojure_namespace 684 | 685 | let result = call(function("vimclojure#ExecuteNailWithInput"), 686 | \ [ "RunTests", "", "-n", ns ] + (a:all ? [ "-a" ] : [])) 687 | 688 | call vimclojure#ShowClojureResult(result, ns) 689 | endfunction 690 | 691 | function! vimclojure#EvalFile() 692 | let content = getbufline(bufnr("%"), 1, line("$")) 693 | let file = vimclojure#BufferName() 694 | let ns = b:vimclojure_namespace 695 | 696 | let result = vimclojure#ExecuteNailWithInput("Repl", content, 697 | \ "-r", "-n", ns, "-f", file) 698 | 699 | call vimclojure#ShowClojureResult(result, ns) 700 | endfunction 701 | 702 | function! vimclojure#EvalLine() 703 | let theLine = line(".") 704 | let content = getline(theLine) 705 | let file = vimclojure#BufferName() 706 | let ns = b:vimclojure_namespace 707 | 708 | let result = vimclojure#ExecuteNailWithInput("Repl", content, 709 | \ "-r", "-n", ns, "-f", file, "-l", theLine) 710 | 711 | call vimclojure#ShowClojureResult(result, ns) 712 | endfunction 713 | 714 | function! vimclojure#EvalBlock() 715 | let file = vimclojure#BufferName() 716 | let ns = b:vimclojure_namespace 717 | 718 | let content = vimclojure#util#Yank("l", 'normal! gv"ly') 719 | let result = vimclojure#ExecuteNailWithInput("Repl", content, 720 | \ "-r", "-n", ns, "-f", file, "-l", line("'<") - 1) 721 | 722 | call vimclojure#ShowClojureResult(result, ns) 723 | endfunction 724 | 725 | function! vimclojure#EvalToplevel() 726 | let file = vimclojure#BufferName() 727 | let ns = b:vimclojure_namespace 728 | let [pos, expr] = vimclojure#ExtractSexpr(1) 729 | 730 | let result = vimclojure#ExecuteNailWithInput("Repl", expr, 731 | \ "-r", "-n", ns, "-f", file, "-l", pos[0] - 1) 732 | 733 | call vimclojure#ShowClojureResult(result, ns) 734 | endfunction 735 | 736 | function! ClojureEvalParagraphWorker() dict 737 | normal! } 738 | return line(".") 739 | endfunction 740 | 741 | function! vimclojure#EvalParagraph() 742 | let file = vimclojure#BufferName() 743 | let ns = b:vimclojure_namespace 744 | let startPosition = line(".") 745 | 746 | let closure = { 'f' : function("ClojureEvalParagraphWorker") } 747 | 748 | let endPosition = vimclojure#util#WithSavedPosition(closure) 749 | 750 | let content = getbufline(bufnr("%"), startPosition, endPosition) 751 | let result = vimclojure#ExecuteNailWithInput("Repl", content, 752 | \ "-r", "-n", ns, "-f", file, "-l", startPosition - 1) 753 | 754 | call vimclojure#ShowClojureResult(result, ns) 755 | endfunction 756 | 757 | " The Repl 758 | let vimclojure#Repl = copy(vimclojure#Window) 759 | let vimclojure#Repl["__superWindowNew"] = vimclojure#Repl.New 760 | let vimclojure#Repl["__superWindowInit"] = vimclojure#Repl.Init 761 | let vimclojure#Repl["__superWindowClear"] = vimclojure#Repl.clear 762 | 763 | let vimclojure#Repl._history = [] 764 | let vimclojure#Repl._historyDepth = 0 765 | let vimclojure#Repl._replCommands = [ ",close", ",st", ",ct", ",toggle-pprint" ] 766 | 767 | " Simple wrapper to allow on demand load of autoload/vimclojure.vim. 768 | function! vimclojure#StartRepl(...) 769 | let ns = a:0 > 0 ? a:1 : "user" 770 | call g:vimclojure#Repl.New(ns) 771 | endfunction 772 | 773 | " FIXME: Ugly hack. But easier than cleaning up the buffer 774 | " mess in case something goes wrong with repl start. 775 | function! vimclojure#Repl.New(namespace, ...) dict 776 | let replStart = vimclojure#ExecuteNail("Repl", "-s", 777 | \ "-n", a:namespace) 778 | if replStart.stderr != "" 779 | call vimclojure#ReportError(replStart.stderr) 780 | return 781 | endif 782 | 783 | let instance = call(self.__superWindowNew, 784 | \ [g:vimclojure#Buffer, a:namespace] + a:000, 785 | \ self) 786 | let instance._id = replStart.value.id 787 | call vimclojure#ExecuteNailWithInput("Repl", 788 | \ "(require 'clojure.stacktrace)", 789 | \ "-r", "-i", instance._id) 790 | 791 | return instance 792 | endfunction 793 | 794 | function! vimclojure#Repl.Init(buftype, namespace) dict 795 | call self.__superWindowInit(a:buftype) 796 | 797 | let self._prompt = a:namespace . "=>" 798 | 799 | setlocal buftype=nofile 800 | setlocal noswapfile 801 | 802 | call append(line("$"), ["Clojure", self._prompt . " "]) 803 | 804 | let b:vimclojure_repl = self 805 | 806 | set filetype=vimclojure.clojure 807 | let b:vimclojure_namespace = a:namespace 808 | 809 | if !hasmapto("ClojureReplEnterHook.", "i") 810 | imap ClojureReplEnterHook. 811 | endif 812 | if !hasmapto("ClojureReplEvaluate.", "i") 813 | imap ClojureReplEvaluate. 814 | endif 815 | if !hasmapto("ClojureReplHatHook.", "n") 816 | nmap ^ ClojureReplHatHook. 817 | endif 818 | if !hasmapto("ClojureReplUpHistory.", "i") 819 | imap ClojureReplUpHistory. 820 | endif 821 | if !hasmapto("ClojureReplDownHistory.", "i") 822 | imap ClojureReplDownHistory. 823 | endif 824 | 825 | normal! G 826 | startinsert! 827 | endfunction 828 | 829 | function! vimclojure#Repl.isReplCommand(cmd) dict 830 | for candidate in self._replCommands 831 | if candidate == a:cmd 832 | return 1 833 | endif 834 | endfor 835 | return 0 836 | endfunction 837 | 838 | function! vimclojure#Repl.doReplCommand(cmd) dict 839 | if a:cmd == ",close" 840 | call vimclojure#ExecuteNail("Repl", "-S", "-i", self._id) 841 | call self.close() 842 | stopinsert 843 | elseif a:cmd == ",st" 844 | let result = vimclojure#ExecuteNailWithInput("Repl", 845 | \ "(vimclojure.util/pretty-print-stacktrace *e)", "-r", 846 | \ "-i", self._id) 847 | call self.showOutput(result) 848 | call self.showPrompt() 849 | elseif a:cmd == ",ct" 850 | let result = vimclojure#ExecuteNailWithInput("Repl", 851 | \ "(vimclojure.util/pretty-print-causetrace *e)", "-r", 852 | \ "-i", self._id) 853 | call self.showOutput(result) 854 | call self.showPrompt() 855 | elseif a:cmd == ",toggle-pprint" 856 | let result = vimclojure#ExecuteNailWithInput("Repl", 857 | \ "(set! vimclojure.repl/*print-pretty* (not vimclojure.repl/*print-pretty*))", "-r", 858 | \ "-i", self._id) 859 | call self.showOutput(result) 860 | call self.showPrompt() 861 | endif 862 | endfunction 863 | 864 | function! vimclojure#Repl.showPrompt() dict 865 | call self.showText(self._prompt . " ") 866 | normal! G 867 | startinsert! 868 | endfunction 869 | 870 | function! vimclojure#Repl.clear() dict 871 | call self.__superWindowClear() 872 | call self.showPrompt() 873 | endfunction 874 | 875 | function! vimclojure#Repl.getCommand() dict 876 | let ln = line("$") 877 | 878 | while getline(ln) !~ "^" . self._prompt && ln > 0 879 | let ln = ln - 1 880 | endwhile 881 | 882 | " Special Case: User deleted Prompt by accident. Insert a new one. 883 | if ln == 0 884 | call self.showPrompt() 885 | return "" 886 | endif 887 | 888 | let cmd = vimclojure#util#Yank("l", ln . "," . line("$") . "yank l") 889 | 890 | let cmd = substitute(cmd, "^" . self._prompt . "\\s*", "", "") 891 | let cmd = substitute(cmd, "\n$", "", "") 892 | return cmd 893 | endfunction 894 | 895 | function! vimclojure#ReplDoEnter() 896 | execute "normal! a\x" 897 | normal! ==x 898 | if getline(".") =~ '^\s*$' 899 | startinsert! 900 | else 901 | startinsert 902 | endif 903 | endfunction 904 | 905 | function! vimclojure#Repl.enterHook() dict 906 | let lastCol = {} 907 | 908 | function lastCol.f() dict 909 | normal! g_ 910 | return col(".") 911 | endfunction 912 | 913 | if line(".") < line("$") || col(".") < vimclojure#util#WithSavedPosition(lastCol) 914 | call vimclojure#ReplDoEnter() 915 | return 916 | endif 917 | 918 | let cmd = self.getCommand() 919 | 920 | " Special Case: Showed prompt (or user just hit enter). 921 | if cmd =~ '^\(\s\|\n\)*$' 922 | execute "normal! a\" 923 | startinsert! 924 | return 925 | endif 926 | 927 | if self.isReplCommand(cmd) 928 | call self.doReplCommand(cmd) 929 | return 930 | endif 931 | 932 | let result = vimclojure#ExecuteNailWithInput("CheckSyntax", cmd, 933 | \ "-n", b:vimclojure_namespace) 934 | if result.value == 0 && result.stderr == "" 935 | call vimclojure#ReplDoEnter() 936 | elseif result.stderr != "" 937 | call vimclojure#ShowResult(result) 938 | else 939 | let result = vimclojure#ExecuteNailWithInput("Repl", cmd, 940 | \ "-r", "-i", self._id) 941 | call self.showOutput(result) 942 | 943 | let self._historyDepth = 0 944 | let self._history = [cmd] + self._history 945 | 946 | let namespace = vimclojure#ExecuteNailWithInput("ReplNamespace", "", 947 | \ "-i", self._id) 948 | let b:vimclojure_namespace = namespace.value 949 | let self._prompt = namespace.value . "=>" 950 | 951 | call self.showPrompt() 952 | endif 953 | endfunction 954 | 955 | function! vimclojure#Repl.hatHook() dict 956 | let l = getline(".") 957 | 958 | if l =~ "^" . self._prompt 959 | let [buf, line, col, off] = getpos(".") 960 | call setpos(".", [buf, line, len(self._prompt) + 2, off]) 961 | else 962 | normal! ^ 963 | endif 964 | endfunction 965 | 966 | function! vimclojure#Repl.upHistory() dict 967 | let histLen = len(self._history) 968 | let histDepth = self._historyDepth 969 | 970 | if histLen > 0 && histLen > histDepth 971 | let cmd = self._history[histDepth] 972 | let self._historyDepth = histDepth + 1 973 | 974 | call self.deleteLast() 975 | 976 | call self.showText(self._prompt . " " . cmd) 977 | endif 978 | 979 | normal! G$ 980 | endfunction 981 | 982 | function! vimclojure#Repl.downHistory() dict 983 | let histLen = len(self._history) 984 | let histDepth = self._historyDepth 985 | 986 | if histDepth > 0 && histLen > 0 987 | let self._historyDepth = histDepth - 1 988 | let cmd = self._history[self._historyDepth] 989 | 990 | call self.deleteLast() 991 | 992 | call self.showText(self._prompt . " " . cmd) 993 | elseif histDepth == 0 994 | call self.deleteLast() 995 | call self.showText(self._prompt . " ") 996 | endif 997 | 998 | normal! G$ 999 | endfunction 1000 | 1001 | function! vimclojure#Repl.deleteLast() dict 1002 | normal! G 1003 | 1004 | while getline("$") !~ self._prompt 1005 | normal! dd 1006 | endwhile 1007 | 1008 | normal! dd 1009 | endfunction 1010 | 1011 | " Highlighting 1012 | function! vimclojure#ColorNamespace(highlights) 1013 | for [category, words] in items(a:highlights) 1014 | if words != [] 1015 | execute "syntax keyword clojure" . category . " " . join(words, " ") 1016 | endif 1017 | endfor 1018 | endfunction 1019 | 1020 | " Omni Completion 1021 | function! vimclojure#OmniCompletion(findstart, base) 1022 | if a:findstart == 1 1023 | let line = getline(".") 1024 | let start = col(".") - 1 1025 | 1026 | while start > 0 && line[start - 1] =~ '\w\|-\|\.\|+\|*\|/' 1027 | let start -= 1 1028 | endwhile 1029 | 1030 | return start 1031 | else 1032 | let slash = stridx(a:base, '/') 1033 | if slash > -1 1034 | let prefix = strpart(a:base, 0, slash) 1035 | let base = strpart(a:base, slash + 1) 1036 | else 1037 | let prefix = "" 1038 | let base = a:base 1039 | endif 1040 | 1041 | if prefix == "" && base == "" 1042 | return [] 1043 | endif 1044 | 1045 | let completions = vimclojure#ExecuteNail("Complete", 1046 | \ "-n", b:vimclojure_namespace, 1047 | \ "-p", prefix, "-b", base) 1048 | return completions.value 1049 | endif 1050 | endfunction 1051 | 1052 | function! vimclojure#InitBuffer(...) 1053 | if exists("b:vimclojure_loaded") 1054 | return 1055 | endif 1056 | let b:vimclojure_loaded = 1 1057 | 1058 | if g:vimclojure#WantNailgun == 1 1059 | if !exists("b:vimclojure_namespace") 1060 | " Get the namespace of the buffer. 1061 | if &previewwindow 1062 | let b:vimclojure_namespace = "user" 1063 | else 1064 | try 1065 | let content = getbufline(bufnr("%"), 1, line("$")) 1066 | let namespace = 1067 | \ vimclojure#ExecuteNailWithInput( 1068 | \ "NamespaceOfFile", content) 1069 | if namespace.stderr != "" 1070 | throw namespace.stderr 1071 | endif 1072 | let b:vimclojure_namespace = namespace.value 1073 | catch /.*/ 1074 | if a:000 == [] 1075 | call vimclojure#ReportError( 1076 | \ "Could not determine the Namespace of the file.\n\n" 1077 | \ . "This might have different reasons. Please check, that the ng server\n" 1078 | \ . "is running with the correct classpath and that the file does not contain\n" 1079 | \ . "syntax errors. The interactive features will not be enabled, ie. the\n" 1080 | \ . "keybindings will not be mapped.\n\nReason:\n" . v:exception) 1081 | endif 1082 | endtry 1083 | endif 1084 | endif 1085 | endif 1086 | endfunction 1087 | 1088 | function! vimclojure#AddToLispWords(word) 1089 | execute "setlocal lw+=" . a:word 1090 | endfunction 1091 | 1092 | function! vimclojure#ToggleParenRainbow() 1093 | highlight clear clojureParen1 1094 | highlight clear clojureParen2 1095 | highlight clear clojureParen3 1096 | highlight clear clojureParen4 1097 | highlight clear clojureParen5 1098 | highlight clear clojureParen6 1099 | highlight clear clojureParen7 1100 | highlight clear clojureParen8 1101 | highlight clear clojureParen9 1102 | 1103 | let g:vimclojure#ParenRainbow = !g:vimclojure#ParenRainbow 1104 | 1105 | if g:vimclojure#ParenRainbow != 0 1106 | if &background == "dark" 1107 | highlight clojureParen1 ctermfg=yellow guifg=orange1 1108 | highlight clojureParen2 ctermfg=green guifg=yellow1 1109 | highlight clojureParen3 ctermfg=cyan guifg=greenyellow 1110 | highlight clojureParen4 ctermfg=magenta guifg=green1 1111 | highlight clojureParen5 ctermfg=red guifg=springgreen1 1112 | highlight clojureParen6 ctermfg=yellow guifg=cyan1 1113 | highlight clojureParen7 ctermfg=green guifg=slateblue1 1114 | highlight clojureParen8 ctermfg=cyan guifg=magenta1 1115 | highlight clojureParen9 ctermfg=magenta guifg=purple1 1116 | else 1117 | highlight clojureParen1 ctermfg=darkyellow guifg=orangered3 1118 | highlight clojureParen2 ctermfg=darkgreen guifg=orange2 1119 | highlight clojureParen3 ctermfg=blue guifg=yellow3 1120 | highlight clojureParen4 ctermfg=darkmagenta guifg=olivedrab4 1121 | highlight clojureParen5 ctermfg=red guifg=green4 1122 | highlight clojureParen6 ctermfg=darkyellow guifg=paleturquoise3 1123 | highlight clojureParen7 ctermfg=darkgreen guifg=deepskyblue4 1124 | highlight clojureParen8 ctermfg=blue guifg=darkslateblue 1125 | highlight clojureParen9 ctermfg=darkmagenta guifg=darkviolet 1126 | endif 1127 | else 1128 | highlight link clojureParen1 clojureParen0 1129 | highlight link clojureParen2 clojureParen0 1130 | highlight link clojureParen3 clojureParen0 1131 | highlight link clojureParen4 clojureParen0 1132 | highlight link clojureParen5 clojureParen0 1133 | highlight link clojureParen6 clojureParen0 1134 | highlight link clojureParen7 clojureParen0 1135 | highlight link clojureParen8 clojureParen0 1136 | highlight link clojureParen9 clojureParen0 1137 | endif 1138 | endfunction 1139 | 1140 | " Epilog 1141 | let &cpo = s:save_cpo 1142 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/autoload/vimclojure/util.vim: -------------------------------------------------------------------------------- 1 | " Part of Vim filetype plugin for Clojure 2 | " Language: Clojure 3 | " Maintainer: Meikel Brandmeyer 4 | 5 | let s:save_cpo = &cpo 6 | set cpo&vim 7 | 8 | function! vimclojure#util#SynIdName() 9 | return synIDattr(synID(line("."), col("."), 0), "name") 10 | endfunction 11 | 12 | function! vimclojure#util#WithSaved(closure) 13 | let v = a:closure.save() 14 | try 15 | let r = a:closure.f() 16 | finally 17 | call a:closure.restore(v) 18 | endtry 19 | return r 20 | endfunction 21 | 22 | function! s:SavePosition() dict 23 | let [ _b, l, c, _o ] = getpos(".") 24 | let b = bufnr("%") 25 | return [b, l, c] 26 | endfunction 27 | 28 | function! s:RestorePosition(value) dict 29 | let [b, l, c] = a:value 30 | 31 | if bufnr("%") != b 32 | execute b "buffer!" 33 | endif 34 | call setpos(".", [0, l, c, 0]) 35 | endfunction 36 | 37 | function! vimclojure#util#WithSavedPosition(closure) 38 | let a:closure.save = function("s:SavePosition") 39 | let a:closure.restore = function("s:RestorePosition") 40 | 41 | return vimclojure#util#WithSaved(a:closure) 42 | endfunction 43 | 44 | function! s:SaveRegister(reg) 45 | return [a:reg, getreg(a:reg, 1), getregtype(a:reg)] 46 | endfunction 47 | 48 | function! s:SaveRegisters() dict 49 | return map([self._register, "", "/", "-", 50 | \ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], 51 | \ "s:SaveRegister(v:val)") 52 | endfunction 53 | 54 | function! s:RestoreRegisters(registers) dict 55 | for register in a:registers 56 | call call(function("setreg"), register) 57 | endfor 58 | endfunction 59 | 60 | function! vimclojure#util#WithSavedRegister(reg, closure) 61 | let a:closure._register = a:reg 62 | let a:closure.save = function("s:SaveRegisters") 63 | let a:closure.restore = function("s:RestoreRegisters") 64 | 65 | return vimclojure#util#WithSaved(a:closure) 66 | endfunction 67 | 68 | function! s:SaveOption() dict 69 | return eval("&" . self._option) 70 | endfunction 71 | 72 | function! s:RestoreOption(value) dict 73 | execute "let &" . self._option . " = a:value" 74 | endfunction 75 | 76 | function! vimclojure#util#WithSavedOption(option, closure) 77 | let a:closure._option = a:option 78 | let a:closure.save = function("s:SaveOption") 79 | let a:closure.restore = function("s:RestoreOption") 80 | 81 | return vimclojure#util#WithSaved(a:closure) 82 | endfunction 83 | 84 | function! s:DoYank() dict 85 | silent execute self.yank 86 | return getreg(self.reg) 87 | endfunction 88 | 89 | function! vimclojure#util#Yank(r, how) 90 | let closure = { 91 | \ 'reg': a:r, 92 | \ 'yank': a:how, 93 | \ 'f': function("s:DoYank") 94 | \ } 95 | 96 | return vimclojure#util#WithSavedRegister(a:r, closure) 97 | endfunction 98 | 99 | function! vimclojure#util#MoveBackward() 100 | call search('\S', 'Wb') 101 | endfunction 102 | 103 | function! vimclojure#util#MoveForward() 104 | call search('\S', 'W') 105 | endfunction 106 | 107 | " Epilog 108 | let &cpo = s:save_cpo 109 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/bin/clj: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) Stephen C. Gilardi. All rights reserved. The use and 4 | # distribution terms for this software are covered by the Eclipse Public 5 | # License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be 6 | # found in the file epl-v10.html at the root of this distribution. By 7 | # using this software in any fashion, you are agreeing to be bound by the 8 | # terms of this license. You must not remove this notice, or any other, 9 | # from this software. 10 | # 11 | # clj-env-dir Launches Clojure, passing along command line arguments. This 12 | # launcher can be configured using environment variables and 13 | # makes it easy to include directories full of classpath roots 14 | # in CLASSPATH. 15 | # 16 | # scgilardi (gmail) 17 | # Created 7 January 2009 18 | # 19 | # Modified to read in an optional .clojure file in the current directory 20 | # naming further items for the CLASSPATH. 21 | # 22 | # Meikel Brandmeyer (mb ? kotka ! de) 23 | # Frankfurt am Main, 21.08.2009 24 | # 25 | # Environment variables (optional): 26 | # 27 | # CLOJURE_EXT Colon-delimited list of paths to directories whose top-level 28 | # contents are (either directly or as symbolic links) jar 29 | # files and/or directories whose paths will be in Clojure's 30 | # classpath. The value of the CLASSPATH environment variable 31 | # for Clojure will include these top-level paths followed by 32 | # the previous value of CLASSPATH (if any). 33 | # default: 34 | # example: /usr/local/share/clojure/ext:$HOME/.clojure.d/ext 35 | # 36 | # CLOJURE_JAVA The command to launch a JVM instance for Clojure 37 | # default: java 38 | # example: /usr/local/bin/java6 39 | # 40 | # CLOJURE_OPTS Java options for this JVM instance 41 | # default: 42 | # example:"-Xms32M -Xmx128M -server" 43 | # 44 | # CLOJURE_MAIN The Java class to launch 45 | # default: clojure.main 46 | # example: clojure.contrib.repl_ln 47 | 48 | set -o errexit 49 | #set -o nounset 50 | #set -o xtrace 51 | 52 | if [ -n "${CLOJURE_EXT:-}" ]; then 53 | OLD="$IFS" 54 | IFS=":" 55 | EXT="$(find -H ${CLOJURE_EXT} -mindepth 1 -maxdepth 1 -print0 | tr \\0 \:)" 56 | IFS="$OLD" 57 | if [ -n "${CLASSPATH:-}" ]; then 58 | CLASSPATH="${EXT}${CLASSPATH}" 59 | else 60 | CLASSPATH="${EXT%:}" 61 | fi 62 | fi 63 | 64 | if [ -f .clojure ]; then 65 | for path in `cat .clojure`; do 66 | if [ -n "${CLASSPATH:-}" ]; then 67 | CLASSPATH="${path}:${CLASSPATH}" 68 | else 69 | CLASSPATH="${path%:}" 70 | fi 71 | done 72 | fi 73 | 74 | export CLASSPATH 75 | 76 | JAVA=${CLOJURE_JAVA:-java} 77 | OPTS=${CLOJURE_OPTS:-} 78 | MAIN=${CLOJURE_MAIN:-clojure.main} 79 | 80 | exec ${JAVA} ${OPTS} ${MAIN} "$@" 81 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/bin/clj.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM # Copyright (c) Stephen C. Gilardi. All rights reserved. The use and 4 | REM # distribution terms for this software are covered by the Eclipse Public 5 | REM # License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be 6 | REM # found in the file epl-v10.html at the root of this distribution. By 7 | REM # using this software in any fashion, you are agreeing to be bound by the 8 | REM # terms of this license. You must not remove this notice, or any other, 9 | REM # from this software. 10 | REM # 11 | REM # scgilardi (gmail) 12 | REM # Created 7 January 2009 13 | REM # 14 | REM # Modified by Justin Johnson to run on Windows 15 | REM # and to include a check for .clojure file in the current directory. 16 | REM # 17 | REM # Environment variables: 18 | REM # 19 | REM # Optional: 20 | REM # 21 | REM # CLOJURE_EXT The path to a directory containing (either directly or as 22 | REM # symbolic links) jar files and/or directories whose paths 23 | REM # should be in Clojure's classpath. The value of the 24 | REM # CLASSPATH environment variable for Clojure will be a list 25 | REM # of these paths followed by the previous value of CLASSPATH 26 | REM # (if any). 27 | REM # 28 | REM # CLOJURE_JAVA The command to launch a JVM instance for Clojure 29 | REM # default: java 30 | REM # example: /usr/local/bin/java6 31 | REM # 32 | REM # CLOJURE_OPTS Java options for this JVM instance 33 | REM # default: 34 | REM # example:"-Xms32M -Xmx128M -server" 35 | REM # 36 | REM # Configuration files: 37 | REM # 38 | REM # Optional: 39 | REM # 40 | REM # .clojure A file sitting in the directory where you invoke ng-server. 41 | REM # Each line contains a single path that should be added to the classpath. 42 | REM # 43 | 44 | SETLOCAL ENABLEDELAYEDEXPANSION 45 | 46 | REM # Add all jar files from CLOJURE_EXT directory to classpath 47 | IF DEFINED CLOJURE_EXT FOR %%E IN ("%CLOJURE_EXT%\*") DO SET CP=!CP!;%%~fE 48 | 49 | IF NOT DEFINED CLOJURE_JAVA SET CLOJURE_JAVA=java 50 | 51 | REM # If the current directory has a .clojure file in it, add each path 52 | REM # in the file to the classpath. 53 | IF EXIST .clojure FOR /F %%E IN (.clojure) DO SET CP=!CP!;%%~fE 54 | 55 | %CLOJURE_JAVA% %CLOJURE_OPTS% -cp "%CP%" clojure.main %1 %2 %3 %4 %5 %6 %7 %8 %9 56 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/bin/ng-server: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # Copyright (c) Stephen C. Gilardi. All rights reserved. The use and 4 | # distribution terms for this software are covered by the Eclipse Public 5 | # License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be 6 | # found in the file epl-v10.html at the root of this distribution. By 7 | # using this software in any fashion, you are agreeing to be bound by the 8 | # terms of this license. You must not remove this notice, or any other, 9 | # from this software. 10 | # 11 | # clj-env-dir Launches Clojure, passing along command line arguments. This 12 | # launcher can be configured using environment variables and 13 | # makes it easy to include directories full of classpath roots 14 | # in CLASSPATH. 15 | # 16 | # scgilardi (gmail) 17 | # Created 7 January 2009 18 | # 19 | # Modified to act as launcher for the Nailgun server and to read in an 20 | # optional .clojure file in the current directory naming further items 21 | # for the CLASSPATH. 22 | # 23 | # Meikel Brandmeyer (mb ? kotka ! de) 24 | # Frankfurt am Main, 21.08.2009 25 | # 26 | # Environment variables (optional): 27 | # 28 | # CLOJURE_EXT Colon-delimited list of paths to directories whose top-level 29 | # contents are (either directly or as symbolic links) jar 30 | # files and/or directories whose paths will be in Clojure's 31 | # classpath. The value of the CLASSPATH environment variable 32 | # for Clojure will include these top-level paths followed by 33 | # the previous value of CLASSPATH (if any). 34 | # default: 35 | # example: /usr/local/share/clojure/ext:$HOME/.clojure.d/ext 36 | # 37 | # CLOJURE_JAVA The command to launch a JVM instance for Clojure 38 | # default: java 39 | # example: /usr/local/bin/java6 40 | # 41 | # CLOJURE_OPTS Java options for this JVM instance 42 | # default: 43 | # example:"-Xms32M -Xmx128M -server" 44 | # 45 | # .clojure A file in the current directory. Every line names an item 46 | # which will be added to the CLASSPATH. 47 | 48 | set -o errexit 49 | #set -o nounset 50 | #set -o xtrace 51 | 52 | if [ -n "${CLOJURE_EXT:-}" ]; then 53 | OLD="$IFS" 54 | IFS=":" 55 | EXT="$(find -H ${CLOJURE_EXT} -mindepth 1 -maxdepth 1 -print0 | tr \\0 \:)" 56 | IFS="$OLD" 57 | if [ -n "${CLASSPATH:-}" ]; then 58 | export CLASSPATH="${EXT}${CLASSPATH}" 59 | else 60 | export CLASSPATH="${EXT%:}" 61 | fi 62 | fi 63 | 64 | if [ -f .clojure ]; then 65 | for path in `cat .clojure`; do 66 | if [ -n "${CLASSPATH:-}" ]; then 67 | export CLASSPATH="${path}:${CLASSPATH}" 68 | else 69 | export CLASSPATH="${path%:}" 70 | fi 71 | done 72 | fi 73 | 74 | JAVA=${CLOJURE_JAVA:-java} 75 | OPTS=${CLOJURE_OPTS:-} 76 | 77 | exec ${JAVA} ${OPTS} vimclojure.nailgun.NGServer 127.0.0.1 "$@" 78 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/bin/ng-server.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM # Copyright (c) Stephen C. Gilardi. All rights reserved. The use and 4 | REM # distribution terms for this software are covered by the Eclipse Public 5 | REM # License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be 6 | REM # found in the file epl-v10.html at the root of this distribution. By 7 | REM # using this software in any fashion, you are agreeing to be bound by the 8 | REM # terms of this license. You must not remove this notice, or any other, 9 | REM # from this software. 10 | REM # 11 | REM # scgilardi (gmail) 12 | REM # Created 7 January 2009 13 | REM # 14 | REM # Modified by Justin Johnson to act as Windows 15 | REM # launcher for the Nailgun server of VimClojure, and to include a check for 16 | REM # a .clojure file in the current directory. 17 | REM # 18 | REM # Environment variables: 19 | REM # 20 | REM # Optional: 21 | REM # 22 | REM # CLOJURE_EXT The path to a directory containing (either directly or as 23 | REM # symbolic links) jar files and/or directories whose paths 24 | REM # should be in Clojure's classpath. The value of the 25 | REM # CLASSPATH environment variable for Clojure will be a list 26 | REM # of these paths followed by the previous value of CLASSPATH 27 | REM # (if any). 28 | REM # 29 | REM # CLOJURE_JAVA The command to launch a JVM instance for Clojure 30 | REM # default: java 31 | REM # example: /usr/local/bin/java6 32 | REM # 33 | REM # CLOJURE_OPTS Java options for this JVM instance 34 | REM # default: 35 | REM # example:"-Xms32M -Xmx128M -server" 36 | REM # 37 | REM # Configuration files: 38 | REM # 39 | REM # Optional: 40 | REM # 41 | REM # .clojure A file sitting in the directory where you invoke ng-server. 42 | REM # Each line contains a single path that should be added to the classpath. 43 | REM # 44 | 45 | SETLOCAL ENABLEDELAYEDEXPANSION 46 | 47 | REM # Add all jar files from CLOJURE_EXT directory to classpath 48 | IF DEFINED CLOJURE_EXT FOR %%E IN ("%CLOJURE_EXT%\*") DO SET CP=!CP!;%%~fE 49 | 50 | IF NOT DEFINED CLOJURE_JAVA SET CLOJURE_JAVA=java 51 | 52 | REM # If the current directory has a .clojure file in it, add each path 53 | REM # in the file to the classpath. 54 | IF EXIST .clojure FOR /F %%E IN (.clojure) DO SET CP=!CP!;%%~fE 55 | 56 | REM # Since we do not provide any security we at least bind only to the loopback. 57 | %CLOJURE_JAVA% %CLOJURE_OPTS% -cp "%CP%" vimclojure.nailgun.NGServer 127.0.0.1 %1 %2 %3 %4 %5 %6 %7 %8 %9 58 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/doc/clojure.txt: -------------------------------------------------------------------------------- 1 | *vimclojure.txt* *clojure.vim* 2 | 3 | VimClojure - A Clojure Environment 4 | ================================== 5 | 6 | Introduction 7 | ------------ 8 | 9 | VimClojure is a filetype plugin and development environment for Clojure. It 10 | provides indenting, syntax highlighting and – if configured – interactive 11 | features like omni completion, documentation lookup and a Repl running in a 12 | Vim buffer. 13 | 14 | Nailgun Server *clj-nailgun-server* 15 | -------------- 16 | 17 | To use the interactive part you have to start the nailgun server via the jar 18 | file. Make sure, that clojure and clojure-contrib are in your classpath and 19 | start the vimclojure.nailgun.NGServer class. Example invocation: 20 | > 21 | java -cp clojure.jar:clojure-contrib.jar:vimclojure.jar vimclojure.nailgun.NGServer 127.0.0.1 22 | < 23 | This may look different depending on your system. 24 | 25 | You can stop the server by invoking the nailgun client with the ng-stop 26 | argument. 27 | > 28 | ng ng-stop 29 | < 30 | Set the vimclojure#WantNailgun variable in your vimrc. 31 | > 32 | let vimclojure#WantNailgun = 1 33 | < 34 | The actual server to connect to and the port of said server can be given 35 | via configuration variables. The defaults are: 36 | > 37 | let vimclojure#NailgunServer = "127.0.0.1" 38 | let vimclojure#NailgunPort = "2113" 39 | < 40 | Note: Should there be an error when executing an interactive command 41 | and the error message goes away to quickly, you can use |:messages| to 42 | recall the message and read it conveniently without time pressure. 43 | 44 | VimClojure might pop up windows, like the preview window or the Repl. 45 | The place where this is done may be controlled with the SplitPos variable. 46 | Possible values are "left", "right", "top" and "bottom". The default is 47 | "top". 48 | 49 | Example: 50 | > 51 | let vimclojure#SplitPos = "left" 52 | < 53 | It is also possible to specify the size of the new window. The size is 54 | specified in lines/columns. 55 | > 56 | let vimclojure#SplitSize = 10 57 | < 58 | 59 | Errors 60 | ------ 61 | 62 | Errors are reported in a temporary buffer. This is to make error messages 63 | more readable. In particular when they contain stacktraces from the Java 64 | side. However this may interfer with scripts which do not expect that a 65 | new buffer pops up. So one can go back to the old behaviour. 66 | > 67 | let vimclojure#UseErrorBuffer = 0 68 | < 69 | Note: the error might not be shown by vim. Check the output of |:message| 70 | for errors. 71 | 72 | Syntax Highlighting *ft-clj-syntax* 73 | ------------------- 74 | 75 | The clojure syntax highlighting provides several options: 76 | > 77 | g:vimclojure#HighlightBuiltins 78 | If it is nonzero, then Clojure's builtin functions are 79 | highlighted. This useful to distuingish macros and special 80 | forms from functions. Enabled by default. 81 | 82 | g:vimclojure#ParenRainbow 83 | Controls the colorisation of the differing levels of 84 | parenthesisation. If non-zero, different levels will be 85 | colored differently. Disabled by default. 86 | 87 | g:vimclojure#DynamicHighlighting 88 | Uses the dynamic features of VimClojure to dynamically add 89 | the symbols of required and used namespaces. The file needs 90 | to be correct (ie. w/o syntax errors and on the classpath) 91 | for this to work. If this is not the case, dynamic 92 | highlighting is not done. Disabled by default. 93 | < 94 | The g:vimclojure#ParenRainbow option provides 10 levels of individual 95 | colorisation for the parentheses. Because of the quantity of colorisation 96 | levels, unlike non-rainbow highlighting, the rainbow mode specifies its 97 | highlighting using ctermfg and guifg, thereby bypassing the usual colorscheme 98 | control using standard highlighting groups. The actual highlighting used 99 | depends on the dark/bright setting (see |'bg'|). 100 | 101 | To customise the paren rainbow colors provide a from levels to the desired 102 | color definitions. 103 | > 104 | let vimclojure#ParenRainbowColors = { 105 | \ '1': 'guifg=green', 106 | \ ... 107 | \ } 108 | < 109 | This will be used for all settings of 'bg'. If you want to specify only 110 | for light resp. dark backgrounds, just add "Light" resp. "Dark" to the 111 | option name. 112 | 113 | Indenting *ft-clj-indent* 114 | --------- 115 | 116 | VimClojure provides the (hopefully) correct indentation rules for 117 | the standard forms and macros. However user code might define also 118 | forms for which the indentation should follow the indentation according 119 | to the 'lispwords' option. The names of these forms often follow a 120 | pattern like "defsomething" or "with-something". 121 | 122 | By setting the fuzzy indent option, you can tell VimClojure, that you 123 | want names matching a fuzzy indent pattern to be indented as if they 124 | were included in the 'lispwords' option. 125 | > 126 | let vimclojure#FuzzyIndent = 1 127 | < 128 | This option is disabled by default. 129 | 130 | Custom fuzzy indent patterns may be specified as normal regular expressions 131 | in the corresponding option. The patterns are matched against the leading 132 | symbol of the form in a way to ignore namespace aliases. The default 133 | patterns are “def.*”, “with.*” and “let.*”. 134 | 135 | For example, consider working a lot with core.logic. Then you may specify 136 | eg. “fresh” in .vim/after/ftplugin/clojure.vim. 137 | > 138 | let vimclojure#FuzzyIndentPatterns .= ",fresh" 139 | < 140 | Note: this is a normal variable. So you have to use “.=” rather than 141 | “+=” and the comma separator has to be given explicitly. 142 | 143 | To be able to properly indent a given line there is some searching 144 | necessary to determine the surroundings of the cursor. In big files 145 | this my result in a slow down when entering a new line. So there is 146 | an option to basically limit the horizon which is searched for the 147 | indentation to synchronise. By default this is 100 lines backwards in 148 | the file. However you may specify whatever value works best for you. 149 | Higher values mean more searching. 150 | > 151 | let vimclojure#SearchThreshold = 100 152 | < 153 | 154 | Preview Window 155 | -------------- 156 | 157 | Many of the below mentioned commands open the so called preview window. 158 | It displays information obtained from the lookup functions and the omni 159 | completion. You may close the preview window with p. 160 | 161 | Note: The preview window sometimes doesn't not adhere to the SplitPos 162 | variable. This is the case, eg. for omni completion. It happens when 163 | the preview window is created by Vim and not by VimClojure itself. At 164 | the moment, I don't know how to fix this. 165 | 166 | Keybindings 167 | ----------- 168 | 169 | Note: is a Vim feature. More information can be found 170 | under the |maplocalleader| help topic. 171 | 172 | You can redefine any key mapping using some autocommand in your .vimrc file. 173 | All mappings use so-called Plugs. Simply prepend "Clojure" to the given 174 | Plug name, append a "." and your setting will override the default mapping. 175 | > 176 | aucmd BufRead,BufNewFile *.clj nmap xyz ClojureEvalToplevel. 177 | < 178 | To inhibit all mappings set the global flag to zero: 179 | > 180 | let vimclojure#SetupKeyMap = 0 181 | < 182 | To inhibit only single mappings append the plug name: 183 | > 184 | let vimclojure#SetupKeyMapEvalToplevel = 0 185 | < 186 | To enable only single mappings first turn off all flags, and then 187 | whitelist the ones you want to be enabled: 188 | > 189 | let vimclojure#SetupKeyMap = 0 190 | let vimclojure#SetupKeyMapEvalToplevel = 1 191 | < 192 | Whatever setting: it will still honor any key mapping made by yourself. 193 | 194 | et *et* *EvalToplevel* 195 | Send off the toplevel sexpression currently 196 | containing the cursor to the Clojure server. 197 | 198 | ef *ef* *EvalFile* 199 | Send off the current file to the Clojure Server. 200 | 201 | eb *eb* *EvalBlock* 202 | Send off the the mark visual block to the 203 | Clojure server. Obviously this mapping is only 204 | active in visual mode. 205 | Note: This does not check for structure. 206 | 207 | el *el* *EvalLine* 208 | Send off the current line to the Clojure Server. 209 | Note: This does not check for structure. 210 | 211 | ep *ep* *EvalParagraph* 212 | Send off the current paragraph to the Clojure Server. 213 | Note: This does not check for structure. 214 | 215 | rf *rf* *RequireFile* 216 | Require the namespace of the current file with 217 | the :reload flag. Note: For this to work with 218 | a remote Clojure server, the files have to put in 219 | place before issuing the command, eg. via scp 220 | or NFS. 221 | 222 | rF *rF* *RequireFileAll* 223 | Require the namespace of the current file with 224 | the :reload-all flag. Note: For this to work with 225 | a remote Clojure server, the files have to put in 226 | place before issuing the command, eg. via scp 227 | or NFS. 228 | 229 | rt *rt* *RunTests* 230 | Require the namespace of the filename with the 231 | :reload flag. Then use clojure.contrib.test-is 232 | to run the tests of the namespace via run-tests. 233 | Note: For this to work with a remote Clojure 234 | server, the files have to put in place before 235 | issuing the command, eg. via scp or NFS. 236 | 237 | me *me* *MacroExpand* 238 | Expand the innermost sexpression currently 239 | containing the cursor using macroexpand. 240 | 241 | m1 *m1* *MacroExpand1* 242 | Same as MacroExpand, but use macroexpand-1. 243 | 244 | 245 | lw *lw* *DocLookupWord* 246 | Lookup up the word under the cursor and print 247 | the documentation for it via (doc). 248 | 249 | li *li* *DocLookupInteractive* 250 | Lookup the documentation of an arbitrary word. 251 | The user is prompted for input. 252 | 253 | fd *fd* *FindDoc* 254 | Find a the documentation for a given pattern 255 | with (find-doc). The user is prompted for input. 256 | 257 | jw *jw* *JavadocLookupWord* 258 | Open the javadoc for the word under the cursor 259 | in an external browser. 260 | 261 | ji *ji* *JavadocLookupInteractive* 262 | Open the javadoc for an arbitrary word in an 263 | external browser. The user is prompted for input. 264 | 265 | sw *sw* *SourceLookupWord* 266 | Show a read-only view of the source the word under 267 | the cursor. For this to work, the source must be 268 | available in the Classpath or as a file (depending 269 | on how the source was loaded). 270 | 271 | si *si* *SourceLookupInteractive* 272 | Show a read-only view of the source of an arbitrary 273 | word. For this to work, the source must be available 274 | in the Classpath or as a file (depending on how the 275 | source was loaded). 276 | 277 | gw *gw* *GotoSourceWord* 278 | Goto the source of the word under the cursor. For this 279 | to work, the source must be available in a directory 280 | of the |'path'| option. The directories in the 281 | CLOJURE_SOURCE_DIRS environment variable will be added 282 | to the |'path'| setting. 283 | 284 | gi *gi* *GotoSourceInteractive* 285 | Goto the source of an arbitrary word. For this to work, 286 | the source must be available in a directory of the 287 | |'path'| option. The directories in the 288 | CLOJURE_SOURCE_DIRS environment variable will be added 289 | to the |'path'| setting. 290 | 291 | mw *mw* *MetaLookupWord* 292 | Lookup the meta data of the word under the cursor. 293 | 294 | mi *mi* *MetaLookupInteractive* 295 | Lookup the meta data of an arbitrary word. The 296 | user is prompted for input. 297 | 298 | sr *sr* *StartRepl* 299 | Start a new Vim Repl in a fresh buffer. There 300 | might be multiple Repls at the same time. 301 | 302 | sR *sR* *StartLocalRepl* 303 | Start a new Vim Repl in a fresh buffer. Initialise 304 | the namespace to be the namespace of the current 305 | buffer. Note: this will 'require' the namespace! 306 | 307 | The following key mappings are also supported if the dynamic features are 308 | turned off. 309 | 310 | aw *aw* *AddToLispWords* 311 | Add the word under the cursor to the lispwords option 312 | of the buffer. This modifies the way the form is 313 | indented. 314 | 315 | tr *tr* *ToggleParenRainbow* 316 | Toggle the paren rainbow option. Note: After 317 | toggling the default colors will be used. Not any 318 | customised ones. 319 | 320 | Vim Repl 321 | -------- 322 | 323 | Start a Repl via the |sr| shortcut. At the prompt just type expressions. 324 | Hitting enter will determine, whether the expression is complete and 325 | will send it to the Clojure instance. In case the expression is incomplete, 326 | eg. after "(defn foo" will result in a newline for multiline expressions. 327 | 328 | A newline will also be inserted if you are inside of the expression. The 329 | expression will only be submitted to the Repl when you hit enter after 330 | the last character of the buffer. If you are inside the expression and 331 | want to start the evaluation immediately you may use instead of 332 | the plain . 333 | 334 | Previously sent expressions may be recalled via and . 335 | Note: sending multiple expressions will save them in the same history 336 | entry. So playing back with will again send all of the contained 337 | expressions. 338 | 339 | If the current line starts with a repl prompt, the *^* command moves to 340 | the end of the prompt and to the beginning of the line. 341 | 342 | The Plugs are: 343 | - ClojureReplEnterHook. for the enter key 344 | - ClojureReplEvaluate. for immediate evaluation () 345 | - ClojureReplHatHook. for ^ navigation 346 | - ClojureReplUpHistory. for going backwards in history () 347 | - ClojureReplDownHistory. for going forwards in history () 348 | 349 | The following convenience commands are provided: 350 | 351 | - ,close - close the Repl and free the Repl resources in the server process 352 | - ,st - print a stack trace of *e as with clojure.contrib.stacktrace 353 | - ,ct - print a cause trace of *e as with clojure.contrib.stacktrace 354 | - ,toggle-pprint - toggle pretty-printing of evaluated values 355 | 356 | You can also start a Repl with the :ClojureRepl command. This command works 357 | regardless of the type of the current buffer, while the shortcuts only work in 358 | Clojure buffers. 359 | 360 | Pretty Printing 361 | --------------- 362 | 363 | In case Tom Faulhaber's cl-format package is available in the Classpath 364 | it will be used for pretty printing, eg. of macroexpansions. The Repl 365 | can be told to use pretty printing via a global Var. 366 | > 367 | (set! vimclojure.repl/*print-pretty* true) 368 | < 369 | 370 | Omni Completion 371 | --------------- 372 | 373 | VimClojure supports omni completion for Clojure code. Hitting in 374 | insert mode will try to provide completions for the item in front of the 375 | cursor. 376 | 377 | The completion tries to be somewhat intelligent in what it completes. 378 | 379 | - a word starting with an upper case letter will be completed to an 380 | imported class. 381 | Str => String, StringBuilder, ... 382 | 383 | - a word containing dots will be completed to a namespace. 384 | c.c => clojure.core, clojure.contrib.repl-utils, ... 385 | 386 | - everything else will be completed to a Var, an alias or namespace. 387 | 388 | - a word containing a slash will be handled differently 389 | - if the word starts with an upper case letter, will complete 390 | static fields of the given class 391 | String/va => String/valueOf 392 | 393 | - otherwise it is treated as a namespace or alias 394 | clojure.core/re => clojure.core/read, ... 395 | 396 | The completion uses certain characters to split the matching. This are 397 | hyphens and (for namespaces) dots. So r-s matches read-string. 398 | 399 | Note: Completion of symbols and keywords is also provided via the 400 | functionality of Vim. 401 | 402 | Known Issues 403 | ------------ 404 | 405 | There seems to be a race condition in nailgun. At the moment there is 406 | no solution to this problem. In case you get errors with valid looking 407 | input for vim, please contact me. 408 | 409 | License 410 | ------- 411 | 412 | Copyright (c) 2008-2011 Meikel Brandmeyer, Frankfurt am Main 413 | All rights reserved. 414 | 415 | Permission is hereby granted, free of charge, to any person obtaining a copy 416 | of this software and associated documentation files (the "Software"), to deal 417 | in the Software without restriction, including without limitation the rights 418 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 419 | copies of the Software, and to permit persons to whom the Software is 420 | furnished to do so, subject to the following conditions: 421 | 422 | The above copyright notice and this permission notice shall be included in 423 | all copies or substantial portions of the Software. 424 | 425 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 426 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 427 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 428 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 429 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 430 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 431 | THE SOFTWARE. 432 | ============================================================================== 433 | .. vim: set ft=help norl ts=8 tw=78 et : 434 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftdetect/clojure.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.clj set filetype=clojure 2 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin file 2 | " Language: Clojure 3 | " Maintainer: Meikel Brandmeyer 4 | 5 | " Only do this when not done yet for this buffer 6 | if exists("b:did_ftplugin") 7 | finish 8 | endif 9 | 10 | let b:did_ftplugin = 1 11 | 12 | let s:cpo_save = &cpo 13 | set cpo&vim 14 | 15 | let b:undo_ftplugin = "setlocal fo< com< cms< cpt< isk< def<" 16 | 17 | setlocal iskeyword+=?,-,*,!,+,/,=,<,>,.,: 18 | 19 | setlocal define=^\\s*(def\\(-\\|n\\|n-\\|macro\\|struct\\|multi\\)? 20 | 21 | " Set 'formatoptions' to break comment lines but not other lines, 22 | " and insert the comment leader when hitting or using "o". 23 | setlocal formatoptions-=t formatoptions+=croql 24 | setlocal commentstring=;%s 25 | 26 | " Set 'comments' to format dashed lists in comments. 27 | setlocal comments=sO:;\ -,mO:;\ \ ,n:; 28 | 29 | " Take all directories of the CLOJURE_SOURCE_DIRS environment variable 30 | " and add them to the path option. 31 | if has("win32") || has("win64") 32 | let s:delim = ";" 33 | else 34 | let s:delim = ":" 35 | endif 36 | for dir in split($CLOJURE_SOURCE_DIRS, s:delim) 37 | call vimclojure#AddPathToOption(dir . "/**", 'path') 38 | endfor 39 | 40 | " When the matchit plugin is loaded, this makes the % command skip parens and 41 | " braces in comments. 42 | let b:match_words = &matchpairs 43 | let b:match_skip = 's:comment\|string\|character' 44 | 45 | " Win32 can filter files in the browse dialog 46 | if has("gui_win32") && !exists("b:browsefilter") 47 | let b:browsefilter = "Clojure Source Files (*.clj)\t*.clj\n" . 48 | \ "Jave Source Files (*.java)\t*.java\n" . 49 | \ "All Files (*.*)\t*.*\n" 50 | endif 51 | 52 | for ns in [ "clojure.core", "clojure.inspector", "clojure.java.browse", 53 | \ "clojure.java.io", "clojure.java.javadoc", "clojure.java.shell", 54 | \ "clojure.main", "clojure.pprint", "clojure.repl", "clojure.set", 55 | \ "clojure.stacktrace", "clojure.string", "clojure.template", 56 | \ "clojure.test", "clojure.test.tap", "clojure.test.junit", 57 | \ "clojure.walk", "clojure.xml", "clojure.zip" ] 58 | call vimclojure#AddCompletions(ns) 59 | endfor 60 | 61 | " Define toplevel folding if desired. 62 | function! ClojureGetFoldingLevelWorker() dict 63 | execute self.lineno 64 | 65 | if vimclojure#util#SynIdName() =~ 'clojureParen\d' && vimclojure#util#Yank('l', 'normal! "lyl') == '(' 66 | return 1 67 | endif 68 | 69 | if searchpairpos('(', '', ')', 'bWr', 'vimclojure#util#SynIdName() !~ "clojureParen\\d"') != [0, 0] 70 | return 1 71 | endif 72 | 73 | return 0 74 | endfunction 75 | 76 | function! ClojureGetFoldingLevel(lineno) 77 | let closure = { 78 | \ 'lineno' : a:lineno, 79 | \ 'f' : function("ClojureGetFoldingLevelWorker") 80 | \ } 81 | 82 | return vimclojure#WithSavedPosition(closure) 83 | endfunction 84 | 85 | " Disabled for now. Too slow (and naive). 86 | if exists("g:clj_want_folding") && g:clj_want_folding == 1 && 0 == 1 87 | setlocal foldexpr=ClojureGetFoldingLevel(v:lnum) 88 | setlocal foldmethod=expr 89 | endif 90 | 91 | try 92 | call vimclojure#InitBuffer() 93 | catch /.*/ 94 | " We swallow a failure here. It means most likely that the 95 | " server is not running. 96 | echohl WarningMsg 97 | echomsg v:exception 98 | echohl None 99 | endtry 100 | 101 | call vimclojure#MapPlug("n", "aw", "AddToLispWords") 102 | call vimclojure#MapPlug("n", "tr", "ToggleParenRainbow") 103 | 104 | call vimclojure#MapPlug("n", "lw", "DocLookupWord") 105 | call vimclojure#MapPlug("n", "li", "DocLookupInteractive") 106 | call vimclojure#MapPlug("n", "jw", "JavadocLookupWord") 107 | call vimclojure#MapPlug("n", "ji", "JavadocLookupInteractive") 108 | call vimclojure#MapPlug("n", "fd", "FindDoc") 109 | 110 | call vimclojure#MapPlug("n", "mw", "MetaLookupWord") 111 | call vimclojure#MapPlug("n", "mi", "MetaLookupInteractive") 112 | 113 | call vimclojure#MapPlug("n", "sw", "SourceLookupWord") 114 | call vimclojure#MapPlug("n", "si", "SourceLookupInteractive") 115 | 116 | call vimclojure#MapPlug("n", "gw", "GotoSourceWord") 117 | call vimclojure#MapPlug("n", "gi", "GotoSourceInteractive") 118 | 119 | call vimclojure#MapPlug("n", "rf", "RequireFile") 120 | call vimclojure#MapPlug("n", "rF", "RequireFileAll") 121 | 122 | call vimclojure#MapPlug("n", "rt", "RunTests") 123 | 124 | call vimclojure#MapPlug("n", "me", "MacroExpand") 125 | call vimclojure#MapPlug("n", "m1", "MacroExpand1") 126 | 127 | call vimclojure#MapPlug("n", "ef", "EvalFile") 128 | call vimclojure#MapPlug("n", "el", "EvalLine") 129 | call vimclojure#MapPlug("v", "eb", "EvalBlock") 130 | call vimclojure#MapPlug("n", "et", "EvalToplevel") 131 | call vimclojure#MapPlug("n", "ep", "EvalParagraph") 132 | 133 | call vimclojure#MapPlug("n", "sr", "StartRepl") 134 | call vimclojure#MapPlug("n", "sR", "StartLocalRepl") 135 | 136 | if exists("b:vimclojure_namespace") 137 | setlocal omnifunc=vimclojure#OmniCompletion 138 | 139 | augroup VimClojure 140 | au! 141 | autocmd CursorMovedI if pumvisible() == 0 | pclose | endif 142 | augroup END 143 | endif 144 | 145 | call vimclojure#MapPlug("n", "p", "CloseResultBuffer") 146 | 147 | let &cpo = s:cpo_save 148 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.core.txt: -------------------------------------------------------------------------------- 1 | *agent* 2 | *allow-unresolved-vars* 3 | *assert* 4 | *clojure-version* 5 | *command-line-args* 6 | *compile-files* 7 | *compile-path* 8 | *err* 9 | *file* 10 | *flush-on-newline* 11 | *fn-loader* 12 | *in* 13 | *math-context* 14 | *ns* 15 | *out* 16 | *print-dup* 17 | *print-length* 18 | *print-level* 19 | *print-meta* 20 | *print-readably* 21 | *read-eval* 22 | *source-path* 23 | *unchecked-math* 24 | *use-context-classloader* 25 | *verbose-defrecords* 26 | *warn-on-reflection* 27 | ->> 28 | -cache-protocol-fn 29 | -reset-methods 30 | EMPTY-NODE 31 | accessor 32 | aclone 33 | add-classpath 34 | add-watch 35 | agent 36 | agent-error 37 | agent-errors 38 | aget 39 | alength 40 | alias 41 | all-ns 42 | alter 43 | alter-meta! 44 | alter-var-root 45 | amap 46 | ancestors 47 | and 48 | apply 49 | areduce 50 | array-map 51 | aset 52 | aset-boolean 53 | aset-byte 54 | aset-char 55 | aset-double 56 | aset-float 57 | aset-int 58 | aset-long 59 | aset-short 60 | assert 61 | assoc 62 | assoc! 63 | assoc-in 64 | associative? 65 | atom 66 | await 67 | await-for 68 | await1 69 | bases 70 | bean 71 | bigdec 72 | bigint 73 | biginteger 74 | binding 75 | bit-and 76 | bit-and-not 77 | bit-clear 78 | bit-flip 79 | bit-not 80 | bit-or 81 | bit-set 82 | bit-shift-left 83 | bit-shift-right 84 | bit-test 85 | bit-xor 86 | boolean 87 | boolean-array 88 | booleans 89 | bound-fn 90 | bound-fn* 91 | bound? 92 | butlast 93 | byte 94 | byte-array 95 | bytes 96 | case 97 | cast 98 | char 99 | char-array 100 | char-escape-string 101 | char-name-string 102 | char? 103 | chars 104 | chunk 105 | chunk-append 106 | chunk-buffer 107 | chunk-cons 108 | chunk-first 109 | chunk-next 110 | chunk-rest 111 | chunked-seq? 112 | class 113 | class? 114 | clear-agent-errors 115 | clojure-version 116 | coll? 117 | comment 118 | commute 119 | comp 120 | comparator 121 | compare 122 | compare-and-set! 123 | compile 124 | complement 125 | concat 126 | cond 127 | condp 128 | conj 129 | conj! 130 | cons 131 | constantly 132 | construct-proxy 133 | contains? 134 | count 135 | counted? 136 | create-ns 137 | create-struct 138 | cycle 139 | dec 140 | dec' 141 | decimal? 142 | declare 143 | definline 144 | definterface 145 | defmacro 146 | defmethod 147 | defmulti 148 | defn 149 | defn- 150 | defonce 151 | defprotocol 152 | defrecord 153 | defstruct 154 | deftype 155 | delay 156 | delay? 157 | deliver 158 | denominator 159 | deref 160 | derive 161 | descendants 162 | destructure 163 | disj 164 | disj! 165 | dissoc 166 | dissoc! 167 | distinct 168 | distinct? 169 | doall 170 | dorun 171 | doseq 172 | dosync 173 | dotimes 174 | doto 175 | double 176 | double-array 177 | doubles 178 | drop 179 | drop-last 180 | drop-while 181 | empty 182 | empty? 183 | ensure 184 | enumeration-seq 185 | error-handler 186 | error-mode 187 | eval 188 | even? 189 | every-pred 190 | every? 191 | extend 192 | extend-protocol 193 | extend-type 194 | extenders 195 | extends? 196 | false? 197 | ffirst 198 | file-seq 199 | filter 200 | find 201 | find-keyword 202 | find-ns 203 | find-protocol-impl 204 | find-protocol-method 205 | find-var 206 | first 207 | flatten 208 | float 209 | float-array 210 | float? 211 | floats 212 | flush 213 | fn? 214 | fnext 215 | fnil 216 | for 217 | force 218 | format 219 | frequencies 220 | future 221 | future-call 222 | future-cancel 223 | future-cancelled? 224 | future-done? 225 | future? 226 | gen-class 227 | gen-interface 228 | gensym 229 | get 230 | get-in 231 | get-method 232 | get-proxy-class 233 | get-thread-bindings 234 | get-validator 235 | group-by 236 | hash 237 | hash-combine 238 | hash-map 239 | hash-set 240 | identical? 241 | identity 242 | if-let 243 | if-not 244 | ifn? 245 | import 246 | in-ns 247 | inc 248 | inc' 249 | init-proxy 250 | instance? 251 | int 252 | int-array 253 | integer? 254 | interleave 255 | intern 256 | interpose 257 | into 258 | into-array 259 | ints 260 | io! 261 | isa? 262 | iterate 263 | iterator-seq 264 | juxt 265 | keep 266 | keep-indexed 267 | key 268 | keys 269 | keyword 270 | keyword? 271 | last 272 | lazy-cat 273 | lazy-seq 274 | let 275 | letfn 276 | line-seq 277 | list 278 | list* 279 | list? 280 | load 281 | load-file 282 | load-reader 283 | load-string 284 | loaded-libs 285 | locking 286 | long 287 | long-array 288 | longs 289 | loop 290 | macroexpand 291 | macroexpand-1 292 | make-array 293 | make-hierarchy 294 | map 295 | map-indexed 296 | map? 297 | mapcat 298 | max 299 | max-key 300 | memfn 301 | memoize 302 | merge 303 | merge-with 304 | meta 305 | method-sig 306 | methods 307 | min 308 | min-key 309 | mod 310 | munge 311 | name 312 | namespace 313 | namespace-munge 314 | neg? 315 | newline 316 | next 317 | nfirst 318 | nil? 319 | nnext 320 | not 321 | not-any? 322 | not-empty 323 | not-every? 324 | not= 325 | ns-aliases 326 | ns-imports 327 | ns-interns 328 | ns-map 329 | ns-name 330 | ns-publics 331 | ns-refers 332 | ns-resolve 333 | ns-unalias 334 | ns-unmap 335 | nth 336 | nthnext 337 | num 338 | number? 339 | numerator 340 | object-array 341 | odd? 342 | parents 343 | partial 344 | partition 345 | partition-all 346 | partition-by 347 | pcalls 348 | peek 349 | persistent! 350 | pmap 351 | pop 352 | pop! 353 | pop-thread-bindings 354 | pos? 355 | pr-str 356 | prefer-method 357 | prefers 358 | primitives-classnames 359 | print 360 | print-ctor 361 | print-dup 362 | print-method 363 | print-simple 364 | print-str 365 | printf 366 | println 367 | println-str 368 | prn 369 | prn-str 370 | promise 371 | proxy 372 | proxy-call-with-super 373 | proxy-mappings 374 | proxy-name 375 | proxy-super 376 | push-thread-bindings 377 | pvalues 378 | quot 379 | rand 380 | rand-int 381 | rand-nth 382 | range 383 | ratio? 384 | rational? 385 | rationalize 386 | re-find 387 | re-groups 388 | re-matcher 389 | re-matches 390 | re-pattern 391 | re-seq 392 | read 393 | read-line 394 | read-string 395 | realized? 396 | reduce 397 | reductions 398 | ref 399 | ref-history-count 400 | ref-max-history 401 | ref-min-history 402 | ref-set 403 | refer 404 | refer-clojure 405 | reify 406 | release-pending-sends 407 | rem 408 | remove 409 | remove-all-methods 410 | remove-method 411 | remove-ns 412 | remove-watch 413 | repeat 414 | repeatedly 415 | replace 416 | replicate 417 | require 418 | reset! 419 | reset-meta! 420 | resolve 421 | rest 422 | restart-agent 423 | resultset-seq 424 | reverse 425 | reversible? 426 | rseq 427 | rsubseq 428 | satisfies? 429 | second 430 | select-keys 431 | send 432 | send-off 433 | seq 434 | seq? 435 | seque 436 | sequence 437 | sequential? 438 | set 439 | set-error-handler! 440 | set-error-mode! 441 | set-validator! 442 | set? 443 | short 444 | short-array 445 | shorts 446 | shuffle 447 | shutdown-agents 448 | slurp 449 | some 450 | some-fn 451 | sort 452 | sort-by 453 | sorted-map 454 | sorted-map-by 455 | sorted-set 456 | sorted-set-by 457 | sorted? 458 | special-symbol? 459 | spit 460 | split-at 461 | split-with 462 | str 463 | string? 464 | struct 465 | struct-map 466 | subs 467 | subseq 468 | subvec 469 | supers 470 | swap! 471 | symbol 472 | symbol? 473 | sync 474 | take 475 | take-last 476 | take-nth 477 | take-while 478 | test 479 | the-ns 480 | thread-bound? 481 | time 482 | to-array 483 | to-array-2d 484 | trampoline 485 | transient 486 | tree-seq 487 | true? 488 | type 489 | unchecked-add 490 | unchecked-add-int 491 | unchecked-byte 492 | unchecked-char 493 | unchecked-dec 494 | unchecked-dec-int 495 | unchecked-divide-int 496 | unchecked-double 497 | unchecked-float 498 | unchecked-inc 499 | unchecked-inc-int 500 | unchecked-int 501 | unchecked-long 502 | unchecked-multiply 503 | unchecked-multiply-int 504 | unchecked-negate 505 | unchecked-negate-int 506 | unchecked-remainder-int 507 | unchecked-short 508 | unchecked-subtract 509 | unchecked-subtract-int 510 | underive 511 | unquote 512 | unquote-splicing 513 | update-in 514 | update-proxy 515 | use 516 | val 517 | vals 518 | var-get 519 | var-set 520 | var? 521 | vary-meta 522 | vec 523 | vector 524 | vector-of 525 | vector? 526 | when 527 | when-first 528 | when-let 529 | when-not 530 | while 531 | with-bindings 532 | with-bindings* 533 | with-in-str 534 | with-loading-context 535 | with-local-vars 536 | with-meta 537 | with-open 538 | with-out-str 539 | with-precision 540 | with-redefs 541 | with-redefs-fn 542 | xml-seq 543 | zero? 544 | zipmap 545 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.data.txt: -------------------------------------------------------------------------------- 1 | diff 2 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.inspector.txt: -------------------------------------------------------------------------------- 1 | atom? 2 | collection-tag 3 | get-child 4 | get-child-count 5 | inspect 6 | inspect-table 7 | inspect-tree 8 | is-leaf 9 | list-model 10 | list-provider 11 | old-table-model 12 | table-model 13 | tree-model 14 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.java.browse.txt: -------------------------------------------------------------------------------- 1 | *open-url-script* 2 | browse-url 3 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.java.io.txt: -------------------------------------------------------------------------------- 1 | Coercions 2 | IOFactory 3 | as-file 4 | as-relative-path 5 | as-url 6 | copy 7 | default-streams-impl 8 | delete-file 9 | file 10 | input-stream 11 | make-input-stream 12 | make-output-stream 13 | make-parents 14 | make-reader 15 | make-writer 16 | output-stream 17 | reader 18 | resource 19 | writer 20 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.java.javadoc.txt: -------------------------------------------------------------------------------- 1 | *core-java-api* 2 | *feeling-lucky* 3 | *feeling-lucky-url* 4 | *local-javadocs* 5 | *remote-javadocs* 6 | add-local-javadoc 7 | add-remote-javadoc 8 | javadoc 9 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.java.shell.txt: -------------------------------------------------------------------------------- 1 | *sh-dir* 2 | *sh-env* 3 | with-sh-dir 4 | with-sh-env 5 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.main.txt: -------------------------------------------------------------------------------- 1 | demunge 2 | load-script 3 | main 4 | repl 5 | repl-caught 6 | repl-exception 7 | repl-prompt 8 | repl-read 9 | root-cause 10 | skip-if-eol 11 | skip-whitespace 12 | stack-element-str 13 | with-bindings 14 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.pprint.txt: -------------------------------------------------------------------------------- 1 | *print-base* 2 | *print-miser-width* 3 | *print-pprint-dispatch* 4 | *print-pretty* 5 | *print-radix* 6 | *print-right-margin* 7 | *print-suppress-namespaces* 8 | cl-format 9 | code-dispatch 10 | formatter 11 | formatter-out 12 | fresh-line 13 | get-pretty-writer 14 | pprint 15 | pprint-indent 16 | pprint-logical-block 17 | pprint-newline 18 | pprint-tab 19 | print-length-loop 20 | print-table 21 | set-pprint-dispatch 22 | simple-dispatch 23 | with-pprint-dispatch 24 | write 25 | write-out 26 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.repl.txt: -------------------------------------------------------------------------------- 1 | apropos 2 | demunge 3 | dir 4 | dir-fn 5 | doc 6 | find-doc 7 | pst 8 | root-cause 9 | set-break-handler! 10 | source 11 | source-fn 12 | stack-element-str 13 | thread-stopper 14 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.set.txt: -------------------------------------------------------------------------------- 1 | difference 2 | index 3 | intersection 4 | join 5 | map-invert 6 | project 7 | rename 8 | rename-keys 9 | select 10 | subset? 11 | superset? 12 | union 13 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.stacktrace.txt: -------------------------------------------------------------------------------- 1 | print-cause-trace 2 | print-stack-trace 3 | print-throwable 4 | print-trace-element 5 | root-cause 6 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.string.txt: -------------------------------------------------------------------------------- 1 | blank? 2 | capitalize 3 | escape 4 | join 5 | lower-case 6 | replace 7 | replace-first 8 | reverse 9 | split 10 | split-lines 11 | trim 12 | trim-newline 13 | triml 14 | trimr 15 | upper-case 16 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.template.txt: -------------------------------------------------------------------------------- 1 | apply-template 2 | do-template 3 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.test.junit.txt: -------------------------------------------------------------------------------- 1 | *depth* 2 | *var-context* 3 | element-content 4 | error-el 5 | failure-el 6 | finish-case 7 | finish-element 8 | finish-suite 9 | indent 10 | junit-report 11 | message-el 12 | package-class 13 | start-case 14 | start-element 15 | start-suite 16 | suite-attrs 17 | test-name 18 | with-junit-output 19 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.test.tap.txt: -------------------------------------------------------------------------------- 1 | print-tap-diagnostic 2 | print-tap-fail 3 | print-tap-pass 4 | print-tap-plan 5 | tap-report 6 | with-tap-output 7 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.test.txt: -------------------------------------------------------------------------------- 1 | *initial-report-counters* 2 | *load-tests* 3 | *report-counters* 4 | *stack-trace-depth* 5 | *test-out* 6 | *testing-contexts* 7 | *testing-vars* 8 | are 9 | assert-any 10 | assert-expr 11 | assert-predicate 12 | compose-fixtures 13 | deftest 14 | deftest- 15 | do-report 16 | file-position 17 | function? 18 | get-possibly-unbound-var 19 | inc-report-counter 20 | join-fixtures 21 | report 22 | run-all-tests 23 | run-tests 24 | set-test 25 | successful? 26 | test-all-vars 27 | test-ns 28 | test-var 29 | testing 30 | testing-contexts-str 31 | testing-vars-str 32 | try-expr 33 | use-fixtures 34 | with-test 35 | with-test-out 36 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.walk.txt: -------------------------------------------------------------------------------- 1 | keywordize-keys 2 | macroexpand-all 3 | postwalk 4 | postwalk-demo 5 | postwalk-replace 6 | prewalk 7 | prewalk-demo 8 | prewalk-replace 9 | stringify-keys 10 | walk 11 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.xml.txt: -------------------------------------------------------------------------------- 1 | *current* 2 | *sb* 3 | *stack* 4 | *state* 5 | attrs 6 | content 7 | content-handler 8 | element 9 | emit 10 | emit-element 11 | parse 12 | startparse-sax 13 | tag 14 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/ftplugin/clojure/completions-clojure.zip.txt: -------------------------------------------------------------------------------- 1 | append-child 2 | branch? 3 | children 4 | down 5 | edit 6 | end? 7 | insert-child 8 | insert-left 9 | insert-right 10 | left 11 | leftmost 12 | lefts 13 | make-node 14 | next 15 | node 16 | path 17 | prev 18 | remove 19 | replace 20 | right 21 | rightmost 22 | rights 23 | root 24 | seq-zip 25 | vector-zip 26 | xml-zip 27 | zipper 28 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/indent/clojure.vim: -------------------------------------------------------------------------------- 1 | " Vim indent file 2 | " Language: Clojure 3 | " Maintainer: Meikel Brandmeyer 4 | " URL: http://kotka.de/projects/clojure/vimclojure.html 5 | 6 | " Only load this indent file when no other was loaded. 7 | if exists("b:did_indent") 8 | finish 9 | endif 10 | let b:did_indent = 1 11 | 12 | let s:save_cpo = &cpo 13 | set cpo&vim 14 | 15 | let b:undo_indent = "setlocal ai< si< lw< et< sts< sw< inde< indk<" 16 | 17 | setlocal noautoindent expandtab nosmartindent 18 | 19 | setlocal softtabstop=2 20 | setlocal shiftwidth=2 21 | 22 | setlocal indentkeys=!,o,O 23 | 24 | if exists("*searchpairpos") 25 | 26 | function! s:MatchPairs(open, close, stopat) 27 | " Stop only on vector and map [ resp. {. Ignore the ones in strings and 28 | " comments. 29 | if a:stopat == 0 30 | let stopat = max([line(".") - g:vimclojure#SearchThreshold, 0]) 31 | else 32 | let stopat = a:stopat 33 | endif 34 | 35 | let pos = searchpairpos(a:open, '', a:close, 'bWn', 36 | \ 'vimclojure#util#SynIdName() !~ "clojureParen\\d"', 37 | \ stopat) 38 | return [ pos[0], virtcol(pos) ] 39 | endfunction 40 | 41 | function! ClojureCheckForStringWorker() dict 42 | " Check whether there is the last character of the previous line is 43 | " highlighted as a string. If so, we check whether it's a ". In this 44 | " case we have to check also the previous character. The " might be the 45 | " closing one. In case the we are still in the string, we search for the 46 | " opening ". If this is not found we take the indent of the line. 47 | let nb = prevnonblank(v:lnum - 1) 48 | 49 | if nb == 0 50 | return -1 51 | endif 52 | 53 | call cursor(nb, 0) 54 | call cursor(0, col("$") - 1) 55 | if vimclojure#util#SynIdName() != "clojureString" 56 | return -1 57 | endif 58 | 59 | " This will not work for a " in the first column... 60 | if vimclojure#util#Yank('l', 'normal! "lyl') == '"' 61 | call cursor(0, col("$") - 2) 62 | if vimclojure#util#SynIdName() != "clojureString" 63 | return -1 64 | endif 65 | if vimclojure#util#Yank('l', 'normal! "lyl') != '\\' 66 | return -1 67 | endif 68 | call cursor(0, col("$") - 1) 69 | endif 70 | 71 | let p = searchpos('\(^\|[^\\]\)\zs"', 'bW') 72 | 73 | if p != [0, 0] 74 | return p[1] - 1 75 | endif 76 | 77 | return indent(".") 78 | endfunction 79 | 80 | function! s:CheckForString() 81 | return vimclojure#util#WithSavedPosition({ 82 | \ 'f' : function("ClojureCheckForStringWorker") 83 | \ }) 84 | endfunction 85 | 86 | function! ClojureIsMethodSpecialCaseWorker() dict 87 | " Find the next enclosing form. 88 | call vimclojure#util#MoveBackward() 89 | 90 | " Special case: we are at a '(('. 91 | if vimclojure#util#Yank('l', 'normal! "lyl') == '(' 92 | return 0 93 | endif 94 | call cursor(self.pos) 95 | 96 | let nextParen = s:MatchPairs('(', ')', 0) 97 | 98 | " Special case: we are now at toplevel. 99 | if nextParen == [0, 0] 100 | return 0 101 | endif 102 | call cursor(nextParen) 103 | 104 | call vimclojure#util#MoveForward() 105 | let keyword = vimclojure#util#Yank('l', 'normal! "lye') 106 | if index([ 'deftype', 'defrecord', 'reify', 'proxy', 107 | \ 'extend-type', 'extend-protocol', 108 | \ 'letfn' ], keyword) >= 0 109 | return 1 110 | endif 111 | 112 | return 0 113 | endfunction 114 | 115 | function! s:IsMethodSpecialCase(position) 116 | let closure = { 117 | \ 'pos': a:position, 118 | \ 'f' : function("ClojureIsMethodSpecialCaseWorker") 119 | \ } 120 | 121 | return vimclojure#util#WithSavedPosition(closure) 122 | endfunction 123 | 124 | function! GetClojureIndent() 125 | " Get rid of special case. 126 | if line(".") == 1 127 | return 0 128 | endif 129 | 130 | " We have to apply some heuristics here to figure out, whether to use 131 | " normal lisp indenting or not. 132 | let i = s:CheckForString() 133 | if i > -1 134 | return i 135 | endif 136 | 137 | call cursor(0, 1) 138 | 139 | " Find the next enclosing [ or {. We can limit the second search 140 | " to the line, where the [ was found. If no [ was there this is 141 | " zero and we search for an enclosing {. 142 | let paren = s:MatchPairs('(', ')', 0) 143 | let bracket = s:MatchPairs('\[', '\]', paren[0]) 144 | let curly = s:MatchPairs('{', '}', bracket[0]) 145 | 146 | " In case the curly brace is on a line later then the [ or - in 147 | " case they are on the same line - in a higher column, we take the 148 | " curly indent. 149 | if curly[0] > bracket[0] || curly[1] > bracket[1] 150 | if curly[0] > paren[0] || curly[1] > paren[1] 151 | return curly[1] 152 | endif 153 | endif 154 | 155 | " If the curly was not chosen, we take the bracket indent - if 156 | " there was one. 157 | if bracket[0] > paren[0] || bracket[1] > paren[1] 158 | return bracket[1] 159 | endif 160 | 161 | " There are neither { nor [ nor (, ie. we are at the toplevel. 162 | if paren == [0, 0] 163 | return 0 164 | endif 165 | 166 | " Now we have to reimplement lispindent. This is surprisingly easy, as 167 | " soon as one has access to syntax items. 168 | " 169 | " - Check whether we are in a special position after deftype, defrecord, 170 | " reify, proxy or letfn. These are special cases. 171 | " - Get the next keyword after the (. 172 | " - If its first character is also a (, we have another sexp and align 173 | " one column to the right of the unmatched (. 174 | " - In case it is in lispwords, we indent the next line to the column of 175 | " the ( + sw. 176 | " - If not, we check whether it is last word in the line. In that case 177 | " we again use ( + sw for indent. 178 | " - In any other case we use the column of the end of the word + 2. 179 | call cursor(paren) 180 | 181 | if s:IsMethodSpecialCase(paren) 182 | return paren[1] + &shiftwidth - 1 183 | endif 184 | 185 | " In case we are at the last character, we use the paren position. 186 | if col("$") - 1 == paren[1] 187 | return paren[1] 188 | endif 189 | 190 | " In case after the paren is a whitespace, we search for the next word. 191 | normal! l 192 | if vimclojure#util#Yank('l', 'normal! "lyl') == ' ' 193 | normal! w 194 | endif 195 | 196 | " If we moved to another line, there is no word after the (. We 197 | " use the ( position for indent. 198 | if line(".") > paren[0] 199 | return paren[1] 200 | endif 201 | 202 | " We still have to check, whether the keyword starts with a (, [ or {. 203 | " In that case we use the ( position for indent. 204 | let w = vimclojure#util#Yank('l', 'normal! "lye') 205 | if stridx('([{', w[0]) > 0 206 | return paren[1] 207 | endif 208 | 209 | if &lispwords =~ '\<' . w . '\>' 210 | return paren[1] + &shiftwidth - 1 211 | endif 212 | 213 | " XXX: Slight glitch here with special cases. However it's only 214 | " a heureustic. Offline we can't do more. 215 | if g:vimclojure#FuzzyIndent 216 | \ && w != 'with-meta' 217 | \ && w != 'clojure.core/with-meta' 218 | for pat in split(g:vimclojure#FuzzyIndentPatterns, ",") 219 | if w =~ '\(^\|/\)' . pat . '$' 220 | \ && w !~ '\(^\|/\)' . pat . '\*$' 221 | \ && w !~ '\(^\|/\)' . pat . '-fn$' 222 | return paren[1] + &shiftwidth - 1 223 | endif 224 | endfor 225 | endif 226 | 227 | normal! w 228 | if paren[0] < line(".") 229 | return paren[1] + &shiftwidth - 1 230 | endif 231 | 232 | normal! ge 233 | return virtcol(".") + 1 234 | endfunction 235 | 236 | setlocal indentexpr=GetClojureIndent() 237 | 238 | else 239 | 240 | " In case we have searchpairpos not available we fall back to 241 | " normal lisp indenting. 242 | setlocal indentexpr= 243 | setlocal lisp 244 | let b:undo_indent .= " lisp<" 245 | 246 | endif 247 | 248 | " Defintions: 249 | setlocal lispwords=def,def-,defn,defn-,defmacro,defmacro-,defmethod,defmulti 250 | setlocal lispwords+=defonce,defvar,defvar-,defunbound,let,fn,letfn,binding,proxy 251 | setlocal lispwords+=defnk,definterface,defprotocol,deftype,defrecord,reify 252 | setlocal lispwords+=extend,extend-protocol,extend-type,bound-fn 253 | 254 | " Conditionals and Loops: 255 | setlocal lispwords+=if,if-not,if-let,when,when-not,when-let,when-first 256 | setlocal lispwords+=condp,case,loop,dotimes,for,while 257 | 258 | " Blocks: 259 | setlocal lispwords+=do,doto,try,catch,locking,with-in-str,with-out-str,with-open 260 | setlocal lispwords+=dosync,with-local-vars,doseq,dorun,doall,->,->>,future 261 | setlocal lispwords+=with-bindings 262 | 263 | " Namespaces: 264 | setlocal lispwords+=ns,clojure.core/ns 265 | 266 | " Java Classes: 267 | setlocal lispwords+=gen-class,gen-interface 268 | 269 | let &cpo = s:save_cpo 270 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/plugin/clojure.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin file 2 | " Language: Clojure 3 | " Maintainer: Meikel Brandmeyer 4 | 5 | " Only do this when not done yet for this buffer 6 | if exists("clojure_loaded") 7 | finish 8 | endif 9 | 10 | let clojure_loaded = "2.2.0-SNAPSHOT" 11 | 12 | let s:cpo_save = &cpo 13 | set cpo&vim 14 | 15 | command! -nargs=0 ClojureRepl call vimclojure#StartRepl() 16 | 17 | call vimclojure#MakeProtectedPlug("n", "AddToLispWords", "vimclojure#AddToLispWords", "expand(\"\")") 18 | call vimclojure#MakeProtectedPlug("n", "ToggleParenRainbow", "vimclojure#ToggleParenRainbow", "") 19 | 20 | call vimclojure#MakeCommandPlug("n", "DocLookupWord", "vimclojure#DocLookup", "expand(\"\")") 21 | call vimclojure#MakeCommandPlug("n", "DocLookupInteractive", "vimclojure#DocLookup", "input(\"Symbol to look up: \")") 22 | call vimclojure#MakeCommandPlug("n", "JavadocLookupWord", "vimclojure#JavadocLookup", "expand(\"\")") 23 | call vimclojure#MakeCommandPlug("n", "JavadocLookupInteractive", "vimclojure#JavadocLookup", "input(\"Class to lookup: \")") 24 | call vimclojure#MakeCommandPlug("n", "FindDoc", "vimclojure#FindDoc", "") 25 | 26 | call vimclojure#MakeCommandPlug("n", "MetaLookupWord", "vimclojure#MetaLookup", "expand(\"\")") 27 | call vimclojure#MakeCommandPlug("n", "MetaLookupInteractive", "vimclojure#MetaLookup", "input(\"Symbol to look up: \")") 28 | 29 | call vimclojure#MakeCommandPlug("n", "SourceLookupWord", "vimclojure#SourceLookup", "expand(\"\")") 30 | call vimclojure#MakeCommandPlug("n", "SourceLookupInteractive", "vimclojure#SourceLookup", "input(\"Symbol to look up: \")") 31 | 32 | call vimclojure#MakeCommandPlug("n", "GotoSourceWord", "vimclojure#GotoSource", "expand(\"\")") 33 | call vimclojure#MakeCommandPlug("n", "GotoSourceInteractive", "vimclojure#GotoSource", "input(\"Symbol to go to: \")") 34 | 35 | call vimclojure#MakeCommandPlug("n", "RequireFile", "vimclojure#RequireFile", "0") 36 | call vimclojure#MakeCommandPlug("n", "RequireFileAll", "vimclojure#RequireFile", "1") 37 | 38 | call vimclojure#MakeCommandPlug("n", "RunTests", "vimclojure#RunTests", "0") 39 | 40 | call vimclojure#MakeCommandPlug("n", "MacroExpand", "vimclojure#MacroExpand", "0") 41 | call vimclojure#MakeCommandPlug("n", "MacroExpand1", "vimclojure#MacroExpand", "1") 42 | 43 | call vimclojure#MakeCommandPlug("n", "EvalFile", "vimclojure#EvalFile", "") 44 | call vimclojure#MakeCommandPlug("n", "EvalLine", "vimclojure#EvalLine", "") 45 | call vimclojure#MakeCommandPlug("v", "EvalBlock", "vimclojure#EvalBlock", "") 46 | call vimclojure#MakeCommandPlug("n", "EvalToplevel", "vimclojure#EvalToplevel", "") 47 | call vimclojure#MakeCommandPlug("n", "EvalParagraph", "vimclojure#EvalParagraph", "") 48 | 49 | call vimclojure#MakeCommandPlug("n", "StartRepl", "vimclojure#StartRepl", "") 50 | call vimclojure#MakeCommandPlug("n", "StartLocalRepl", "vimclojure#StartRepl", "b:vimclojure_namespace") 51 | 52 | inoremap ClojureReplEnterHook. :call b:vimclojure_repl.enterHook() 53 | inoremap ClojureReplEvaluate. G$:call b:vimclojure_repl.enterHook() 54 | nnoremap ClojureReplHatHook. :call b:vimclojure_repl.hatHook() 55 | inoremap ClojureReplUpHistory. :call b:vimclojure_repl.upHistory() 56 | inoremap ClojureReplDownHistory. :call b:vimclojure_repl.downHistory() 57 | 58 | nnoremap ClojureCloseResultBuffer. :call vimclojure#ResultWindow.CloseWindow() 59 | 60 | let &cpo = s:cpo_save 61 | -------------------------------------------------------------------------------- /bundle/vimclojure-2.3.6/syntax/clojure.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Clojure 3 | " Maintainer: Toralf Wittner 4 | " modified by Meikel Brandmeyer 5 | " URL: http://kotka.de/projects/clojure/vimclojure.html 6 | 7 | if version < 600 8 | syntax clear 9 | elseif exists("b:current_syntax") 10 | finish 11 | endif 12 | 13 | " Highlight superfluous closing parens, brackets and braces. 14 | syn match clojureError "]\|}\|)" 15 | 16 | " Special case for Windows. 17 | try 18 | call vimclojure#InitBuffer() 19 | catch /.*/ 20 | " We swallow a failure here. It means most likely that the 21 | " server is not running. 22 | echohl WarningMsg 23 | echomsg v:exception 24 | echohl None 25 | endtry 26 | 27 | if g:vimclojure#HighlightBuiltins != 0 28 | let s:builtins_map = { 29 | \ "Constant": "nil", 30 | \ "Boolean": "true false", 31 | \ "Cond": "if if-not if-let when when-not when-let " 32 | \ . "when-first cond condp case", 33 | \ "Exception": "try catch finally throw", 34 | \ "Repeat": "recur map mapcat reduce filter for doseq dorun " 35 | \ . "doall dotimes map-indexed keep keep-indexed", 36 | \ "Special": ". def do fn if let new quote var loop", 37 | \ "Variable": "*warn-on-reflection* this *assert* " 38 | \ . "*agent* *ns* *in* *out* *err* *command-line-args* " 39 | \ . "*print-meta* *print-readably* *print-length* " 40 | \ . "*allow-unresolved-args* *compile-files* " 41 | \ . "*compile-path* *file* *flush-on-newline* " 42 | \ . "*math-context* *unchecked-math* *print-dup* " 43 | \ . "*print-level* *use-context-classloader* " 44 | \ . "*source-path* *clojure-version* *read-eval* " 45 | \ . "*fn-loader* *1 *2 *3 *e", 46 | \ "Define": "def- defn defn- defmacro defmulti defmethod " 47 | \ . "defstruct defonce declare definline definterface " 48 | \ . "defprotocol defrecord deftype", 49 | \ "Macro": "and or -> assert with-out-str with-in-str with-open " 50 | \ . "locking destructure ns dosync binding delay " 51 | \ . "lazy-cons lazy-cat time assert with-precision " 52 | \ . "with-local-vars .. doto memfn proxy amap areduce " 53 | \ . "refer-clojure future lazy-seq letfn " 54 | \ . "with-loading-context bound-fn extend extend-protocol " 55 | \ . "extend-type reify with-bindings ->>", 56 | \ "Func": "= not= not nil? false? true? complement identical? " 57 | \ . "string? symbol? map? seq? vector? keyword? var? " 58 | \ . "special-symbol? apply partial comp constantly " 59 | \ . "identity comparator fn? re-matcher re-find re-matches " 60 | \ . "re-groups re-seq re-pattern str pr prn print " 61 | \ . "println pr-str prn-str print-str println-str newline " 62 | \ . "macroexpand macroexpand-1 monitor-enter monitor-exit " 63 | \ . "eval find-doc file-seq flush hash load load-file " 64 | \ . "read read-line scan slurp subs sync test " 65 | \ . "format printf loaded-libs use require load-reader " 66 | \ . "load-string + - * / +' -' *' /' < <= == >= > dec dec' " 67 | \ . "inc inc' min max " 68 | \ . "neg? pos? quot rem zero? rand rand-int decimal? even? " 69 | \ . "odd? float? integer? number? ratio? rational? " 70 | \ . "bit-and bit-or bit-xor bit-not bit-shift-left " 71 | \ . "bit-shift-right symbol keyword gensym count conj seq " 72 | \ . "first rest ffirst fnext nfirst nnext second every? " 73 | \ . "not-every? some not-any? concat reverse cycle " 74 | \ . "interleave interpose split-at split-with take " 75 | \ . "take-nth take-while drop drop-while repeat replicate " 76 | \ . "iterate range into distinct sort sort-by zipmap " 77 | \ . "line-seq butlast last nth nthnext next " 78 | \ . "repeatedly tree-seq enumeration-seq iterator-seq " 79 | \ . "coll? associative? empty? list? reversible? " 80 | \ . "sequential? sorted? list list* cons peek pop vec " 81 | \ . "vector peek pop rseq subvec array-map hash-map " 82 | \ . "sorted-map sorted-map-by assoc assoc-in dissoc get " 83 | \ . "get-in contains? find select-keys update-in key val " 84 | \ . "keys vals merge merge-with max-key min-key " 85 | \ . "create-struct struct-map struct accessor " 86 | \ . "remove-method meta with-meta in-ns refer create-ns " 87 | \ . "find-ns all-ns remove-ns import ns-name ns-map " 88 | \ . "ns-interns ns-publics ns-imports ns-refers ns-resolve " 89 | \ . "resolve ns-unmap name namespace require use " 90 | \ . "set! find-var var-get var-set ref deref " 91 | \ . "ensure alter ref-set commute agent send send-off " 92 | \ . "agent-errors clear-agent-errors await await-for " 93 | \ . "instance? bean alength aget aset aset-boolean " 94 | \ . "aset-byte aset-char aset-double aset-float " 95 | \ . "aset-int aset-long aset-short make-array " 96 | \ . "to-array to-array-2d into-array int long float " 97 | \ . "double char boolean short byte parse add-classpath " 98 | \ . "cast class get-proxy-class proxy-mappings " 99 | \ . "update-proxy hash-set sorted-set set disj set? " 100 | \ . "aclone add-watch alias alter-var-root " 101 | \ . "ancestors await1 bases bigdec bigint bit-and-not " 102 | \ . "bit-clear bit-flip bit-set bit-test counted?" 103 | \ . "char-escape-string char-name-string class? " 104 | \ . "compare compile construct-proxy delay? " 105 | \ . "derive descendants distinct? double-array " 106 | \ . "doubles drop-last empty float-array floats " 107 | \ . "force gen-class get-validator int-array ints " 108 | \ . "isa? long-array longs make-hierarchy method-sig " 109 | \ . "not-empty ns-aliases ns-unalias num partition " 110 | \ . "parents pmap prefer-method primitives-classnames " 111 | \ . "print-ctor print-dup print-method print-simple " 112 | \ . "proxy-call-with-super " 113 | \ . "proxy-super rationalize read-string remove " 114 | \ . "remove-watch replace resultset-seq rsubseq " 115 | \ . "seque set-validator! shutdown-agents subseq " 116 | \ . "supers " 117 | \ . "unchecked-add unchecked-dec unchecked-divide " 118 | \ . "unchecked-inc unchecked-multiply unchecked-negate " 119 | \ . "unchecked-subtract underive xml-seq trampoline " 120 | \ . "atom compare-and-set! ifn? gen-interface " 121 | \ . "intern init-proxy io! memoize proxy-name swap! " 122 | \ . "release-pending-sends the-ns unquote while " 123 | \ . "unchecked-remainder alter-meta! " 124 | \ . "future-call methods mod pcalls prefers pvalues " 125 | \ . "reset! realized? some-fn " 126 | \ . "reset-meta! type vary-meta unquote-splicing " 127 | \ . "sequence clojure-version counted? " 128 | \ . "chunk-buffer chunk-append chunk chunk-first " 129 | \ . "chunk-rest chunk-next chunk-cons chunked-seq? " 130 | \ . "deliver future? future-done? future-cancel " 131 | \ . "future-cancelled? get-method promise " 132 | \ . "ref-history-count ref-min-history ref-max-history " 133 | \ . "agent-error assoc! boolean-array booleans bound-fn* " 134 | \ . "bound? byte-array bytes char-array char? chars " 135 | \ . "conj! denominator disj! dissoc! error-handler " 136 | \ . "error-mode extenders extends? find-protocol-impl " 137 | \ . "find-protocol-method flatten frequencies " 138 | \ . "get-thread-bindings group-by hash-combine juxt " 139 | \ . "munge namespace-munge numerator object-array " 140 | \ . "partition-all partition-by persistent! pop! " 141 | \ . "pop-thread-bindings push-thread-bindings rand-nth " 142 | \ . "reductions remove-all-methods restart-agent " 143 | \ . "satisfies? set-error-handler! set-error-mode! " 144 | \ . "short-array shorts shuffle sorted-set-by take-last " 145 | \ . "thread-bound? transient vector-of with-bindings* fnil " 146 | \ . "spit biginteger every-pred find-keyword " 147 | \ . "unchecked-add-int unchecked-byte unchecked-char " 148 | \ . "unchecked-dec-int unchecked-divide-int " 149 | \ . "unchecked-double unchecked-float " 150 | \ . "unchecked-inc-int unchecked-int unchecked-long " 151 | \ . "unchecked-multiply-int unchecked-negate-int " 152 | \ . "unchecked-remainder-int unchecked-short " 153 | \ . "unchecked-subtract-int with-redefs with-redefs-fn" 154 | \ } 155 | 156 | for category in keys(s:builtins_map) 157 | let words = split(s:builtins_map[category], " ") 158 | let words = map(copy(words), '"clojure.core/" . v:val') + words 159 | let s:builtins_map[category] = words 160 | endfor 161 | 162 | call vimclojure#ColorNamespace(s:builtins_map) 163 | endif 164 | 165 | if g:vimclojure#DynamicHighlighting != 0 && exists("b:vimclojure_namespace") 166 | try 167 | let s:result = vimclojure#ExecuteNailWithInput("DynamicHighlighting", 168 | \ b:vimclojure_namespace) 169 | if s:result.stderr == "" 170 | call vimclojure#ColorNamespace(s:result.value) 171 | unlet s:result 172 | endif 173 | catch /.*/ 174 | " We ignore errors here. If the file is messed up, we at least get 175 | " the basic syntax highlighting. 176 | endtry 177 | endif 178 | 179 | syn cluster clojureAtomCluster contains=clojureError,clojureFunc,clojureMacro,clojureCond,clojureDefine,clojureRepeat,clojureException,clojureConstant,clojureVariable,clojureSpecial,clojureKeyword,clojureString,clojureCharacter,clojureNumber,clojureBoolean,clojureQuote,clojureUnquote,clojureDispatch,clojurePattern 180 | syn cluster clojureTopCluster contains=@clojureAtomCluster,clojureComment,clojureSexp,clojureAnonFn,clojureVector,clojureMap,clojureSet 181 | 182 | syn keyword clojureTodo contained FIXME XXX TODO FIXME: XXX: TODO: 183 | syn match clojureComment contains=clojureTodo ";.*$" 184 | 185 | syn match clojureKeyword "\c:\{1,2}[a-z0-9?!\-_+*.=<>#$]\+\(/[a-z0-9?!\-_+*.=<>#$]\+\)\?" 186 | 187 | syn region clojureString start=/L\="/ skip=/\\\\\|\\"/ end=/"/ 188 | 189 | syn match clojureCharacter "\\." 190 | syn match clojureCharacter "\\[0-7]\{3\}" 191 | syn match clojureCharacter "\\u[0-9]\{4\}" 192 | syn match clojureCharacter "\\space" 193 | syn match clojureCharacter "\\tab" 194 | syn match clojureCharacter "\\newline" 195 | syn match clojureCharacter "\\return" 196 | syn match clojureCharacter "\\backspace" 197 | syn match clojureCharacter "\\formfeed" 198 | 199 | let radixChars = "0123456789abcdefghijklmnopqrstuvwxyz" 200 | for radix in range(2, 36) 201 | execute 'syn match clojureNumber "\c\<-\?' . radix . 'r[' 202 | \ . strpart(radixChars, 0, radix) 203 | \ . ']\+\>"' 204 | endfor 205 | 206 | syn match clojureNumber "\<-\=[0-9]\+\(\.[0-9]*\)\=\(M\|\([eE][-+]\?[0-9]\+\)\)\?\>" 207 | syn match clojureNumber "\<-\=[0-9]\+N\?\>" 208 | syn match clojureNumber "\<-\=0x[0-9a-fA-F]\+\>" 209 | syn match clojureNumber "\<-\=[0-9]\+/[0-9]\+\>" 210 | 211 | syn match clojureQuote "\('\|`\)" 212 | syn match clojureUnquote "\(\~@\|\~\)" 213 | syn match clojureDispatch "\(#^\|#'\)" 214 | syn match clojureDispatch "\^" 215 | 216 | syn match clojureAnonArg contained "%\(\d\|&\)\?" 217 | syn match clojureVarArg contained "&" 218 | 219 | syn region clojureSexpLevel0 matchgroup=clojureParen0 start="(" matchgroup=clojureParen0 end=")" contains=@clojureTopCluster,clojureSexpLevel1 220 | syn region clojureSexpLevel1 matchgroup=clojureParen1 start="(" matchgroup=clojureParen1 end=")" contained contains=@clojureTopCluster,clojureSexpLevel2 221 | syn region clojureSexpLevel2 matchgroup=clojureParen2 start="(" matchgroup=clojureParen2 end=")" contained contains=@clojureTopCluster,clojureSexpLevel3 222 | syn region clojureSexpLevel3 matchgroup=clojureParen3 start="(" matchgroup=clojureParen3 end=")" contained contains=@clojureTopCluster,clojureSexpLevel4 223 | syn region clojureSexpLevel4 matchgroup=clojureParen4 start="(" matchgroup=clojureParen4 end=")" contained contains=@clojureTopCluster,clojureSexpLevel5 224 | syn region clojureSexpLevel5 matchgroup=clojureParen5 start="(" matchgroup=clojureParen5 end=")" contained contains=@clojureTopCluster,clojureSexpLevel6 225 | syn region clojureSexpLevel6 matchgroup=clojureParen6 start="(" matchgroup=clojureParen6 end=")" contained contains=@clojureTopCluster,clojureSexpLevel7 226 | syn region clojureSexpLevel7 matchgroup=clojureParen7 start="(" matchgroup=clojureParen7 end=")" contained contains=@clojureTopCluster,clojureSexpLevel8 227 | syn region clojureSexpLevel8 matchgroup=clojureParen8 start="(" matchgroup=clojureParen8 end=")" contained contains=@clojureTopCluster,clojureSexpLevel9 228 | syn region clojureSexpLevel9 matchgroup=clojureParen9 start="(" matchgroup=clojureParen9 end=")" contained contains=@clojureTopCluster,clojureSexpLevel0 229 | 230 | syn region clojureAnonFn matchgroup=clojureParen0 start="#(" matchgroup=clojureParen0 end=")" contains=@clojureTopCluster,clojureAnonArg,clojureSexpLevel0 231 | syn region clojureVector matchgroup=clojureParen0 start="\[" matchgroup=clojureParen0 end="\]" contains=@clojureTopCluster,clojureVarArg,clojureSexpLevel0 232 | syn region clojureMap matchgroup=clojureParen0 start="{" matchgroup=clojureParen0 end="}" contains=@clojureTopCluster,clojureSexpLevel0 233 | syn region clojureSet matchgroup=clojureParen0 start="#{" matchgroup=clojureParen0 end="}" contains=@clojureTopCluster,clojureSexpLevel0 234 | 235 | syn region clojurePattern start=/L\=\#"/ skip=/\\\\\|\\"/ end=/"/ 236 | 237 | " FIXME: Matching of 'comment' is broken. It seems we can't nest 238 | " the different highlighting items, when they share the same end 239 | " pattern. 240 | " See also: https://bitbucket.org/kotarak/vimclojure/issue/87/comment-is-highlighted-incorrectly 241 | " 242 | "syn region clojureCommentSexp start="(" end=")" transparent contained contains=clojureCommentSexp 243 | "syn region clojureComment matchgroup=clojureParen0 start="(comment"rs=s+1 matchgroup=clojureParen0 end=")" contains=clojureTopCluster 244 | syn match clojureComment "comment" 245 | syn region clojureComment start="#!" end="\n" 246 | syn match clojureComment "#_" 247 | 248 | syn sync fromstart 249 | 250 | if version >= 600 251 | command -nargs=+ HiLink highlight default link 252 | else 253 | command -nargs=+ HiLink highlight link 254 | endif 255 | 256 | HiLink clojureConstant Constant 257 | HiLink clojureBoolean Boolean 258 | HiLink clojureCharacter Character 259 | HiLink clojureKeyword Operator 260 | HiLink clojureNumber Number 261 | HiLink clojureString String 262 | HiLink clojurePattern Constant 263 | 264 | HiLink clojureVariable Identifier 265 | HiLink clojureCond Conditional 266 | HiLink clojureDefine Define 267 | HiLink clojureException Exception 268 | HiLink clojureFunc Function 269 | HiLink clojureMacro Macro 270 | HiLink clojureRepeat Repeat 271 | 272 | HiLink clojureQuote Special 273 | HiLink clojureUnquote Special 274 | HiLink clojureDispatch Special 275 | HiLink clojureAnonArg Special 276 | HiLink clojureVarArg Special 277 | HiLink clojureSpecial Special 278 | 279 | HiLink clojureComment Comment 280 | HiLink clojureTodo Todo 281 | 282 | HiLink clojureError Error 283 | 284 | HiLink clojureParen0 Delimiter 285 | 286 | if !exists("g:vimclojure#ParenRainbowColorsDark") 287 | if exists("g:vimclojure#ParenRainbowColors") 288 | let g:vimclojure#ParenRainbowColorsDark = 289 | \ g:vimclojure#ParenRainbowColors 290 | else 291 | let g:vimclojure#ParenRainbowColorsDark = { 292 | \ '1': 'ctermfg=yellow guifg=orange1', 293 | \ '2': 'ctermfg=green guifg=yellow1', 294 | \ '3': 'ctermfg=cyan guifg=greenyellow', 295 | \ '4': 'ctermfg=magenta guifg=green1', 296 | \ '5': 'ctermfg=red guifg=springgreen1', 297 | \ '6': 'ctermfg=yellow guifg=cyan1', 298 | \ '7': 'ctermfg=green guifg=slateblue1', 299 | \ '8': 'ctermfg=cyan guifg=magenta1', 300 | \ '9': 'ctermfg=magenta guifg=purple1' 301 | \ } 302 | endif 303 | endif 304 | 305 | if !exists("g:vimclojure#ParenRainbowColorsLight") 306 | if exists("g:vimclojure#ParenRainbowColors") 307 | let g:vimclojure#ParenRainbowColorsLight = 308 | \ g:vimclojure#ParenRainbowColors 309 | else 310 | let g:vimclojure#ParenRainbowColorsLight = { 311 | \ '1': 'ctermfg=darkyellow guifg=orangered3', 312 | \ '2': 'ctermfg=darkgreen guifg=orange2', 313 | \ '3': 'ctermfg=blue guifg=yellow3', 314 | \ '4': 'ctermfg=darkmagenta guifg=olivedrab4', 315 | \ '5': 'ctermfg=red guifg=green4', 316 | \ '6': 'ctermfg=darkyellow guifg=paleturquoise3', 317 | \ '7': 'ctermfg=darkgreen guifg=deepskyblue4', 318 | \ '8': 'ctermfg=blue guifg=darkslateblue', 319 | \ '9': 'ctermfg=darkmagenta guifg=darkviolet' 320 | \ } 321 | endif 322 | endif 323 | 324 | function! VimClojureSetupParenRainbow() 325 | if &background == "dark" 326 | let colors = g:vimclojure#ParenRainbowColorsDark 327 | else 328 | let colors = g:vimclojure#ParenRainbowColorsLight 329 | endif 330 | 331 | for [level, color] in items(colors) 332 | execute "highlight clojureParen" . level . " " . color 333 | endfor 334 | endfunction 335 | 336 | if vimclojure#ParenRainbow != 0 337 | call VimClojureSetupParenRainbow() 338 | 339 | augroup VimClojureSyntax 340 | au! 341 | autocmd ColorScheme * if &ft == "clojure" | call VimClojureSetupParenRainbow() | endif 342 | augroup END 343 | else 344 | HiLink clojureParen1 clojureParen0 345 | HiLink clojureParen2 clojureParen0 346 | HiLink clojureParen3 clojureParen0 347 | HiLink clojureParen4 clojureParen0 348 | HiLink clojureParen5 clojureParen0 349 | HiLink clojureParen6 clojureParen0 350 | HiLink clojureParen7 clojureParen0 351 | HiLink clojureParen8 clojureParen0 352 | HiLink clojureParen9 clojureParen0 353 | endif 354 | 355 | delcommand HiLink 356 | 357 | let b:current_syntax = "clojure" 358 | -------------------------------------------------------------------------------- /lib/.gitignore: -------------------------------------------------------------------------------- 1 | ng 2 | -------------------------------------------------------------------------------- /lib/server-2.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveray/vimclojure-easy/092f2c8c48c4e46b1081c69a325444fa331642cd/lib/server-2.3.0.jar -------------------------------------------------------------------------------- /lib/vimclojure-nailgun-client/Makefile: -------------------------------------------------------------------------------- 1 | # This Makefile has only been tested on linux. It uses 2 | # MinGW32 to cross-compile for windows. To install and 3 | # configure MinGW32 on linux, see 4 | # http://www.mingw.org/MinGWiki/index.php/BuildMingwCross 5 | # 6 | # Marty Lamb 7 | 8 | CC=gcc 9 | CFLAGS=-Wall -pedantic -s -O3 10 | 11 | # Special library requirements 12 | # Default: 13 | LIBS= 14 | 15 | # OpenSolaris 2009.06 16 | #LIBS=-lsocket -lnsl 17 | 18 | # Windows 19 | #LIBS=-lwsock32 20 | 21 | ng: ngclient/ng.c 22 | @echo "Building ng client. To build a Windows binary, type 'make ng.exe'" 23 | ${CC} ${CFLAGS} ${LIBS} -o ng ngclient/ng.c 24 | 25 | clean: 26 | @echo "If you have a Windows binary, 'make clean' won't delete it." 27 | @echo "You must remove this manually. Most users won't have MinGW" 28 | @echo "installed - so I'd rather not delete something they can't rebuild." 29 | rm ng 30 | # rm ng.exe 31 | -------------------------------------------------------------------------------- /lib/vimclojure-nailgun-client/ng.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveray/vimclojure-easy/092f2c8c48c4e46b1081c69a325444fa331642cd/lib/vimclojure-nailgun-client/ng.exe -------------------------------------------------------------------------------- /lib/vimclojure-nailgun-client/ngclient/ng.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2004, Martian Software, Inc. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | 17 | */ 18 | 19 | /** 20 | * @author Marty Lamb 21 | * @author Pete Kirkham (Win32 port) 22 | */ 23 | 24 | #ifdef WIN32 25 | #include 26 | #include 27 | #else 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #endif 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #define NAILGUN_VERSION "0.7.1" 41 | 42 | #define BUFSIZE (2048) 43 | 44 | #ifdef WIN32 45 | HANDLE NG_STDIN_FILENO; 46 | HANDLE NG_STDOUT_FILENO; 47 | HANDLE NG_STDERR_FILENO; 48 | #define FILE_SEPARATOR '\\' 49 | #define MSG_WAITALL 0 50 | #else 51 | #define NG_STDIN_FILENO STDIN_FILENO 52 | #define NG_STDOUT_FILENO STDOUT_FILENO 53 | #define NG_STDERR_FILENO STDERR_FILENO 54 | #define FILE_SEPARATOR '/' 55 | typedef int HANDLE; 56 | typedef unsigned int SOCKET; 57 | /* buffer used for reading an writing chunk data */ 58 | char buf[BUFSIZE]; 59 | #endif 60 | 61 | #ifndef MIN 62 | #define MIN(a,b) ((a> 24) & 0xff; 189 | header[1] = (size >> 16) & 0xff; 190 | header[2] = (size >> 8) & 0xff; 191 | header[3] = size & 0xff; 192 | header[4] = chunkType; 193 | 194 | sendAll(nailgunsocket, header, CHUNK_HEADER_LEN); 195 | } 196 | 197 | /** 198 | * Sends a null-terminated string with the specified chunk type. 199 | * 200 | * @param chunkType the chunk type identifier 201 | * @param text the null-terminated string to send 202 | */ 203 | void sendText(char chunkType, char *text) { 204 | int len = 0; 205 | if (text != NULL) 206 | len = strlen(text); 207 | sendHeader(len, chunkType); 208 | sendAll(nailgunsocket, text, len); 209 | } 210 | 211 | /** 212 | * Exits the client if the nailgun server ungracefully shut down the connection. 213 | */ 214 | void handleSocketClose() { 215 | cleanUpAndExit(NAILGUN_CONNECTION_BROKEN); 216 | } 217 | 218 | /** 219 | * Receives len bytes from the nailgun socket and copies them to the specified file descriptor. 220 | * Used to route data to stdout or stderr on the client. 221 | * 222 | * @param destFD the destination file descriptor (stdout or stderr) 223 | * @param len the number of bytes to copy 224 | */ 225 | void recvToFD(HANDLE destFD, char *buf, unsigned long len) { 226 | unsigned long bytesRead = 0; 227 | int bytesCopied; 228 | 229 | while (bytesRead < len) { 230 | unsigned long bytesRemaining = len - bytesRead; 231 | int bytesToRead = (BUFSIZE < bytesRemaining) ? BUFSIZE : bytesRemaining; 232 | int thisPass = 0; 233 | 234 | thisPass = recv(nailgunsocket, buf, bytesToRead, MSG_WAITALL); 235 | 236 | bytesRead += thisPass; 237 | 238 | bytesCopied = 0; 239 | 240 | while(bytesCopied < thisPass) { 241 | #ifdef WIN32 242 | DWORD thisWrite = 0; 243 | 244 | WriteFile(destFD, buf + bytesCopied, thisPass - bytesCopied, 245 | &thisWrite, NULL); 246 | 247 | if (thisWrite < 0) { 248 | break; 249 | } 250 | 251 | bytesCopied += thisWrite; 252 | #else 253 | bytesCopied += write(destFD, buf + bytesCopied, thisPass - bytesCopied); 254 | #endif 255 | } 256 | } 257 | } 258 | 259 | 260 | /** 261 | * Processes an exit chunk from the server. This is just a string 262 | * containing the exit code in decimal format. It should fit well 263 | * within our buffer, so assume that it does. 264 | * 265 | * @param len the current length of the buffer containing the exit code. 266 | */ 267 | void processExit(char *buf, unsigned long len) { 268 | int exitcode; 269 | int bytesToRead = (BUFSIZE - 1 < len) ? BUFSIZE - 1 : len; 270 | int bytesRead = recv(nailgunsocket, buf, bytesToRead, MSG_WAITALL); 271 | 272 | if (bytesRead < 0) { 273 | handleSocketClose(); 274 | } 275 | 276 | buf[bytesRead] = 0; 277 | 278 | exitcode = atoi(buf); 279 | 280 | cleanUpAndExit(exitcode); 281 | } 282 | 283 | /** 284 | * Processes data from the nailgun server. 285 | */ 286 | void processnailgunstream() { 287 | /* buffer used for receiving and writing nail output chunks */ 288 | char buf[BUFSIZE]; 289 | 290 | /*for (;;) {*/ 291 | int bytesRead = 0; 292 | unsigned long len; 293 | char chunkType; 294 | 295 | bytesRead = recv(nailgunsocket, buf, CHUNK_HEADER_LEN, 0); 296 | 297 | if (bytesRead < CHUNK_HEADER_LEN) { 298 | handleSocketClose(); 299 | } 300 | 301 | len = ((buf[0] << 24) & 0xff000000) 302 | | ((buf[1] << 16) & 0x00ff0000) 303 | | ((buf[2] << 8) & 0x0000ff00) 304 | | ((buf[3]) & 0x000000ff); 305 | 306 | chunkType = buf[4]; 307 | 308 | switch(chunkType) { 309 | case CHUNKTYPE_STDOUT: recvToFD(NG_STDOUT_FILENO, buf, len); 310 | break; 311 | case CHUNKTYPE_STDERR: recvToFD(NG_STDERR_FILENO, buf, len); 312 | break; 313 | case CHUNKTYPE_EXIT: processExit(buf, len); 314 | break; 315 | default: fprintf(stderr, "Unexpected chunk type %d ('%c')\n", chunkType, chunkType); 316 | cleanUpAndExit(NAILGUN_UNEXPECTED_CHUNKTYPE); 317 | } 318 | /*}*/ 319 | } 320 | 321 | /** 322 | * Sends len bytes from buf to the nailgun server in a stdin chunk. 323 | * 324 | * @param buf the bytes to send 325 | * @param len the number of bytes to send 326 | */ 327 | void sendStdin(char *buf, unsigned int len) { 328 | sendHeader(len, CHUNKTYPE_STDIN); 329 | sendAll(nailgunsocket, buf, len); 330 | } 331 | 332 | /** 333 | * Sends a stdin-eof chunk to the nailgun server 334 | */ 335 | void processEof() { 336 | sendHeader(0, CHUNKTYPE_STDIN_EOF); 337 | } 338 | 339 | 340 | #ifdef WIN32 341 | /** 342 | * Thread main for reading from stdin and sending 343 | */ 344 | DWORD WINAPI processStdin (LPVOID lpParameter) { 345 | /* buffer used for reading and sending stdin chunks */ 346 | char buf[BUFSIZE]; 347 | 348 | for (;;) { 349 | DWORD numberOfBytes = 0; 350 | 351 | if (!ReadFile(NG_STDIN_FILENO, buf, BUFSIZE, &numberOfBytes, NULL)) { 352 | if (numberOfBytes != 0) { 353 | handleError(); 354 | } 355 | } 356 | 357 | if (numberOfBytes > 0) { 358 | sendStdin(buf, numberOfBytes); 359 | } else { 360 | processEof(); 361 | break; 362 | } 363 | } 364 | 365 | return 0; 366 | } 367 | #else 368 | /** 369 | * Reads from stdin and transmits it to the nailgun server in a stdin chunk. 370 | * Sends a stdin-eof chunk if necessary. 371 | * 372 | * @return zero if eof has been reached. 373 | */ 374 | int processStdin() { 375 | int bytesread = read(STDIN_FILENO, buf, BUFSIZE); 376 | if (bytesread > 0) { 377 | sendStdin(buf, bytesread); 378 | } else if (bytesread == 0) { 379 | processEof(); 380 | } 381 | return(bytesread); 382 | } 383 | #endif 384 | 385 | #ifdef WIN32 386 | /** 387 | * Initialise Windows sockets 388 | */ 389 | void initSockets () { 390 | WSADATA win_socket_data; /* required to initialise winsock */ 391 | 392 | WSAStartup(2, &win_socket_data); 393 | } 394 | #endif 395 | 396 | #ifdef WIN32 397 | /** 398 | * Initialise the asynchronous io. 399 | */ 400 | void initIo () { 401 | SECURITY_ATTRIBUTES securityAttributes; 402 | DWORD threadId = 0; 403 | 404 | /* create non-blocking console io */ 405 | AllocConsole(); 406 | 407 | securityAttributes.bInheritHandle = TRUE; 408 | securityAttributes.lpSecurityDescriptor = NULL; 409 | securityAttributes.nLength = 0; 410 | 411 | NG_STDIN_FILENO = GetStdHandle(STD_INPUT_HANDLE); 412 | NG_STDOUT_FILENO = GetStdHandle(STD_OUTPUT_HANDLE); 413 | NG_STDERR_FILENO = GetStdHandle(STD_ERROR_HANDLE); 414 | 415 | if (!CreateThread(&securityAttributes, 0, &processStdin, NULL, 0, &threadId)) { 416 | handleError(); 417 | } 418 | } 419 | #endif 420 | 421 | /** 422 | * Trims any path info from the beginning of argv[0] to determine 423 | * the name used to launch the client. 424 | * 425 | * @param s argv[0] 426 | */ 427 | char *shortClientName(char *s) { 428 | char *result = strrchr(s, FILE_SEPARATOR); 429 | return ((result == NULL) ? s : result + 1); 430 | } 431 | 432 | /** 433 | * Returns true if the specified string is the name of the nailgun 434 | * client. The comparison is made case-insensitively for windows. 435 | * 436 | * @param s the program name to check 437 | */ 438 | int isNailgunClientName(char *s) { 439 | #ifdef WIN32 440 | return (!strcasecmp(s, NAILGUN_CLIENT_NAME) || 441 | !strcasecmp(s, NAILGUN_CLIENT_NAME_EXE)); 442 | #else 443 | return(!(strcmp(s, NAILGUN_CLIENT_NAME))); 444 | #endif 445 | } 446 | 447 | /** 448 | * Displays usage info and bails 449 | */ 450 | void usage(int exitcode) { 451 | 452 | fprintf(stderr, "Usage: ng class [--nailgun-options] [args]\n"); 453 | fprintf(stderr, " (to execute a class)\n"); 454 | fprintf(stderr, " or: ng alias [--nailgun-options] [args]\n"); 455 | fprintf(stderr, " (to execute an aliased class)\n"); 456 | fprintf(stderr, " or: alias [--nailgun-options] [args]\n"); 457 | fprintf(stderr, " (to execute an aliased class, where \"alias\"\n"); 458 | fprintf(stderr, " is both the alias for the class and a symbolic\n"); 459 | fprintf(stderr, " link to the ng client)\n\n"); 460 | 461 | fprintf(stderr, "where options include:\n"); 462 | fprintf(stderr, " --nailgun-D= set/override a client environment variable\n"); 463 | fprintf(stderr, " --nailgun-version print product version and exit\n"); 464 | fprintf(stderr, " --nailgun-showversion print product version and continue\n"); 465 | fprintf(stderr, " --nailgun-server to specify the address of the nailgun server\n"); 466 | fprintf(stderr, " (default is localhost)\n"); 467 | fprintf(stderr, " --nailgun-port to specify the port of the nailgun server\n"); 468 | fprintf(stderr, " (default is 2113)\n"); 469 | fprintf(stderr, " --nailgun-help print this message and exit\n"); 470 | 471 | cleanUpAndExit(exitcode); 472 | } 473 | 474 | int main(int argc, char *argv[], char *env[]) { 475 | int i; 476 | struct sockaddr_in server_addr; 477 | char *nailgun_server; /* server as specified by user */ 478 | char *nailgun_port; /* port as specified by user */ 479 | char *cwd; 480 | u_short port; /* port */ 481 | struct hostent *hostinfo; 482 | char *cmd; 483 | int firstArgIndex; /* the first argument _to pass to the server_ */ 484 | 485 | #ifndef WIN32 486 | fd_set readfds; 487 | int eof = 0; 488 | #endif 489 | 490 | #ifdef WIN32 491 | initSockets(); 492 | #endif 493 | 494 | /* start with environment variable. default to localhost if not defined. */ 495 | nailgun_server = getenv("NAILGUN_SERVER"); 496 | if (nailgun_server == NULL) { 497 | nailgun_server = "127.0.0.1"; 498 | } 499 | 500 | /* start with environment variable. default to normal nailgun port if not defined */ 501 | nailgun_port = getenv("NAILGUN_PORT"); 502 | if (nailgun_port == NULL) { 503 | nailgun_port = NAILGUN_PORT_DEFAULT; 504 | } 505 | 506 | /* look at the command used to launch this program. if it was "ng", then the actual 507 | command to issue to the server must be specified as another argument. if it 508 | wasn't ng, assume that the desired command name was symlinked to ng in the user's 509 | filesystem, and use the symlink name (without path info) as the command for the server. */ 510 | cmd = shortClientName(argv[0]); 511 | 512 | if (isNailgunClientName(cmd)) { 513 | cmd = NULL; 514 | } 515 | 516 | firstArgIndex = 1; 517 | 518 | /* quite possibly the lamest commandline parsing ever. 519 | look for the two args we care about (--nailgun-server and 520 | --nailgun-port) and NULL them and their parameters after 521 | reading them if found. later, when we send args to the 522 | server, skip the null args. */ 523 | for (i = 1; i < argc; ++i) { 524 | if (!strcmp("--nailgun-server", argv[i])) { 525 | if (i == argc - 1) usage(NAILGUN_BAD_ARGUMENTS); 526 | nailgun_server = argv[i + 1]; 527 | argv[i] = argv[i + 1] = NULL; 528 | ++i; 529 | } else if(!strcmp("--nailgun-port", argv[i])) { 530 | if (i == argc - 1) usage(NAILGUN_BAD_ARGUMENTS); 531 | nailgun_port = argv[i + 1]; 532 | argv[i] = argv[i + 1]= NULL; 533 | ++i; 534 | } else if (!strcmp("--nailgun-version", argv[i])) { 535 | printf("NailGun client version %s\n", NAILGUN_VERSION); 536 | cleanUpAndExit(0); 537 | } else if (!strcmp("--nailgun-showversion", argv[i])) { 538 | printf("NailGun client version %s\n", NAILGUN_VERSION); 539 | argv[i] = NULL; 540 | } else if (!strcmp("--nailgun-help", argv[i])) { 541 | usage(0); 542 | } else if (cmd == NULL) { 543 | cmd = argv[i]; 544 | firstArgIndex = i + 1; 545 | } 546 | } 547 | 548 | /* if there's no command, we should only display usage info 549 | if the version number was not displayed. */ 550 | if (cmd == NULL) { 551 | usage(NAILGUN_BAD_ARGUMENTS); 552 | } 553 | 554 | /* jump through a series of connection hoops */ 555 | hostinfo = gethostbyname(nailgun_server); 556 | 557 | if (hostinfo == NULL) { 558 | fprintf(stderr, "Unknown host: %s\n", nailgun_server); 559 | cleanUpAndExit(NAILGUN_CONNECT_FAILED); 560 | } 561 | 562 | port = atoi(nailgun_port); 563 | 564 | if ((nailgunsocket = socket(AF_INET, SOCK_STREAM, 0)) == -1) { 565 | perror("socket"); 566 | cleanUpAndExit(NAILGUN_SOCKET_FAILED); 567 | } 568 | 569 | server_addr.sin_family = AF_INET; 570 | server_addr.sin_port = htons(port); 571 | server_addr.sin_addr = *(struct in_addr *) hostinfo->h_addr; 572 | 573 | memset(&(server_addr.sin_zero), '\0', 8); 574 | 575 | if (connect(nailgunsocket, (struct sockaddr *)&server_addr, 576 | sizeof(struct sockaddr)) == -1) { 577 | perror("connect"); 578 | cleanUpAndExit(NAILGUN_CONNECT_FAILED); 579 | } 580 | 581 | /* ok, now we're connected. first send all of the command line 582 | arguments for the server, if any. remember that we may have 583 | marked some arguments NULL if we read them to specify the 584 | nailgun server and/or port */ 585 | for(i = firstArgIndex; i < argc; ++i) { 586 | if (argv[i] != NULL) sendText(CHUNKTYPE_ARG, argv[i]); 587 | } 588 | 589 | /* now send environment */ 590 | sendText(CHUNKTYPE_ENV, NAILGUN_FILESEPARATOR); 591 | sendText(CHUNKTYPE_ENV, NAILGUN_PATHSEPARATOR); 592 | for(i = 0; env[i]; ++i) { 593 | sendText(CHUNKTYPE_ENV, env[i]); 594 | } 595 | 596 | /* now send the working directory */ 597 | cwd = getcwd(NULL, 0); 598 | sendText(CHUNKTYPE_DIR, cwd); 599 | free(cwd); 600 | 601 | /* and finally send the command. this marks the point at which 602 | streams are linked between client and server. */ 603 | sendText(CHUNKTYPE_CMD, cmd); 604 | 605 | 606 | /* initialise the std-* handles and the thread to send stdin to the server */ 607 | #ifdef WIN32 608 | initIo(); 609 | #endif 610 | 611 | /* stream forwarding loop */ 612 | while(1) { 613 | #ifndef WIN32 614 | FD_ZERO(&readfds); 615 | 616 | /* don't select on stdin if we've already reached its end */ 617 | if (!eof) { 618 | FD_SET(NG_STDIN_FILENO, &readfds); 619 | } 620 | 621 | FD_SET(nailgunsocket, &readfds); 622 | if (select (nailgunsocket + 1, &readfds, NULL, NULL, NULL) == -1) { 623 | perror("select"); 624 | } 625 | 626 | if (FD_ISSET(nailgunsocket, &readfds)) { 627 | #endif 628 | processnailgunstream(); 629 | #ifndef WIN32 630 | } else if (FD_ISSET(NG_STDIN_FILENO, &readfds)) { 631 | if (!processStdin()) { 632 | FD_CLR(NG_STDIN_FILENO, &readfds); 633 | eof = 1; 634 | } 635 | } 636 | #endif 637 | } 638 | 639 | /* normal termination is triggered by the server, and so occurs in processExit(), above */ 640 | } 641 | -------------------------------------------------------------------------------- /piglatin.clj: -------------------------------------------------------------------------------- 1 | ; From http://java.ociweb.com/mark/clojure/article.html 2 | (def vowel? (set "aeiou")) 3 | 4 | (defn pig-latin [word] ; defines a function 5 | ; word is expected to be a string 6 | ; which can be treated like a sequence of characters. 7 | (let [first-letter (first word)] ; assigns a local binding 8 | (if (vowel? first-letter) 9 | (str word "ay") ; then part of if 10 | (str (subs word 1) first-letter "ay")))) ; else part of if 11 | 12 | (pig-latin "hello") 13 | (pig-latin "vimclojure") 14 | -------------------------------------------------------------------------------- /vimrc.vim: -------------------------------------------------------------------------------- 1 | " This is standard pathogen and vim setup 2 | set nocompatible 3 | call pathogen#infect() 4 | syntax on 5 | filetype plugin indent on 6 | 7 | " Here's the vimclojure stuff. You'll need to adjust the NailgunClient 8 | " setting if you're on windows or have other problems. 9 | let vimclojure#FuzzyIndent=1 10 | let vimclojure#HighlightBuiltins=1 11 | let vimclojure#HighlightContrib=1 12 | let vimclojure#DynamicHighlighting=1 13 | let vimclojure#ParenRainbow=1 14 | let vimclojure#WantNailgun = 1 15 | let vimclojure#NailgunClient = $HOME . "/.vim/lib/vimclojure-nailgun-client/ng" 16 | 17 | " Paredit 18 | let g:paredit_mode = 0 19 | --------------------------------------------------------------------------------