Rename foreplay.vim to fireplace.vim
This commit is contained in:
parent
fa6e35bc19
commit
db27257f7f
@ -1,12 +1,15 @@
|
|||||||
# foreplay.vim
|
# fireplace.vim
|
||||||
|
|
||||||
There's a REPL in foreplay, but you probably wouldn't have noticed if I hadn't
|
There's a REPL in fireplace, but you probably wouldn't have noticed if I hadn't
|
||||||
told you. Such is the way with foreplay.vim. By the way, this plugin is for
|
told you. Such is the way with fireplace.vim. By the way, this plugin is for
|
||||||
Clojure.
|
Clojure.
|
||||||
|
|
||||||
|
Fireplace.vim used to be called foreplay.vim, but it was renamed so Java
|
||||||
|
developers wouldn't have to speak in hushed tones.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Foreplay.vim doesn't provide indenting or syntax highlighting, so you'll want
|
Fireplace.vim doesn't provide indenting or syntax highlighting, so you'll want
|
||||||
[a set of Clojure runtime files](https://github.com/guns/vim-clojure-static).
|
[a set of Clojure runtime files](https://github.com/guns/vim-clojure-static).
|
||||||
You might also want [classpath.vim][] to run code when no REPL is available.
|
You might also want [classpath.vim][] to run code when no REPL is available.
|
||||||
|
|
||||||
@ -15,12 +18,12 @@ installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
|||||||
then simply copy and paste:
|
then simply copy and paste:
|
||||||
|
|
||||||
cd ~/.vim/bundle
|
cd ~/.vim/bundle
|
||||||
git clone git://github.com/tpope/vim-foreplay.git
|
git clone git://github.com/tpope/vim-fireplace.git
|
||||||
git clone git://github.com/tpope/vim-classpath.git
|
git clone git://github.com/tpope/vim-classpath.git
|
||||||
git clone git://github.com/guns/vim-clojure-static.git
|
git clone git://github.com/guns/vim-clojure-static.git
|
||||||
|
|
||||||
Once help tags have been generated, you can view the manual with
|
Once help tags have been generated, you can view the manual with
|
||||||
`:help foreplay`.
|
`:help fireplace`.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@ -28,7 +31,7 @@ This list isn't exhaustive; see the `:help` for details.
|
|||||||
|
|
||||||
### Transparent setup
|
### Transparent setup
|
||||||
|
|
||||||
Foreplay.vim talks to nREPL. With Leiningen, it connects automatically based
|
Fireplace.vim talks to nREPL. With Leiningen, it connects automatically based
|
||||||
on `target/repl-port`, otherwise it's just a `:Connect` away. You can connect
|
on `target/repl-port`, otherwise it's just a `:Connect` away. You can connect
|
||||||
to multiple instances of nREPL for different projects, and it will use the
|
to multiple instances of nREPL for different projects, and it will use the
|
||||||
right one automatically.
|
right one automatically.
|
||||||
@ -51,7 +54,7 @@ absolutely flawlessly, never breaking just because you did something innocuous
|
|||||||
like backspace through part of the prompt? No? Such a shame, you really
|
like backspace through part of the prompt? No? Such a shame, you really
|
||||||
would have liked it.
|
would have liked it.
|
||||||
|
|
||||||
I've taken a different approach in foreplay.vim. `cq` (Think "Clojure
|
I've taken a different approach in fireplace.vim. `cq` (Think "Clojure
|
||||||
Quasi-REPL") is the prefix for a set of commands that bring up a *command-line
|
Quasi-REPL") is the prefix for a set of commands that bring up a *command-line
|
||||||
window* — the same thing you get when you hit `q:` — but set up for Clojure
|
window* — the same thing you get when you hit `q:` — but set up for Clojure
|
||||||
code.
|
code.
|
||||||
@ -115,13 +118,13 @@ I'm a stickler for [commit messages][], so if you send me a pull
|
|||||||
request with so much as superfluous period in the subject line, I will
|
request with so much as superfluous period in the subject line, I will
|
||||||
reject it, then TP your house.
|
reject it, then TP your house.
|
||||||
|
|
||||||
[GitHub issues]: http://github.com/tpope/vim-foreplay/issues
|
[GitHub issues]: http://github.com/tpope/vim-fireplace/issues
|
||||||
[commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
[commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
||||||
|
|
||||||
## Self-Promotion
|
## Self-Promotion
|
||||||
|
|
||||||
Like foreplay.vim? Follow the repository on
|
Like fireplace.vim? Follow the repository on
|
||||||
[GitHub](https://github.com/tpope/vim-foreplay). And if
|
[GitHub](https://github.com/tpope/vim-fireplace). And if
|
||||||
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
||||||
[Twitter](http://twitter.com/tpope) and
|
[Twitter](http://twitter.com/tpope) and
|
||||||
[GitHub](https://github.com/tpope).
|
[GitHub](https://github.com/tpope).
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
" autoload/nrepl/foreplay_connection.vim
|
" autoload/nrepl/fireplace_connection.vim
|
||||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||||
|
|
||||||
if exists("g:autoloaded_nrepl_foreplay_connection") || &cp
|
if exists("g:autoloaded_nrepl_fireplace_connection") || &cp
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:autoloaded_nrepl_foreplay_connection = 1
|
let g:autoloaded_nrepl_fireplace_connection = 1
|
||||||
|
|
||||||
function! s:function(name) abort
|
function! s:function(name) abort
|
||||||
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
|
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
|
||||||
@ -12,21 +12,21 @@ endfunction
|
|||||||
|
|
||||||
" Bencode {{{1
|
" Bencode {{{1
|
||||||
|
|
||||||
function! nrepl#foreplay_connection#bencode(value) abort
|
function! nrepl#fireplace_connection#bencode(value) abort
|
||||||
if type(a:value) == type(0)
|
if type(a:value) == type(0)
|
||||||
return 'i'.a:value.'e'
|
return 'i'.a:value.'e'
|
||||||
elseif type(a:value) == type('')
|
elseif type(a:value) == type('')
|
||||||
return strlen(a:value).':'.a:value
|
return strlen(a:value).':'.a:value
|
||||||
elseif type(a:value) == type([])
|
elseif type(a:value) == type([])
|
||||||
return 'l'.join(map(a:value,'nrepl#foreplay_connection#bencode(v:val)'),'').'e'
|
return 'l'.join(map(a:value,'nrepl#fireplace_connection#bencode(v:val)'),'').'e'
|
||||||
elseif type(a:value) == type({})
|
elseif type(a:value) == type({})
|
||||||
return 'd'.join(values(map(a:value,'nrepl#foreplay_connection#bencode(v:key).nrepl#foreplay_connection#bencode(v:val)')),'').'e'
|
return 'd'.join(values(map(a:value,'nrepl#fireplace_connection#bencode(v:key).nrepl#fireplace_connection#bencode(v:val)')),'').'e'
|
||||||
else
|
else
|
||||||
throw "Can't bencode ".string(a:value)
|
throw "Can't bencode ".string(a:value)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! nrepl#foreplay_connection#bdecode(value) abort
|
function! nrepl#fireplace_connection#bdecode(value) abort
|
||||||
return s:bdecode({'pos': 0, 'value': a:value})
|
return s:bdecode({'pos': 0, 'value': a:value})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -80,11 +80,11 @@ function! s:shellesc(arg) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! nrepl#foreplay_connection#prompt() abort
|
function! nrepl#fireplace_connection#prompt() abort
|
||||||
return foreplay#input_host_port()
|
return fireplace#input_host_port()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! nrepl#foreplay_connection#open(arg) abort
|
function! nrepl#fireplace_connection#open(arg) abort
|
||||||
if a:arg =~# '^\d\+$'
|
if a:arg =~# '^\d\+$'
|
||||||
let host = 'localhost'
|
let host = 'localhost'
|
||||||
let port = a:arg
|
let port = a:arg
|
||||||
@ -187,10 +187,10 @@ function! s:nrepl_call(payload) dict abort
|
|||||||
\ 'break if body.include?(%(6:statusl4:done)) }};' .
|
\ 'break if body.include?(%(6:statusl4:done)) }};' .
|
||||||
\ 'rescue; abort $!.to_s;' .
|
\ 'rescue; abort $!.to_s;' .
|
||||||
\ 'end') . ' ' .
|
\ 'end') . ' ' .
|
||||||
\ s:shellesc(nrepl#foreplay_connection#bencode(a:payload))
|
\ s:shellesc(nrepl#fireplace_connection#bencode(a:payload))
|
||||||
let out = system(in)
|
let out = system(in)
|
||||||
if !v:shell_error
|
if !v:shell_error
|
||||||
return nrepl#foreplay_connection#bdecode('l'.out.'e')
|
return nrepl#fireplace_connection#bdecode('l'.out.'e')
|
||||||
endif
|
endif
|
||||||
throw 'nREPL: '.split(out, "\n")[0]
|
throw 'nREPL: '.split(out, "\n")[0]
|
||||||
endfunction
|
endfunction
|
||||||
@ -212,7 +212,7 @@ import socket
|
|||||||
import string
|
import string
|
||||||
import re
|
import re
|
||||||
|
|
||||||
def foreplay_string_encode(input):
|
def fireplace_string_encode(input):
|
||||||
str_list = []
|
str_list = []
|
||||||
for c in input:
|
for c in input:
|
||||||
if (000 <= ord(c) and ord(c) <= 037) or c == '"' or c == "\\":
|
if (000 <= ord(c) and ord(c) <= 037) or c == '"' or c == "\\":
|
||||||
@ -221,10 +221,10 @@ def foreplay_string_encode(input):
|
|||||||
str_list.append(c)
|
str_list.append(c)
|
||||||
return '"' + ''.join(str_list) + '"'
|
return '"' + ''.join(str_list) + '"'
|
||||||
|
|
||||||
def foreplay_let(var, value):
|
def fireplace_let(var, value):
|
||||||
return vim.command('let ' + var + " = " + foreplay_string_encode(value))
|
return vim.command('let ' + var + " = " + fireplace_string_encode(value))
|
||||||
|
|
||||||
def foreplay_repl_interact():
|
def fireplace_repl_interact():
|
||||||
buffer = ''
|
buffer = ''
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
host = vim.eval('self.host')
|
host = vim.eval('self.host')
|
||||||
@ -243,20 +243,20 @@ def foreplay_repl_interact():
|
|||||||
buffer += body
|
buffer += body
|
||||||
if string.find(body, '6:statusl4:done') != -1:
|
if string.find(body, '6:statusl4:done') != -1:
|
||||||
break
|
break
|
||||||
foreplay_let('out', buffer)
|
fireplace_let('out', buffer)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
foreplay_let('err', str(e))
|
fireplace_let('err', str(e))
|
||||||
finally:
|
finally:
|
||||||
s.close()
|
s.close()
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
function! s:nrepl_call(payload) dict abort
|
function! s:nrepl_call(payload) dict abort
|
||||||
let payload = nrepl#foreplay_connection#bencode(a:payload)
|
let payload = nrepl#fireplace_connection#bencode(a:payload)
|
||||||
python << EOF
|
python << EOF
|
||||||
foreplay_repl_interact()
|
fireplace_repl_interact()
|
||||||
EOF
|
EOF
|
||||||
if !exists('err')
|
if !exists('err')
|
||||||
return nrepl#foreplay_connection#bdecode('l'.out.'e')
|
return nrepl#fireplace_connection#bdecode('l'.out.'e')
|
||||||
endif
|
endif
|
||||||
throw 'nREPL Connection Error: '.err
|
throw 'nREPL Connection Error: '.err
|
||||||
endfunction
|
endfunction
|
@ -1,4 +1,4 @@
|
|||||||
*foreplay.txt* Clojure REPL tease
|
*fireplace.txt* Clojure REPL tease
|
||||||
|
|
||||||
Author: Tim Pope <http://tpo.pe/>
|
Author: Tim Pope <http://tpo.pe/>
|
||||||
License: Same terms as Vim itself (see |license|)
|
License: Same terms as Vim itself (see |license|)
|
||||||
@ -7,12 +7,12 @@ This plugin is only available if 'compatible' is not set.
|
|||||||
|
|
||||||
You need Clojure runtime files to use this plugin. Try vim-clojure-static.
|
You need Clojure runtime files to use this plugin. Try vim-clojure-static.
|
||||||
|
|
||||||
CONNECTING TO A REPL *foreplay-connect*
|
CONNECTING TO A REPL *fireplace-connect*
|
||||||
|
|
||||||
Connecting to lein repl happens automatically. If you have a different setup,
|
Connecting to lein repl happens automatically. If you have a different setup,
|
||||||
you can connect by hand.
|
you can connect by hand.
|
||||||
|
|
||||||
*foreplay-:Connect*
|
*fireplace-:Connect*
|
||||||
:Connect {proto}://{host}:{port} {path}
|
:Connect {proto}://{host}:{port} {path}
|
||||||
Connect to a REPL server. The path is the root of the
|
Connect to a REPL server. The path is the root of the
|
||||||
project that the REPL applies to.
|
project that the REPL applies to.
|
||||||
@ -24,93 +24,93 @@ The REPL is used for the commands below. If no REPL is found for the current
|
|||||||
buffer and classpath.vim is installed, java (or $JAVA_CMD) is invoked
|
buffer and classpath.vim is installed, java (or $JAVA_CMD) is invoked
|
||||||
directly, which can be quite slow depending on your setup.
|
directly, which can be quite slow depending on your setup.
|
||||||
|
|
||||||
The only adapter shipped with foreplay.vim is for nREPL. You need either
|
The only adapter shipped with fireplace.vim is for nREPL. You need either
|
||||||
|if_pyth| or the ruby command in your PATH. (This curious combination is an
|
|if_pyth| or the ruby command in your PATH. (This curious combination is an
|
||||||
accident of history.)
|
accident of history.)
|
||||||
|
|
||||||
LEININGEN *foreplay-leiningen*
|
LEININGEN *fireplace-leiningen*
|
||||||
|
|
||||||
In addition to automatic repl connection, Clojure buffers in a Leiningen
|
In addition to automatic repl connection, Clojure buffers in a Leiningen
|
||||||
project will automatically have their 'makeprg' set to lein. This has the
|
project will automatically have their 'makeprg' set to lein. This has the
|
||||||
nominal value of letting you call, for example, |:make| deps rather than
|
nominal value of letting you call, for example, |:make| deps rather than
|
||||||
:!lein deps.
|
:!lein deps.
|
||||||
|
|
||||||
DOCUMENTATION *foreplay-documentation*
|
DOCUMENTATION *fireplace-documentation*
|
||||||
|
|
||||||
*foreplay-:Doc*
|
*fireplace-:Doc*
|
||||||
:Doc {symbol} Show the docs for the given symbol.
|
:Doc {symbol} Show the docs for the given symbol.
|
||||||
|
|
||||||
*foreplay-:Javadoc*
|
*fireplace-:Javadoc*
|
||||||
:Javadoc {class} Open the java docs for the given class in a browser.
|
:Javadoc {class} Open the java docs for the given class in a browser.
|
||||||
|
|
||||||
*foreplay-K*
|
*fireplace-K*
|
||||||
K Look up docs for keyword under cursor.
|
K Look up docs for keyword under cursor.
|
||||||
|
|
||||||
*foreplay-:FindDoc*
|
*fireplace-:FindDoc*
|
||||||
:FindDoc {arg} Wrapper around (clojure.repl/find-doc ...).
|
:FindDoc {arg} Wrapper around (clojure.repl/find-doc ...).
|
||||||
|
|
||||||
*foreplay-:Apropos*
|
*fireplace-:Apropos*
|
||||||
:Apropos {arg} Wrapper around (clojure.repl/apropos ...).
|
:Apropos {arg} Wrapper around (clojure.repl/apropos ...).
|
||||||
|
|
||||||
*foreplay-:Source*
|
*fireplace-:Source*
|
||||||
:Source {symbol} Show the source for the given symbol.
|
:Source {symbol} Show the source for the given symbol.
|
||||||
|
|
||||||
*foreplay-[d*
|
*fireplace-[d*
|
||||||
[d Show source for keyword under cursor.
|
[d Show source for keyword under cursor.
|
||||||
]d
|
]d
|
||||||
|
|
||||||
NAVIGATING *foreplay-navigating*
|
NAVIGATING *fireplace-navigating*
|
||||||
|
|
||||||
These commands will never use a remote REPL, only a local one, as file paths
|
These commands will never use a remote REPL, only a local one, as file paths
|
||||||
on a remote server wouldn't be very useful locally.
|
on a remote server wouldn't be very useful locally.
|
||||||
|
|
||||||
*foreplay-[_CTRL-D*
|
*fireplace-[_CTRL-D*
|
||||||
[<C-D> Jump to the source of the keyword under the cursor.
|
[<C-D> Jump to the source of the keyword under the cursor.
|
||||||
]<C-D>
|
]<C-D>
|
||||||
|
|
||||||
*foreplay-CTRL-W_CTRL-D*
|
*fireplace-CTRL-W_CTRL-D*
|
||||||
<C-W><C-D> Jump to the source of the keyword under the cursor in
|
<C-W><C-D> Jump to the source of the keyword under the cursor in
|
||||||
<C-W>d a split.
|
<C-W>d a split.
|
||||||
|
|
||||||
*foreplay-gf*
|
*fireplace-gf*
|
||||||
gf Go to the file for the namespace under the cursor.
|
gf Go to the file for the namespace under the cursor.
|
||||||
|
|
||||||
*foreplay-:Djump*
|
*fireplace-:Djump*
|
||||||
:Djump {symbol} Jump to the definition for the given symbol.
|
:Djump {symbol} Jump to the definition for the given symbol.
|
||||||
|
|
||||||
*foreplay-:Dsplit*
|
*fireplace-:Dsplit*
|
||||||
:Dsplit {symbol} Jump to the definition for the given symbol in a
|
:Dsplit {symbol} Jump to the definition for the given symbol in a
|
||||||
split.
|
split.
|
||||||
|
|
||||||
*foreplay-:A*
|
*fireplace-:A*
|
||||||
:A In a test file, edit the implementation, and vice
|
:A In a test file, edit the implementation, and vice
|
||||||
versa. Basically adds or removes -test from the end
|
versa. Basically adds or removes -test from the end
|
||||||
of the current namespace and searches for it in the
|
of the current namespace and searches for it in the
|
||||||
class path.
|
class path.
|
||||||
|
|
||||||
*foreplay-:AS*
|
*fireplace-:AS*
|
||||||
:AS Like :A, but in a split.
|
:AS Like :A, but in a split.
|
||||||
|
|
||||||
*foreplay-:AV*
|
*fireplace-:AV*
|
||||||
:AV Like :A, but in a vertical split.
|
:AV Like :A, but in a vertical split.
|
||||||
|
|
||||||
*foreplay-:AT*
|
*fireplace-:AT*
|
||||||
:AT Like :A, but in a tab.
|
:AT Like :A, but in a tab.
|
||||||
|
|
||||||
EVALUATING CODE *foreplay-eval*
|
EVALUATING CODE *fireplace-eval*
|
||||||
|
|
||||||
All code is evaluated in the namespace of the current file, requiring it if
|
All code is evaluated in the namespace of the current file, requiring it if
|
||||||
necessary. If the current file sits outside the class path (project.clj, for
|
necessary. If the current file sits outside the class path (project.clj, for
|
||||||
example), the user namespace is used instead. If an exception occurs, the
|
example), the user namespace is used instead. If an exception occurs, the
|
||||||
stack trace is loaded into the |location-list|. Use |:lopen| to view it.
|
stack trace is loaded into the |location-list|. Use |:lopen| to view it.
|
||||||
|
|
||||||
*foreplay-:Require*
|
*fireplace-:Require*
|
||||||
:Require [ns] Require :reload the given/current namespace.
|
:Require [ns] Require :reload the given/current namespace.
|
||||||
|
|
||||||
*foreplay-:Require!*
|
*fireplace-:Require!*
|
||||||
:Require! [ns] Require :reload-all the given/current namespace.
|
:Require! [ns] Require :reload-all the given/current namespace.
|
||||||
|
|
||||||
*foreplay-:Eval*
|
*fireplace-:Eval*
|
||||||
:Eval Eval/print the outermost expression for the current
|
:Eval Eval/print the outermost expression for the current
|
||||||
line.
|
line.
|
||||||
|
|
||||||
@ -118,41 +118,41 @@ stack trace is loaded into the |location-list|. Use |:lopen| to view it.
|
|||||||
|
|
||||||
:Eval {expr} Eval/print the given expression.
|
:Eval {expr} Eval/print the given expression.
|
||||||
|
|
||||||
*foreplay-:Eval!*
|
*fireplace-:Eval!*
|
||||||
:[range]Eval! Eval the given range or outermost expression and
|
:[range]Eval! Eval the given range or outermost expression and
|
||||||
replace it with its result.
|
replace it with its result.
|
||||||
|
|
||||||
:[range]Eval! {expr} Eval the given expression and insert it after
|
:[range]Eval! {expr} Eval the given expression and insert it after
|
||||||
the given range or current line.
|
the given range or current line.
|
||||||
|
|
||||||
*foreplay-cp*
|
*fireplace-cp*
|
||||||
cp{motion} Eval/print the code indicated by {motion}.
|
cp{motion} Eval/print the code indicated by {motion}.
|
||||||
|
|
||||||
cpp Eval/print the inner-most expr at the cursor.
|
cpp Eval/print the inner-most expr at the cursor.
|
||||||
|
|
||||||
*foreplay-cpr*
|
*fireplace-cpr*
|
||||||
cpr Eval a require :reload form.
|
cpr Eval a require :reload form.
|
||||||
|
|
||||||
*foreplay-cpR*
|
*fireplace-cpR*
|
||||||
cpR Eval a require :reload-all form.
|
cpR Eval a require :reload-all form.
|
||||||
|
|
||||||
*foreplay-c!*
|
*fireplace-c!*
|
||||||
c!{motion} Eval/replace the code indicated by {motion}.
|
c!{motion} Eval/replace the code indicated by {motion}.
|
||||||
|
|
||||||
c!! Eval/replace the inner-most expr at the cusror.
|
c!! Eval/replace the inner-most expr at the cusror.
|
||||||
|
|
||||||
*foreplay-cqp*
|
*fireplace-cqp*
|
||||||
cqp Bring up a prompt for code to eval/print.
|
cqp Bring up a prompt for code to eval/print.
|
||||||
|
|
||||||
*foreplay-cqc*
|
*fireplace-cqc*
|
||||||
cqc Bring up a |command-line-window| for code to
|
cqc Bring up a |command-line-window| for code to
|
||||||
eval/print. Equivalent to cqp<C-F>i.
|
eval/print. Equivalent to cqp<C-F>i.
|
||||||
|
|
||||||
*foreplay-cq*
|
*fireplace-cq*
|
||||||
cq{motion} Bring up a |command-line-window| with text indicated
|
cq{motion} Bring up a |command-line-window| with text indicated
|
||||||
by {motion} prepopulated.
|
by {motion} prepopulated.
|
||||||
|
|
||||||
*foreplay-:Last*
|
*fireplace-:Last*
|
||||||
:Last Open the result of the last evaluation in the preview
|
:Last Open the result of the last evaluation in the preview
|
||||||
window. Use :2Last to get the next-to-last result,
|
window. Use :2Last to get the next-to-last result,
|
||||||
and so on. Once the window is open, cycle to older
|
and so on. Once the window is open, cycle to older
|
||||||
@ -160,16 +160,16 @@ cq{motion} Bring up a |command-line-window| with text indicated
|
|||||||
|
|
||||||
And insert mode:
|
And insert mode:
|
||||||
|
|
||||||
*foreplay-i_CTRL-R_(*
|
*fireplace-i_CTRL-R_(*
|
||||||
<C-R>( Evaluate the given expression and insert the result.
|
<C-R>( Evaluate the given expression and insert the result.
|
||||||
|
|
||||||
There's omnicomplete on |CTRL-X_CTRL-O|, which works in Clojure buffers and
|
There's omnicomplete on |CTRL-X_CTRL-O|, which works in Clojure buffers and
|
||||||
in the |command-line-window|, and tab complete at the cqp prompt.
|
in the |command-line-window|, and tab complete at the cqp prompt.
|
||||||
|
|
||||||
ABOUT *foreplay-about*
|
ABOUT *fireplace-about*
|
||||||
|
|
||||||
Grab the latest version or report a bug on GitHub:
|
Grab the latest version or report a bug on GitHub:
|
||||||
|
|
||||||
http://github.com/tpope/vim-foreplay
|
http://github.com/tpope/vim-fireplace
|
||||||
|
|
||||||
vim:tw=78:et:ft=help:norl:
|
vim:tw=78:et:ft=help:norl:
|
@ -1,14 +1,14 @@
|
|||||||
" foreplay.vim - Clojure REPL tease
|
" fireplace.vim - Clojure REPL tease
|
||||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
" Maintainer: Tim Pope <http://tpo.pe/>
|
||||||
|
|
||||||
if exists("g:loaded_foreplay") || v:version < 700 || &cp
|
if exists("g:loaded_fireplace") || v:version < 700 || &cp
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let g:loaded_foreplay = 1
|
let g:loaded_fireplace = 1
|
||||||
|
|
||||||
" File type {{{1
|
" File type {{{1
|
||||||
|
|
||||||
augroup foreplay_file_type
|
augroup fireplace_file_type
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufNewFile,BufReadPost *.clj setfiletype clojure
|
autocmd BufNewFile,BufReadPost *.clj setfiletype clojure
|
||||||
augroup END
|
augroup END
|
||||||
@ -37,7 +37,7 @@ endfunction
|
|||||||
|
|
||||||
let s:jar_contents = {}
|
let s:jar_contents = {}
|
||||||
|
|
||||||
function! foreplay#jar_contents(path) abort
|
function! fireplace#jar_contents(path) abort
|
||||||
if !exists('s:zipinfo')
|
if !exists('s:zipinfo')
|
||||||
let s:zipinfo = executable('zipinfo')
|
let s:zipinfo = executable('zipinfo')
|
||||||
endif
|
endif
|
||||||
@ -50,17 +50,17 @@ function! foreplay#jar_contents(path) abort
|
|||||||
return copy(get(s:jar_contents, a:path, []))
|
return copy(get(s:jar_contents, a:path, []))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#eval_complete(A, L, P) abort
|
function! fireplace#eval_complete(A, L, P) abort
|
||||||
let prefix = matchstr(a:A, '\%(.* \|^\)\%(#\=[\[{('']\)*')
|
let prefix = matchstr(a:A, '\%(.* \|^\)\%(#\=[\[{('']\)*')
|
||||||
let keyword = a:A[strlen(prefix) : -1]
|
let keyword = a:A[strlen(prefix) : -1]
|
||||||
return sort(map(foreplay#omnicomplete(0, keyword), 'prefix . v:val.word'))
|
return sort(map(fireplace#omnicomplete(0, keyword), 'prefix . v:val.word'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#ns_complete(A, L, P) abort
|
function! fireplace#ns_complete(A, L, P) abort
|
||||||
let matches = []
|
let matches = []
|
||||||
for dir in foreplay#client().path()
|
for dir in fireplace#client().path()
|
||||||
if dir =~# '\.jar$'
|
if dir =~# '\.jar$'
|
||||||
let files = filter(foreplay#jar_contents(dir), 'v:val =~# "\\.clj$"')
|
let files = filter(fireplace#jar_contents(dir), 'v:val =~# "\\.clj$"')
|
||||||
else
|
else
|
||||||
let files = split(glob(dir."/**/*.clj", 1), "\n")
|
let files = split(glob(dir."/**/*.clj", 1), "\n")
|
||||||
call map(files, 'v:val[strlen(dir)+1 : -1]')
|
call map(files, 'v:val[strlen(dir)+1 : -1]')
|
||||||
@ -70,7 +70,7 @@ function! foreplay#ns_complete(A, L, P) abort
|
|||||||
return filter(map(matches, 's:to_ns(v:val)'), 'a:A ==# "" || a:A ==# v:val[0 : strlen(a:A)-1]')
|
return filter(map(matches, 's:to_ns(v:val)'), 'a:A ==# "" || a:A ==# v:val[0 : strlen(a:A)-1]')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#omnicomplete(findstart, base) abort
|
function! fireplace#omnicomplete(findstart, base) abort
|
||||||
if a:findstart
|
if a:findstart
|
||||||
let line = getline('.')[0 : col('.')-2]
|
let line = getline('.')[0 : col('.')-2]
|
||||||
return col('.') - strlen(matchstr(line, '\k\+$')) - 1
|
return col('.') - strlen(matchstr(line, '\k\+$')) - 1
|
||||||
@ -79,9 +79,9 @@ function! foreplay#omnicomplete(findstart, base) abort
|
|||||||
let omnifier = '(fn [[k v]] (let [m (meta v)]' .
|
let omnifier = '(fn [[k v]] (let [m (meta v)]' .
|
||||||
\ ' {:word k :menu (pr-str (:arglists m (symbol ""))) :info (str " " (:doc m)) :kind (if (:arglists m) "f" "v")}))'
|
\ ' {:word k :menu (pr-str (:arglists m (symbol ""))) :info (str " " (:doc m)) :kind (if (:arglists m) "f" "v")}))'
|
||||||
|
|
||||||
let ns = foreplay#ns()
|
let ns = fireplace#ns()
|
||||||
|
|
||||||
let [aliases, namespaces, maps] = foreplay#evalparse(
|
let [aliases, namespaces, maps] = fireplace#evalparse(
|
||||||
\ '[(ns-aliases '.s:qsym(ns).') (all-ns) '.
|
\ '[(ns-aliases '.s:qsym(ns).') (all-ns) '.
|
||||||
\ '(sort-by :word (map '.omnifier.' (ns-map '.s:qsym(ns).')))]')
|
\ '(sort-by :word (map '.omnifier.' (ns-map '.s:qsym(ns).')))]')
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ function! foreplay#omnicomplete(findstart, base) abort
|
|||||||
let prefix = ns . '/'
|
let prefix = ns . '/'
|
||||||
let ns = get(aliases, ns, ns)
|
let ns = get(aliases, ns, ns)
|
||||||
let keyword = matchstr(a:base, '.*/\zs.*')
|
let keyword = matchstr(a:base, '.*/\zs.*')
|
||||||
let results = foreplay#evalparse(
|
let results = fireplace#evalparse(
|
||||||
\ '(sort-by :word (map '.omnifier.' (ns-publics '.s:qsym(ns).')))')
|
\ '(sort-by :word (map '.omnifier.' (ns-publics '.s:qsym(ns).')))')
|
||||||
for r in results
|
for r in results
|
||||||
let r.word = prefix . r.word
|
let r.word = prefix . r.word
|
||||||
@ -110,9 +110,9 @@ function! foreplay#omnicomplete(findstart, base) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup foreplay_completion
|
augroup fireplace_completion
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure setlocal omnifunc=foreplay#omnicomplete
|
autocmd FileType clojure setlocal omnifunc=fireplace#omnicomplete
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
@ -173,9 +173,9 @@ endfunction
|
|||||||
" }}}1
|
" }}}1
|
||||||
" :Connect {{{1
|
" :Connect {{{1
|
||||||
|
|
||||||
command! -bar -complete=customlist,s:connect_complete -nargs=* ForeplayConnect :exe s:Connect(<f-args>)
|
command! -bar -complete=customlist,s:connect_complete -nargs=* FireplaceConnect :exe s:Connect(<f-args>)
|
||||||
|
|
||||||
function! foreplay#input_host_port()
|
function! fireplace#input_host_port()
|
||||||
let arg = input('Host> ', 'localhost')
|
let arg = input('Host> ', 'localhost')
|
||||||
if arg ==# ''
|
if arg ==# ''
|
||||||
return ''
|
return ''
|
||||||
@ -190,7 +190,7 @@ function! foreplay#input_host_port()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:protos()
|
function! s:protos()
|
||||||
return map(split(globpath(&runtimepath, 'autoload/*/foreplay_connection.vim'), "\n"), 'fnamemodify(v:val, ":h:t")')
|
return map(split(globpath(&runtimepath, 'autoload/*/fireplace_connection.vim'), "\n"), 'fnamemodify(v:val, ":h:t")')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:connect_complete(A, L, P)
|
function! s:connect_complete(A, L, P)
|
||||||
@ -200,7 +200,7 @@ function! s:connect_complete(A, L, P)
|
|||||||
else
|
else
|
||||||
let rest = matchstr(a:A, '://\zs.*')
|
let rest = matchstr(a:A, '://\zs.*')
|
||||||
try
|
try
|
||||||
let options = {proto}#foreplay_connection#complete(rest)
|
let options = {proto}#fireplace_connection#complete(rest)
|
||||||
catch /^Vim(let):E117/
|
catch /^Vim(let):E117/
|
||||||
let options = ['localhost:']
|
let options = ['localhost:']
|
||||||
endtry
|
endtry
|
||||||
@ -229,10 +229,10 @@ function! s:Connect(arg, ...)
|
|||||||
redraw!
|
redraw!
|
||||||
echo ':Connect'
|
echo ':Connect'
|
||||||
echo 'Protocol> '.proto
|
echo 'Protocol> '.proto
|
||||||
let arg = {proto}#foreplay_connection#prompt()
|
let arg = {proto}#fireplace_connection#prompt()
|
||||||
endif
|
endif
|
||||||
try
|
try
|
||||||
let connection = {proto}#foreplay_connection#open(arg)
|
let connection = {proto}#fireplace_connection#open(arg)
|
||||||
catch /.*/
|
catch /.*/
|
||||||
return 'echoerr '.string(v:exception)
|
return 'echoerr '.string(v:exception)
|
||||||
endtry
|
endtry
|
||||||
@ -249,9 +249,9 @@ function! s:Connect(arg, ...)
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup foreplay_connect
|
augroup fireplace_connect
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure command! -bar -complete=customlist,s:connect_complete -nargs=* Connect :ForeplayConnect <args>
|
autocmd FileType clojure command! -bar -complete=customlist,s:connect_complete -nargs=* Connect :FireplaceConnect <args>
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
@ -322,7 +322,7 @@ endfunction
|
|||||||
" Client {{{1
|
" Client {{{1
|
||||||
|
|
||||||
function! s:client() abort
|
function! s:client() abort
|
||||||
silent doautocmd User ForeplayPreConnect
|
silent doautocmd User FireplacePreConnect
|
||||||
if exists('s:input')
|
if exists('s:input')
|
||||||
let buf = s:input
|
let buf = s:input
|
||||||
elseif has_key(s:qffiles, expand('%:p'))
|
elseif has_key(s:qffiles, expand('%:p'))
|
||||||
@ -339,16 +339,16 @@ function! s:client() abort
|
|||||||
let previous = root
|
let previous = root
|
||||||
let root = fnamemodify(root, ':h')
|
let root = fnamemodify(root, ':h')
|
||||||
endwhile
|
endwhile
|
||||||
return foreplay#local_client(1)
|
return fireplace#local_client(1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#client() abort
|
function! fireplace#client() abort
|
||||||
return s:client()
|
return s:client()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#local_client(...)
|
function! fireplace#local_client(...)
|
||||||
if !a:0
|
if !a:0
|
||||||
silent doautocmd User ForeplayPreConnect
|
silent doautocmd User FireplacePreConnect
|
||||||
endif
|
endif
|
||||||
if exists('s:input')
|
if exists('s:input')
|
||||||
let buf = s:input
|
let buf = s:input
|
||||||
@ -369,12 +369,12 @@ function! foreplay#local_client(...)
|
|||||||
throw ':Connect to a REPL or install classpath.vim to evaluate code'
|
throw ':Connect to a REPL or install classpath.vim to evaluate code'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#findresource(resource) abort
|
function! fireplace#findresource(resource) abort
|
||||||
if a:resource ==# ''
|
if a:resource ==# ''
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
try
|
try
|
||||||
let path = foreplay#local_client().path()
|
let path = fireplace#local_client().path()
|
||||||
catch /^:Connect/
|
catch /^:Connect/
|
||||||
return ''
|
return ''
|
||||||
endtry
|
endtry
|
||||||
@ -383,14 +383,14 @@ function! foreplay#findresource(resource) abort
|
|||||||
return file
|
return file
|
||||||
endif
|
endif
|
||||||
for jar in path
|
for jar in path
|
||||||
if fnamemodify(jar, ':e') ==# 'jar' && index(foreplay#jar_contents(jar), a:resource) >= 0
|
if fnamemodify(jar, ':e') ==# 'jar' && index(fireplace#jar_contents(jar), a:resource) >= 0
|
||||||
return 'zipfile:' . jar . '::' . a:resource
|
return 'zipfile:' . jar . '::' . a:resource
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#quickfix_for(stacktrace) abort
|
function! fireplace#quickfix_for(stacktrace) abort
|
||||||
let qflist = []
|
let qflist = []
|
||||||
for line in a:stacktrace
|
for line in a:stacktrace
|
||||||
let entry = {'text': line}
|
let entry = {'text': line}
|
||||||
@ -408,7 +408,7 @@ function! foreplay#quickfix_for(stacktrace) abort
|
|||||||
let qflist += [entry]
|
let qflist += [entry]
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
let paths = map(copy(qflist), 'foreplay#findresource(v:val.resource)')
|
let paths = map(copy(qflist), 'fireplace#findresource(v:val.resource)')
|
||||||
let i = 0
|
let i = 0
|
||||||
for i in range(len(qflist))
|
for i in range(len(qflist))
|
||||||
if !empty(paths[i])
|
if !empty(paths[i])
|
||||||
@ -435,16 +435,16 @@ function! s:eval(expr, ...) abort
|
|||||||
let options = a:0 ? copy(a:1) : {}
|
let options = a:0 ? copy(a:1) : {}
|
||||||
let client = get(options, 'client', s:client())
|
let client = get(options, 'client', s:client())
|
||||||
if !has_key(options, 'ns')
|
if !has_key(options, 'ns')
|
||||||
if foreplay#ns() !~# '^\%(user\)$'
|
if fireplace#ns() !~# '^\%(user\)$'
|
||||||
let error = client.require(foreplay#ns())
|
let error = client.require(fireplace#ns())
|
||||||
if !empty(error)
|
if !empty(error)
|
||||||
echohl ErrorMSG
|
echohl ErrorMSG
|
||||||
echo error
|
echo error
|
||||||
echohl NONE
|
echohl NONE
|
||||||
throw "Clojure: couldn't require " . foreplay#ns()
|
throw "Clojure: couldn't require " . fireplace#ns()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
let options.ns = foreplay#ns()
|
let options.ns = fireplace#ns()
|
||||||
endif
|
endif
|
||||||
return client.eval(a:expr, options)
|
return client.eval(a:expr, options)
|
||||||
endfunction
|
endfunction
|
||||||
@ -489,11 +489,11 @@ function! s:qfhistory() abort
|
|||||||
return list
|
return list
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#session_eval(expr) abort
|
function! fireplace#session_eval(expr) abort
|
||||||
let response = s:eval(a:expr, {'session': 1})
|
let response = s:eval(a:expr, {'session': 1})
|
||||||
|
|
||||||
if !empty(get(response, 'value', ''))
|
if !empty(get(response, 'value', ''))
|
||||||
call insert(s:history, {'buffer': bufnr(''), 'code': a:expr, 'ns': foreplay#ns(), 'response': response})
|
call insert(s:history, {'buffer': bufnr(''), 'code': a:expr, 'ns': fireplace#ns(), 'response': response})
|
||||||
endif
|
endif
|
||||||
if len(s:history) > &history
|
if len(s:history) > &history
|
||||||
call remove(s:history, &history, -1)
|
call remove(s:history, &history, -1)
|
||||||
@ -505,7 +505,7 @@ function! foreplay#session_eval(expr) abort
|
|||||||
let nr = winbufnr(s:qffiles[expand('%:p')].buffer)
|
let nr = winbufnr(s:qffiles[expand('%:p')].buffer)
|
||||||
endif
|
endif
|
||||||
if nr != -1
|
if nr != -1
|
||||||
call setloclist(nr, foreplay#quickfix_for(response.stacktrace))
|
call setloclist(nr, fireplace#quickfix_for(response.stacktrace))
|
||||||
lopen
|
lopen
|
||||||
wincmd p
|
wincmd p
|
||||||
endif
|
endif
|
||||||
@ -518,28 +518,28 @@ function! foreplay#session_eval(expr) abort
|
|||||||
elseif has_key(response, 'value')
|
elseif has_key(response, 'value')
|
||||||
return response.value
|
return response.value
|
||||||
else
|
else
|
||||||
let err = 'foreplay.vim: Something went wrong: '.string(response)
|
let err = 'fireplace.vim: Something went wrong: '.string(response)
|
||||||
endif
|
endif
|
||||||
throw err
|
throw err
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#eval(expr) abort
|
function! fireplace#eval(expr) abort
|
||||||
return foreplay#session_eval(a:expr)
|
return fireplace#session_eval(a:expr)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#echo_session_eval(expr) abort
|
function! fireplace#echo_session_eval(expr) abort
|
||||||
try
|
try
|
||||||
echo foreplay#session_eval(a:expr)
|
echo fireplace#session_eval(a:expr)
|
||||||
catch /^Clojure:/
|
catch /^Clojure:/
|
||||||
endtry
|
endtry
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#evalprint(expr) abort
|
function! fireplace#evalprint(expr) abort
|
||||||
return foreplay#echo_session_eval(a:expr)
|
return fireplace#echo_session_eval(a:expr)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let g:foreplay#reader =
|
let g:fireplace#reader =
|
||||||
\ '(symbol ((fn *vimify [x]' .
|
\ '(symbol ((fn *vimify [x]' .
|
||||||
\ ' (cond' .
|
\ ' (cond' .
|
||||||
\ ' (map? x) (str "{" (apply str (interpose ", " (map (fn [[k v]] (str (*vimify k) ": " (*vimify v))) x))) "}")' .
|
\ ' (map? x) (str "{" (apply str (interpose ", " (map (fn [[k v]] (str (*vimify k) ": " (*vimify v))) x))) "}")' .
|
||||||
@ -550,9 +550,9 @@ let g:foreplay#reader =
|
|||||||
\ ' (keyword? x) (pr-str (name x))' .
|
\ ' (keyword? x) (pr-str (name x))' .
|
||||||
\ ' :else (pr-str (str x)))) %s))'
|
\ ' :else (pr-str (str x)))) %s))'
|
||||||
|
|
||||||
function! foreplay#evalparse(expr, ...) abort
|
function! fireplace#evalparse(expr, ...) abort
|
||||||
let options = extend({'session': 0}, a:0 ? a:1 : {})
|
let options = extend({'session': 0}, a:0 ? a:1 : {})
|
||||||
let response = s:eval(printf(g:foreplay#reader, a:expr), options)
|
let response = s:eval(printf(g:fireplace#reader, a:expr), options)
|
||||||
call s:output_response(response)
|
call s:output_response(response)
|
||||||
|
|
||||||
if get(response, 'ex', '') !=# ''
|
if get(response, 'ex', '') !=# ''
|
||||||
@ -560,7 +560,7 @@ function! foreplay#evalparse(expr, ...) abort
|
|||||||
elseif has_key(response, 'value')
|
elseif has_key(response, 'value')
|
||||||
return empty(response.value) ? '' : eval(response.value)
|
return empty(response.value) ? '' : eval(response.value)
|
||||||
else
|
else
|
||||||
let err = 'foreplay.vim: Something went wrong: '.string(response)
|
let err = 'fireplace.vim: Something went wrong: '.string(response)
|
||||||
endif
|
endif
|
||||||
throw err
|
throw err
|
||||||
endfunction
|
endfunction
|
||||||
@ -568,7 +568,7 @@ endfunction
|
|||||||
" }}}1
|
" }}}1
|
||||||
" Eval {{{1
|
" Eval {{{1
|
||||||
|
|
||||||
let foreplay#skip = 'synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string\\|char"'
|
let fireplace#skip = 'synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string\\|char"'
|
||||||
|
|
||||||
function! s:opfunc(type) abort
|
function! s:opfunc(type) abort
|
||||||
let sel_save = &selection
|
let sel_save = &selection
|
||||||
@ -585,7 +585,7 @@ function! s:opfunc(type) abort
|
|||||||
elseif a:type ==# 'block'
|
elseif a:type ==# 'block'
|
||||||
silent exe "normal! `[\<C-V>`]y"
|
silent exe "normal! `[\<C-V>`]y"
|
||||||
elseif a:type ==# 'outer'
|
elseif a:type ==# 'outer'
|
||||||
call searchpair('(','',')', 'Wbcr', g:foreplay#skip)
|
call searchpair('(','',')', 'Wbcr', g:fireplace#skip)
|
||||||
silent exe "normal! vaby"
|
silent exe "normal! vaby"
|
||||||
else
|
else
|
||||||
silent exe "normal! `[v`]y"
|
silent exe "normal! `[v`]y"
|
||||||
@ -603,7 +603,7 @@ function! s:filterop(type) abort
|
|||||||
let reg_save = @@
|
let reg_save = @@
|
||||||
try
|
try
|
||||||
let expr = s:opfunc(a:type)
|
let expr = s:opfunc(a:type)
|
||||||
let @@ = matchstr(expr, '^\n\+').foreplay#session_eval(expr).matchstr(expr, '\n\+$')
|
let @@ = matchstr(expr, '^\n\+').fireplace#session_eval(expr).matchstr(expr, '\n\+$')
|
||||||
if @@ !~# '^\n*$'
|
if @@ !~# '^\n*$'
|
||||||
normal! gvp
|
normal! gvp
|
||||||
endif
|
endif
|
||||||
@ -616,11 +616,11 @@ endfunction
|
|||||||
|
|
||||||
function! s:printop(type) abort
|
function! s:printop(type) abort
|
||||||
let s:todo = s:opfunc(a:type)
|
let s:todo = s:opfunc(a:type)
|
||||||
call feedkeys("\<Plug>ForeplayPrintLast")
|
call feedkeys("\<Plug>FireplacePrintLast")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:print_last() abort
|
function! s:print_last() abort
|
||||||
call foreplay#echo_session_eval(s:todo)
|
call fireplace#echo_session_eval(s:todo)
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -628,7 +628,7 @@ function! s:editop(type) abort
|
|||||||
call feedkeys(&cedit . "\<Home>", 'n')
|
call feedkeys(&cedit . "\<Home>", 'n')
|
||||||
let input = s:input(substitute(substitute(s:opfunc(a:type), "\s*;[^\n]*", '', 'g'), '\n\+\s*', ' ', 'g'))
|
let input = s:input(substitute(substitute(s:opfunc(a:type), "\s*;[^\n]*", '', 'g'), '\n\+\s*', ' ', 'g'))
|
||||||
if input !=# ''
|
if input !=# ''
|
||||||
call foreplay#echo_session_eval(input)
|
call fireplace#echo_session_eval(input)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -638,8 +638,8 @@ function! s:Eval(bang, line1, line2, count, args) abort
|
|||||||
else
|
else
|
||||||
if a:count ==# 0
|
if a:count ==# 0
|
||||||
normal! ^
|
normal! ^
|
||||||
let line1 = searchpair('(','',')', 'bcrn', g:foreplay#skip)
|
let line1 = searchpair('(','',')', 'bcrn', g:fireplace#skip)
|
||||||
let line2 = searchpair('(','',')', 'rn', g:foreplay#skip)
|
let line2 = searchpair('(','',')', 'rn', g:fireplace#skip)
|
||||||
else
|
else
|
||||||
let line1 = a:line1
|
let line1 = a:line1
|
||||||
let line2 = a:line2
|
let line2 = a:line2
|
||||||
@ -654,7 +654,7 @@ function! s:Eval(bang, line1, line2, count, args) abort
|
|||||||
endif
|
endif
|
||||||
if a:bang
|
if a:bang
|
||||||
try
|
try
|
||||||
let result = foreplay#session_eval(expr)
|
let result = fireplace#session_eval(expr)
|
||||||
if a:args !=# ''
|
if a:args !=# ''
|
||||||
call append(a:line1, result)
|
call append(a:line1, result)
|
||||||
exe a:line1
|
exe a:line1
|
||||||
@ -665,7 +665,7 @@ function! s:Eval(bang, line1, line2, count, args) abort
|
|||||||
catch /^Clojure:/
|
catch /^Clojure:/
|
||||||
endtry
|
endtry
|
||||||
else
|
else
|
||||||
call foreplay#echo_session_eval(expr)
|
call fireplace#echo_session_eval(expr)
|
||||||
endif
|
endif
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
@ -679,18 +679,18 @@ function! s:actually_input(...)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:input(default) abort
|
function! s:input(default) abort
|
||||||
if !exists('g:FOREPLAY_HISTORY') || type(g:FOREPLAY_HISTORY) != type([])
|
if !exists('g:FIREPLACE_HISTORY') || type(g:FIREPLACE_HISTORY) != type([])
|
||||||
unlet! g:FOREPLAY_HISTORY
|
unlet! g:FIREPLACE_HISTORY
|
||||||
let g:FOREPLAY_HISTORY = []
|
let g:FIREPLACE_HISTORY = []
|
||||||
endif
|
endif
|
||||||
try
|
try
|
||||||
let s:input = bufnr('%')
|
let s:input = bufnr('%')
|
||||||
let s:oldhist = s:histswap(g:FOREPLAY_HISTORY)
|
let s:oldhist = s:histswap(g:FIREPLACE_HISTORY)
|
||||||
return s:actually_input(foreplay#ns().'=> ', a:default, 'customlist,foreplay#eval_complete')
|
return s:actually_input(fireplace#ns().'=> ', a:default, 'customlist,fireplace#eval_complete')
|
||||||
finally
|
finally
|
||||||
unlet! s:input
|
unlet! s:input
|
||||||
if exists('s:oldhist')
|
if exists('s:oldhist')
|
||||||
let g:FOREPLAY_HISTORY = s:histswap(s:oldhist)
|
let g:FIREPLACE_HISTORY = s:histswap(s:oldhist)
|
||||||
endif
|
endif
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
@ -710,7 +710,7 @@ function! s:inputeval() abort
|
|||||||
let input = s:input('')
|
let input = s:input('')
|
||||||
redraw
|
redraw
|
||||||
if input !=# ''
|
if input !=# ''
|
||||||
call foreplay#echo_session_eval(input)
|
call fireplace#echo_session_eval(input)
|
||||||
endif
|
endif
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
@ -722,7 +722,7 @@ function! s:recall() abort
|
|||||||
if input =~# '^(\=$'
|
if input =~# '^(\=$'
|
||||||
return ''
|
return ''
|
||||||
else
|
else
|
||||||
return foreplay#session_eval(input)
|
return fireplace#session_eval(input)
|
||||||
endif
|
endif
|
||||||
catch /^Clojure:/
|
catch /^Clojure:/
|
||||||
return ''
|
return ''
|
||||||
@ -743,19 +743,19 @@ function! s:histswap(list) abort
|
|||||||
return old
|
return old
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
nnoremap <silent> <Plug>ForeplayPrintLast :exe <SID>print_last()<CR>
|
nnoremap <silent> <Plug>FireplacePrintLast :exe <SID>print_last()<CR>
|
||||||
nnoremap <silent> <Plug>ForeplayPrint :<C-U>set opfunc=<SID>printop<CR>g@
|
nnoremap <silent> <Plug>FireplacePrint :<C-U>set opfunc=<SID>printop<CR>g@
|
||||||
xnoremap <silent> <Plug>ForeplayPrint :<C-U>call <SID>printop(visualmode())<CR>
|
xnoremap <silent> <Plug>FireplacePrint :<C-U>call <SID>printop(visualmode())<CR>
|
||||||
|
|
||||||
nnoremap <silent> <Plug>ForeplayFilter :<C-U>set opfunc=<SID>filterop<CR>g@
|
nnoremap <silent> <Plug>FireplaceFilter :<C-U>set opfunc=<SID>filterop<CR>g@
|
||||||
xnoremap <silent> <Plug>ForeplayFilter :<C-U>call <SID>filterop(visualmode())<CR>
|
xnoremap <silent> <Plug>FireplaceFilter :<C-U>call <SID>filterop(visualmode())<CR>
|
||||||
|
|
||||||
nnoremap <silent> <Plug>ForeplayEdit :<C-U>set opfunc=<SID>editop<CR>g@
|
nnoremap <silent> <Plug>FireplaceEdit :<C-U>set opfunc=<SID>editop<CR>g@
|
||||||
xnoremap <silent> <Plug>ForeplayEdit :<C-U>call <SID>editop(visualmode())<CR>
|
xnoremap <silent> <Plug>FireplaceEdit :<C-U>call <SID>editop(visualmode())<CR>
|
||||||
|
|
||||||
nnoremap <Plug>ForeplayPrompt :exe <SID>inputeval()<CR>
|
nnoremap <Plug>FireplacePrompt :exe <SID>inputeval()<CR>
|
||||||
|
|
||||||
noremap! <Plug>ForeplayRecall <C-R>=<SID>recall()<CR>
|
noremap! <Plug>FireplaceRecall <C-R>=<SID>recall()<CR>
|
||||||
|
|
||||||
function! s:Last(bang, count) abort
|
function! s:Last(bang, count) abort
|
||||||
if len(s:history) < a:count
|
if len(s:history) < a:count
|
||||||
@ -779,22 +779,22 @@ function! s:Last(bang, count) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:setup_eval() abort
|
function! s:setup_eval() abort
|
||||||
command! -buffer -bang -range=0 -nargs=? -complete=customlist,foreplay#eval_complete Eval :exe s:Eval(<bang>0, <line1>, <line2>, <count>, <q-args>)
|
command! -buffer -bang -range=0 -nargs=? -complete=customlist,fireplace#eval_complete Eval :exe s:Eval(<bang>0, <line1>, <line2>, <count>, <q-args>)
|
||||||
command! -buffer -bang -bar -count=1 Last exe s:Last(<bang>0, <count>)
|
command! -buffer -bang -bar -count=1 Last exe s:Last(<bang>0, <count>)
|
||||||
|
|
||||||
nmap <buffer> cp <Plug>ForeplayPrint
|
nmap <buffer> cp <Plug>FireplacePrint
|
||||||
nmap <buffer> cpp <Plug>ForeplayPrintab
|
nmap <buffer> cpp <Plug>FireplacePrintab
|
||||||
|
|
||||||
nmap <buffer> c! <Plug>ForeplayFilter
|
nmap <buffer> c! <Plug>FireplaceFilter
|
||||||
nmap <buffer> c!! <Plug>ForeplayFilterab
|
nmap <buffer> c!! <Plug>FireplaceFilterab
|
||||||
|
|
||||||
nmap <buffer> cq <Plug>ForeplayEdit
|
nmap <buffer> cq <Plug>FireplaceEdit
|
||||||
nmap <buffer> cqq <Plug>ForeplayEditab
|
nmap <buffer> cqq <Plug>FireplaceEditab
|
||||||
|
|
||||||
nmap <buffer> cqp <Plug>ForeplayPrompt
|
nmap <buffer> cqp <Plug>FireplacePrompt
|
||||||
exe 'nmap <buffer> cqc <Plug>ForeplayPrompt' . &cedit . 'i'
|
exe 'nmap <buffer> cqc <Plug>FireplacePrompt' . &cedit . 'i'
|
||||||
|
|
||||||
map! <buffer> <C-R>( <Plug>ForeplayRecall
|
map! <buffer> <C-R>( <Plug>FireplaceRecall
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:setup_historical()
|
function! s:setup_historical()
|
||||||
@ -810,7 +810,7 @@ function! s:cmdwinleave()
|
|||||||
setlocal filetype< omnifunc<
|
setlocal filetype< omnifunc<
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup foreplay_eval
|
augroup fireplace_eval
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure call s:setup_eval()
|
autocmd FileType clojure call s:setup_eval()
|
||||||
autocmd BufReadPost * if has_key(s:qffiles, expand('<afile>:p')) |
|
autocmd BufReadPost * if has_key(s:qffiles, expand('<afile>:p')) |
|
||||||
@ -824,10 +824,10 @@ augroup END
|
|||||||
" :Require {{{1
|
" :Require {{{1
|
||||||
|
|
||||||
function! s:Require(bang, ns)
|
function! s:Require(bang, ns)
|
||||||
let cmd = ('(clojure.core/require '.s:qsym(a:ns ==# '' ? foreplay#ns() : a:ns).' :reload'.(a:bang ? '-all' : '').')')
|
let cmd = ('(clojure.core/require '.s:qsym(a:ns ==# '' ? fireplace#ns() : a:ns).' :reload'.(a:bang ? '-all' : '').')')
|
||||||
echo cmd
|
echo cmd
|
||||||
try
|
try
|
||||||
call foreplay#session_eval(cmd)
|
call fireplace#session_eval(cmd)
|
||||||
return ''
|
return ''
|
||||||
catch /^Clojure:.*/
|
catch /^Clojure:.*/
|
||||||
return ''
|
return ''
|
||||||
@ -835,12 +835,12 @@ function! s:Require(bang, ns)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:setup_require()
|
function! s:setup_require()
|
||||||
command! -buffer -bar -bang -complete=customlist,foreplay#ns_complete -nargs=? Require :exe s:Require(<bang>0, <q-args>)
|
command! -buffer -bar -bang -complete=customlist,fireplace#ns_complete -nargs=? Require :exe s:Require(<bang>0, <q-args>)
|
||||||
nnoremap <silent><buffer> cpr :Require<CR>
|
nnoremap <silent><buffer> cpr :Require<CR>
|
||||||
nnoremap <silent><buffer> cpR :Require!<CR>
|
nnoremap <silent><buffer> cpR :Require!<CR>
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup foreplay_require
|
augroup fireplace_require
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure call s:setup_require()
|
autocmd FileType clojure call s:setup_require()
|
||||||
augroup END
|
augroup END
|
||||||
@ -857,15 +857,15 @@ function! s:decode_url(url) abort
|
|||||||
return url
|
return url
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#source(symbol) abort
|
function! fireplace#source(symbol) abort
|
||||||
let options = {'client': foreplay#local_client(), 'session': 0}
|
let options = {'client': fireplace#local_client(), 'session': 0}
|
||||||
let cmd =
|
let cmd =
|
||||||
\ '(when-let [v (resolve ' . s:qsym(a:symbol) .')]' .
|
\ '(when-let [v (resolve ' . s:qsym(a:symbol) .')]' .
|
||||||
\ ' (when-let [filepath (:file (meta v))]' .
|
\ ' (when-let [filepath (:file (meta v))]' .
|
||||||
\ ' (when-let [url (.getResource (clojure.lang.RT/baseLoader) filepath)]' .
|
\ ' (when-let [url (.getResource (clojure.lang.RT/baseLoader) filepath)]' .
|
||||||
\ ' [(str url)' .
|
\ ' [(str url)' .
|
||||||
\ ' (:line (meta v))])))'
|
\ ' (:line (meta v))])))'
|
||||||
let result = foreplay#evalparse(cmd, options)
|
let result = fireplace#evalparse(cmd, options)
|
||||||
if type(result) == type([])
|
if type(result) == type([])
|
||||||
return '+' . result[1] . ' ' . fnameescape(s:decode_url(result[0]))
|
return '+' . result[1] . ' ' . fnameescape(s:decode_url(result[0]))
|
||||||
else
|
else
|
||||||
@ -875,11 +875,11 @@ endfunction
|
|||||||
|
|
||||||
function! s:Edit(cmd, keyword) abort
|
function! s:Edit(cmd, keyword) abort
|
||||||
if a:keyword =~# '^\k\+/$'
|
if a:keyword =~# '^\k\+/$'
|
||||||
let location = foreplay#findfile(a:keyword[0: -2])
|
let location = fireplace#findfile(a:keyword[0: -2])
|
||||||
elseif a:keyword =~# '^\k\+\.[^/.]\+$'
|
elseif a:keyword =~# '^\k\+\.[^/.]\+$'
|
||||||
let location = foreplay#findfile(a:keyword)
|
let location = fireplace#findfile(a:keyword)
|
||||||
else
|
else
|
||||||
let location = foreplay#source(a:keyword)
|
let location = fireplace#source(a:keyword)
|
||||||
endif
|
endif
|
||||||
if location !=# ''
|
if location !=# ''
|
||||||
if matchstr(location, '^+\d\+ \zs.*') ==# expand('%:p') && a:cmd ==# 'edit'
|
if matchstr(location, '^+\d\+ \zs.*') ==# expand('%:p') && a:cmd ==# 'edit'
|
||||||
@ -892,29 +892,29 @@ function! s:Edit(cmd, keyword) abort
|
|||||||
return 'echoerr v:errmsg'
|
return 'echoerr v:errmsg'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
nnoremap <silent> <Plug>ForeplayDjump :<C-U>exe <SID>Edit('edit', expand('<cword>'))<CR>
|
nnoremap <silent> <Plug>FireplaceDjump :<C-U>exe <SID>Edit('edit', expand('<cword>'))<CR>
|
||||||
nnoremap <silent> <Plug>ForeplayDsplit :<C-U>exe <SID>Edit('split', expand('<cword>'))<CR>
|
nnoremap <silent> <Plug>FireplaceDsplit :<C-U>exe <SID>Edit('split', expand('<cword>'))<CR>
|
||||||
nnoremap <silent> <Plug>ForeplayDtabjump :<C-U>exe <SID>Edit('tabedit', expand('<cword>'))<CR>
|
nnoremap <silent> <Plug>FireplaceDtabjump :<C-U>exe <SID>Edit('tabedit', expand('<cword>'))<CR>
|
||||||
|
|
||||||
augroup foreplay_source
|
augroup fireplace_source
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure setlocal includeexpr=tr(v:fname,'.-','/_')
|
autocmd FileType clojure setlocal includeexpr=tr(v:fname,'.-','/_')
|
||||||
autocmd FileType clojure setlocal suffixesadd=.clj,.java
|
autocmd FileType clojure setlocal suffixesadd=.clj,.java
|
||||||
autocmd FileType clojure setlocal define=^\\s*(def\\w*
|
autocmd FileType clojure setlocal define=^\\s*(def\\w*
|
||||||
autocmd FileType clojure command! -bar -buffer -nargs=1 -complete=customlist,foreplay#eval_complete Djump :exe s:Edit('edit', <q-args>)
|
autocmd FileType clojure command! -bar -buffer -nargs=1 -complete=customlist,fireplace#eval_complete Djump :exe s:Edit('edit', <q-args>)
|
||||||
autocmd FileType clojure command! -bar -buffer -nargs=1 -complete=customlist,foreplay#eval_complete Dsplit :exe s:Edit('split', <q-args>)
|
autocmd FileType clojure command! -bar -buffer -nargs=1 -complete=customlist,fireplace#eval_complete Dsplit :exe s:Edit('split', <q-args>)
|
||||||
autocmd FileType clojure nmap <buffer> [<C-D> <Plug>ForeplayDjump
|
autocmd FileType clojure nmap <buffer> [<C-D> <Plug>FireplaceDjump
|
||||||
autocmd FileType clojure nmap <buffer> ]<C-D> <Plug>ForeplayDjump
|
autocmd FileType clojure nmap <buffer> ]<C-D> <Plug>FireplaceDjump
|
||||||
autocmd FileType clojure nmap <buffer> <C-W><C-D> <Plug>ForeplayDsplit
|
autocmd FileType clojure nmap <buffer> <C-W><C-D> <Plug>FireplaceDsplit
|
||||||
autocmd FileType clojure nmap <buffer> <C-W>d <Plug>ForeplayDsplit
|
autocmd FileType clojure nmap <buffer> <C-W>d <Plug>FireplaceDsplit
|
||||||
autocmd FileType clojure nmap <buffer> <C-W>gd <Plug>ForeplayDtabjump
|
autocmd FileType clojure nmap <buffer> <C-W>gd <Plug>FireplaceDtabjump
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
" Go to file {{{1
|
" Go to file {{{1
|
||||||
|
|
||||||
function! foreplay#findfile(path) abort
|
function! fireplace#findfile(path) abort
|
||||||
let options = {'client': foreplay#local_client(), 'session': 0}
|
let options = {'client': fireplace#local_client(), 'session': 0}
|
||||||
|
|
||||||
let cmd =
|
let cmd =
|
||||||
\ '(symbol' .
|
\ '(symbol' .
|
||||||
@ -944,7 +944,7 @@ function! foreplay#findfile(path) abort
|
|||||||
endif
|
endif
|
||||||
let result = s:decode_url(result)
|
let result = s:decode_url(result)
|
||||||
if result ==# ''
|
if result ==# ''
|
||||||
return foreplay#findresource(path)
|
return fireplace#findresource(path)
|
||||||
else
|
else
|
||||||
return result
|
return result
|
||||||
endif
|
endif
|
||||||
@ -956,7 +956,7 @@ function! s:GF(cmd, file) abort
|
|||||||
else
|
else
|
||||||
let file = a:file
|
let file = a:file
|
||||||
endif
|
endif
|
||||||
let file = foreplay#findfile(file)
|
let file = fireplace#findfile(file)
|
||||||
if file ==# ''
|
if file ==# ''
|
||||||
let v:errmsg = "Couldn't find file for ".a:file
|
let v:errmsg = "Couldn't find file for ".a:file
|
||||||
return 'echoerr v:errmsg'
|
return 'echoerr v:errmsg'
|
||||||
@ -967,7 +967,7 @@ function! s:GF(cmd, file) abort
|
|||||||
\ '| let &l:path = ' . string(&l:path)
|
\ '| let &l:path = ' . string(&l:path)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup foreplay_go_to_file
|
augroup fireplace_go_to_file
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure nnoremap <silent><buffer> gf :<C-U>exe <SID>GF('edit', expand('<cfile>'))<CR>
|
autocmd FileType clojure nnoremap <silent><buffer> gf :<C-U>exe <SID>GF('edit', expand('<cfile>'))<CR>
|
||||||
autocmd FileType clojure nnoremap <silent><buffer> <C-W>f :<C-U>exe <SID>GF('split', expand('<cfile>'))<CR>
|
autocmd FileType clojure nnoremap <silent><buffer> <C-W>f :<C-U>exe <SID>GF('split', expand('<cfile>'))<CR>
|
||||||
@ -994,7 +994,7 @@ function! s:buffer_path(...) abort
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! foreplay#ns() abort
|
function! fireplace#ns() abort
|
||||||
let lnum = 1
|
let lnum = 1
|
||||||
while lnum < line('$') && getline(lnum) =~# '^\s*\%(;.*\)\=$'
|
while lnum < line('$') && getline(lnum) =~# '^\s*\%(;.*\)\=$'
|
||||||
let lnum += 1
|
let lnum += 1
|
||||||
@ -1016,7 +1016,7 @@ endfunction
|
|||||||
function! s:Lookup(ns, macro, arg) abort
|
function! s:Lookup(ns, macro, arg) abort
|
||||||
" doc is in clojure.core in older Clojure versions
|
" doc is in clojure.core in older Clojure versions
|
||||||
try
|
try
|
||||||
call foreplay#session_eval("(clojure.core/require '".a:ns.") (clojure.core/eval (clojure.core/list (if (ns-resolve 'clojure.core '".a:macro.") 'clojure.core/".a:macro." '".a:ns.'/'.a:macro.") '".a:arg.'))')
|
call fireplace#session_eval("(clojure.core/require '".a:ns.") (clojure.core/eval (clojure.core/list (if (ns-resolve 'clojure.core '".a:macro.") 'clojure.core/".a:macro." '".a:ns.'/'.a:macro.") '".a:arg.'))')
|
||||||
catch /^Clojure:/
|
catch /^Clojure:/
|
||||||
catch /.*/
|
catch /.*/
|
||||||
echohl ErrorMSG
|
echohl ErrorMSG
|
||||||
@ -1047,7 +1047,7 @@ function! s:Apropos(pattern) abort
|
|||||||
else
|
else
|
||||||
let pattern = '"' . a:pattern . '"'
|
let pattern = '"' . a:pattern . '"'
|
||||||
endif
|
endif
|
||||||
let matches = foreplay#evalparse('(clojure.repl/apropos '.pattern.')')
|
let matches = fireplace#evalparse('(clojure.repl/apropos '.pattern.')')
|
||||||
if empty(matches)
|
if empty(matches)
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
@ -1069,25 +1069,25 @@ function! s:K()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
nnoremap <Plug>ForeplayK :<C-R>=<SID>K()<CR><CR>
|
nnoremap <Plug>FireplaceK :<C-R>=<SID>K()<CR><CR>
|
||||||
nnoremap <Plug>ForeplaySource :Source <C-R><C-W><CR>
|
nnoremap <Plug>FireplaceSource :Source <C-R><C-W><CR>
|
||||||
|
|
||||||
augroup foreplay_doc
|
augroup fireplace_doc
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure nmap <buffer> K <Plug>ForeplayK
|
autocmd FileType clojure nmap <buffer> K <Plug>FireplaceK
|
||||||
autocmd FileType clojure nmap <buffer> [d <Plug>ForeplaySource
|
autocmd FileType clojure nmap <buffer> [d <Plug>FireplaceSource
|
||||||
autocmd FileType clojure nmap <buffer> ]d <Plug>ForeplaySource
|
autocmd FileType clojure nmap <buffer> ]d <Plug>FireplaceSource
|
||||||
autocmd FileType clojure command! -buffer -nargs=1 Apropos :exe s:Apropos(<q-args>)
|
autocmd FileType clojure command! -buffer -nargs=1 Apropos :exe s:Apropos(<q-args>)
|
||||||
autocmd FileType clojure command! -buffer -nargs=1 FindDoc :exe s:Lookup('clojure.repl', 'find-doc', printf('#"%s"', <q-args>))
|
autocmd FileType clojure command! -buffer -nargs=1 FindDoc :exe s:Lookup('clojure.repl', 'find-doc', printf('#"%s"', <q-args>))
|
||||||
autocmd FileType clojure command! -buffer -bar -nargs=1 Javadoc :exe s:Lookup('clojure.java.javadoc', 'javadoc', <q-args>)
|
autocmd FileType clojure command! -buffer -bar -nargs=1 Javadoc :exe s:Lookup('clojure.java.javadoc', 'javadoc', <q-args>)
|
||||||
autocmd FileType clojure command! -buffer -bar -nargs=1 -complete=customlist,foreplay#eval_complete Doc :exe s:Lookup('clojure.repl', 'doc', <q-args>)
|
autocmd FileType clojure command! -buffer -bar -nargs=1 -complete=customlist,fireplace#eval_complete Doc :exe s:Lookup('clojure.repl', 'doc', <q-args>)
|
||||||
autocmd FileType clojure command! -buffer -bar -nargs=1 -complete=customlist,foreplay#eval_complete Source :exe s:Lookup('clojure.repl', 'source', <q-args>)
|
autocmd FileType clojure command! -buffer -bar -nargs=1 -complete=customlist,fireplace#eval_complete Source :exe s:Lookup('clojure.repl', 'source', <q-args>)
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
" Alternate {{{1
|
" Alternate {{{1
|
||||||
|
|
||||||
augroup foreplay_alternate
|
augroup fireplace_alternate
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure command! -buffer -bar -bang A :exe s:Alternate('edit<bang>')
|
autocmd FileType clojure command! -buffer -bar -bang A :exe s:Alternate('edit<bang>')
|
||||||
autocmd FileType clojure command! -buffer -bar AS :exe s:Alternate('split')
|
autocmd FileType clojure command! -buffer -bar AS :exe s:Alternate('split')
|
||||||
@ -1096,7 +1096,7 @@ augroup foreplay_alternate
|
|||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
function! s:alternates() abort
|
function! s:alternates() abort
|
||||||
let ns = foreplay#ns()
|
let ns = fireplace#ns()
|
||||||
if ns =~# '-test$'
|
if ns =~# '-test$'
|
||||||
let alt = [ns[0:-6]]
|
let alt = [ns[0:-6]]
|
||||||
elseif ns =~# '\.test\.'
|
elseif ns =~# '\.test\.'
|
||||||
@ -1112,7 +1112,7 @@ endfunction
|
|||||||
function! s:Alternate(cmd) abort
|
function! s:Alternate(cmd) abort
|
||||||
let alternates = s:alternates()
|
let alternates = s:alternates()
|
||||||
for file in alternates
|
for file in alternates
|
||||||
let path = foreplay#findresource(file)
|
let path = fireplace#findresource(file)
|
||||||
if !empty(path)
|
if !empty(path)
|
||||||
return a:cmd . ' ' . fnameescape(path)
|
return a:cmd . ' ' . fnameescape(path)
|
||||||
endif
|
endif
|
||||||
@ -1152,7 +1152,7 @@ function! s:leiningen_connect()
|
|||||||
let port = matchstr(readfile(portfile, 'b', 1)[0], '\d\+')
|
let port = matchstr(readfile(portfile, 'b', 1)[0], '\d\+')
|
||||||
let s:leiningen_repl_ports[b:leiningen_root] = getftime(portfile)
|
let s:leiningen_repl_ports[b:leiningen_root] = getftime(portfile)
|
||||||
try
|
try
|
||||||
call s:register_connection(nrepl#foreplay_connection#open(port), b:leiningen_root)
|
call s:register_connection(nrepl#fireplace_connection#open(port), b:leiningen_root)
|
||||||
catch /^nREPL Connection Error:/
|
catch /^nREPL Connection Error:/
|
||||||
call delete(portfile)
|
call delete(portfile)
|
||||||
endtry
|
endtry
|
||||||
@ -1178,9 +1178,9 @@ function! s:leiningen_init() abort
|
|||||||
call s:leiningen_connect()
|
call s:leiningen_connect()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup foreplay_leiningen
|
augroup fireplace_leiningen
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd User ForeplayPreConnect call s:leiningen_connect()
|
autocmd User FireplacePreConnect call s:leiningen_connect()
|
||||||
autocmd FileType clojure call s:leiningen_init()
|
autocmd FileType clojure call s:leiningen_init()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
" foreplay/zip.vim: zip.vim monkey patch to allow access from quickfix
|
" fireplace/zip.vim: zip.vim monkey patch to allow access from quickfix
|
||||||
" Maintainer: Tim Pope <http://tpo.pe>
|
" Maintainer: Tim Pope <http://tpo.pe>
|
||||||
|
|
||||||
if exists("g:loaded_zip") || &cp
|
if exists("g:loaded_zip") || &cp
|
||||||
@ -25,7 +25,7 @@ fun! zip#Read(fname,mode)
|
|||||||
" call Decho("zipfile<".zipfile.">")
|
" call Decho("zipfile<".zipfile.">")
|
||||||
" call Decho("fname <".fname.">")
|
" call Decho("fname <".fname.">")
|
||||||
|
|
||||||
" Changes for foreplay.
|
" Changes for fireplace.
|
||||||
let temp = tempname()
|
let temp = tempname()
|
||||||
let fn = expand('%:p')
|
let fn = expand('%:p')
|
||||||
exe "sil! ! ".g:zip_unzipcmd." -p -- ".shellescape(zipfile,1)." ".shellescape(fnameescape(fname),1). ' > '.temp
|
exe "sil! ! ".g:zip_unzipcmd." -p -- ".shellescape(zipfile,1)." ".shellescape(fnameescape(fname),1). ' > '.temp
|
Loading…
Reference in New Issue
Block a user