Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.22 KB

README.md

File metadata and controls

30 lines (25 loc) · 1.22 KB

autorun.vim

This is a Neovim plugin that was inspired by the TJ Devries YouTube videos Automatically Execute Anything in Nvim and Execute anything in neovim (now customizable).

This creates the user commands "BufNum" and "AutoRun". To use them:

  1. Open a source file that can be executed by some shell command.
  2. Enter :vnew to open an empty buffer in a vertical split.
  3. Enter :BufNum to get the number of the empty buffer.
  4. Enter :AutoRun which will prompt for three things.
  5. Enter the buffer number that was output in step 3.
  6. Enter a pattern that matches files that should trigger a run. For example, *.lua.
  7. Enter a command to run that builds and runs a program. For example, lua main.lua.

This will run the command immediately and again every time a file that matches the pattern is saved, the command will be executed. Its output, both stdout and stderr, will be displayed in the buffer in the vertical split.

Using the example values above, saving any .lua file will cause the command lua main.lua to execute again. This is good because it is possible that main.lua uses (requires) other .lua files.