Timeline for Execute vimscript without saving first?
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 8, 2023 at 6:07 | answer | added | Maxim Kim | timeline score: 5 | |
Feb 8, 2023 at 3:55 | answer | added | Big McLargeHuge | timeline score: 1 | |
Sep 17, 2020 at 21:25 | comment | added | Nordine Lotfi | Seems like your previously posted example work but only the first time. Described the issue here @user938271 :D | |
Sep 17, 2020 at 6:44 | comment | added | Matt |
Maybe a possible fix would be to make execute getline('.') continue until it find a newline, which might go around the mentioned problem with line continuations/command separators. See this answer
|
|
Sep 16, 2020 at 21:37 | comment | added | Nordine Lotfi | I see! I don't mind if there temp files, but I'm mostly worried about disk i/o, since Vim already does a lots of operation on temp files (internally, like .swp file etc) and what other plugins does too. But i guess it is of minor worry since it is deleted after Vim close, though I'm also worried about when i don't close Vim for a long amount of time testing things, which will end up filling my disk with temp files! Didn't thought of using Tmux panes for this either :D @user938271 | |
Sep 16, 2020 at 21:11 | comment | added | Nordine Lotfi |
That's too bad :/. Maybe a possible fix would be to make execute getline('.') continue until it find a newline, which might go around the mentioned problem with line continuations/command separators. @D.BenKnoble
|
|
Sep 16, 2020 at 21:10 | comment | added | user938271 |
It does execute :source ; it's just written in the short form so . In my experience, writing the code in a tempfile does not cause issues; they should be automatically removed as soon as you quit Vim. There are other similar techniques. If you use tmux, you can run the code in another pane, which is especially useful when you're trying to debug a crash (I'm doing it right now); you don't want your main Vim instance to crash.
|
|
Sep 16, 2020 at 21:07 | comment | added | D. Ben Knoble♦ |
Short of looping and doing execute getline('.') (or joining the lines and exec’ing), I’m not aware of anything. And those two usually have issues with line continuations/command separators.
|
|
Sep 16, 2020 at 20:58 | comment | added | Nordine Lotfi | Thanks! had to search first if this question was asked before...seems it wasn't (afaik). @AriSweedler | |
Sep 16, 2020 at 20:56 | comment | added | Nordine Lotfi |
That actually work :O. Though the use of temp file is a little downside hmm (since this still save the content somewhere) @user938271 also, how does it work? don't think i see you using source on the temp file hmm
|
|
Sep 16, 2020 at 20:51 | comment | added | user938271 |
Try this: 0x0.st/iIUL.txt ; to use it, visually select the code you want to run, then execute :@* .
|
|
Sep 16, 2020 at 20:50 | comment | added | Ari Sweedler |
There is, of course, the hack of remapping something to :w | source % . This answers your use case, but for the sake of knowledge (much more important :P), it does not answer question. I am searching for a way to use something like the source command on a buffer instead of a file, now. Cool question :)
|
|
S Sep 16, 2020 at 20:10 | history | suggested | guntbert | CC BY-SA 4.0 |
improve language/spelling
|
Sep 16, 2020 at 20:06 | review | Suggested edits | |||
S Sep 16, 2020 at 20:10 | |||||
Sep 16, 2020 at 19:58 | history | asked | Nordine Lotfi | CC BY-SA 4.0 |