nixos-configs/homeManagerModules/neovim/langs/web.nix
matt1432 cc80e9f265
All checks were successful
Discord / discord commits (push) Has been skipped
chore: update sources
Flake Inputs:
• Updated input 'astal':
    'github:Aylur/astal/b7af61d' (2024-11-24)
  → 'github:Aylur/astal/12fa0fb' (2024-11-26)

• Updated input 'custom-sidebar-src':
    'github:elchininet/custom-sidebar/d0c4394' (2024-11-25)
  → 'github:elchininet/custom-sidebar/91af66e' (2024-11-26)

• Updated input 'discord-overlay':
    'github:matt1432/discord-nightly-overlay/a397f74' (2024-11-25)
  → 'github:matt1432/discord-nightly-overlay/0ea4f4d' (2024-11-26)

• Updated input 'gtk-theme-src':
    'github:dracula/gtk/fda0fb5' (2024-11-17)
  → 'github:dracula/gtk/788add3' (2024-11-26)

• Updated input 'hyprland':
    'github:hyprwm/Hyprland/2687788' (2024-11-25)
  → 'github:hyprwm/Hyprland/1fb720b' (2024-11-26)

• Updated input 'jellyfin-flake':
    'github:matt1432/nixos-jellyfin/74f284f' (2024-11-24)
  → 'github:matt1432/nixos-jellyfin/28c58c6' (2024-11-27)

• Updated input 'jovian':
    'github:Jovian-Experiments/Jovian-NixOS/98a61cf' (2024-11-24)
  → 'github:Jovian-Experiments/Jovian-NixOS/e86d2ad' (2024-11-26)

• Updated input 'nh':
    'github:viperML/nh/cff51af' (2024-11-20)
  → 'github:viperML/nh/51020a2' (2024-11-26)

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5e4fbfb' (2024-11-15)
  → 'github:NixOS/nixpkgs/4633a7c' (2024-11-25)

• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/0c3d6b6' (2024-11-25)
  → 'github:nix-community/nixpkgs-wayland/af74f7c' (2024-11-26)

• Updated input 'sops-nix':
    'github:Mic92/sops-nix/53c853f' (2024-11-21)
  → 'github:Mic92/sops-nix/3433ea1' (2024-11-25)

• Updated input 'tuya-local-src':
    'github:make-all/tuya-local/c13cf16' (2024-11-25)
  → 'github:make-all/tuya-local/56f76f9' (2024-11-26)

Docker Images:
• rssbridge/rss-bridge latest:
   sha256:72218407217f2495a5f7f39b0adc1fdefba05c2fdecae6d4df1192389a250426
 → sha256:a0ceedea6bfcaf7c8a2508b110ce20af6f5931f6f720674e414400fcae19d3af

• nginx latest:
   sha256:bc5eac5eafc581aeda3008b4b1f07ebba230de2f27d47767129a6a905c84f470
 → sha256:0c86dddac19f2ce4fd716ac58c0fd87bf69bfd4edabfd6971fb885bafd12a00b

• ghcr.io/linuxserver/bazarr latest:
   sha256:0d544276b51e11fb96f4bccd7d5babef597be0199364a11c0cdf24ab0470c381
 → sha256:5805d6a44689a41cf78a8317208276a52f0647fb3cd0b2c4a3c8df6e02f93d3b

• ghcr.io/linuxserver/prowlarr latest:
   sha256:c492863c8e1da876a6be3d0d5836f25b3547c0a3293f0e9f09cd198ebf47ea37
 → sha256:2ae64259bfca88972deec4cffa3750a454224283515854408e35af480f167cd7

• ghcr.io/linuxserver/sonarr latest:
   sha256:a30d870ae503e617e84909367c8f19096567ef60834fa8d81d86d17a13e50d1a
 → sha256:f1b771bf5f911ddb11aa86170ae27fab5ccde7d4671edcde6a3b264af8662945
2024-11-26 22:26:28 -05:00

204 lines
6.2 KiB
Nix

self: {
config,
lib,
pkgs,
...
}: let
inherit (self.inputs) vimplugin-ts-error-translator-src;
inherit (self.lib.${pkgs.system}) buildPlugin;
inherit (lib) mkIf;
cfg = config.programs.neovim;
in {
config = mkIf cfg.enableIde {
programs = {
neovim = {
withNodeJs = true;
extraPackages = builtins.attrValues {
inherit
(pkgs)
neovim-node-client
nodejs_latest
vscode-langservers-extracted
;
inherit
(pkgs.nodePackages)
npm
;
inherit
(self.packages.${pkgs.system})
some-sass-language-server
;
};
extraLuaConfig =
# lua
''
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', 'typescriptreact', 'typescript.tsx', 'css', 'scss' },
command = 'setlocal ts=4 sw=4 sts=0 expandtab',
});
vim.api.nvim_create_autocmd('FileType', {
pattern = 'html',
command = 'setlocal ts=4 sw=4 expandtab',
});
vim.api.nvim_create_autocmd('FileType', {
pattern = 'scss',
command = 'setlocal iskeyword+=@-@',
});
local lsp = require('lspconfig');
local tsserver = require('typescript-tools');
local default_capabilities = require('cmp_nvim_lsp').default_capabilities();
tsserver.setup({
capabilities = default_capabilities,
handlers = {
-- format error code with better error message
['textDocument/publishDiagnostics'] = function(err, result, ctx, config)
require('ts-error-translator').translate_diagnostics(err, result, ctx, config)
vim.lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config)
end,
},
});
lsp.eslint.setup({
capabilities = default_capabilities,
-- auto-save
on_attach = function(client, bufnr)
vim.api.nvim_create_autocmd('BufWritePre', {
buffer = bufnr,
command = 'EslintFixAll',
});
end,
settings = {
validate = 'on',
packageManager = 'npm',
useESLintClass = true,
useFlatConfig = true,
experimental = {
useFlatConfig = true,
},
codeAction = {
disableRuleComment = {
enable = true,
location = 'separateLine'
},
showDocumentation = {
enable = true,
},
},
codeActionOnSave = {
mode = 'all',
rules = {},
},
format = true,
quiet = false,
onIgnoredFiles = 'off',
rulesCustomizations = {},
run = 'onType',
problems = {
shortenToSingleLine = false,
},
nodePath = "",
workingDirectory = {
mode = 'location',
},
options = {
flags = {'unstable_ts_config'},
},
},
});
lsp.cssls.setup({
capabilities = default_capabilities,
settings = {
css = {
validate = false,
},
less = {
validate = false,
},
scss = {
validate = false,
},
},
});
lsp.somesass_ls.setup({
capabilities = default_capabilities,
});
lsp.somesass_ls.manager.config.settings = {
somesass = {
scss = {
completion = {
suggestFromUseOnly = true,
},
},
},
};
local html_caps = default_capabilities;
html_caps.textDocument.completion.completionItem.snippetSupport = true;
lsp.html.setup({
capabilities = html_caps,
settings = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = {
css = true,
javascript = true,
},
provideFormatter = true,
tabSize = 4,
insertSpaces = true,
indentEmptyLines = false,
wrapAttributes = 'auto',
wrapAttributesIndentSize = 4,
endWithNewline = true,
},
});
'';
plugins = [
pkgs.vimPlugins.typescript-tools-nvim
(buildPlugin "ts-error-translator" vimplugin-ts-error-translator-src)
{
plugin = pkgs.vimPlugins.package-info-nvim;
type = "lua";
config =
# lua
''
local packageInfo = require('package-info');
packageInfo.setup({
hide_up_to_date = true,
package_manager = 'npm',
});
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { 'package.json' },
callback = function()
packageInfo.show({ force = true });
end,
});
'';
}
];
};
};
};
# For accurate stack trace
_file = ./web.nix;
}