aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock205
-rw-r--r--flake.nix7
-rw-r--r--home.nix1
-rw-r--r--modules/default.nix1
-rw-r--r--modules/global.nix3
-rw-r--r--modules/neovide.nix26
-rw-r--r--modules/neovim/default.nix3
-rw-r--r--modules/neovim/keybinds.lua12
-rw-r--r--modules/neovim/lsp.lua57
-rw-r--r--modules/neovim/terminal.lua7
10 files changed, 320 insertions, 2 deletions
diff --git a/flake.lock b/flake.lock
index ad7f39f..a5e139f 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,79 @@
{
"nodes": {
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1733328505,
+ "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "flake-compat_2": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1696426674,
+ "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": [
+ "neovim-nightly",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1738453229,
+ "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
+ "flake-parts_2": {
+ "inputs": {
+ "nixpkgs-lib": [
+ "neovim-nightly",
+ "hercules-ci-effects",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1738453229,
+ "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
+ "type": "github"
+ },
+ "original": {
+ "id": "flake-parts",
+ "type": "indirect"
+ }
+ },
"flake-utils": {
"locked": {
"lastModified": 1659877975,
@@ -15,6 +89,73 @@
"type": "github"
}
},
+ "git-hooks": {
+ "inputs": {
+ "flake-compat": "flake-compat_2",
+ "gitignore": "gitignore",
+ "nixpkgs": [
+ "neovim-nightly",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1737465171,
+ "narHash": "sha256-R10v2hoJRLq8jcL4syVFag7nIGE7m13qO48wRIukWNg=",
+ "owner": "cachix",
+ "repo": "git-hooks.nix",
+ "rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17",
+ "type": "github"
+ },
+ "original": {
+ "owner": "cachix",
+ "repo": "git-hooks.nix",
+ "type": "github"
+ }
+ },
+ "gitignore": {
+ "inputs": {
+ "nixpkgs": [
+ "neovim-nightly",
+ "git-hooks",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1709087332,
+ "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
+ "owner": "hercules-ci",
+ "repo": "gitignore.nix",
+ "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "gitignore.nix",
+ "type": "github"
+ }
+ },
+ "hercules-ci-effects": {
+ "inputs": {
+ "flake-parts": "flake-parts_2",
+ "nixpkgs": [
+ "neovim-nightly",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1739595404,
+ "narHash": "sha256-0CjCfbq0yHWexOrpO06e2WU1r5JAqR6ffy1zgM3NksI=",
+ "owner": "hercules-ci",
+ "repo": "hercules-ci-effects",
+ "rev": "06519cec8fb32d219006da6eacd255504a9996af",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "hercules-ci-effects",
+ "type": "github"
+ }
+ },
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -35,6 +176,48 @@
"type": "github"
}
},
+ "neovim-nightly": {
+ "inputs": {
+ "flake-compat": "flake-compat",
+ "flake-parts": "flake-parts",
+ "git-hooks": "git-hooks",
+ "hercules-ci-effects": "hercules-ci-effects",
+ "neovim-src": "neovim-src",
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "treefmt-nix": "treefmt-nix"
+ },
+ "locked": {
+ "lastModified": 1740500764,
+ "narHash": "sha256-AQF6DKdiKeTe5VWs5faEVmvVKtMBe5Tmjy6+Ak9lD8c=",
+ "owner": "nix-community",
+ "repo": "neovim-nightly-overlay",
+ "rev": "9709774a9967bad9f7ddd1d4eaa4d6e0399bd6d0",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "neovim-nightly-overlay",
+ "type": "github"
+ }
+ },
+ "neovim-src": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1740432889,
+ "narHash": "sha256-0cWyvDni1m5pgYF6pSNRoCSezaxpb95kvt5jYCdZmfk=",
+ "owner": "neovim",
+ "repo": "neovim",
+ "rev": "614c9322d50052c76fb3e6e1be7536a972ff0902",
+ "type": "github"
+ },
+ "original": {
+ "owner": "neovim",
+ "repo": "neovim",
+ "type": "github"
+ }
+ },
"nixgl": {
"inputs": {
"flake-utils": "flake-utils",
@@ -75,9 +258,31 @@
"root": {
"inputs": {
"home-manager": "home-manager",
+ "neovim-nightly": "neovim-nightly",
"nixgl": "nixgl",
"nixpkgs": "nixpkgs"
}
+ },
+ "treefmt-nix": {
+ "inputs": {
+ "nixpkgs": [
+ "neovim-nightly",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1739829690,
+ "narHash": "sha256-mL1szCeIsjh6Khn3nH2cYtwO5YXG6gBiTw1A30iGeDU=",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "rev": "3d0579f5cc93436052d94b73925b48973a104204",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "type": "github"
+ }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index 4758390..19e901e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -8,11 +8,14 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
-
nixgl = {
url = "github:nix-community/nixgl";
inputs.nixpkgs.follows = "nixpkgs";
};
+ neovim-nightly = {
+ url = "github:nix-community/neovim-nightly-overlay";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
};
outputs =
@@ -21,12 +24,14 @@
nixpkgs,
home-manager,
nixgl,
+ neovim-nightly,
...
}:
let
system = "x86_64-linux";
overlays = [
inputs.nixgl.overlays.default
+ inputs.neovim-nightly.overlays.default
];
pkgs = import nixpkgs {
config.allowUnfree = true;
diff --git a/home.nix b/home.nix
index 1638e65..472bcde 100644
--- a/home.nix
+++ b/home.nix
@@ -29,5 +29,6 @@
};
mako.enable = true;
+ neovide.enable = true;
};
}
diff --git a/modules/default.nix b/modules/default.nix
index 6afeec0..dc6912b 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -3,6 +3,7 @@
imports = [
./foot.nix
./mako.nix
+ ./neovide.nix
./sway
./neovim
./qutebrowser
diff --git a/modules/global.nix b/modules/global.nix
index 5d88ef2..76177e3 100644
--- a/modules/global.nix
+++ b/modules/global.nix
@@ -53,7 +53,8 @@ in
[
wl-clipboard
#...
- ]);
+ ])
+ ++ cfg.extraPackages;
};
};
diff --git a/modules/neovide.nix b/modules/neovide.nix
new file mode 100644
index 0000000..14a7aa4
--- /dev/null
+++ b/modules/neovide.nix
@@ -0,0 +1,26 @@
+{ config, lib, pkgs, ... }:
+let
+ cfg = config.modules.neovide;
+in
+{
+ options.modules.neovide = {
+ enable = lib.mkEnableOption "neovide";
+ };
+
+ config = {
+ programs.neovide = lib.mkIf cfg.enable {
+ enable = true;
+ package = config.lib.nixGL.wrap pkgs.neovide;
+ settings = {
+ title-hidden = true;
+ font = {
+ normal = ["ComicShannsMono Nerd Font"];
+ features = {
+ "ComicShannsMono Nerd Font" = ["+ss01" "+ss07" "+ss11" "-calt" "+ss09" "+ss02" "+ss14"];
+ };
+ size = 11.0;
+ };
+ };
+ };
+ };
+}
diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix
index fd77085..ce1e6e0 100644
--- a/modules/neovim/default.nix
+++ b/modules/neovim/default.nix
@@ -22,6 +22,7 @@ in
config = let
servers = [
{ name = "clangd"; }
+ { name = "zls"; }
];
in lua (pkgs.lib.strings.concatStrings (pkgs.lib.lists.forEach servers (s: "require('lspconfig')['${s.name}'].setup(${s.config or "{}"})\n")));
}
@@ -42,6 +43,8 @@ in
extraLuaConfig = ''
${builtins.readFile ./settings.lua}
${builtins.readFile ./keybinds.lua}
+ ${builtins.readFile ./lsp.lua}
+ ${builtins.readFile ./terminal.lua}
'';
};
};
diff --git a/modules/neovim/keybinds.lua b/modules/neovim/keybinds.lua
index cbd46c5..3f848b5 100644
--- a/modules/neovim/keybinds.lua
+++ b/modules/neovim/keybinds.lua
@@ -39,3 +39,15 @@ nmap('<leader>we', '<C-w><C-k>', { desc = "Focus window above the current one" }
nmap('<leader>wi', '<C-w><C-l>', { desc = "Focus window right of the current one" })
nmap('<leader>fo', '<cmd>Telescope find_files<CR>', { silent = true })
+nmap('<leader>?', '<cmd>Telescope live_grep<CR>', { silent = true })
+
+nmap('<leader>to', '<cmd>te<CR>', { silent = true; desc = "Open a terminal buffer in the current window." })
+
+map('n', 'grr', function()
+ vim.lsp.buf.references()
+end, { desc = "Code references (LSP)" })
+
+map('n', 'gd', function()
+ vim.lsp.buf.definition()
+end, { desc = "Goto definition (LSP)" })
+
diff --git a/modules/neovim/lsp.lua b/modules/neovim/lsp.lua
new file mode 100644
index 0000000..ad6cddf
--- /dev/null
+++ b/modules/neovim/lsp.lua
@@ -0,0 +1,57 @@
+-- builtin neovim lsp configuration
+vim.opt.cot = "menu,menuone,noselect"
+--vim.opt.cot = "menu,menuone"
+
+local methods = vim.lsp.protocol.Methods
+local map = vim.keymap.set
+
+-- hook that makes every floating window opened by nvim lsp rounded
+local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
+function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
+ opts = opts or {}
+ opts.border = opts.border or "rounded"
+ return orig_util_open_floating_preview(contents, syntax, opts, ...)
+end
+
+vim.diagnostic.config({
+-- virtual_text = { prefix = "", virt_text_pos = "eol_right_align", },
+ virtual_text = false,
+ float = { border = "rounded" },
+ signs = false,
+ underline = true,
+ update_in_insert = false,
+ float = true,
+ jump = { float = true }
+})
+
+local function pumvisible()
+ return tonumber(vim.fn.pumvisible()) ~= 0
+end
+
+vim.api.nvim_create_autocmd("LspAttach", { callback = function(args)
+ local client = vim.lsp.get_client_by_id(args.data.client_id)
+
+-- fun but gets annoying
+-- if client:supports_method(methods.textDocument_inlayHint) then
+-- vim.lsp.inlay_hint.enable()
+-- end
+
+ map('n', 'E', '<cmd>lua vim.lsp.buf.hover()<CR>', { silent = true })
+
+ if client:supports_method(methods.textDocument_completion) then
+ vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = false })
+ vim.keymap.set('i', '<C-n>', function()
+ return pumvisible() and '<C-n>' or vim.lsp.completion.trigger()
+ end)
+ end
+
+-- autoformat on save
+ if client:supports_method(methods.textDocument_formatting) then
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ buffer = args.buf,
+ callback = function()
+ vim.lsp.buf.format({bufnr = args.buf, id = client_id})
+ end
+ })
+ end
+end})
diff --git a/modules/neovim/terminal.lua b/modules/neovim/terminal.lua
new file mode 100644
index 0000000..6d8e70b
--- /dev/null
+++ b/modules/neovim/terminal.lua
@@ -0,0 +1,7 @@
+--vim.api.nvim_create_autocmd("TermOpen", {
+-- callback = function()
+-- vim.o.statusline = "%{b:term_title}"
+-- end
+--})
+
+vim.cmd[[autocmd TermOpen * setlocal statusline=%{b:term_title}]]