Skip to main content
deleted 420 characters in body
Source Link
Doorknob
  • 72.1k
  • 20
  • 146
  • 393

vim, 9 8 77 6 characters

<C-a><C-v><esc>1@div><esc>1@ad 

We can build and execute an arbitrary vimscript program as follows:

  1. Use the sequence ii<Caa<C-v><C-v>11<esc>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a>11<C-a>dd@1<esc>ddddv>1<esc>dd@1<esc>dddd to obtain ana l<C-a> in register 1.

  2. Enter insert mode with ia, then insert an ia, which will be used to re-enter insert mode in a macro later.

  3. Use <C-v><C-v>1 as many times as necessary to insert the literal sequence <C-v>1—each of these will correspond to oneFor each character in the finaldesired vimscript program.

  4. Exit insert mode (<esc>), then move back to the beginning of the line with i<esc>i<esc>i<esc>....

  5. Use <C-a> as many times as necessary to increment the first 1 until the ASCII value of the first desired character is reached.

    1. use <C-v><C-v>1<esc> to insert the literal sequence <C-v>1,

    2. use @1 (which is <C-a><cr>, in which the final <cr> is a no-op due to being on the last line) as many times as necessary to increment the 1 until the ASCII value of the desired character is reached,

    3. and re-enter insert mode with a.

  6. Move pastDelete the first number with @1 (which executes an l and then <cr>, which is a no-op when there is only one line) and continue at step 4 until all desired numbers have been obtained.

  7. Use dd to delete the inserted text (includingalong with a trailing newline) into the "1 andregister with 1<esc>dd registers.

  8. UseExecute the result as vim keystrokes by using @1 to execute the text as a macro. At this point, the desired vimscript program has been inserted into the file.

  9. Exit insert mode, then dd<esc>dd to delete the empty line inserted because ofentered by the trailing newline that came from the previous step 6.

  10. dd again to delete the vimscript program into Run the 1 register.

  11. Finally, useresulting arbitrary sequence of bytes with @1dd@1 to execute the program. (If the first character isIf it begins with a :, the resultit will be executedinterpreted as vimscript code, and it will be run due to the trailing newline from dd.)

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

vim, 9 8 7 characters

<C-a><C-v><esc>1@di 

We can build and execute an arbitrary vimscript program as follows:

  1. Use the sequence ii<C-v><C-v>11<esc>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a>11<C-a>dd@1<esc>dddd to obtain an l in register 1.

  2. Enter insert mode with i, then insert an i.

  3. Use <C-v><C-v>1 as many times as necessary to insert the literal sequence <C-v>1—each of these will correspond to one character in the final vimscript program.

  4. Exit insert mode (<esc>), then move back to the beginning of the line with i<esc>i<esc>i<esc>....

  5. Use <C-a> as many times as necessary to increment the first 1 until the ASCII value of the first desired character is reached.

  6. Move past the first number with @1 (which executes an l and then <cr>, which is a no-op when there is only one line) and continue at step 4 until all desired numbers have been obtained.

  7. Use dd to delete the inserted text (including a trailing newline) into the " and 1 registers.

  8. Use @1 to execute the text as a macro. At this point, the desired vimscript program has been inserted into the file.

  9. Exit insert mode, then dd to delete the empty line inserted because of the trailing newline that came from step 6.

  10. dd again to delete the vimscript program into the 1 register.

  11. Finally, use @1 to execute the program. (If the first character is a :, the result will be executed as vimscript and run due to the trailing newline from dd.)

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

vim, 9 8 7 6 characters

<C-v><esc>1@ad 

We can build and execute an arbitrary vimscript program as follows:

  1. Use the sequence aa<C-v><C-v>1<esc>dd@1<esc>dddd to obtain a <C-a> in register 1.

  2. Enter insert mode with a, then insert an a, which will be used to re-enter insert mode in a macro later.

  3. For each character in the desired vimscript program,

    1. use <C-v><C-v>1<esc> to insert the literal sequence <C-v>1,

    2. use @1 (which is <C-a><cr>, in which the final <cr> is a no-op due to being on the last line) as many times as necessary to increment the 1 until the ASCII value of the desired character is reached,

    3. and re-enter insert mode with a.

  4. Delete the line (along with a trailing newline) into the 1 register with <esc>dd.

  5. Execute the result as vim keystrokes by using @1, then <esc>dd to delete the line entered by the trailing newline from the previous step.

  6. Run the resulting arbitrary sequence of bytes with dd@1. If it begins with a :, it will be interpreted as vimscript code, and it will be run due to the trailing newline from dd.

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

added 79 characters in body
Source Link
Doorknob
  • 72.1k
  • 20
  • 146
  • 393

vim, 89 8 7 characters

<C-a><C-v><esc>01@div><esc>1@di 

We can build and execute an arbitrary vimscript program as follows:

  1. Use the sequence ii<C-v><C-v>100<esc><Cv>11<esc>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a>11<C-a>dd@1<esc>dddd to obtain an l in register 1.

  2. Enter insert mode with i, then insert an i.

  3. Use <C-v><C-v>0v>1 as many times as necessary to insert the literal sequence <C-v>0v>1—each of these will correspond to one character in the final vimscript program.

  4. Exit insert mode (<esc>), then move back to the beginning of the line with 0i<esc>i<esc>i<esc>....

  5. Use <C-a> as many times as necessary to increment the first 01 until the ASCII value of the first desired character is reached.

  6. Move past the first number with @1 (which executes an l and then <cr>, which is a no-op when there is only one line) and continue at step 4 until all desired numbers have been obtained.

  7. Use dd to delete the inserted text (including a trailing newline) into the " and 1 registers.

  8. Use @1 to execute the text as a macro. At this point, the desired vimscript program has been inserted into the file.

  9. Exit insert mode, then dd to delete the empty line inserted because of the trailing newline that came from step 6.

  10. dd again to delete the vimscript program into the 1 register.

  11. Finally, use @1 to execute the program. (If the first character is a :, the result will be executed as vimscript and run due to the trailing newline from dd.)

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

vim, 8 characters

<C-a><C-v><esc>01@di 

We can build and execute an arbitrary vimscript program as follows:

  1. Use the sequence ii<C-v><C-v>100<esc><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a>dd@1<esc>dddd to obtain an l in register 1.

  2. Enter insert mode with i, then insert an i.

  3. Use <C-v><C-v>0 as many times as necessary to insert the literal sequence <C-v>0—each of these will correspond to one character in the final vimscript program.

  4. Exit insert mode (<esc>), then move back to the beginning of the line with 0.

  5. Use <C-a> as many times as necessary to increment the first 0 until the ASCII value of the first desired character is reached.

  6. Move past the first number with @1 (which executes an l and then <cr>, which is a no-op when there is only one line) and continue at step 4 until all desired numbers have been obtained.

  7. Use dd to delete the inserted text (including a trailing newline) into the " and 1 registers.

  8. Use @1 to execute the text as a macro. At this point, the desired vimscript program has been inserted into the file.

  9. Exit insert mode, then dd to delete the empty line inserted because of the trailing newline that came from step 6.

  10. dd again to delete the vimscript program into the 1 register.

  11. Finally, use @1 to execute the program. (If the first character is a :, the result will be executed as vimscript and run due to the trailing newline from dd.)

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

vim, 9 8 7 characters

<C-a><C-v><esc>1@di 

We can build and execute an arbitrary vimscript program as follows:

  1. Use the sequence ii<C-v><C-v>11<esc>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a>11<C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a>11<C-a>dd@1<esc>dddd to obtain an l in register 1.

  2. Enter insert mode with i, then insert an i.

  3. Use <C-v><C-v>1 as many times as necessary to insert the literal sequence <C-v>1—each of these will correspond to one character in the final vimscript program.

  4. Exit insert mode (<esc>), then move back to the beginning of the line with i<esc>i<esc>i<esc>....

  5. Use <C-a> as many times as necessary to increment the first 1 until the ASCII value of the first desired character is reached.

  6. Move past the first number with @1 (which executes an l and then <cr>, which is a no-op when there is only one line) and continue at step 4 until all desired numbers have been obtained.

  7. Use dd to delete the inserted text (including a trailing newline) into the " and 1 registers.

  8. Use @1 to execute the text as a macro. At this point, the desired vimscript program has been inserted into the file.

  9. Exit insert mode, then dd to delete the empty line inserted because of the trailing newline that came from step 6.

  10. dd again to delete the vimscript program into the 1 register.

  11. Finally, use @1 to execute the program. (If the first character is a :, the result will be executed as vimscript and run due to the trailing newline from dd.)

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

added 219 characters in body
Source Link
Doorknob
  • 72.1k
  • 20
  • 146
  • 393

vim, 98 characters

<C-a><C-v><esc>01@dilv><esc>01@di 

We can build and execute an arbitrary vimscript program as follows:

  1. Use the sequence ii<C-v><C-v>100<esc><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a>dd@1<esc>dddd to obtain an l in register 1.

  2. Enter insert mode with i, then insert an i.

  3. Use <C-v><C-v>0 as many times as necessary to insert the literal sequence <C-v>0—each of these will correspond to one character in the final vimscript program.

  4. Exit insert mode (<esc>), then move back to the beginning of the line with 0.

  5. Use <C-a> as many times as necessary to increment the first 0 until the ASCII value of the first desired character is reached.

  6. Move past the first number with @1 (which executes an l and then <cr>, which is a no-op when there is only one line) and continue at step 4 until all desired numbers have been obtained.

  7. Use dd to delete the inserted text (including a trailing newline) into the " and 1 registers.

  8. Use @1 to execute the text as a macro. At this point, the desired vimscript program has been inserted into the file.

  9. Exit insert mode, then dd to delete the empty line inserted because of the trailing newline that came from step 6.

  10. dd again to delete the vimscript program into the 1 register.

  11. Finally, use @1 to execute the program. (If the first character is a :, the result will be executed as vimscript and run due to the trailing newline from dd.)

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

vim, 9 characters

<C-a><C-v><esc>01@dil 

We can build and execute an arbitrary vimscript program as follows:

  1. Enter insert mode with i, then insert an i.

  2. Use <C-v><C-v>0 as many times as necessary to insert the literal sequence <C-v>0—each of these will correspond to one character in the final vimscript program.

  3. Exit insert mode (<esc>), then move back to the beginning of the line with 0.

  4. Use <C-a> as many times as necessary to increment the first 0 until the ASCII value of the first desired character is reached.

  5. Move past the first number with l and continue at step 4 until all desired numbers have been obtained.

  6. Use dd to delete the inserted text (including a trailing newline) into the " and 1 registers.

  7. Use @1 to execute the text as a macro. At this point, the desired vimscript program has been inserted into the file.

  8. Exit insert mode, then dd to delete the empty line inserted because of the trailing newline that came from step 6.

  9. dd again to delete the vimscript program into the 1 register.

  10. Finally, use @1 to execute the program. (If the first character is a :, the result will be executed as vimscript and run due to the trailing newline from dd.)

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

vim, 8 characters

<C-a><C-v><esc>01@di 

We can build and execute an arbitrary vimscript program as follows:

  1. Use the sequence ii<C-v><C-v>100<esc><C-a><C-a><C-a><C-a><C-a><C-a><C-a><C-a>dd@1<esc>dddd to obtain an l in register 1.

  2. Enter insert mode with i, then insert an i.

  3. Use <C-v><C-v>0 as many times as necessary to insert the literal sequence <C-v>0—each of these will correspond to one character in the final vimscript program.

  4. Exit insert mode (<esc>), then move back to the beginning of the line with 0.

  5. Use <C-a> as many times as necessary to increment the first 0 until the ASCII value of the first desired character is reached.

  6. Move past the first number with @1 (which executes an l and then <cr>, which is a no-op when there is only one line) and continue at step 4 until all desired numbers have been obtained.

  7. Use dd to delete the inserted text (including a trailing newline) into the " and 1 registers.

  8. Use @1 to execute the text as a macro. At this point, the desired vimscript program has been inserted into the file.

  9. Exit insert mode, then dd to delete the empty line inserted because of the trailing newline that came from step 6.

  10. dd again to delete the vimscript program into the 1 register.

  11. Finally, use @1 to execute the program. (If the first character is a :, the result will be executed as vimscript and run due to the trailing newline from dd.)

I'm not convinced this is a minimal character set, but it's quite easy to prove to be Turing-complete.

Source Link
Doorknob
  • 72.1k
  • 20
  • 146
  • 393
Loading