Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
repos:
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.14.2
rev: v2.1.0
hooks:
- id: stylua-github
13 changes: 6 additions & 7 deletions lua/precommit/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ local function center_width(width)
return math.floor((vim.o.columns - width) / 2)
end

local function set_local_keymaps(win, buf)
---@param buf integer
local function set_local_keymaps(buf)
vim.keymap.set("n", "q", quit_map(), {
silent = true,
buffer = buf,
Expand All @@ -42,9 +43,8 @@ local function set_local_keymaps(win, buf)
})
end

---@param win integer
---@param buf integer
local function set_local_options(win, buf)
local function set_local_options(buf)
vim.api.nvim_set_option_value("filetype", "precommit", { buf = buf })
-- or
-- vim.api.nvim_set_option_value("filetype", "precommit", { scope = "local" })
Expand Down Expand Up @@ -87,10 +87,9 @@ function M.execute()

local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_lines(buf, 0, -1, true, data)
local opts = gen_window_opts()
local win = vim.api.nvim_open_win(buf, true, opts)
set_local_keymaps(win, buf)
set_local_options(win, buf)
vim.api.nvim_open_win(buf, true, gen_window_opts())
set_local_keymaps(buf)
set_local_options(buf)
end,
})
end
Expand Down
4 changes: 4 additions & 0 deletions selene.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
std = "vim"

[lints]
mixed_table = "allow"
58 changes: 58 additions & 0 deletions vim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
base: lua51
name: vim

globals:
_:
any: true

user_api:
any: true

os:
any: true

a:
any: true

jit:
any: true

bit:
any: true

vim:
any: true

assert:
args:
- type: bool
- type: string
required: false

after_each:
args:
- type: function

before_each:
args:
- type: function

describe:
args:
- type: string
- type: function

it:
args:
- type: string
- type: function

table:
any: true

string:
any: true

math:
any: true
Loading