-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
let vim-slime ignore triple backtiks in markdown filles #380
Comments
Hi @pkyoung At the bottom of this section, there is a bit about
Can you try that and let me know if that works for you? (using triple backticks 😄 ) |
Hi @jpalardy , thank you for this amazing plugin and I just wanted to mention the I'd like to add on a suggestion that I think is still in line with the title of this issue: having functions other than Line 100 in ce6ffa7
My vimscript is pretty rough so I wanted to get an idea of your thoughts on this kind of functionality before really diving into it myself. I imagine that if that delimiter search and replace is evaluated further downstream (say, at The reason for this is that occasionally, I do happen to want to run only the first few lines or last few lines of a chunk of code:
As the cell_delimiter is currently implemented, if I just wanted to run the first and last lines (for whatever reason), I would need to go back to resorting to temporarily adding blank lines between the delimiters:
That works decently well and honestly is not much of a big deal. Not much wrong with having the blank lines and if I really wanted to, I supposed splitting that code into multiple chunks is also an option. I only bring this up because (with my minimal understanding) it looks like the lines of code used to strip out the delimiters when sending a cell through slime could very easily be relocated to apply to any slime send function. And I cannot really imagine a time where a user would specify a cell delimiter but only want that delimiter to be ignored during cell block sends, rather than any send. What would you think about having all the slime send functions ignore the delimiters? If it sounds like a good idea to you but you don't have the time right now, I can try to see if I can implement this myself when I get a chance. Thanks again for the stellar plugin! |
Hi @pvelayudhan I read your comment a few times, but I'm not sure I understand the situation and what you want to happen. Could you make a bigger example and try to include:
Thanks 👍 |
Definitely. Also I only just realized I forgot to escape the cell delimiters in the above example. Let's say everything between the dashed lines is the contents of a .Rmd file (which has regular markdown interspersed with code blocks that begin with ```{r} and end with ```). And I have set in my config ------------- This is a sentence. ```{r} If I try to slime send an entire cell, the behaviour is perfect: ------------- This is a sentence. ```{r} # line 1-8 sends if cursor is here If I try to send the paragraph im on with ------------- This is a sentence. ```{r} # this fails because backticks What I want to get is: ------------- This is a sentence. ```{r} # this sends 1-2 My workaround in the mean time has been to add in bonus blank space before the first paragraph of code and after the last paragraph of code: ------------- This is a sentence. ```{r} And then I remove lines 0 and 9 later. Let me know if it is still a little unclear! |
Hi @pvelayudhan Super clear now 🎉 I can relate to this example … especially since I'm a big Rmd user myself. But, interestingly, I did converge on "cheating" with empty lines, I can think of 2 reasons:
So, now I tend to structure my code in semi-logical paragraphs… … The mid-level solution is to pre-select your code before hitting But it's easy to break out of flow, if you have to think about block boundaries 🤔 … A more final solution is to write some custom logic to "do what you mean", selection-wise:
In practice, I don't know if "what you mean" and what other people would mean/want is the same 😄 If you want to give it a try — let me know how that goes. You can also consider posting your solution here for others. … Another solution is to modify the text before the send. 💡 |
Thank you for the response and it is very fair that your Rmd habits were developed for this to not really be an issue lol. I switched over to vim-slime from Nvim-R (also a great plugin, but just for R) where I became used to slinging paragraphs right out of the gates of the cells. I've opted for the "pre-select" code option that I'll share here. This is like "vip" command but will ignore the starting and ending triple backticks. It's not pretty but it works 😄:
Then back in vimscript I have:
To send the current paragraph with ";". Works perfectly fine for my purposes : ) Cheers! |
Dear,
Thank you for the helpful plugin.
I'd like to know how to used vim-slime with code block in md files.
In example below, I like to execute cmd1 and cmd2 only by hitting c-c c-c.
This is similar issue with #209, and I made comment there also.
Thank you.
The text was updated successfully, but these errors were encountered: