The following instructions assume the path ~/Projects/nvim-plugins/ exists.
If it doesn't exist, create it or make sure to update relevant commands to
match your file structure.
1. Clone github-preview.nvim to ~/Projects/nvim-plugins/github-preview.nvim
and install dependencies:
cd ~/Projects/nvim-plugins
git clone git@github.com:wallpants/github-preview.nvim.git
cd github-preview.nvim
bun install2. Setup lazy.nvim for plugin development:
-- in your neovim config files, wherever you set up lazy
require("lazy").setup("plugins", {
-- ...config
dev = {
-- path where dev plugins are to be found
path = vim.fn.expand("~/Projects/nvim-plugins"),
-- fallback to github if dev plugins not found locally
fallback = true,
},
})3. Install plugin and setup for development
Specify a log_level to enable dev-mode.
In github-preview.nvim dev-mode enables logging and hot-reloading of the bun app.
{
"wallpants/github-preview.nvim",
-- if dev = true, lazy will look for plugin in "~/Projects/nvim-plugins"
dev = true,
cmd = { "GithubPreviewToggle" },
opts = {
log_level = "debug",
},
},4. Start listening for logs
Use bunvim's CLI tool to listen for logs.
The following command will start a service that will listen for logs.
You can stop the service with CTRL+C.
At the repository root ~/Projects/nvim-plugins/github-preview.nvim run:
bun run logsYou should see no output until the plugin is started in the next step.
5. Open Neovim and start the plugin
Open Neovim, load a markdown file into the current buffer and run :GithubPreviewToggle
A new tab should open in your browser and logs will be printed both in Neovim and in the logs process started in the previous step.
Run :messages to see what's been printed in Neovim.
Logs that are shown under :messages in Neovim, are logs created server-side via
console.log(). You can use console.log() for quick logs, but as you'll see,
sometimes they're hard to follow/read. For a more complete logging experience, use
bunvim logging.
6. Start editing server-side or webapp code
If you specified a log_level, hot-reload will be enabled for both changes to the bun app as well as the webapp.
This project uses prettier and eslint to enforce coding style and quality standards.
Make sure to set them up in your editor. You can configure prettier to format on save or you can manually run the following package.json script to format files:
bun run format
To ensure that there are no lint issues, you can run the package.json script:
bun run lint
To ensure that there are no TypeScript issues, you can run the package.json script:
bun run typecheck
Note
There's a github action that verifies if these actions were performed and will notify you if any steps were skipped.
This project uses semantic-release to handle versioning.
semantic-release requires commit messages to follow the
Conventional Commit format. To ensure your commits
follow the format, run the package.json script bun run commit to perform your commits:
touch file.txt
git add file.txt
bun run commit