Code Monkey home page Code Monkey logo

Comments (12)

jpalardy avatar jpalardy commented on July 24, 2024

Right now the IPython mode is controlled through a global variable. It wouldn't be too hard to chain a conditional on a buffer variable b:slime_python_ipython.

In practice, when inside a specific buffer, how will you toggle the mode?

Alternatively, you could have another key mapping that:

  • unsets the global variable
  • sends the text
  • resets the global variable

but that's not super-elegant.

from vim-slime.

languitar avatar languitar commented on July 24, 2024

In practice, when inside a specific buffer, how will you toggle the mode?

I would like to set the variable with an ftplugin so that all python files automatically get this option, but other languages do not get it.

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

I'm sorry, we're commenting in a few issues at the same time. Can you walk me through your use cases? (I want to make sure I really understand the problem)

from vim-slime.

languitar avatar languitar commented on July 24, 2024

Right. Maybe I have several different file types open in different buffers. I want to connect them to multiple tmux panes. For some of these buffers, setting g:slime_python_ipython might be necessary because they are connected to ipython. For other buffers this option might not be necessary (maybe because I am sending code snippets to an IRC conversation in weechat or whatever).

from vim-slime.

languitar avatar languitar commented on July 24, 2024

Or maybe thinking the other way around: certain transformations applied to the text sent to e.g. tmux, could be tied to the slime connection.

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

Although the g:slime_python_ipython is a global variable -- it doesn't affect all buffers.

For example, when you send text, vim-slime checks what filetype you sent the text from and runs it onlu through the specific filter. As such, python files get the python filter, etc.

Is that not the behavior you see?

from vim-slime.

languitar avatar languitar commented on July 24, 2024

Oh right, I missed that.

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

I thought you might be mixing python and ipython buffers. (something currently not supported)

from vim-slime.

languitar avatar languitar commented on July 24, 2024

Ok. I understand.

The only thing that see from a design point of view is that the filters to apply not only relate to the file type, but also to the connection information. If I connect a python file to my mcabber session (inside tmux), I do not want to have the ipython transformation, but a transformation where the message starts with /msay begin etc.

If the transformations were maintained inside the connection information, and multiple connection could be open in parallel, then some very interesting use cases could be possible. E.g. I could create one key mapping to send to ipython and a second one to send to mcabber or weechat etc. That way it would be very easy to create code and on parallel discuss this code with others without ever having to use the clipboard manually.

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

This is all possible today, with some tweaking.

All buffers have their own "connection config". With different mappings, you could overwrite b:slime_config before invoking the slime binding.

  • send text to python, slime gets configured
  • (save b:slime_config, set to null)
  • send text to mcabber, slime gets configured
  • now you have the saved b:slime_config from the python connection, and b:slime_config currently points to mcabber … if you swap those before you send to slime, you can send to the connection you want

You would, essentially, build a channel-selector in front of vim-slime.

from vim-slime.

languitar avatar languitar commented on July 24, 2024

Ok, that's nice. But this lacks the ability so select the transformations to apply as they are not contained in the slime_config.

from vim-slime.

jpalardy avatar jpalardy commented on July 24, 2024

2-year old, closing.

from vim-slime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.