nvim-lua-plugin-template icon indicating copy to clipboard operation
nvim-lua-plugin-template copied to clipboard

local developer installation and CI setup

Open matu3ba opened this issue 4 years ago • 1 comments
trafficstars

  1. lua cov local dev and CI installation
  2. stylua also has nice github actions => column width 4, spaces or tabs?!
  3. luacheck local dev installation
  4. for completeness: luarocks installation as local user => plugins may want to use the lua plugin manager

For stylua, I failed to define autocmds like this:

Styluafmt = function()
-- hardcoding formatting option for not needing a config file
-- single quote and emptyspace are consisently readable independ of editor
vim.api.nvim_command([[
if &modified
  let cursor_pos = getpos('.')
  :!stylua --indent-type Spaces --quote-style AutoPreferSingle %
  call setpos('.', cursor_pos)
end
]])
end
vim.api.nvim_exec([[
augroup TESTME
autocmd!
autocmd BufWritePre *.lua :lua Styluafmt()
augroup END
]], false)

The github setup for stylua is quite simple: https://github.com/nvim-lua/plenary.nvim/commit/6a51028a103518826423b0c408077ea7e258f1ee though I didnt check if this includes spaces/tabs formatting.

matu3ba avatar Oct 03 '21 20:10 matu3ba

Collecting my ideas while working on a thing:

Developing dependencies:

  • luacheck
    • lurocks install --local luacheck
    • luarocks install --local lanes
  • luacov
    • luarocks install --local luacov
  • stylua
    • cargo install stylua
Developing manual commands
  • luacheck
    • luacheck .
  • luacov
    • lua -lluacov test/* && TODO
  • stylua
    • stylua --color always --check lua/ tests/
  • plenary
    • nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal.vim'}"
    • not working yet nvim --headless --noplugin -u tests/minimal_init.lua -c "PlenaryBustedDirectory ../plenary.nvim/ {minimal_init = 'tests/minimal_init.lua'}"

Afaiu, minima_init.lua needs the rtp paths to the root files for neovim runtime to pick dependencies up (lua files are atomatically picked up).

-- vim.api.nvim_list_runtime_paths(), :h nvim_list_runtime_paths
-- vim.opt.runtimepath:get(), :h vim.opt
-- vim.opt.rtp:append()

Developing command suggestion

TODO

I very much dislike a CI setup being different from the local one, so I'll add that one as well.

matu3ba avatar Mar 31 '23 00:03 matu3ba