Comments (7)
Thank you so much! I will get a look tomorrow, it looks great =)
from intim.
Yupe, confirmed.
python
interpreter considers it's your job to indent each new line the way it has to be indented, whereas..sage
interpreter automatically indents the first line of new scopes for you.
The solution may be to preprocess or not lines sent by <Plug>IntimSendSelection
in a way that depends on your interpreter or your language. I'll get into this.
As a workaround for now, you may use <Plug>IntimSendChunk
instead, which should not mind about indentation, although it's a totally different way to send script lines.
Thank you for reporting :)
from intim.
106a9c6 should fix it. The problem actually affects every ipython
interpreter, which I think sage
interpreter is an instance.
Considering deprecation of the old sage %autoindent
feature. I have chosen to use ipython's %cpaste
magic command to send selection just like we would do while pasting text to the console.
This requires the SendSelection
function to choose now whether or not to send selection naively line-by-line or using the new MagicCpaste
procedure. So I had to introduce an new sendSelection
intim option to handle this case.
However, in order to keep basic user out of this subtle tweak. I've made this option automagically set to the right value if user's invoked interpreter is detected to be sage
or ipython
. This can be done with a new hook triggered while user is setting an Intim option.
This should work transparently from now on, unless you have a very specific case to handle.
See :help intim-autoindent
or :help intim-sage
to keep updated :)
from intim.
Hi Iago,
the magical option seems not to work. I have still the indentation problem.
Moreover, The call Intim_sendSelection('sage', 'MagicCpaste')
throws an error:
Thank you so much for your help!
from intim.
Ay.
-
For the magic to occur,
sage
must have been somehow defined as your formal invoke command by:call Intim_invokeCommand('python', 'sage')
or
call Intim_invokeCommand('sage', 'sage')
or anything like that (see
:help intim-invoke
).. is this the case? Otherwise, could you provide the output of::echo <SNR>29_get_invokeCommand() :echo <SNR>29_get_sendSelection()
(I wrote
29_
because it is the number that shows up in your error message. It may change if you have installed/uninstalled other plugins since then. Please use the latest one.) -
As for this
E117
error. Thanks to your report, I found out that Intim function were guaranteed to be defined only.. at least.. at the time of vimautocmd
resolving (see :help autocommand
). As a consequence, wrapping your call in something like:augroup PythonGroup autocmd! autocmd VimEnter *.py,*.sage call Intim_sendSelection('sage', 'MagicCpaste') augroup end
Should fix it. I'll update the doc to warn about this.
Thanks for reporting again. Keep me updated :)
from intim.
Thank you for your help!
When I start Intim from my somefile.sage, I get a python session.
The output that you resquested are:
:echo <SNR>29_get_invokeCommand()
python
:echo <SNR>29_get_sendSelection()
LineByLine
I have added your wrap to my $VIMRC
. Opening a .sage
file results in:
Futhermore, call Intim_invokeCommand('python', 'sage')
throws me also an error:
from intim.
Thank you. So the magic is not happening because it turns out you cannot actually set your options correctly. This is another problem, if you don't mind skipping to #6 :)
from intim.
Related Issues (10)
- Intim errors while opening tex file HOT 2
- No terminal started HOT 4
- IndentationError: expected an indented block HOT 5
- E117: Unknown function: Intim_invokeCommand HOT 2
- Julia support? HOT 4
- IntimSetLanguage: Unknown function HOT 2
- E484: Cannot open file /tmp/ HOT 12
- Vundle - Error while running helptags HOT 6
- Intim option calls fail: `call Intim_*()` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intim.