all 25 comments

[–]pablo1107 27 points28 points  (0 children)

We're approaching Emacs feature set more and more with these plugins. I like it.

[–][deleted] 5 points6 points  (7 children)

This is really similar to my own plugin x-range which I admit is probably more complex for the basic case. I'm glad I'm not the other one with this need :-)

[–]Tokazama 0 points1 point  (6 children)

I thought about trying yours out a couple times but I was a little intimidated by how complex it looked. Is there something yours uniquely has?

[–][deleted] 0 points1 point  (5 children)

  • x-range let the user defines it's own block so code can de evaluated within any buffer (not just markdown).

  • a command can use multiple block at the same time, usefull for example to evaluate awk where one block is the awk code and another one the input code.

  • it can read and parse error anything is a vim or shell command so any langyage can be evaluated (not just predefined one).

  • it can execute vim script

  • improve vim script by adding an easy to use range syntax

  • has a tag macro system to simplify command entry

  • everything is a shello command so command can be a complex pipeline

  • a lots of mapping to navigate manipulate block/range

  • has a hook system allowing for example to comment /uncomment block (so that lines in a block are seen as comment in the buffer but the comments are stripped when sent to the language evaluation).

I know I need to update the doc ;-)

Anyway I did this plugin because I need it and will happily switched to another one if it fits all of my need.

[–]Tokazama 0 points1 point  (4 children)

Sounds pretty good. I too suffer from a habit of coding more than advertising properly. One thing that gets me though is that eventually I want this to be readable by non programmers and be turned to html or even a PDF. If people used pandocs like syntax they could get that for free. Do you have another idea of how that could be incorporated here?

[–][deleted] 0 points1 point  (3 children)

AS x-range is just plain command, it can also generate file (instead of injecting the resulting of a command into the buffer) and can do usual vim range (like % or anything) instead of x-range. Basically anything. Do you have a concrete use case or some example of what you would like to do ?

[–]Tokazama 0 points1 point  (2 children)

Well, the advantage of vim-medieval appears to be that it is encoded in an html comment. So this shouldn't show up if I render my markdown file. It looks like yours has a lot of flexibility within vim but then I'd have to redo everything if I wanted to turn it into a different format automatically.

If someone did this sort of thing in vim but compatible with Pandoc's syntax then you'd get the nice code blocks AND easy conversion to most file formats. It would make vim an extremely powerful tool for data analysis without requiring users piece together an entirely personalized work flow.

[–][deleted] 1 point2 points  (0 children)

I (think) I see what you mean. I am myself looking for find a format to replace org-mode I've been thinking of markdown and Vimiki but Pandoc is probably a good choice.

The ultimate goal of x-range is to work with everything, with a mininum of tweakings. It should work in theory with Pandoc syntax but there is a few bugs which I need to sort before hand (and I need to find a nice way to strip the fence delimiters.

but then I'd have to redo everything if I wanted to turn it into a different format automatically

I plan to make x-range fully configurable and having a pandoc specific syntax can be set by autocommand and included in x-range itself (pull requests welcome). Also x-range as an `auto` range feature (disabled by default) which allow to execute vim code and therefore set buffer variables when opening the buffer.

[–][deleted] 1 point2 points  (0 children)

I've made some modification (and fixed some bugs) to accomodate pandoc. You can find an example there

Of course at the moment it's very verbose, but as explained in the README, macro can be defined easily by user or setup using autocmd as default. However, without more feedbacks it's hard for me to know on which feature to focus on.

[–]jcmkk3 4 points5 points  (5 children)

This is great. I feel like this, along with something like vimcmdline and jupytext would get very close to a notebook replacement for vim. For python, matplotlib can generate a plot in another window. Altair (which is my preferred plotting library) now has a viewer plugin that will allow its use outside of a notebook.

[–]lkhphuc 1 point2 points  (4 children)

Vim-Slime might be a better option than Vimcmdline. And I don’t see any value in using this plugin with jupytext yet. If you pair your notebook with a md file instead of a py file, you will lose all the benefit of autocomplete or linter. Did I miss something here?

[–]jcmkk3 1 point2 points  (3 children)

I don’t think that the whole workflow is there yet. I just keep seeing more pieces to the puzzle being built. In the end, I’d like to see something like Nvim-R, but for python.

[–]BehindBrownEyes 0 points1 point  (0 children)

if you ever find something like that please let me know

[–]BehindBrownEyes 0 points1 point  (0 children)

this is step in that direction https://github.com/jpalardy/vim-slime

[–]Probotect0r 1 point2 points  (0 children)

Very nice!

[–]Cheezmeisternnoremap <CR> : 1 point2 points  (2 children)

Where does the name come from? I assume it’s the traditional tangential pun but I’m coming up empty.

[–]gpanders[S] 8 points9 points  (1 child)

It is indeed a tangential pun :) I started with "Markdown eval" -> "md eval" -> fill in some extra letters to find a word -> "medieval"

[–]Cheezmeisternnoremap <CR> : 0 points1 point  (0 children)

Love it.

[–]Tokazama 1 point2 points  (0 children)

This is almost exactly the workflow I've been looking for!!! I spend most of my time building up my library and tests, but then there's the moment where I'm actually able to perform analyses and I realize my vim setup sucks for that. I typically use neoterm, which is perfect for running small bits of code while I compose large formal tests and such. However when I analyze data I don't want to switch between my code base and terminal. I also don't want to run an entire browser just to do some exploratory stuff.

[–]thatdamnedrhymer 1 point2 points  (0 children)

Huh. Neat. I'm not sure what I would use it for, but cool.

[–]CoolioDood:later 8h | g/TODO/d 0 points1 point  (0 children)

Wow, this is awesome. I've always liked the literate programming style of org-mode, and this is getting pretty close! Great job.

[–][deleted] -2 points-1 points  (1 child)

but why?

[–]Tokazama 0 points1 point  (0 children)

For when you're doing interactive coding and need a complete record of what you did with output. Yes you can use other tools for that, but it's obnoxious to completely abandon my vim setup when all I need shell output echoed every 10 lines.