mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-11-17 17:26:27 +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)^(
|
(?x)^(
|
||||||
vim/colors/.*\.vim
|
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
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: sort-json
|
- id: sort-json
|
||||||
@ -33,3 +21,13 @@ repos:
|
|||||||
entry: ./scripts/sort-json.sh
|
entry: ./scripts/sort-json.sh
|
||||||
files: "(\\.json$|^neovim/packer_snapshots/)"
|
files: "(\\.json$|^neovim/packer_snapshots/)"
|
||||||
types: [text]
|
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')"):
|
if not maybe_run("lua", "-e", "require('lfs')"):
|
||||||
maybe_run("luarocks", "--local", "install", "luafilesystem")
|
maybe_run("luarocks", "--local", "install", "luafilesystem")
|
||||||
maybe_run("luarocks", "--local", "install", "luacheck", "1.1.0")
|
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:
|
if Language.DOCKER in langs:
|
||||||
hadolint_arm64 = "arm64"
|
hadolint_arm64 = "arm64"
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
-- Update colors based on environment variables
|
-- Update colors based on environment variables
|
||||||
function _G.update_colors()
|
local M = {}
|
||||||
|
|
||||||
|
function M.update_colors()
|
||||||
local function maybe_set(scope, name, val, force)
|
local function maybe_set(scope, name, val, force)
|
||||||
force = force or false
|
force = force or false
|
||||||
local changed = vim[scope][name] ~= val
|
local changed = vim[scope][name] ~= val
|
||||||
@ -63,10 +65,14 @@ local utils = require("utils")
|
|||||||
if not utils.is_plugin_loaded("dark-notify") then
|
if not utils.is_plugin_loaded("dark-notify") then
|
||||||
vim.api.nvim_create_autocmd({ "FocusGained" }, {
|
vim.api.nvim_create_autocmd({ "FocusGained" }, {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = _G.update_colors,
|
callback = M.update_colors,
|
||||||
group = vim.api.nvim_create_augroup("auto_colors", { clear = true }),
|
group = vim.api.nvim_create_augroup("auto_colors", { clear = true }),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initial setting of colors
|
-- 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")
|
require("lazy_init")
|
||||||
|
|
||||||
-- Load colors after plugins
|
-- Load colors after plugins
|
||||||
require("colors")
|
require("colors").init()
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
-- #selene: allow(mixed_table)
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
@ -377,9 +378,7 @@ return {
|
|||||||
|
|
||||||
-- Generic linter/formatters in diagnostics API
|
-- Generic linter/formatters in diagnostics API
|
||||||
{
|
{
|
||||||
-- TODO: null-ls is archived and no longer maintained. It is replaced by none-ls
|
"https://github.com/nvimtools/none-ls.nvim",
|
||||||
-- Replace with https://github.com/nvimtools/none-ls.nvim
|
|
||||||
"https://github.com/jose-elias-alvarez/null-ls.nvim",
|
|
||||||
-- This is lazy and configured after lsps loaded in plugins/lsp.lua
|
-- This is lazy and configured after lsps loaded in plugins/lsp.lua
|
||||||
lazy = true,
|
lazy = true,
|
||||||
branch = utils.map_version_rule({
|
branch = utils.map_version_rule({
|
||||||
@ -393,6 +392,7 @@ return {
|
|||||||
[">=0.6.0"] = "4b403d2d724f48150ded41189ae4866492a8158b",
|
[">=0.6.0"] = "4b403d2d724f48150ded41189ae4866492a8158b",
|
||||||
}),
|
}),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
{ "https://github.com/nvimtools/none-ls-extras.nvim" },
|
||||||
{ "https://github.com/nvim-lua/plenary.nvim" },
|
{ "https://github.com/nvim-lua/plenary.nvim" },
|
||||||
{ "https://github.com/neovim/nvim-lspconfig" },
|
{ "https://github.com/neovim/nvim-lspconfig" },
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
require("dark_notify").run({
|
require("dark_notify").run({
|
||||||
onchange = function(_)
|
onchange = function(_)
|
||||||
-- Defined in _colors
|
require("colors").update_colors()
|
||||||
_G.update_colors()
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -243,7 +243,7 @@ function M.config_lsp()
|
|||||||
-- Setup each server with default config
|
-- Setup each server with default config
|
||||||
vim.tbl_map(function(server)
|
vim.tbl_map(function(server)
|
||||||
if server == "lua_ls" then
|
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, {
|
local config = vim.tbl_extend("force", default_setup, {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
-- #selene: allow(mixed_table)
|
||||||
local M = {}
|
local M = {}
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
|
|
||||||
@ -50,9 +51,7 @@ function M.config_lualine(theme_name)
|
|||||||
-- Theme name transformations
|
-- Theme name transformations
|
||||||
if theme_name == nil then
|
if theme_name == nil then
|
||||||
theme_name = "auto"
|
theme_name = "auto"
|
||||||
elseif theme_name:find("wombat") then
|
elseif theme_name:find("wombat") or theme_name == "wombuddy" then
|
||||||
theme_name = "wombat"
|
|
||||||
elseif theme_name == "wombuddy" then
|
|
||||||
theme_name = "wombat"
|
theme_name = "wombat"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -41,14 +41,15 @@ function M.configure(options)
|
|||||||
local sources = {
|
local sources = {
|
||||||
-- Generic
|
-- Generic
|
||||||
null_ls.builtins.formatting.prettier,
|
null_ls.builtins.formatting.prettier,
|
||||||
null_ls.builtins.formatting.trim_whitespace,
|
-- From extras
|
||||||
null_ls.builtins.formatting.trim_newlines,
|
require("none-ls.formatting.trim_whitespace"),
|
||||||
|
require("none-ls.formatting.trim_newlines"),
|
||||||
-- Ansible
|
-- Ansible
|
||||||
null_ls.builtins.diagnostics.ansiblelint.with({ filetypes = { "yaml.ansible" } }),
|
null_ls.builtins.diagnostics.ansiblelint.with({ filetypes = { "yaml.ansible" } }),
|
||||||
-- Fish
|
-- Fish
|
||||||
null_ls.builtins.formatting.fish_indent,
|
null_ls.builtins.formatting.fish_indent,
|
||||||
-- Python
|
-- Python
|
||||||
null_ls.builtins.formatting.reorder_python_imports,
|
-- null_ls.builtins.formatting.reorder_python_imports,
|
||||||
null_ls.builtins.formatting.isort,
|
null_ls.builtins.formatting.isort,
|
||||||
null_ls.builtins.formatting.black,
|
null_ls.builtins.formatting.black,
|
||||||
null_ls.builtins.diagnostics.mypy,
|
null_ls.builtins.diagnostics.mypy,
|
||||||
@ -65,9 +66,9 @@ function M.configure(options)
|
|||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
-- Shell
|
-- Shell
|
||||||
null_ls.builtins.diagnostics.shellcheck,
|
-- null_ls.builtins.diagnostics.shellcheck,
|
||||||
-- Lua
|
-- Lua
|
||||||
null_ls.builtins.diagnostics.luacheck,
|
null_ls.builtins.diagnostics.selene,
|
||||||
null_ls.builtins.formatting.stylua,
|
null_ls.builtins.formatting.stylua,
|
||||||
-- Docker
|
-- Docker
|
||||||
null_ls.builtins.diagnostics.hadolint,
|
null_ls.builtins.diagnostics.hadolint,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
-- luacheck: globals packer_plugins
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.get_color(synID, what, mode)
|
function M.get_color(synID, what, mode)
|
||||||
|
Loading…
Reference in New Issue
Block a user