mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 01:57:34 +00:00
Switch to none-ls and selene for lua checks
Also moves pre-commit hooks to system hooks to make sure editing and committing versions match
This commit is contained in:
parent
b4b0d7a87c
commit
afa67c1b0c
@ -13,18 +13,6 @@ repos:
|
||||
(?x)^(
|
||||
vim/colors/.*\.vim
|
||||
)$
|
||||
- repo: https://github.com/johnnymorganz/stylua
|
||||
rev: v0.17.1
|
||||
hooks:
|
||||
- id: stylua-github
|
||||
- repo: https://github.com/lunarmodules/luacheck
|
||||
rev: v1.1.0
|
||||
hooks:
|
||||
- id: luacheck
|
||||
args:
|
||||
- --globals
|
||||
- vim
|
||||
- --
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: sort-json
|
||||
@ -33,3 +21,13 @@ repos:
|
||||
entry: ./scripts/sort-json.sh
|
||||
files: "(\\.json$|^neovim/packer_snapshots/)"
|
||||
types: [text]
|
||||
- id: selene
|
||||
name: An opinionated Lua code linter
|
||||
entry: selene
|
||||
language: system
|
||||
types: [lua]
|
||||
- id: stylua
|
||||
name: An opinionated Lua code formatter
|
||||
entry: selene
|
||||
language: system
|
||||
types: [lua]
|
||||
|
@ -175,6 +175,16 @@ def install_linters(langs: set[Language]):
|
||||
if not maybe_run("lua", "-e", "require('lfs')"):
|
||||
maybe_run("luarocks", "--local", "install", "luafilesystem")
|
||||
maybe_run("luarocks", "--local", "install", "luacheck", "1.1.0")
|
||||
maybe_run(
|
||||
"release-gitter",
|
||||
"--git-url",
|
||||
"https://github.com/Kampfkarren/selene",
|
||||
"--exec",
|
||||
os.path.expanduser("chmod +x ~/bin/selene"),
|
||||
"--extract-files", "selene",
|
||||
"selene-{version}-{system}.zip",
|
||||
os.path.expanduser("~/bin"),
|
||||
)
|
||||
if Language.DOCKER in langs:
|
||||
hadolint_arm64 = "arm64"
|
||||
if sys.platform == "darwin":
|
||||
|
@ -1,5 +1,7 @@
|
||||
-- Update colors based on environment variables
|
||||
function _G.update_colors()
|
||||
local M = {}
|
||||
|
||||
function M.update_colors()
|
||||
local function maybe_set(scope, name, val, force)
|
||||
force = force or false
|
||||
local changed = vim[scope][name] ~= val
|
||||
@ -63,10 +65,14 @@ local utils = require("utils")
|
||||
if not utils.is_plugin_loaded("dark-notify") then
|
||||
vim.api.nvim_create_autocmd({ "FocusGained" }, {
|
||||
pattern = "*",
|
||||
callback = _G.update_colors,
|
||||
callback = M.update_colors,
|
||||
group = vim.api.nvim_create_augroup("auto_colors", { clear = true }),
|
||||
})
|
||||
end
|
||||
|
||||
-- Initial setting of colors
|
||||
_G.update_colors()
|
||||
function M.init()
|
||||
M.update_colors()
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -28,4 +28,4 @@ vim.g.polyglot_disabled = { "go", "rust" }
|
||||
require("lazy_init")
|
||||
|
||||
-- Load colors after plugins
|
||||
require("colors")
|
||||
require("colors").init()
|
||||
|
@ -1,3 +1,4 @@
|
||||
-- #selene: allow(mixed_table)
|
||||
local utils = require("utils")
|
||||
return {
|
||||
{
|
||||
@ -377,9 +378,7 @@ return {
|
||||
|
||||
-- Generic linter/formatters in diagnostics API
|
||||
{
|
||||
-- TODO: null-ls is archived and no longer maintained. It is replaced by none-ls
|
||||
-- Replace with https://github.com/nvimtools/none-ls.nvim
|
||||
"https://github.com/jose-elias-alvarez/null-ls.nvim",
|
||||
"https://github.com/nvimtools/none-ls.nvim",
|
||||
-- This is lazy and configured after lsps loaded in plugins/lsp.lua
|
||||
lazy = true,
|
||||
branch = utils.map_version_rule({
|
||||
@ -393,6 +392,7 @@ return {
|
||||
[">=0.6.0"] = "4b403d2d724f48150ded41189ae4866492a8158b",
|
||||
}),
|
||||
dependencies = {
|
||||
{ "https://github.com/nvimtools/none-ls-extras.nvim" },
|
||||
{ "https://github.com/nvim-lua/plenary.nvim" },
|
||||
{ "https://github.com/neovim/nvim-lspconfig" },
|
||||
},
|
||||
|
@ -1,6 +1,5 @@
|
||||
require("dark_notify").run({
|
||||
onchange = function(_)
|
||||
-- Defined in _colors
|
||||
_G.update_colors()
|
||||
require("colors").update_colors()
|
||||
end,
|
||||
})
|
||||
|
@ -243,7 +243,7 @@ function M.config_lsp()
|
||||
-- Setup each server with default config
|
||||
vim.tbl_map(function(server)
|
||||
if server == "lua_ls" then
|
||||
-- Disable formatting with lua_ls because I use luacheck
|
||||
-- Disable formatting with lua_ls because I use stylua
|
||||
local config = vim.tbl_extend("force", default_setup, {
|
||||
settings = {
|
||||
Lua = {
|
||||
|
@ -1,3 +1,4 @@
|
||||
-- #selene: allow(mixed_table)
|
||||
local M = {}
|
||||
local utils = require("utils")
|
||||
|
||||
@ -50,9 +51,7 @@ function M.config_lualine(theme_name)
|
||||
-- Theme name transformations
|
||||
if theme_name == nil then
|
||||
theme_name = "auto"
|
||||
elseif theme_name:find("wombat") then
|
||||
theme_name = "wombat"
|
||||
elseif theme_name == "wombuddy" then
|
||||
elseif theme_name:find("wombat") or theme_name == "wombuddy" then
|
||||
theme_name = "wombat"
|
||||
end
|
||||
|
||||
|
@ -41,14 +41,15 @@ function M.configure(options)
|
||||
local sources = {
|
||||
-- Generic
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.trim_whitespace,
|
||||
null_ls.builtins.formatting.trim_newlines,
|
||||
-- From extras
|
||||
require("none-ls.formatting.trim_whitespace"),
|
||||
require("none-ls.formatting.trim_newlines"),
|
||||
-- Ansible
|
||||
null_ls.builtins.diagnostics.ansiblelint.with({ filetypes = { "yaml.ansible" } }),
|
||||
-- Fish
|
||||
null_ls.builtins.formatting.fish_indent,
|
||||
-- Python
|
||||
null_ls.builtins.formatting.reorder_python_imports,
|
||||
-- null_ls.builtins.formatting.reorder_python_imports,
|
||||
null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
@ -65,9 +66,9 @@ function M.configure(options)
|
||||
end,
|
||||
}),
|
||||
-- Shell
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
-- null_ls.builtins.diagnostics.shellcheck,
|
||||
-- Lua
|
||||
null_ls.builtins.diagnostics.luacheck,
|
||||
null_ls.builtins.diagnostics.selene,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
-- Docker
|
||||
null_ls.builtins.diagnostics.hadolint,
|
||||
|
@ -1,4 +1,3 @@
|
||||
-- luacheck: globals packer_plugins
|
||||
local M = {}
|
||||
|
||||
function M.get_color(synID, what, mode)
|
||||
|
Loading…
Reference in New Issue
Block a user