Compare commits
36 Commits
a81f0a2041
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
878c87430f
|
|||
|
0147f451a8
|
|||
|
c4084faeff
|
|||
|
6df3b346eb
|
|||
|
779475f024
|
|||
|
a595413b88
|
|||
|
e205831fd9
|
|||
|
34fc2804d7
|
|||
|
b23265403c
|
|||
|
8245a48cc7
|
|||
|
3d82bad6ee
|
|||
|
6e26ec33fa
|
|||
|
b9c3cd2e1a
|
|||
|
a09a34997c
|
|||
|
127047caeb
|
|||
|
60acbede4d
|
|||
|
9f36693f90
|
|||
|
8fdf9bd08c
|
|||
|
e3c064d3a9
|
|||
|
8754d5b79d
|
|||
|
ba6b926cc4
|
|||
|
201161972e
|
|||
|
2b10f5cb32
|
|||
|
c055bd2a2f
|
|||
|
f042e08ecd
|
|||
|
13bed01615
|
|||
|
3f9559992a
|
|||
|
9332c56c01
|
|||
|
a9bc0c8a7a
|
|||
|
5bba266c6e
|
|||
|
dce3a89665
|
|||
|
b660608fb3
|
|||
| 9652f4cb75 | |||
| df0441425f | |||
| 6347d51dc2 | |||
| 3c95acb92e |
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
result
|
||||||
|
.ccls-cache/
|
||||||
|
hello.c
|
||||||
|
compile_commands.json
|
||||||
1
.nixd.json
Normal file
1
.nixd.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"formatting":{"command":"alejandra"}}
|
||||||
12
flake.lock
generated
12
flake.lock
generated
@@ -2,16 +2,16 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1698266953,
|
"lastModified": 1764494334,
|
||||||
"narHash": "sha256-jf72t7pC8+8h8fUslUYbWTX5rKsRwOzRMX8jJsGqDXA=",
|
"narHash": "sha256-x2xCEXUlU4Ap56+t5HaoReOQ/bV/bIQ5rzTn/m+V3HQ=",
|
||||||
"owner": "NixOS",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "75a52265bda7fd25e06e3a67dee3f0354e73243c",
|
"rev": "d542db745310b6929708d9abea513f3ff19b1341",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "nixos",
|
||||||
"ref": "nixpkgs-unstable",
|
"ref": "nixos-25.11",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|||||||
106
flake.nix
106
flake.nix
@@ -2,31 +2,89 @@
|
|||||||
description = "A very basic flake";
|
description = "A very basic flake";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
self,
|
{ self
|
||||||
nixpkgs,
|
, nixpkgs
|
||||||
}: let
|
,
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
|
}:
|
||||||
in {
|
let
|
||||||
nvim = pkgs.mkShell {
|
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
nativeBuildInputs = [
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
pkgs.alejandra
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||||
pkgs.ccls
|
in
|
||||||
pkgs.luaformatter
|
{
|
||||||
pkgs.nixd
|
packages = forAllSystems (system:
|
||||||
pkgs.pyright
|
let
|
||||||
pkgs.rust-analyzer
|
pkgs = nixpkgsFor.${system};
|
||||||
pkgs.sumneko-lua-language-server
|
neovim = import ./nvim-lsp.nix { inherit pkgs; };
|
||||||
pkgs.svls
|
in
|
||||||
pkgs.texlab
|
{
|
||||||
pkgs.tree-sitter
|
nvim = pkgs.symlinkJoin {
|
||||||
pkgs.verible
|
name = "nvim";
|
||||||
pkgs.zls
|
paths = with pkgs;
|
||||||
(import ./nvim-lsp.nix {inherit pkgs;})
|
[
|
||||||
];
|
alejandra
|
||||||
|
ccls
|
||||||
|
gopls
|
||||||
|
luaformatter
|
||||||
|
nixd
|
||||||
|
nixfmt-rfc-style
|
||||||
|
pyright
|
||||||
|
rust-analyzer
|
||||||
|
lua-language-server
|
||||||
|
svls
|
||||||
|
texlab
|
||||||
|
tree-sitter
|
||||||
|
tinymist
|
||||||
|
verible
|
||||||
|
yaml-language-server
|
||||||
|
zls
|
||||||
|
viu
|
||||||
|
chafa
|
||||||
|
ueberzugpp
|
||||||
|
]
|
||||||
|
++ [ neovim ];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
devShells = forAllSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgsFor.${system};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.alejandra
|
||||||
|
pkgs.ccls
|
||||||
|
pkgs.gopls
|
||||||
|
pkgs.luaformatter
|
||||||
|
pkgs.nixd
|
||||||
|
pkgs.nixfmt-rfc-style
|
||||||
|
pkgs.pyright
|
||||||
|
pkgs.rust-analyzer
|
||||||
|
pkgs.lua-language-server
|
||||||
|
pkgs.svls
|
||||||
|
pkgs.texlab
|
||||||
|
pkgs.tree-sitter
|
||||||
|
pkgs.verible
|
||||||
|
pkgs.zls
|
||||||
|
(import ./nvim-lsp.nix { inherit pkgs; })
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
overlays = forAllSystems (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgsFor.${system};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
overlay = final: prev: {
|
||||||
|
nvim = self.packages.${system}.nvim;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
defaultPackage = forAllSystems (system: self.packages.${system}.nvim);
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
nvim-lsp.nix
10
nvim-lsp.nix
@@ -1,4 +1,4 @@
|
|||||||
{pkgs ? import <nixpkgs> {}}: let
|
{pkgs}: let
|
||||||
neovim = pkgs.neovim.override {
|
neovim = pkgs.neovim.override {
|
||||||
configure = {
|
configure = {
|
||||||
customRC = ''
|
customRC = ''
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
(nvim-treesitter.withPlugins (parsers: [
|
(nvim-treesitter.withPlugins (parsers: [
|
||||||
parsers.c
|
parsers.c
|
||||||
parsers.cpp
|
parsers.cpp
|
||||||
parsers.go
|
parsers.go
|
||||||
parsers.json
|
parsers.json
|
||||||
parsers.latex
|
parsers.latex
|
||||||
parsers.lua
|
parsers.lua
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
parsers.python
|
parsers.python
|
||||||
parsers.query
|
parsers.query
|
||||||
parsers.rust
|
parsers.rust
|
||||||
parsers.verilog
|
|
||||||
parsers.vimdoc
|
parsers.vimdoc
|
||||||
parsers.zig
|
parsers.zig
|
||||||
]))
|
]))
|
||||||
@@ -29,13 +28,13 @@
|
|||||||
cmp-nvim-ultisnips
|
cmp-nvim-ultisnips
|
||||||
cmp-path
|
cmp-path
|
||||||
colorizer
|
colorizer
|
||||||
|
editorconfig-nvim
|
||||||
fugitive
|
fugitive
|
||||||
fzf-lua
|
fzf-lua
|
||||||
gopls
|
|
||||||
gruvbox
|
gruvbox
|
||||||
nvim-cmp
|
nvim-cmp
|
||||||
nvim-lspconfig
|
nvim-lspconfig
|
||||||
nvim-ts-rainbow
|
rainbow-delimiters-nvim
|
||||||
repeat
|
repeat
|
||||||
targets-vim
|
targets-vim
|
||||||
UltiSnips
|
UltiSnips
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
vim-slime
|
vim-slime
|
||||||
vim-snippets
|
vim-snippets
|
||||||
zig-vim
|
zig-vim
|
||||||
|
nvim-web-devicons
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
57
vimrc.lua
57
vimrc.lua
@@ -32,11 +32,9 @@ require 'nvim-treesitter.configs'.setup {
|
|||||||
indent = { enable = false, disable = {} },
|
indent = { enable = false, disable = {} },
|
||||||
rainbow = {
|
rainbow = {
|
||||||
enable = true,
|
enable = true,
|
||||||
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
|
extended_mode = true,
|
||||||
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
|
max_file_lines = 1000,
|
||||||
colors = {
|
colors = { '#ff0000', '#0051a0', '#ffa500', '#ffff00', '#008000', '#8003f2' }
|
||||||
'#ff0000', '#ffa500', '#ffff00', '#008000', '#0051a0', '#8003f2'
|
|
||||||
} -- table of hex strings
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,18 +105,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
|
||||||
@@ -184,15 +182,42 @@ cmp.setup({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'nixd', 'texlab', 'zls', 'gopls' }
|
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'texlab', 'zls', 'gopls', 'yamlls' }
|
||||||
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 {
|
vim.lsp.config(lsp, {
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
})
|
||||||
|
vim.lsp.enable(lsp)
|
||||||
end
|
end
|
||||||
|
|
||||||
require('lspconfig').lua_ls.setup({
|
vim.lsp.config('nixd', {
|
||||||
|
cmd = { "nixd" },
|
||||||
|
settings = {
|
||||||
|
nixd = {
|
||||||
|
nixpkgs = {
|
||||||
|
expr = 'import "${flake.inputs.nixpkgs}" { }',
|
||||||
|
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
command = { "nixpkgs-fmt" },
|
||||||
|
},
|
||||||
|
options = {
|
||||||
|
nixos = {
|
||||||
|
expr =
|
||||||
|
'(let pkgs = import "${inputs.nixpkgs}" { }; in (pkgs.lib.evalModules { modules = (import "${inputs.nixpkgs}/nixos/modules/module-list.nix") ++ [ ({...}: { nixpkgs.hostPlatform = builtins.currentSystem;} ) ] ; })).options',
|
||||||
|
},
|
||||||
|
home_manager = {
|
||||||
|
expr =
|
||||||
|
'(let pkgs = import "${inputs.nixpkgs}" { }; lib = import "${inputs.home-manager}/modules/lib/stdlib-extended.nix" pkgs.lib; in (lib.evalModules { modules = (import "${inputs.home-manager}/modules/modules.nix") { inherit lib pkgs; check = false; }; })).options',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
vim.lsp.enable('nixd');
|
||||||
|
|
||||||
|
vim.lsp.config('lua_ls', {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
single_file_support = true,
|
single_file_support = true,
|
||||||
settings = {
|
settings = {
|
||||||
@@ -216,11 +241,13 @@ require('lspconfig').lua_ls.setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
vim.lsp.enable('lua_ls');
|
||||||
|
|
||||||
require('lspconfig').verible.setup({
|
vim.lsp.config('verible', {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
root_dir = function() return vim.loop.cwd() end
|
root_dir = function() return vim.fn.getcwd() end
|
||||||
})
|
})
|
||||||
|
vim.lsp.enable('verible');
|
||||||
|
|
||||||
if vim.fn.exists('+undofile') ~= 0 then
|
if vim.fn.exists('+undofile') ~= 0 then
|
||||||
local undo_dir = vim.env.HOME .. '/.config/nvim/undo'
|
local undo_dir = vim.env.HOME .. '/.config/nvim/undo'
|
||||||
|
|||||||
Reference in New Issue
Block a user