Compare commits
6 Commits
master
...
add_overla
Author | SHA1 | Date | |
---|---|---|---|
36d278d0a2 | |||
6db8579d0b | |||
8f2b1b05e9 | |||
10b64505cb | |||
81a8a3fb5d | |||
237d5e6a66 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1 @@
|
|||||||
result
|
result
|
||||||
.ccls-cache/
|
|
||||||
hello.c
|
|
||||||
compile_commands.json
|
|
||||||
|
15
flake.lock
generated
15
flake.lock
generated
@ -2,18 +2,17 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733120037,
|
"lastModified": 1698266953,
|
||||||
"narHash": "sha256-En+gSoVJ3iQKPDU1FHrR6zIxSLXKjzKY+pnh9tt+Yts=",
|
"narHash": "sha256-jf72t7pC8+8h8fUslUYbWTX5rKsRwOzRMX8jJsGqDXA=",
|
||||||
"owner": "nixos",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "f9f0d5c5380be0a599b1fb54641fa99af8281539",
|
"rev": "75a52265bda7fd25e06e3a67dee3f0354e73243c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"id": "nixpkgs",
|
||||||
"ref": "nixos-24.11",
|
"ref": "nixpkgs-unstable",
|
||||||
"repo": "nixpkgs",
|
"type": "indirect"
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
50
flake.nix
50
flake.nix
@ -2,7 +2,7 @@
|
|||||||
description = "A very basic flake";
|
description = "A very basic flake";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
@ -12,38 +12,31 @@
|
|||||||
supportedSystems = ["x86_64-linux" "aarch64-linux"];
|
supportedSystems = ["x86_64-linux" "aarch64-linux"];
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
|
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
|
||||||
|
additionalDeps = pkgs: [
|
||||||
|
pkgs.alejandra
|
||||||
|
pkgs.ccls
|
||||||
|
pkgs.gopls
|
||||||
|
pkgs.luaformatter
|
||||||
|
pkgs.nixd
|
||||||
|
pkgs.pyright
|
||||||
|
pkgs.rust-analyzer
|
||||||
|
pkgs.sumneko-lua-language-server
|
||||||
|
pkgs.svls
|
||||||
|
pkgs.texlab
|
||||||
|
pkgs.tree-sitter
|
||||||
|
pkgs.verible
|
||||||
|
pkgs.zls
|
||||||
|
];
|
||||||
in {
|
in {
|
||||||
packages = forAllSystems (system: let
|
packages = forAllSystems (system: let
|
||||||
pkgs = nixpkgsFor.${system};
|
pkgs = nixpkgsFor.${system};
|
||||||
neovim = import ./nvim-lsp.nix {inherit pkgs;};
|
|
||||||
in {
|
in {
|
||||||
nvim = pkgs.symlinkJoin {
|
nvim = import ./nvim-lsp.nix {inherit pkgs;};
|
||||||
name = "nvim";
|
|
||||||
paths = with pkgs;
|
|
||||||
[
|
|
||||||
alejandra
|
|
||||||
ccls
|
|
||||||
gopls
|
|
||||||
luaformatter
|
|
||||||
nixd
|
|
||||||
nixfmt-rfc-style
|
|
||||||
pyright
|
|
||||||
rust-analyzer
|
|
||||||
sumneko-lua-language-server
|
|
||||||
svls
|
|
||||||
texlab
|
|
||||||
tree-sitter
|
|
||||||
typst-lsp
|
|
||||||
verible
|
|
||||||
yaml-language-server
|
|
||||||
zls
|
|
||||||
]
|
|
||||||
++ [neovim];
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
devShells = forAllSystems (system: let
|
devShells = forAllSystems (system: let
|
||||||
pkgs = nixpkgsFor.${system};
|
pkgs = nixpkgsFor.${system};
|
||||||
|
vim = self.packages.${system};
|
||||||
in {
|
in {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
@ -52,7 +45,6 @@
|
|||||||
pkgs.gopls
|
pkgs.gopls
|
||||||
pkgs.luaformatter
|
pkgs.luaformatter
|
||||||
pkgs.nixd
|
pkgs.nixd
|
||||||
pkgs.nixfmt-rfc-style
|
|
||||||
pkgs.pyright
|
pkgs.pyright
|
||||||
pkgs.rust-analyzer
|
pkgs.rust-analyzer
|
||||||
pkgs.sumneko-lua-language-server
|
pkgs.sumneko-lua-language-server
|
||||||
@ -61,7 +53,7 @@
|
|||||||
pkgs.tree-sitter
|
pkgs.tree-sitter
|
||||||
pkgs.verible
|
pkgs.verible
|
||||||
pkgs.zls
|
pkgs.zls
|
||||||
(import ./nvim-lsp.nix {inherit pkgs;})
|
vim
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -70,9 +62,11 @@
|
|||||||
pkgs = nixpkgsFor.${system};
|
pkgs = nixpkgsFor.${system};
|
||||||
in {
|
in {
|
||||||
overlay = final: prev: {
|
overlay = final: prev: {
|
||||||
nvim = self.packages.${system}.nvim;
|
inherit (self.packages.${system}) nvim;
|
||||||
|
inherit additionalDeps;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
defaultPackage = forAllSystems (system: self.packages.${system}.nvim);
|
defaultPackage = forAllSystems (system: self.packages.${system}.nvim);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
17
nvim-lsp.nix
17
nvim-lsp.nix
@ -1,4 +1,4 @@
|
|||||||
{pkgs}: let
|
{pkgs ? import <nixpkgs> {}}: let
|
||||||
neovim = pkgs.neovim.override {
|
neovim = pkgs.neovim.override {
|
||||||
configure = {
|
configure = {
|
||||||
customRC = ''
|
customRC = ''
|
||||||
@ -45,6 +45,21 @@
|
|||||||
vim-snippets
|
vim-snippets
|
||||||
zig-vim
|
zig-vim
|
||||||
];
|
];
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.alejandra
|
||||||
|
pkgs.ccls
|
||||||
|
pkgs.gopls
|
||||||
|
pkgs.luaformatter
|
||||||
|
pkgs.nixd
|
||||||
|
pkgs.pyright
|
||||||
|
pkgs.rust-analyzer
|
||||||
|
pkgs.sumneko-lua-language-server
|
||||||
|
pkgs.svls
|
||||||
|
pkgs.texlab
|
||||||
|
pkgs.tree-sitter
|
||||||
|
pkgs.verible
|
||||||
|
pkgs.zls
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
20
vimrc.lua
20
vimrc.lua
@ -32,9 +32,11 @@ require 'nvim-treesitter.configs'.setup {
|
|||||||
indent = { enable = false, disable = {} },
|
indent = { enable = false, disable = {} },
|
||||||
rainbow = {
|
rainbow = {
|
||||||
enable = true,
|
enable = true,
|
||||||
extended_mode = true,
|
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
|
||||||
max_file_lines = 1000,
|
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
|
||||||
colors = { '#ff0000', '#0051a0' ,'#ffa500', '#ffff00', '#008000', '#8003f2' }
|
colors = {
|
||||||
|
'#ff0000', '#ffa500', '#ffff00', '#008000', '#0051a0', '#8003f2'
|
||||||
|
} -- table of hex strings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,18 +107,18 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.diagnostic.config({ virtual_text = false }) -- Turn off inline diagnostics
|
vim.diagnostic.config({ virtual_text = false}) -- Turn off inline diagnostics
|
||||||
|
|
||||||
-- Show all diagnostics on current line in floating window
|
-- Show all diagnostics on current line in floating window
|
||||||
vim.api.nvim_set_keymap('n', '<Leader>d', ':lua vim.diagnostic.open_float()<CR>', opts)
|
vim.api.nvim_set_keymap( 'n', '<Leader>d', ':lua vim.diagnostic.open_float()<CR>', opts)
|
||||||
|
|
||||||
-- Go to next diagnostic (if there are multiple on the same line, only shows
|
-- Go to next diagnostic (if there are multiple on the same line, only shows
|
||||||
-- one at a time in the floating window)
|
-- one at a time in the floating window)
|
||||||
vim.api.nvim_set_keymap('n', '<Leader>n', ':lua vim.diagnostic.goto_next()<CR>', opts)
|
vim.api.nvim_set_keymap( 'n', '<Leader>n', ':lua vim.diagnostic.goto_next()<CR>', opts)
|
||||||
|
|
||||||
-- Go to prev diagnostic (if there are multiple on the same line, only shows
|
-- Go to prev diagnostic (if there are multiple on the same line, only shows
|
||||||
-- one at a time in the floating window)
|
-- one at a time in the floating window)
|
||||||
vim.api.nvim_set_keymap('n', '<Leader>p', ':lua vim.diagnostic.goto_prev()<CR>', opts)
|
vim.api.nvim_set_keymap( 'n', '<Leader>p', ':lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||||
|
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
-- map buffer local keybindings when the language server attaches
|
-- map buffer local keybindings when the language server attaches
|
||||||
@ -182,7 +184,7 @@ cmp.setup({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'nixd', 'texlab', 'zls', 'gopls', 'yamlls', 'typst_lsp' }
|
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'nixd', 'texlab', 'zls', 'gopls' }
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
for _, lsp in pairs(servers) do
|
for _, lsp in pairs(servers) do
|
||||||
require('lspconfig')[lsp].setup {
|
require('lspconfig')[lsp].setup {
|
||||||
@ -217,7 +219,7 @@ require('lspconfig').lua_ls.setup({
|
|||||||
|
|
||||||
require('lspconfig').verible.setup({
|
require('lspconfig').verible.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
root_dir = function() return vim.fn.getcwd() end
|
root_dir = function() return vim.loop.cwd() end
|
||||||
})
|
})
|
||||||
|
|
||||||
if vim.fn.exists('+undofile') ~= 0 then
|
if vim.fn.exists('+undofile') ~= 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user