galaxyline.nvim icon indicating copy to clipboard operation
galaxyline.nvim copied to clipboard

consider move initialization to lua

Open matu3ba opened this issue 4 years ago • 2 comments

I like the plugin very much. Thanks alot for creating!

Reasons to do:

  1. A pure lua profile would decrease startup time.
  2. The lua startup profiler would be more correct or simpler to get correct with this change. Otherwise one gets more wrong results.
  3. Try to be consistent as to use functionality of lua, if possible.
  4. Having a function to initialize makes separating things for user-specific settings while getting updates much easier (user may implement a different function to customize plugin).

Another related reason (bad practice/historical reasons): nvim-treesitter/module-template#1

Relevant content for change: https://github.com/nanotee/nvim-lua-guide#using-meta-accessors-1

missing fixes: https://github.com/nanotee/nvim-lua-guide/#managing-vim-internal-variables and the echo stuff

if vim.g.loaded_galaxyline == nil

  --let s:save_cpo = &cpo --is there any way to make this plugin local?
  --set cpo&vim --is there any way to make this plugin local?

  if vim.fn.has('nvim') == 0 then
    --echohl Error
    --echom "Sorry this plugin only works with versions of neovim that support lua"
    --echohl clear
    --finish
  end

vim.g.loaded_galaxyline = 1
require('galaxyline').galaxyline_augroup()

--let &cpo = s:save_cpo --is there any way to make this plugin local?
--unlet s:save_cpo --is there any way to make this plugin local?
end

matu3ba avatar Apr 08 '21 21:04 matu3ba

hmm this will need user to call it by themself.

glepnir avatar Apr 09 '21 07:04 glepnir

@glepnir Can you elaborate how this would be a problem? I wanted to discuss first before creating a PR.

matu3ba avatar Apr 11 '21 12:04 matu3ba