Skip to content
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

Follow rustlings watch with editor by opening source files in the same order #281

Closed
agentofuser opened this issue Mar 4, 2020 · 1 comment · Fixed by #599
Closed

Follow rustlings watch with editor by opening source files in the same order #281

agentofuser opened this issue Mar 4, 2020 · 1 comment · Fixed by #599

Comments

@agentofuser
Copy link

First of all, thank you so much for rustlings, this is an amazing project! A well thought-out practice test suite is worth a thousand tutorials.

I got lazy from having to close nvim and open it on the next file to keep up with rustlings watch, so I came up with a little kludge:

cd rustlings # local rustlings repo
rg '^path = "' info.toml | rg '"(.*)"' --only-matching --replace='$1' --null | xargs -J {} nvim '{}'

This is the same as typing:

nvim file1 file2 file3 ...

When you do this, nvim opens one file at a time, and you can navigate between them with :previous and :next.

So after passing the tests for one exercise, I delete the // I AM NOT DONE line, then type :wn on nvim, which saves the file (w is for "write") and opens the next one (n).

That's enough keystroke savings for me, but if this sounds like an interesting idea, maybe it could be turned into a rustlings watch editor command that calls $EDITOR in succession with the file that's currently failing rustlings watch, so both can be kept running side by side in sync.

Tuxified added a commit to Tuxified/rustlings that referenced this issue Apr 7, 2020
As indicated in rust-lang#259 , I found it confusing to have 2 comments as the code wouldn't compile unless I solved both issues (I used the script from rust-lang#281 to remove a comment and use `:wn` to go to next exercise, hence this tripped me).
pedantic79 pushed a commit to pedantic79/rustlings that referenced this issue Apr 11, 2020
As indicated in rust-lang#259 , I found it confusing to have 2 comments as the code wouldn't compile unless I solved both issues (I used the script from rust-lang#281 to remove a comment and use `:wn` to go to next exercise, hence this tripped me).
MendelMonteiro pushed a commit to MendelMonteiro/rustlings that referenced this issue Jun 28, 2020
As indicated in rust-lang#259 , I found it confusing to have 2 comments as the code wouldn't compile unless I solved both issues (I used the script from rust-lang#281 to remove a comment and use `:wn` to go to next exercise, hence this tripped me).
@nealmcb
Copy link

nealmcb commented Sep 4, 2020

Great idea! And thanks for the script. But I guess my version of rg is out-of-date, since I got
Unknown flag: '--only-matching'

Here's my version, which works with emacs or emacsclient and should work any time $EDITOR is defined:

files=$(sed -n 's/^path = "\([^"]*\)"/\1/p' info.toml)
# Open each file in sequence if it seems not done, wait for it to be closed, then continue
for f in $files; do if grep -q "// I AM NOT DONE" $f; then echo $f; $EDITOR $f; fi; done

Next, I'd like to see a solution that, when appropriate, opens the latest README.md

ppp3 pushed a commit to ppp3/rustlings that referenced this issue May 23, 2022
As indicated in rust-lang#259 , I found it confusing to have 2 comments as the code wouldn't compile unless I solved both issues (I used the script from rust-lang#281 to remove a comment and use `:wn` to go to next exercise, hence this tripped me).
dmoore04 pushed a commit to dmoore04/rustlings that referenced this issue Sep 11, 2022
As indicated in rust-lang#259 , I found it confusing to have 2 comments as the code wouldn't compile unless I solved both issues (I used the script from rust-lang#281 to remove a comment and use `:wn` to go to next exercise, hence this tripped me).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants