Compare commits
5 Commits
c760c495b7
...
v2
| Author | SHA1 | Date | |
|---|---|---|---|
| 12945a4cdf | |||
| 6f86bfaa42 | |||
| 81ba1bb96b | |||
| 35b6e123ac | |||
| 237bc9ba5e |
13
.busted
Normal file
13
.busted
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
return {
|
||||||
|
_all = {
|
||||||
|
coverage = false,
|
||||||
|
lpath = "lua/?.lua;lua/?/init.lua",
|
||||||
|
lua = "nlua",
|
||||||
|
},
|
||||||
|
default = {
|
||||||
|
verbose = true
|
||||||
|
},
|
||||||
|
tests = {
|
||||||
|
verbose = true
|
||||||
|
},
|
||||||
|
}
|
||||||
25
.github/workflows/ci.yaml
vendored
25
.github/workflows/ci.yaml
vendored
@@ -2,15 +2,28 @@
|
|||||||
name: NeoVim tests
|
name: NeoVim tests
|
||||||
on: [push]
|
on: [push]
|
||||||
jobs:
|
jobs:
|
||||||
plenary-tests:
|
code-quality:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
XDG_CONFIG_HOME: ${{ github.workspace }}/.config/
|
XDG_CONFIG_HOME: ${{ github.workspace }}/.config/
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: rhysd/action-setup-vim@v1
|
- uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
neovim: true
|
nix_path: nixpkgs=channel:nixos-unstable
|
||||||
version: v0.11.0
|
|
||||||
arch: 'x86_64'
|
- name: Populate Nix store
|
||||||
- run: make test
|
run:
|
||||||
|
nix-shell --run 'true'
|
||||||
|
|
||||||
|
- name: Type-check with lua-language-server
|
||||||
|
run:
|
||||||
|
nix-shell --run 'make lint'
|
||||||
|
|
||||||
|
- name: Check formatting with stylua
|
||||||
|
run:
|
||||||
|
nix-shell --run 'make fmt-check'
|
||||||
|
|
||||||
|
- name: Run busted tests
|
||||||
|
run:
|
||||||
|
nix-shell --run 'make test'
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,3 @@
|
|||||||
/.lux/
|
|
||||||
lux.lock
|
|
||||||
*.src.rock
|
*.src.rock
|
||||||
*.aider*
|
*.aider*
|
||||||
|
luacov.*.out
|
||||||
|
|||||||
27
Makefile
27
Makefile
@@ -1,16 +1,21 @@
|
|||||||
PLENARY_DIR=~/.local/share/nvim/site/pack/test/opt/plenary.nvim
|
all: lint fmt-check test
|
||||||
|
|
||||||
all: lint test
|
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
lua-language-server --check=lua/u/ --checklevel=Error
|
@echo "## Typechecking"
|
||||||
lx check
|
@lua-language-server --check=lua/u/ --checklevel=Error
|
||||||
|
|
||||||
|
fmt-check:
|
||||||
|
@echo "## Checking code format"
|
||||||
|
@stylua --check .
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
stylua .
|
@echo "## Formatting code"
|
||||||
|
@stylua .
|
||||||
|
|
||||||
test: $(PLENARY_DIR)
|
test:
|
||||||
NVIM_APPNAME=noplugstest nvim -u NORC --headless -c 'set packpath+=~/.local/share/nvim/site' -c 'packadd plenary.nvim' -c "PlenaryBustedDirectory spec/"
|
@rm -f luacov.*.out
|
||||||
|
@echo "## Running tests"
|
||||||
$(PLENARY_DIR):
|
@busted --coverage --verbose
|
||||||
git clone https://github.com/nvim-lua/plenary.nvim/ $(PLENARY_DIR)
|
@echo "## Generating coverage report"
|
||||||
|
@luacov
|
||||||
|
@awk '/^Summary$$/{flag=1;next} flag{print}' luacov.report.out
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
local Buffer = require 'u.buffer'
|
local Renderer = require('u.renderer').Renderer
|
||||||
local TreeBuilder = require('u.renderer').TreeBuilder
|
local TreeBuilder = require('u.renderer').TreeBuilder
|
||||||
local tracker = require 'u.tracker'
|
local tracker = require 'u.tracker'
|
||||||
local utils = require 'u.utils'
|
local utils = require 'u.utils'
|
||||||
local Window = require 'my.window'
|
|
||||||
|
|
||||||
local TIMEOUT = 4000
|
local TIMEOUT = 4000
|
||||||
local ICONS = {
|
local ICONS = {
|
||||||
@@ -14,15 +13,25 @@ local ICONS = {
|
|||||||
}
|
}
|
||||||
local DEFAULT_ICON = { text = '', group = 'DiagnosticSignOk' }
|
local DEFAULT_ICON = { text = '', group = 'DiagnosticSignOk' }
|
||||||
|
|
||||||
--- @alias Notification {
|
local S_EDITOR_DIMENSIONS =
|
||||||
|
tracker.create_signal(utils.get_editor_dimensions(), 's:editor_dimensions')
|
||||||
|
vim.api.nvim_create_autocmd('VimResized', {
|
||||||
|
callback = function()
|
||||||
|
local new_dim = utils.get_editor_dimensions()
|
||||||
|
S_EDITOR_DIMENSIONS:set(new_dim)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
--- @alias u.example.Notification {
|
||||||
--- kind: number;
|
--- kind: number;
|
||||||
--- id: number;
|
--- id: number;
|
||||||
--- text: string;
|
--- text: string;
|
||||||
|
--- timer: uv.uv_timer_t;
|
||||||
--- }
|
--- }
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
--- @type Window | nil
|
--- @type { win: integer, buf: integer, renderer: u.Renderer } | nil
|
||||||
local notifs_w
|
local notifs_w
|
||||||
|
|
||||||
local s_notifications_raw = tracker.create_signal {}
|
local s_notifications_raw = tracker.create_signal {}
|
||||||
@@ -30,44 +39,49 @@ local s_notifications = s_notifications_raw:debounce(50)
|
|||||||
|
|
||||||
-- Render effect:
|
-- Render effect:
|
||||||
tracker.create_effect(function()
|
tracker.create_effect(function()
|
||||||
--- @type Notification[]
|
--- @type u.example.Notification[]
|
||||||
local notifs = s_notifications:get()
|
local notifs = s_notifications:get()
|
||||||
|
--- @type { width: integer, height: integer }
|
||||||
|
local editor_size = S_EDITOR_DIMENSIONS:get()
|
||||||
|
|
||||||
if #notifs == 0 then
|
if #notifs == 0 then
|
||||||
if notifs_w then
|
if notifs_w then
|
||||||
notifs_w:close(true)
|
if vim.api.nvim_win_is_valid(notifs_w.win) then vim.api.nvim_win_close(notifs_w.win, true) end
|
||||||
notifs_w = nil
|
notifs_w = nil
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local avail_width = editor_size.width
|
||||||
|
local float_width = 40
|
||||||
|
local float_height = math.min(#notifs, editor_size.height - 3)
|
||||||
|
local win_config = {
|
||||||
|
relative = 'editor',
|
||||||
|
anchor = 'NE',
|
||||||
|
row = 0,
|
||||||
|
col = avail_width,
|
||||||
|
width = float_width,
|
||||||
|
height = float_height,
|
||||||
|
border = 'single',
|
||||||
|
focusable = false,
|
||||||
|
zindex = 900,
|
||||||
|
}
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local editor_size = utils.get_editor_dimensions()
|
|
||||||
local avail_width = editor_size.width
|
|
||||||
local float_width = 40
|
|
||||||
local win_config = {
|
|
||||||
relative = 'editor',
|
|
||||||
anchor = 'NE',
|
|
||||||
row = 0,
|
|
||||||
col = avail_width,
|
|
||||||
width = float_width,
|
|
||||||
height = math.min(#notifs, editor_size.height - 3),
|
|
||||||
border = 'single',
|
|
||||||
focusable = false,
|
|
||||||
}
|
|
||||||
if not notifs_w or not vim.api.nvim_win_is_valid(notifs_w.win) then
|
if not notifs_w or not vim.api.nvim_win_is_valid(notifs_w.win) then
|
||||||
notifs_w = Window.new(Buffer.create(false, true), win_config)
|
local b = vim.api.nvim_create_buf(false, true)
|
||||||
vim.wo[notifs_w.win].cursorline = false
|
local w = vim.api.nvim_open_win(b, false, win_config)
|
||||||
vim.wo[notifs_w.win].list = false
|
vim.wo[w].cursorline = false
|
||||||
vim.wo[notifs_w.win].listchars = ''
|
vim.wo[w].list = false
|
||||||
vim.wo[notifs_w.win].number = false
|
vim.wo[w].listchars = ''
|
||||||
vim.wo[notifs_w.win].relativenumber = false
|
vim.wo[w].number = false
|
||||||
vim.wo[notifs_w.win].wrap = false
|
vim.wo[w].relativenumber = false
|
||||||
|
vim.wo[w].wrap = false
|
||||||
|
notifs_w = { win = w, buf = b, renderer = Renderer.new(b) }
|
||||||
else
|
else
|
||||||
notifs_w:set_config(win_config)
|
vim.api.nvim_win_set_config(notifs_w.win, win_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
notifs_w:render(TreeBuilder.new()
|
notifs_w.renderer:render(TreeBuilder.new()
|
||||||
:nest(function(tb)
|
:nest(function(tb)
|
||||||
for idx, notif in ipairs(notifs) do
|
for idx, notif in ipairs(notifs) do
|
||||||
if idx > 1 then tb:put '\n' end
|
if idx > 1 then tb:put '\n' end
|
||||||
@@ -79,48 +93,81 @@ tracker.create_effect(function()
|
|||||||
end)
|
end)
|
||||||
:tree())
|
:tree())
|
||||||
vim.api.nvim_win_call(notifs_w.win, function()
|
vim.api.nvim_win_call(notifs_w.win, function()
|
||||||
-- scroll to bottom:
|
vim.fn.winrestview {
|
||||||
vim.cmd.normal 'G'
|
-- scroll all the way left:
|
||||||
-- scroll all the way to the left:
|
leftcol = 0,
|
||||||
vim.cmd.normal '9999zh'
|
-- set the bottom line to be at the bottom of the window:
|
||||||
|
topline = vim.api.nvim_buf_line_count(notifs_w.buf) - win_config.height + 1,
|
||||||
|
}
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--- @param id number
|
||||||
|
local function _delete_notif(id)
|
||||||
|
--- @param notifs u.example.Notification[]
|
||||||
|
s_notifications_raw:schedule_update(function(notifs)
|
||||||
|
for i, notif in ipairs(notifs) do
|
||||||
|
if notif.id == id then
|
||||||
|
notif.timer:stop()
|
||||||
|
notif.timer:close()
|
||||||
|
table.remove(notifs, i)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return notifs
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
local _orig_notify
|
local _orig_notify
|
||||||
|
|
||||||
--- @param msg string
|
--- @param msg string
|
||||||
--- @param level integer|nil
|
--- @param level integer|nil
|
||||||
--- @param opts table|nil
|
--- @param opts? { id: number }
|
||||||
local function my_notify(msg, level, opts)
|
function M.notify(msg, level, opts)
|
||||||
vim.schedule(function() _orig_notify(msg, level, opts) end)
|
|
||||||
if level == nil then level = vim.log.levels.INFO end
|
if level == nil then level = vim.log.levels.INFO end
|
||||||
if level < vim.log.levels.INFO then return end
|
|
||||||
|
|
||||||
local id = math.random(math.huge)
|
opts = opts or {}
|
||||||
|
local id = opts.id or math.random(999999999)
|
||||||
|
|
||||||
--- @param notifs Notification[]
|
--- @type u.example.Notification?
|
||||||
s_notifications_raw:schedule_update(function(notifs)
|
local notif = vim.iter(s_notifications_raw:get()):find(function(n) return n.id == id end)
|
||||||
table.insert(notifs, { kind = level, id = id, text = msg })
|
if not notif then
|
||||||
return notifs
|
-- Create a new notification (maybe):
|
||||||
end)
|
if vim.trim(msg) == '' then return id end
|
||||||
|
if level < vim.log.levels.INFO then return id end
|
||||||
|
|
||||||
vim.defer_fn(function()
|
local timer = assert((vim.uv or vim.loop).new_timer(), 'could not create timer')
|
||||||
--- @param notifs Notification[]
|
timer:start(TIMEOUT, 0, function() _delete_notif(id) end)
|
||||||
|
notif = {
|
||||||
|
id = id,
|
||||||
|
kind = level,
|
||||||
|
text = msg,
|
||||||
|
timer = timer,
|
||||||
|
}
|
||||||
|
--- @param notifs u.example.Notification[]
|
||||||
s_notifications_raw:schedule_update(function(notifs)
|
s_notifications_raw:schedule_update(function(notifs)
|
||||||
for i, notif in ipairs(notifs) do
|
table.insert(notifs, notif)
|
||||||
if notif.id == id then
|
|
||||||
table.remove(notifs, i)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return notifs
|
return notifs
|
||||||
end)
|
end)
|
||||||
end, TIMEOUT)
|
else
|
||||||
|
-- Update an existing notification:
|
||||||
|
s_notifications_raw:schedule_update(function(notifs)
|
||||||
|
-- We already have a copy-by-reference of the notif we want to modify:
|
||||||
|
notif.timer:stop()
|
||||||
|
notif.text = msg
|
||||||
|
notif.kind = level
|
||||||
|
notif.timer:start(TIMEOUT, 0, function() _delete_notif(id) end)
|
||||||
|
|
||||||
|
return notifs
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return id
|
||||||
end
|
end
|
||||||
|
|
||||||
local _once_msgs = {}
|
local _once_msgs = {}
|
||||||
local function my_notify_once(msg, level, opts)
|
function M.notify_once(msg, level, opts)
|
||||||
if vim.tbl_contains(_once_msgs, msg) then return false end
|
if vim.tbl_contains(_once_msgs, msg) then return false end
|
||||||
table.insert(_once_msgs, msg)
|
table.insert(_once_msgs, msg)
|
||||||
vim.notify(msg, level, opts)
|
vim.notify(msg, level, opts)
|
||||||
@@ -130,8 +177,8 @@ end
|
|||||||
function M.setup()
|
function M.setup()
|
||||||
if _orig_notify == nil then _orig_notify = vim.notify end
|
if _orig_notify == nil then _orig_notify = vim.notify end
|
||||||
|
|
||||||
vim.notify = my_notify
|
vim.notify = M.notify
|
||||||
vim.notify_once = my_notify_once
|
vim.notify_once = M.notify_once
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
local Pos = require 'u.pos'
|
local Pos = require 'u.pos'
|
||||||
|
|
||||||
-- Certain functions in the Range class yank text. In order to prevent unwanted
|
local ESC = vim.api.nvim_replace_termcodes('<Esc>', true, false, true)
|
||||||
-- highlighting, we intercept and discard some calls to the `on_yank` callback.
|
|
||||||
local orig_on_yank = vim.hl.on_yank
|
|
||||||
local on_yank_enabled = true
|
|
||||||
--- @diagnostic disable-next-line: duplicate-set-field
|
|
||||||
function vim.hl.on_yank(opts)
|
|
||||||
if not on_yank_enabled then return end
|
|
||||||
return orig_on_yank(opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- @class u.Range
|
--- @class u.Range
|
||||||
--- @field start u.Pos
|
--- @field start u.Pos
|
||||||
@@ -133,10 +125,6 @@ function Range.from_motion(motion, opts)
|
|||||||
local is_txtobj = scope == 'a' or scope == 'i'
|
local is_txtobj = scope == 'a' or scope == 'i'
|
||||||
local is_quote_txtobj = is_txtobj and vim.tbl_contains({ "'", '"', '`' }, motion_rest)
|
local is_quote_txtobj = is_txtobj and vim.tbl_contains({ "'", '"', '`' }, motion_rest)
|
||||||
|
|
||||||
--- @type u.Pos
|
|
||||||
local start
|
|
||||||
--- @type u.Pos
|
|
||||||
local stop
|
|
||||||
-- Capture the original state of the buffer for restoration later.
|
-- Capture the original state of the buffer for restoration later.
|
||||||
local original_state = {
|
local original_state = {
|
||||||
winview = vim.fn.winsaveview(),
|
winview = vim.fn.winsaveview(),
|
||||||
@@ -144,59 +132,65 @@ function Range.from_motion(motion, opts)
|
|||||||
cursor = vim.fn.getpos '.',
|
cursor = vim.fn.getpos '.',
|
||||||
pos_lbrack = vim.fn.getpos "'[",
|
pos_lbrack = vim.fn.getpos "'[",
|
||||||
pos_rbrack = vim.fn.getpos "']",
|
pos_rbrack = vim.fn.getpos "']",
|
||||||
|
opfunc = vim.go.operatorfunc,
|
||||||
|
prev_captured_range = _G.Range__from_motion_opfunc_captured_range,
|
||||||
|
prev_mode = vim.fn.mode(),
|
||||||
|
vinf = Range.from_vtext(),
|
||||||
}
|
}
|
||||||
|
--- @type u.Range|nil
|
||||||
|
_G.Range__from_motion_opfunc_captured_range = nil
|
||||||
|
|
||||||
vim.api.nvim_buf_call(opts.bufnr, function()
|
vim.api.nvim_buf_call(opts.bufnr, function()
|
||||||
if opts.pos ~= nil then opts.pos:save_to_pos '.' end
|
if opts.pos ~= nil then opts.pos:save_to_pos '.' end
|
||||||
|
|
||||||
Pos.invalid():save_to_pos "'["
|
_G.Range__from_motion_opfunc = function(ty)
|
||||||
Pos.invalid():save_to_pos "']"
|
_G.Range__from_motion_opfunc_captured_range = Range.from_op_func(ty)
|
||||||
|
end
|
||||||
local prev_on_yank_enabled = on_yank_enabled
|
vim.go.operatorfunc = 'v:lua.Range__from_motion_opfunc'
|
||||||
on_yank_enabled = false
|
|
||||||
vim.cmd {
|
vim.cmd {
|
||||||
cmd = 'normal',
|
cmd = 'normal',
|
||||||
bang = not opts.user_defined,
|
bang = not opts.user_defined,
|
||||||
args = { '""y' .. motion },
|
args = { ESC .. 'g@' .. motion },
|
||||||
mods = { silent = true },
|
mods = { silent = true },
|
||||||
}
|
}
|
||||||
on_yank_enabled = prev_on_yank_enabled
|
|
||||||
|
|
||||||
start = Pos.from_pos "'["
|
|
||||||
stop = Pos.from_pos "']"
|
|
||||||
end)
|
end)
|
||||||
|
local captured_range = _G.Range__from_motion_opfunc_captured_range
|
||||||
|
|
||||||
-- Restore original state:
|
-- Restore original state:
|
||||||
vim.fn.winrestview(original_state.winview)
|
vim.fn.winrestview(original_state.winview)
|
||||||
vim.fn.setreg('"', original_state.regquote)
|
vim.fn.setreg('"', original_state.regquote)
|
||||||
vim.fn.setpos('.', original_state.cursor)
|
vim.fn.setpos('.', original_state.cursor)
|
||||||
vim.fn.setpos("'[", original_state.pos_lbrack)
|
vim.fn.setpos("'[", original_state.pos_lbrack)
|
||||||
vim.fn.setpos("']", original_state.pos_rbrack)
|
vim.fn.setpos("']", original_state.pos_rbrack)
|
||||||
|
if original_state.prev_mode ~= 'n' then original_state.vinf:set_visual_selection() end
|
||||||
|
vim.go.operatorfunc = original_state.opfunc
|
||||||
|
_G.Range__from_motion_opfunc_captured_range = original_state.prev_captured_range
|
||||||
|
|
||||||
if start == stop and start:is_invalid() then return nil end
|
if not captured_range then return nil end
|
||||||
|
|
||||||
-- Fixup the bounds:
|
-- Fixup the bounds:
|
||||||
if
|
if
|
||||||
-- I have no idea why, but when yanking `i"`, the stop-mark is
|
-- I have no idea why, but when yanking `i"`, the stop-mark is
|
||||||
-- placed on the ending quote. For other text-objects, the stop-
|
-- placed on the ending quote. For other text-objects, the stop-
|
||||||
-- mark is placed before the closing character.
|
-- mark is placed before the closing character.
|
||||||
(is_quote_txtobj and scope == 'i' and stop:char() == motion_rest)
|
(is_quote_txtobj and scope == 'i' and captured_range.stop:char() == motion_rest)
|
||||||
-- *Sigh*, this also sometimes happens for `it` as well.
|
-- *Sigh*, this also sometimes happens for `it` as well.
|
||||||
or (motion == 'it' and stop:char() == '<')
|
or (motion == 'it' and captured_range.stop:char() == '<')
|
||||||
then
|
then
|
||||||
stop = stop:next(-1) or stop
|
captured_range.stop = captured_range.stop:next(-1) or captured_range.stop
|
||||||
end
|
end
|
||||||
if is_quote_txtobj and scope == 'a' then
|
if is_quote_txtobj and scope == 'a' then
|
||||||
start = start:find_next(1, motion_rest) or start
|
captured_range.start = captured_range.start:find_next(1, motion_rest) or captured_range.start
|
||||||
stop = stop:find_next(-1, motion_rest) or stop
|
captured_range.stop = captured_range.stop:find_next(-1, motion_rest) or captured_range.stop
|
||||||
end
|
end
|
||||||
|
|
||||||
if
|
if
|
||||||
opts.contains_cursor
|
opts.contains_cursor and not captured_range:contains(Pos.new(unpack(original_state.cursor)))
|
||||||
and not Range.new(start, stop):contains(Pos.new(unpack(original_state.cursor)))
|
|
||||||
then
|
then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return Range.new(start, stop)
|
return captured_range
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get range information from the currently selected visual text.
|
--- Get range information from the currently selected visual text.
|
||||||
|
|||||||
19
lux.toml
19
lux.toml
@@ -1,19 +0,0 @@
|
|||||||
package = "u.nvim"
|
|
||||||
version = "0.2.0"
|
|
||||||
lua = ">=5.1"
|
|
||||||
|
|
||||||
[description]
|
|
||||||
summary = ""
|
|
||||||
maintainer = "jrop"
|
|
||||||
labels = [ "library", "neovim", "neovim-plugin", "range", "utility" ]
|
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
# Add your dependencies here
|
|
||||||
# `busted = ">=2.0"`
|
|
||||||
|
|
||||||
[run]
|
|
||||||
args = [ "src/main.lua" ]
|
|
||||||
|
|
||||||
[build]
|
|
||||||
type = "builtin"
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
std = "vim"
|
|
||||||
|
|
||||||
[lints]
|
|
||||||
multiple_statements = "allow"
|
|
||||||
23
shell.nix
Normal file
23
shell.nix
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
pkgs ?
|
||||||
|
import
|
||||||
|
# nixpkgs-unstable (neovim@0.11.2):
|
||||||
|
(fetchTarball {
|
||||||
|
url = "https://github.com/nixos/nixpkgs/archive/e4b09e47ace7d87de083786b404bf232eb6c89d8.tar.gz";
|
||||||
|
sha256 = "1a2qvp2yz8j1jcggl1yvqmdxicbdqq58nv7hihmw3bzg9cjyqm26";
|
||||||
|
})
|
||||||
|
{ },
|
||||||
|
}:
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
pkgs.git
|
||||||
|
pkgs.gnumake
|
||||||
|
pkgs.lua-language-server
|
||||||
|
pkgs.lua51Packages.busted
|
||||||
|
pkgs.lua51Packages.luacov
|
||||||
|
pkgs.lua51Packages.luarocks
|
||||||
|
pkgs.lua51Packages.nlua
|
||||||
|
pkgs.neovim
|
||||||
|
pkgs.stylua
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
require 'luacov'
|
||||||
local function withbuf(lines, f)
|
local function withbuf(lines, f)
|
||||||
vim.go.swapfile = false
|
vim.go.swapfile = false
|
||||||
|
|
||||||
|
|||||||
36
vim.yml
36
vim.yml
@@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
base: lua51
|
|
||||||
globals:
|
|
||||||
vim:
|
|
||||||
any: true
|
|
||||||
assert.are.same:
|
|
||||||
args:
|
|
||||||
- type: any
|
|
||||||
- type: any
|
|
||||||
assert.are_not.same:
|
|
||||||
args:
|
|
||||||
- type: any
|
|
||||||
- type: any
|
|
||||||
assert.has.error:
|
|
||||||
args:
|
|
||||||
- type: any
|
|
||||||
- type: any
|
|
||||||
assert.is_true:
|
|
||||||
args:
|
|
||||||
- type: any
|
|
||||||
- type: any
|
|
||||||
assert.is_false:
|
|
||||||
args:
|
|
||||||
- type: any
|
|
||||||
- type: any
|
|
||||||
describe:
|
|
||||||
args:
|
|
||||||
- type: string
|
|
||||||
- type: function
|
|
||||||
it:
|
|
||||||
args:
|
|
||||||
- type: string
|
|
||||||
- type: function
|
|
||||||
before_each:
|
|
||||||
args:
|
|
||||||
- type: function
|
|
||||||
Reference in New Issue
Block a user