subnut / nvim-ghost.nvim

:ghost: GhostText plugin for Neovim with zero dependencies :tada: Supports neovim running inside WSL too! :partying_face: Windows/Linux/macOS supported out-of-the-box! :smile: (Other OSes need python3.6+ installed)
MIT License
150 stars 6 forks source link

Include lua instructions #57

Closed casonadams closed 5 months ago

casonadams commented 5 months ago

using lazy

-- lua/plugins/nvim-ghost.lua
{
  "subnut/nvim-ghost.nvim",
  keys = {
    { "<leader>ug", ":GhostTextStart<cr>", desc = "GhostTextStart", silent = true },

  },
  name = "nvim_ghost",
  config = function()
    vim.api.nvim_create_autocmd('User', {
      group = "nvim_ghost_user_autocommands",
      pattern = "*.com",
      command = 'setfiletype markdown'
    })
  end
}
-- lua/config/options.lua
g.nvim_ghost_autostart = 0 -- with this set to 0 an error will happen with the autocommand being setup.

This sets up the plugin to not autostart, but on <Leader>ug it will start, and setup the autocommand to set the filetype as markdown

The nice thing about lazy is is lazy loads plugins. So this plugin never gets loaded until the <leader>ug is executed.

subnut commented 5 months ago

I..... I genuinely have no idea what lazy is, and how it corresponds to the code mentioned above

Could you please give me some tips about what it is / where I can read about it?

casonadams commented 5 months ago

Good point. It's the latest coolness in the neovim world. As far as package management goes.

https://github.com/folke/lazy.nvim

Most of the neovim plugins that are actively being maintained have instructions on how to install the plugin via:

Lazy (lua) Packer (lua) Plug (vim script)

subnut commented 5 months ago

Added to wiki -
https://github.com/subnut/nvim-ghost.nvim/wiki/Installation-and-Configuration#lazynvim

subnut commented 5 months ago

Please check once if you can edit the wiki.
If not, let me know!