I solved it in another way, but thank you for the pull request :)
@RasmusLindroth Your solution (assuming here) does it wrong when having to deal with escaped characters (spaces). Probably better to leave it up to the shell than do it yourself in a way that doesn't work for all.
Because my neovim config does stuff I don't want for composing toots, I have do :set tw=0 every time I open the editor. I had an idea, it's to do nvim -c ":set tw=0" but tut interprets the space between set and tw=0 to be a separate argument, basically making it impossible for my solution to work.
That was my somewhat ranty rant. This PR is pretty much this but rebased so that it works on the master branch.
Also, I tested it, now my thing works. I'm not sure of other scenarios where it doesn't work (or works against the user).
(Questions welcome, although you should read the quoted text for rationale. I am sending this in quite a hurry because I already lost a previous version of my comment, it's nearly midnight and i'm kinda annoyed, so let me know of any little imperfections)
That was my somewhat ranty rant. This PR is pretty much this but rebased so that it works on the master branch.
Also, I tested it, now my thing works. I'm not sure of other scenarios where it doesn't work (or works against the user).
(Questions welcome, although you should read the quoted text for rationale. I am sending this in quite a hurry because I already lost a previous version of my comment, it's nearly midnight and i'm kinda annoyed, so let me know of any little imperfections)