add vlang, update files

This commit is contained in:
RingOfStorms (Josh) 2024-05-14 10:01:47 -05:00
parent c8471e745f
commit aa687d7909
6 changed files with 194 additions and 155 deletions

View file

@ -39,6 +39,12 @@
"aarch64-darwin"
]
);
systemToVAnalyzer = {
"x86_64-linux" = " v-analyzer-linux-x86_64.zip ";
"x86_64-darwin" = "v-analyzer-darwin-x86_64.zip ";
"aarch64-darwin" = "v-analyzer-darwin-arm64.zip ";
};
in
# Takes all top level attributes and changes them to `attribute.${system} = old value`
withSystem (
@ -48,6 +54,27 @@
overlays = [ (import inputs.rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
# v_analyzer = pkgs.stdenv.mkDerivation rec {
# pname = "v_analyzer";
# version = "0.0.3-beta.1";
# src = pkgs.fetchgit {
# url = "https://github.com/v-analyzer/v-analyzer.git";
# rev = version;
# sha256 = "sha256-aZsStI/1/2CrMoRXrTRdNDRoBH/mA1FqC47tghSkCMo=";
# };
# buildInputs = with pkgs; [ vlang ];
# buildPhase = ''
# v install
# v build.vsh release
# '';
# installPhase = ''
# mkdir -p $out/bin
# cp -r ./bin/* $out/bin
# '';
# };
# Plugins provided in nixpkgs, match the naming scheme above for keys
lazyPath = pkgs.vimPlugins.lazy-nvim;
nixPkgsPlugins = with pkgs.vimPlugins; {
@ -140,6 +167,7 @@
# LSPs
nil # nix
lua-language-server
# v_analyzer
vscode-langservers-extracted # HTML/CSS/JSON/ESLint
nodePackages.typescript-language-server
tailwindcss-language-server
@ -154,8 +182,7 @@
nodejs_20
clang
zig
(pkgs.rust-bin.stable.latest.default.override
{
(pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
@ -208,6 +235,8 @@
''export XDG_STATE_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/state"''
"--run"
''export XDG_CACHE_HOME="$NVIM_FLAKE_BASE_DIR/nvim_ringofstorms_${version}/cache"''
"--run"
''export TESTASDASD="${lib.concatStringsSep "|" (lib.attrValues pkgs.vimPlugins.nvim-treesitter.grammarPlugins)}"''
];
});
};

View file

@ -6,31 +6,35 @@ vim.api.nvim_create_autocmd("TextYankPost", {
group = group,
desc = "Highlight when yanking (copying) text",
callback = function()
vim.highlight.on_yank({ timeout = 300 })
vim.highlight.on_yank({ timeout = 200 })
end,
})
-- TODO is there a better way for these?
-- https://www.youtube.com/watch?v=NecszftvMFI vim.filetype.add
vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = ".env*",
command = "set filetype=sh",
vim.filetype.add({
pattern = {
[".*env*"] = "sh",
[".*rc"] = "sh",
},
})
vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = ".*rc",
command = "set filetype=sh",
vim.filetype.add({
pattern = {
["Dockerfile.*"] = "dockerfile",
},
})
vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = "Dockerfile.*",
command = "set filetype=dockerfile",
vim.filetype.add({
extension = {
http = "http",
},
})
vim.api.nvim_create_autocmd("BufRead", {
group = group,
pattern = "*.http",
command = "set filetype=http",
vim.filetype.add({
extension = {
v = "vlang",
vsh = "vlang",
vv = "vlang",
},
filename = {
["v.mod"] = "vlang",
},
})
-- Auto exit insert mode whenever we switch screens
@ -66,11 +70,7 @@ vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged", "TextChangedI", "Buf
local modifiable = vim.api.nvim_buf_get_option(event.buf, "modifiable")
local filetype = vim.api.nvim_buf_get_option(event.buf, "filetype")
local modified = vim.api.nvim_buf_get_option(event.buf, "modified")
if
modifiable
and modified
and U.table_not_contains(auto_save_disallowed_filetypes, filetype)
then
if modifiable and modified and U.table_not_contains(auto_save_disallowed_filetypes, filetype) then
if auto_save_debounce[event.buf] ~= 1 then
auto_save_debounce[event.buf] = 1
vim.defer_fn(function()

View file

@ -85,3 +85,5 @@ vim.opt.equalalways = false
-- enable colors for opacity changes
vim.opt.termguicolors = true

View file

@ -20,10 +20,17 @@ return {
opts = {
-- https://github.com/stevearc/conform.nvim?tab=readme-ov-file#setup
notify_on_error = true,
formatters = {
v_fmt = {
command = "v",
args = { "fmt" },
},
},
-- Note that all these need to be available at runtime, add them to flake.nix#runtimeDependencies
formatters_by_ft = {
lua = { "stylua" },
nix = { "nixfmt" },
vlang = { "v_fmt" },
typescript = { { "prettierd", "prettier" }, "rustywind" },
typescriptreact = { { "prettierd", "prettier" }, "rustywind" },
javascript = { { "prettierd", "prettier" }, "rustywind" },

View file

@ -62,6 +62,7 @@ return {
"-",
},
},
-- TODO add v vet? for v-lang?
-- -- Example of using selene only when a selene.toml file is present
-- selene = {
-- -- `condition` is another LazyVim extension that allows you to

View file

@ -107,6 +107,7 @@ return {
},
},
nil_ls = {},
v_analyzer = { filetypes = { "vlang", "v", "vsh", "vv" } },
tsserver = {
-- typescript/javascript
implicitProjectConfiguration = {
@ -174,4 +175,3 @@ return {
end,
},
}