build: replace luacheck with selene, add nix devshell and pre-commit (#20)
* build: replace luacheck with selene Problem: luacheck is unmaintained (last release 2018) and required suppressing four warning classes to avoid false positives. It also lacks first-class vim/neovim awareness. Solution: switch to selene with std='vim' for vim-aware linting. Replace the luacheck CI job with selene, update the Makefile lint target, and delete .luacheckrc. * build: add nix devshell and pre-commit hooks Problem: oil.nvim had no reproducible dev environment. The .envrc set up a Python venv for the now-removed docgen pipeline, and there were no pre-commit hooks for local formatting checks. Solution: add flake.nix with stylua, selene, and prettier in the devshell. Replace the stale Python .envrc with 'use flake'. Add .pre-commit-config.yaml with stylua and prettier hooks matching other plugins in the repo collection. * fix: format with stylua * build(selene): configure lints and add inline suppressions Problem: selene fails on 5 errors and 3 warnings from upstream code patterns that are intentional (mixed tables in config API, unused callback parameters, identical if branches for readability). Solution: globally allow mixed_table and unused_variable (high volume, inherent to the codebase design). Add inline selene:allow directives for the 8 remaining issues: if_same_then_else (4), mismatched_arg_count (1), empty_if (2), global_usage (1). Remove .envrc from tracking. * build: switch typecheck action to mrcjkb/lua-typecheck-action Problem: oil.nvim used stevearc/nvim-typecheck-action, which required cloning the action repo locally for the Makefile lint target. All other plugins in the collection use mrcjkb/lua-typecheck-action. Solution: swap to mrcjkb/lua-typecheck-action@v0 for consistency. Remove the nvim-typecheck-action git clone from the Makefile and .gitignore. Drop LuaLS from the local lint target since it requires a full language server install — CI handles it.
This commit is contained in:
parent
df53b172a9
commit
86f553cd0a
72 changed files with 2762 additions and 2649 deletions
|
|
@ -5,7 +5,7 @@ local default_config = {
|
|||
-- Id is automatically added at the beginning, and name at the end
|
||||
-- See :help oil-columns
|
||||
columns = {
|
||||
"icon",
|
||||
'icon',
|
||||
-- "permissions",
|
||||
-- "size",
|
||||
-- "mtime",
|
||||
|
|
@ -13,18 +13,18 @@ local default_config = {
|
|||
-- Buffer-local options to use for oil buffers
|
||||
buf_options = {
|
||||
buflisted = false,
|
||||
bufhidden = "hide",
|
||||
bufhidden = 'hide',
|
||||
},
|
||||
-- Window-local options to use for oil buffers
|
||||
win_options = {
|
||||
wrap = false,
|
||||
signcolumn = "no",
|
||||
signcolumn = 'no',
|
||||
cursorcolumn = false,
|
||||
foldcolumn = "0",
|
||||
foldcolumn = '0',
|
||||
spell = false,
|
||||
list = false,
|
||||
conceallevel = 3,
|
||||
concealcursor = "nvic",
|
||||
concealcursor = 'nvic',
|
||||
},
|
||||
-- Send deleted files to the trash instead of permanently deleting them (:help oil-trash)
|
||||
delete_to_trash = false,
|
||||
|
|
@ -48,7 +48,7 @@ local default_config = {
|
|||
},
|
||||
-- Constrain the cursor to the editable parts of the oil buffer
|
||||
-- Set to `false` to disable, or "name" to keep it on the file names
|
||||
constrain_cursor = "editable",
|
||||
constrain_cursor = 'editable',
|
||||
-- Set to true to watch the filesystem for changes and reload oil
|
||||
watch_for_changes = false,
|
||||
-- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap
|
||||
|
|
@ -58,22 +58,22 @@ local default_config = {
|
|||
-- Set to `false` to remove a keymap
|
||||
-- See :help oil-actions for a list of all available actions
|
||||
keymaps = {
|
||||
["g?"] = { "actions.show_help", mode = "n" },
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-s>"] = { "actions.select", opts = { vertical = true } },
|
||||
["<C-h>"] = { "actions.select", opts = { horizontal = true } },
|
||||
["<C-t>"] = { "actions.select", opts = { tab = true } },
|
||||
["<C-p>"] = "actions.preview",
|
||||
["<C-c>"] = { "actions.close", mode = "n" },
|
||||
["<C-l>"] = "actions.refresh",
|
||||
["-"] = { "actions.parent", mode = "n" },
|
||||
["_"] = { "actions.open_cwd", mode = "n" },
|
||||
["`"] = { "actions.cd", mode = "n" },
|
||||
["g~"] = { "actions.cd", opts = { scope = "tab" }, mode = "n" },
|
||||
["gs"] = { "actions.change_sort", mode = "n" },
|
||||
["gx"] = "actions.open_external",
|
||||
["g."] = { "actions.toggle_hidden", mode = "n" },
|
||||
["g\\"] = { "actions.toggle_trash", mode = "n" },
|
||||
['g?'] = { 'actions.show_help', mode = 'n' },
|
||||
['<CR>'] = 'actions.select',
|
||||
['<C-s>'] = { 'actions.select', opts = { vertical = true } },
|
||||
['<C-h>'] = { 'actions.select', opts = { horizontal = true } },
|
||||
['<C-t>'] = { 'actions.select', opts = { tab = true } },
|
||||
['<C-p>'] = 'actions.preview',
|
||||
['<C-c>'] = { 'actions.close', mode = 'n' },
|
||||
['<C-l>'] = 'actions.refresh',
|
||||
['-'] = { 'actions.parent', mode = 'n' },
|
||||
['_'] = { 'actions.open_cwd', mode = 'n' },
|
||||
['`'] = { 'actions.cd', mode = 'n' },
|
||||
['g~'] = { 'actions.cd', opts = { scope = 'tab' }, mode = 'n' },
|
||||
['gs'] = { 'actions.change_sort', mode = 'n' },
|
||||
['gx'] = 'actions.open_external',
|
||||
['g.'] = { 'actions.toggle_hidden', mode = 'n' },
|
||||
['g\\'] = { 'actions.toggle_trash', mode = 'n' },
|
||||
},
|
||||
-- Set to false to disable all of the above keymaps
|
||||
use_default_keymaps = true,
|
||||
|
|
@ -82,7 +82,7 @@ local default_config = {
|
|||
show_hidden = false,
|
||||
-- This function defines what is considered a "hidden" file
|
||||
is_hidden_file = function(name, bufnr)
|
||||
local m = name:match("^%.")
|
||||
local m = name:match('^%.')
|
||||
return m ~= nil
|
||||
end,
|
||||
-- This function defines what will never be shown, even when `show_hidden` is set
|
||||
|
|
@ -91,14 +91,14 @@ local default_config = {
|
|||
end,
|
||||
-- Sort file names with numbers in a more intuitive order for humans.
|
||||
-- Can be "fast", true, or false. "fast" will turn it off for large directories.
|
||||
natural_order = "fast",
|
||||
natural_order = 'fast',
|
||||
-- Sort file and directory names case insensitive
|
||||
case_insensitive = false,
|
||||
sort = {
|
||||
-- sort order can be "asc" or "desc"
|
||||
-- see :help oil-columns to see which columns are sortable
|
||||
{ "type", "asc" },
|
||||
{ "name", "asc" },
|
||||
{ 'type', 'asc' },
|
||||
{ 'name', 'asc' },
|
||||
},
|
||||
-- Customize the highlight group for the file name
|
||||
highlight_filename = function(entry, is_hidden, is_link_target, is_link_orphan)
|
||||
|
|
@ -138,7 +138,7 @@ local default_config = {
|
|||
-- optionally override the oil buffers window title with custom function: fun(winid: integer): string
|
||||
get_win_title = nil,
|
||||
-- preview_split: Split direction: "auto", "left", "right", "above", "below".
|
||||
preview_split = "auto",
|
||||
preview_split = 'auto',
|
||||
-- This is the config that will be passed to nvim_open_win.
|
||||
-- Change values here to customize the layout
|
||||
override = function(conf)
|
||||
|
|
@ -150,7 +150,7 @@ local default_config = {
|
|||
-- Whether the preview window is automatically updated when the cursor is moved
|
||||
update_on_cursor_moved = true,
|
||||
-- How to open the preview window "load"|"scratch"|"fast_scratch"
|
||||
preview_method = "fast_scratch",
|
||||
preview_method = 'fast_scratch',
|
||||
-- A function that returns true to disable preview on a file e.g. to avoid lag
|
||||
disable_preview = function(filename)
|
||||
return false
|
||||
|
|
@ -190,7 +190,7 @@ local default_config = {
|
|||
min_height = { 5, 0.1 },
|
||||
height = nil,
|
||||
border = nil,
|
||||
minimized_border = "none",
|
||||
minimized_border = 'none',
|
||||
win_options = {
|
||||
winblend = 0,
|
||||
},
|
||||
|
|
@ -211,12 +211,12 @@ local default_config = {
|
|||
|
||||
-- not "oil-s3://" on older neovim versions, since it doesn't open buffers correctly with a number
|
||||
-- in the name
|
||||
local oil_s3_string = vim.fn.has("nvim-0.12") == 1 and "oil-s3://" or "oil-sss://"
|
||||
local oil_s3_string = vim.fn.has('nvim-0.12') == 1 and 'oil-s3://' or 'oil-sss://'
|
||||
default_config.adapters = {
|
||||
["oil://"] = "files",
|
||||
["oil-ssh://"] = "ssh",
|
||||
[oil_s3_string] = "s3",
|
||||
["oil-trash://"] = "trash",
|
||||
['oil://'] = 'files',
|
||||
['oil-ssh://'] = 'ssh',
|
||||
[oil_s3_string] = 's3',
|
||||
['oil-trash://'] = 'trash',
|
||||
}
|
||||
default_config.adapter_aliases = {}
|
||||
-- We want the function in the default config for documentation generation, but if we nil it out
|
||||
|
|
@ -408,7 +408,7 @@ local M = {}
|
|||
M.setup = function(opts)
|
||||
opts = opts or vim.g.oil or {}
|
||||
|
||||
local new_conf = vim.tbl_deep_extend("keep", opts, default_config)
|
||||
local new_conf = vim.tbl_deep_extend('keep', opts, default_config)
|
||||
if not new_conf.use_default_keymaps then
|
||||
new_conf.keymaps = opts.keymaps or {}
|
||||
elseif opts.keymaps then
|
||||
|
|
@ -429,19 +429,19 @@ M.setup = function(opts)
|
|||
end
|
||||
|
||||
-- Backwards compatibility for old versions that don't support winborder
|
||||
if vim.fn.has("nvim-0.11") == 0 then
|
||||
new_conf = vim.tbl_deep_extend("keep", new_conf, {
|
||||
float = { border = "rounded" },
|
||||
confirmation = { border = "rounded" },
|
||||
progress = { border = "rounded" },
|
||||
ssh = { border = "rounded" },
|
||||
keymaps_help = { border = "rounded" },
|
||||
if vim.fn.has('nvim-0.11') == 0 then
|
||||
new_conf = vim.tbl_deep_extend('keep', new_conf, {
|
||||
float = { border = 'rounded' },
|
||||
confirmation = { border = 'rounded' },
|
||||
progress = { border = 'rounded' },
|
||||
ssh = { border = 'rounded' },
|
||||
keymaps_help = { border = 'rounded' },
|
||||
})
|
||||
end
|
||||
|
||||
-- Backwards compatibility. We renamed the 'preview' window config to be called 'confirmation'.
|
||||
if opts.preview and not opts.confirmation then
|
||||
new_conf.confirmation = vim.tbl_deep_extend("keep", opts.preview, default_config.confirmation)
|
||||
new_conf.confirmation = vim.tbl_deep_extend('keep', opts.preview, default_config.confirmation)
|
||||
end
|
||||
-- Backwards compatibility. We renamed the 'preview' config to 'preview_win'
|
||||
if opts.preview and opts.preview.update_on_cursor_moved ~= nil then
|
||||
|
|
@ -452,7 +452,7 @@ M.setup = function(opts)
|
|||
new_conf.lsp_file_methods.autosave_changes = new_conf.lsp_rename_autosave
|
||||
new_conf.lsp_rename_autosave = nil
|
||||
vim.notify_once(
|
||||
"oil config value lsp_rename_autosave has moved to lsp_file_methods.autosave_changes.\nCompatibility will be removed on 2024-09-01.",
|
||||
'oil config value lsp_rename_autosave has moved to lsp_file_methods.autosave_changes.\nCompatibility will be removed on 2024-09-01.',
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
end
|
||||
|
|
@ -479,10 +479,10 @@ M.get_adapter_by_scheme = function(scheme)
|
|||
if not scheme then
|
||||
return nil
|
||||
end
|
||||
if not vim.endswith(scheme, "://") then
|
||||
local pieces = vim.split(scheme, "://", { plain = true })
|
||||
if not vim.endswith(scheme, '://') then
|
||||
local pieces = vim.split(scheme, '://', { plain = true })
|
||||
if #pieces <= 2 then
|
||||
scheme = pieces[1] .. "://"
|
||||
scheme = pieces[1] .. '://'
|
||||
else
|
||||
error(string.format("Malformed url: '%s'", scheme))
|
||||
end
|
||||
|
|
@ -494,7 +494,7 @@ M.get_adapter_by_scheme = function(scheme)
|
|||
return nil
|
||||
end
|
||||
local ok
|
||||
ok, adapter = pcall(require, string.format("oil.adapters.%s", name))
|
||||
ok, adapter = pcall(require, string.format('oil.adapters.%s', name))
|
||||
if ok then
|
||||
adapter.name = name
|
||||
M._adapter_by_scheme[scheme] = adapter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue