mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-22 14:35:37 +00:00
Merge branch 'k9s-color'
This commit is contained in:
commit
4a803427fb
20
README.md
20
README.md
@ -6,12 +6,24 @@ configuration may be difficult to translate to a non-Nix system.
|
||||
|
||||
However, some of the configurations are easier to lift directly:
|
||||
|
||||
- [Neovim](https://github.com/nmasur/dotfiles/tree/master/modules/neovim/lua)
|
||||
- [Neovim](https://github.com/nmasur/dotfiles/tree/master/modules/neovim/config)
|
||||
- [Fish functions](https://github.com/nmasur/dotfiles/tree/master/modules/shell/fish/functions)
|
||||
- [More fish aliases](https://github.com/nmasur/dotfiles/blob/master/modules/shell/fish/default.nix)
|
||||
- [Git aliases](https://github.com/nmasur/dotfiles/blob/master/modules/shell/git.nix)
|
||||
- [Hammerspoon](https://github.com/nmasur/dotfiles/tree/master/modules/darwin/hammerspoon)
|
||||
|
||||
Try out my Neovim config:
|
||||
|
||||
```bash
|
||||
nix run github:nmasur/dotfiles#neovim
|
||||
```
|
||||
|
||||
Or build it as a package:
|
||||
|
||||
```bash
|
||||
nix build github:nmasur/dotfiles#neovim
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Installation
|
||||
@ -87,12 +99,6 @@ openssl s_client -showcerts -verify 5 -connect cache.nixos.org:443 < /dev/null
|
||||
sudo nvim $NIX_SSL_CERT_FILE
|
||||
```
|
||||
|
||||
### Dealing with Neovim issues:
|
||||
|
||||
Update Neovim Packer plugins: `:PackerSync`
|
||||
|
||||
Update TreeSitter languages: `:TSUpdateSync`
|
||||
|
||||
---
|
||||
|
||||
# Flake Templates
|
||||
|
@ -29,4 +29,19 @@
|
||||
# Connect machine metrics to Netdata Cloud
|
||||
netdata = import ./netdata-cloud.nix { inherit pkgs; };
|
||||
|
||||
# Run neovim as an app
|
||||
neovim = {
|
||||
type = "app";
|
||||
program = "${
|
||||
(import ../modules/neovim/package {
|
||||
inherit pkgs;
|
||||
colors = import ../modules/colorscheme/gruvbox/neovim-gruvbox.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
})
|
||||
}/bin/nvim";
|
||||
};
|
||||
|
||||
nvim = neovim;
|
||||
|
||||
}
|
||||
|
292
flake.lock
292
flake.lock
@ -1,5 +1,53 @@
|
||||
{
|
||||
"nodes": {
|
||||
"Comment-nvim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1668781964,
|
||||
"narHash": "sha256-po1MyuuOH3e8yJTAtkxnusFSJuNpQnjpe+zfWPoO62E=",
|
||||
"owner": "numToStr",
|
||||
"repo": "Comment.nvim",
|
||||
"rev": "5f01c1a89adafc52bf34e3bf690f80d9d726715d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numToStr",
|
||||
"repo": "Comment.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"bufferline-nvim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1668632062,
|
||||
"narHash": "sha256-qGl1jwBaMFWsrth7F20KrfJpyVENF8GEOJsVBBcSTVA=",
|
||||
"owner": "akinsho",
|
||||
"repo": "bufferline.nvim",
|
||||
"rev": "4ecfa81e470a589e74adcde3d5bb1727dd407363",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "akinsho",
|
||||
"repo": "bufferline.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cmp-nvim-lsp-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1668566979,
|
||||
"narHash": "sha256-Mqkp8IH/laUx0cK7S0BjusTT+OtOOJOamZM4+93RHdU=",
|
||||
"owner": "hrsh7th",
|
||||
"repo": "cmp-nvim-lsp",
|
||||
"rev": "59224771f91b86d1de12570b4070fe4ad7cd1eeb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hrsh7th",
|
||||
"repo": "cmp-nvim-lsp",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@ -56,6 +104,36 @@
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_3": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
@ -92,6 +170,47 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nil": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1669391194,
|
||||
"narHash": "sha256-4oWcXqyBYPHF+Wt8AxRhWk70O1qVJPkyBw2IhxJtj6k=",
|
||||
"owner": "oxalica",
|
||||
"repo": "nil",
|
||||
"rev": "afec5fed829ee193de7e8c62e1fb4bd55140f4ac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "nil",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix2vim": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1666021730,
|
||||
"narHash": "sha256-eXd9bqYleh+BZsUybKCj7rNhnwoV0tzsuGGXKmW/+NA=",
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "nix2vim",
|
||||
"rev": "f3b56da72278cd720fe7fb4b6d001047b7179669",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "gytis-ivaskevicius",
|
||||
"repo": "nix2vim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixlib": {
|
||||
"locked": {
|
||||
"lastModified": 1636849918,
|
||||
@ -145,6 +264,22 @@
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1669597967,
|
||||
"narHash": "sha256-R+2NaDkXsYkOpFOhmVR8jBZ77Pq55Z6ilaqwFLLn000=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "be9e3762e719211368d186f547f847737baad720",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1666959691,
|
||||
"narHash": "sha256-TRpWA3t8ata79HOGtFd5dDCl1kJQmIE16PDF53/Hcxo=",
|
||||
@ -160,7 +295,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1660318005,
|
||||
"narHash": "sha256-g9WCa9lVUmOV6dYRbEPjv/TLOR5hamjeCcKExVGS3OQ=",
|
||||
@ -175,6 +310,22 @@
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"null-ls-nvim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669235424,
|
||||
"narHash": "sha256-po66LOeGuBHi3MZsn5+/gYdgU+oFTZUPfPWx2norc3I=",
|
||||
"owner": "jose-elias-alvarez",
|
||||
"repo": "null-ls.nvim",
|
||||
"rev": "c51978f546a86a653f4a492b86313f4616412cec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "jose-elias-alvarez",
|
||||
"repo": "null-ls.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1667025500,
|
||||
@ -190,18 +341,151 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-lspconfig-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669447443,
|
||||
"narHash": "sha256-ikrkXhzkn4nYqJd9WaG61UGYWRdY2cbzKQIR+kDcYqE=",
|
||||
"owner": "neovim",
|
||||
"repo": "nvim-lspconfig",
|
||||
"rev": "abe6c99c7489de2c317869cf5dea57a9595a0cca",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "neovim",
|
||||
"repo": "nvim-lspconfig",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-tree-lua-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669432749,
|
||||
"narHash": "sha256-YQix8eYrruuyH5pzjFvxb6hbMLhu1X/hnymO9dmbCqs=",
|
||||
"owner": "kyazdani42",
|
||||
"repo": "nvim-tree.lua",
|
||||
"rev": "b17358ff4d822deeb42b97919065800f8f91cb55",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "kyazdani42",
|
||||
"repo": "nvim-tree.lua",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-treesitter-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669484329,
|
||||
"narHash": "sha256-aAzVCRoqa2TDMsDKuxFRJHleR4ubA0bLaCVYk96/su8=",
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter",
|
||||
"rev": "5aacb06135a952190933f9bfff923957db8965db",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"Comment-nvim-src": "Comment-nvim-src",
|
||||
"bufferline-nvim-src": "bufferline-nvim-src",
|
||||
"cmp-nvim-lsp-src": "cmp-nvim-lsp-src",
|
||||
"darwin": "darwin",
|
||||
"firefox-darwin": "firefox-darwin",
|
||||
"home-manager": "home-manager",
|
||||
"nil": "nil",
|
||||
"nix2vim": "nix2vim",
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"null-ls-nvim-src": "null-ls-nvim-src",
|
||||
"nur": "nur",
|
||||
"nvim-lspconfig-src": "nvim-lspconfig-src",
|
||||
"nvim-tree-lua-src": "nvim-tree-lua-src",
|
||||
"nvim-treesitter-src": "nvim-treesitter-src",
|
||||
"telescope-nvim-src": "telescope-nvim-src",
|
||||
"telescope-project-nvim-src": "telescope-project-nvim-src",
|
||||
"toggleterm-nvim-src": "toggleterm-nvim-src",
|
||||
"wallpapers": "wallpapers",
|
||||
"wsl": "wsl"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"nil",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nil",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1669170936,
|
||||
"narHash": "sha256-TKPH4Pzkjw5gAPo9hejs3O4mWJW6V/RSiOj8UuSFRTs=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "c90c223c4aef334356029b89c72bb65e26f7efe6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"telescope-nvim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669224375,
|
||||
"narHash": "sha256-NqMtFHgYO031WLDHb7AuVRUFMA72LHYVjbD0bt26O6I=",
|
||||
"owner": "nvim-telescope",
|
||||
"repo": "telescope.nvim",
|
||||
"rev": "cea9c75c19d172d2c6f089f21656019734a615cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-telescope",
|
||||
"repo": "telescope.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"telescope-project-nvim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1665406281,
|
||||
"narHash": "sha256-ZBFgUlW+h7vndazZ0lZux8i7yQHKJNDPQPZ2z96Rfpk=",
|
||||
"owner": "nvim-telescope",
|
||||
"repo": "telescope-project.nvim",
|
||||
"rev": "ff4d3cea905383a67d1a47b9dd210c4907d858c2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-telescope",
|
||||
"repo": "telescope-project.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"toggleterm-nvim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1667475764,
|
||||
"narHash": "sha256-gazqaTsK5hAFqk6OONqTsR/zmjN3P8fPKsYufBhkeRA=",
|
||||
"owner": "akinsho",
|
||||
"repo": "toggleterm.nvim",
|
||||
"rev": "3ba683827c623affb4d9aa518e97b34db2623093",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "akinsho",
|
||||
"repo": "toggleterm.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
@ -236,8 +520,8 @@
|
||||
"wsl": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1666720338,
|
||||
|
88
flake.nix
88
flake.nix
@ -41,6 +41,57 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Convert Nix to Neovim config
|
||||
nix2vim = {
|
||||
url = "github:gytis-ivaskevicius/nix2vim";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Nix language server
|
||||
nil.url = "github:oxalica/nil";
|
||||
|
||||
# Neovim plugins
|
||||
nvim-lspconfig-src = {
|
||||
url = "github:neovim/nvim-lspconfig";
|
||||
flake = false;
|
||||
};
|
||||
cmp-nvim-lsp-src = {
|
||||
url = "github:hrsh7th/cmp-nvim-lsp";
|
||||
flake = false;
|
||||
};
|
||||
null-ls-nvim-src = {
|
||||
url = "github:jose-elias-alvarez/null-ls.nvim";
|
||||
flake = false;
|
||||
};
|
||||
Comment-nvim-src = {
|
||||
url = "github:numToStr/Comment.nvim";
|
||||
flake = false;
|
||||
};
|
||||
nvim-treesitter-src = {
|
||||
url = "github:nvim-treesitter/nvim-treesitter";
|
||||
flake = false;
|
||||
};
|
||||
telescope-nvim-src = {
|
||||
url = "github:nvim-telescope/telescope.nvim";
|
||||
flake = false;
|
||||
};
|
||||
telescope-project-nvim-src = {
|
||||
url = "github:nvim-telescope/telescope-project.nvim";
|
||||
flake = false;
|
||||
};
|
||||
toggleterm-nvim-src = {
|
||||
url = "github:akinsho/toggleterm.nvim";
|
||||
flake = false;
|
||||
};
|
||||
bufferline-nvim-src = {
|
||||
url = "github:akinsho/bufferline.nvim";
|
||||
flake = false;
|
||||
};
|
||||
nvim-tree-lua-src = {
|
||||
url = "github:kyazdani42/nvim-tree.lua";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs:
|
||||
@ -57,6 +108,13 @@
|
||||
dotfilesRepo = "git@github.com:nmasur/dotfiles";
|
||||
};
|
||||
|
||||
# Common overlays to always use
|
||||
overlays = [
|
||||
inputs.nur.overlay
|
||||
inputs.nix2vim.overlay
|
||||
(import ./modules/neovim/plugins-overlay.nix inputs)
|
||||
];
|
||||
|
||||
# System types to support.
|
||||
supportedSystems =
|
||||
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||
@ -67,13 +125,13 @@
|
||||
in rec {
|
||||
|
||||
nixosConfigurations = {
|
||||
desktop = import ./hosts/desktop { inherit inputs globals; };
|
||||
wsl = import ./hosts/wsl { inherit inputs globals; };
|
||||
oracle = import ./hosts/oracle { inherit inputs globals; };
|
||||
desktop = import ./hosts/desktop { inherit inputs globals overlays; };
|
||||
wsl = import ./hosts/wsl { inherit inputs globals overlays; };
|
||||
oracle = import ./hosts/oracle { inherit inputs globals overlays; };
|
||||
};
|
||||
|
||||
darwinConfigurations = {
|
||||
macbook = import ./hosts/macbook { inherit inputs globals; };
|
||||
macbook = import ./hosts/macbook { inherit inputs globals overlays; };
|
||||
};
|
||||
|
||||
# For quickly applying local settings with:
|
||||
@ -86,17 +144,29 @@
|
||||
};
|
||||
|
||||
# Package servers into images with a generator
|
||||
packages.aws = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ]
|
||||
(system: {
|
||||
"${system}" = import ./hosts/aws { inherit inputs globals system; };
|
||||
packages = forAllSystems (system: {
|
||||
|
||||
aws = {
|
||||
"${system}" =
|
||||
import ./hosts/aws { inherit inputs globals system overlays; };
|
||||
};
|
||||
|
||||
neovim = let pkgs = import nixpkgs { inherit system overlays; };
|
||||
in import ./modules/neovim/package {
|
||||
inherit pkgs;
|
||||
colors = import ./modules/colorscheme/gruvbox/neovim-gruvbox.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
apps = forAllSystems (system:
|
||||
let pkgs = import nixpkgs { inherit system; };
|
||||
let pkgs = import nixpkgs { inherit system overlays; };
|
||||
in import ./apps { inherit pkgs; });
|
||||
|
||||
devShells = forAllSystems (system:
|
||||
let pkgs = import nixpkgs { inherit system; };
|
||||
let pkgs = import nixpkgs { inherit system overlays; };
|
||||
in {
|
||||
|
||||
# Used to run commands and edit files in this repo
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ inputs, globals, ... }:
|
||||
{ inputs, globals, overlays, ... }:
|
||||
|
||||
with inputs;
|
||||
|
||||
@ -22,7 +22,7 @@ darwin.lib.darwinSystem {
|
||||
};
|
||||
mailUser = globals.user;
|
||||
networking.hostName = "noah-masur-mac";
|
||||
nixpkgs.overlays = [ nur.overlay firefox-darwin.overlay ];
|
||||
nixpkgs.overlays = [ firefox-darwin.overlay ] ++ overlays;
|
||||
# Set registry to flake packages, used for nix X commands
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
base0D = "#83a598"; # blue
|
||||
base0E = "#d3869b"; # purple
|
||||
base0F = "#d65d0e"; # brown
|
||||
neovimConfig = ./neovim.lua;
|
||||
neovimConfig = ./neovim-gruvbox.nix;
|
||||
batTheme = "gruvbox-dark";
|
||||
};
|
||||
light = {
|
||||
@ -39,7 +39,7 @@
|
||||
base0D = "#076678"; # blue
|
||||
base0E = "#8f3f71"; # purple
|
||||
base0F = "#d65d0e"; # brown
|
||||
neovimConfig = ./neovim.lua;
|
||||
neovimConfig = ./neovim-gruvbox.nix;
|
||||
batTheme = "gruvbox-light";
|
||||
};
|
||||
}
|
||||
|
12
modules/colorscheme/gruvbox/neovim-gruvbox.nix
Normal file
12
modules/colorscheme/gruvbox/neovim-gruvbox.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{ pkgs, ... }: {
|
||||
|
||||
plugins = [ pkgs.vimPlugins.vim-gruvbox8 ];
|
||||
|
||||
vim.g.gruvbox_italicize_strings = 0;
|
||||
vim.o.background = "dark";
|
||||
vimscript = ''
|
||||
let g:gruvbox_italicize_strings = 0
|
||||
colorscheme gruvbox8
|
||||
'';
|
||||
|
||||
}
|
22
modules/neovim/config/bufferline.nix
Normal file
22
modules/neovim/config/bufferline.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ pkgs, ... }: {
|
||||
plugins = [
|
||||
pkgs.vimPlugins.bufferline-nvim
|
||||
pkgs.vimPlugins.vim-bbye # Better closing of buffers
|
||||
];
|
||||
setup.bufferline = {
|
||||
options = {
|
||||
diagnostics = "nvim_lsp";
|
||||
always_show_bufferline = false;
|
||||
separator_style = "slant";
|
||||
offsets = [{ filetype = "NvimTree"; }];
|
||||
};
|
||||
};
|
||||
lua = ''
|
||||
-- Move buffers
|
||||
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>", { silent = true })
|
||||
vim.keymap.set("n", "H", ":BufferLineCyclePrev<CR>", { silent = true })
|
||||
|
||||
-- Kill buffer
|
||||
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>", { silent = true })
|
||||
'';
|
||||
}
|
155
modules/neovim/config/completion.nix
Normal file
155
modules/neovim/config/completion.nix
Normal file
@ -0,0 +1,155 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [
|
||||
pkgs.vimPlugins.cmp-nvim-lsp
|
||||
pkgs.vimPlugins.cmp-buffer
|
||||
pkgs.vimPlugins.cmp-path
|
||||
pkgs.vimPlugins.cmp-cmdline
|
||||
pkgs.vimPlugins.cmp-nvim-lua
|
||||
pkgs.vimPlugins.luasnip
|
||||
pkgs.vimPlugins.cmp_luasnip
|
||||
pkgs.vimPlugins.cmp-rg
|
||||
pkgs.vimPlugins.friendly-snippets
|
||||
];
|
||||
|
||||
use.cmp.setup = dsl.callWith {
|
||||
|
||||
# Disable in telescope buffers
|
||||
enabled = dsl.rawLua ''
|
||||
function()
|
||||
if vim.bo.buftype == "prompt" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
'';
|
||||
|
||||
snippet.expand = dsl.rawLua ''
|
||||
function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
|
||||
mapping = {
|
||||
"['<C-n>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||
"['<C-p>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||
"['<Down>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Select })";
|
||||
"['<Up>']" = dsl.rawLua
|
||||
"require('cmp').mapping.select_prev_item({ behavior = require('cmp').SelectBehavior.Select })";
|
||||
"['<C-d>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(-4)";
|
||||
"['<C-f>']" = dsl.rawLua "require('cmp').mapping.scroll_docs(4)";
|
||||
"['<C-e>']" = dsl.rawLua "require('cmp').mapping.abort()";
|
||||
"['<CR>']" = dsl.rawLua
|
||||
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
||||
"['<C-r>']" = dsl.rawLua
|
||||
"require('cmp').mapping.confirm({ behavior = require('cmp').ConfirmBehavior.Replace, select = true, })";
|
||||
"['<Esc>']" = dsl.rawLua ''
|
||||
function(_)
|
||||
cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
})
|
||||
vim.cmd("stopinsert") --- Abort and leave insert mode
|
||||
end
|
||||
'';
|
||||
"['<C-l>']" = dsl.rawLua ''
|
||||
cmp.mapping(function(_)
|
||||
if require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" })
|
||||
'';
|
||||
};
|
||||
|
||||
sources = [
|
||||
{ name = "nvim_lua"; }
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "luasnip"; }
|
||||
{ name = "path"; }
|
||||
{
|
||||
name = "buffer";
|
||||
keyword_length = 3;
|
||||
max_item_count = 10;
|
||||
}
|
||||
{
|
||||
name = "rg";
|
||||
keyword_length = 6;
|
||||
max_item_count = 10;
|
||||
option = { additional_arguments = "--ignore-case"; };
|
||||
}
|
||||
];
|
||||
|
||||
formatting = {
|
||||
fields = [ "kind" "abbr" "menu" ];
|
||||
format = dsl.rawLua ''
|
||||
function(entry, vim_item)
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "m",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||
vim_item.menu = ({
|
||||
luasnip = "[Snippet]",
|
||||
buffer = "[Buffer]",
|
||||
path = "[Path]",
|
||||
rg = "[Grep]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
experimental = {
|
||||
native_menu = false; # Use cmp menu instead of Vim menu
|
||||
ghost_text = true; # Show preview auto-completion
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
lua = ''
|
||||
-- Use buffer source for `/`
|
||||
require('cmp').setup.cmdline("/", {
|
||||
sources = {
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
require('cmp').setup.cmdline(":", {
|
||||
sources = require('cmp').config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
'';
|
||||
|
||||
}
|
35
modules/neovim/config/gitsigns.lua
Normal file
35
modules/neovim/config/gitsigns.lua
Normal file
@ -0,0 +1,35 @@
|
||||
vim.keymap.set("", "<Space>", "<Nop>", { silent = true })
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
local gitsigns = require("gitsigns")
|
||||
vim.keymap.set("n", "<Leader>gB", gitsigns.blame_line)
|
||||
vim.keymap.set("n", "<Leader>gp", gitsigns.preview_hunk)
|
||||
vim.keymap.set("v", "<Leader>gp", gitsigns.preview_hunk)
|
||||
vim.keymap.set("n", "<Leader>gd", gitsigns.diffthis)
|
||||
vim.keymap.set("v", "<Leader>gd", gitsigns.diffthis)
|
||||
vim.keymap.set("n", "<Leader>rgf", gitsigns.reset_buffer)
|
||||
vim.keymap.set("v", "<Leader>hs", gitsigns.stage_hunk)
|
||||
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
|
||||
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
|
||||
|
||||
-- Navigation
|
||||
vim.keymap.set("n", "]g", function()
|
||||
if vim.wo.diff then
|
||||
return "]g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
||||
|
||||
vim.keymap.set("n", "[g", function()
|
||||
if vim.wo.diff then
|
||||
return "[g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
5
modules/neovim/config/gitsigns.nix
Normal file
5
modules/neovim/config/gitsigns.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ pkgs, ... }: {
|
||||
plugins = [ pkgs.vimPlugins.gitsigns-nvim ];
|
||||
setup.gitsigns = { };
|
||||
lua = builtins.readFile ./gitsigns.lua;
|
||||
}
|
10
modules/neovim/config/lsp.lua
Normal file
10
modules/neovim/config/lsp.lua
Normal file
@ -0,0 +1,10 @@
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
|
||||
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
|
||||
-- vim.keymap.set("n", "gr", telescope.lsp_references)
|
||||
vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
|
63
modules/neovim/config/lsp.nix
Normal file
63
modules/neovim/config/lsp.nix
Normal file
@ -0,0 +1,63 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [
|
||||
pkgs.vimPlugins.nvim-lspconfig
|
||||
pkgs.vimPlugins.lsp-colors-nvim
|
||||
pkgs.vimPlugins.null-ls-nvim
|
||||
];
|
||||
|
||||
use.lspconfig.sumneko_lua.setup = dsl.callWith {
|
||||
settings = { Lua = { diagnostics = { globals = [ "vim" "hs" ]; }; }; };
|
||||
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
|
||||
cmd = [ "${pkgs.sumneko-lua-language-server}/bin/lua-language-server" ];
|
||||
};
|
||||
|
||||
use.lspconfig.nil_ls.setup = dsl.callWith {
|
||||
cmd = [ "${pkgs.nil}/bin/nil" ];
|
||||
capabilities = dsl.rawLua "require('cmp_nvim_lsp').default_capabilities()";
|
||||
};
|
||||
|
||||
use.lspconfig.pyright.setup = dsl.callWith {
|
||||
cmd = [ "${pkgs.pyright}/bin/pyright-langserver" "--stdio" ];
|
||||
};
|
||||
|
||||
use.lspconfig.terraformls.setup =
|
||||
dsl.callWith { cmd = [ "${pkgs.terraform-ls}/bin/terraform-lsp" ]; };
|
||||
|
||||
vim.api.nvim_create_augroup = dsl.callWith [ "LspFormatting" { } ];
|
||||
|
||||
lua = ''
|
||||
${builtins.readFile ./lsp.lua}
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
||||
require("null-ls").builtins.formatting.black.with({ command = "${pkgs.black}/bin/black" }),
|
||||
require("null-ls").builtins.diagnostics.flake8.with({ command = "${pkgs.python310Packages.flake8}/bin/flake8" }),
|
||||
require("null-ls").builtins.formatting.fish_indent.with({ command = "${pkgs.fish}/bin/fish_indent" }),
|
||||
require("null-ls").builtins.formatting.nixfmt.with({ command = "${pkgs.nixfmt}/bin/nixfmt" }),
|
||||
require("null-ls").builtins.formatting.rustfmt.with({ command = "${pkgs.rustfmt}/bin/rustfmt" }),
|
||||
require("null-ls").builtins.diagnostics.shellcheck.with({ command = "${pkgs.shellcheck}/bin/shellcheck" }),
|
||||
require("null-ls").builtins.formatting.shfmt.with({
|
||||
command = "${pkgs.shfmt}/bin/shfmt",
|
||||
extra_args = { "-i", "4", "-ci" },
|
||||
}),
|
||||
require("null-ls").builtins.formatting.terraform_fmt.with({ command = "${pkgs.terraform}/bin/terraform" }),
|
||||
},
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
'';
|
||||
|
||||
}
|
70
modules/neovim/config/misc.nix
Normal file
70
modules/neovim/config/misc.nix
Normal file
@ -0,0 +1,70 @@
|
||||
{ pkgs, dsl, lib, ... }: {
|
||||
plugins = [
|
||||
pkgs.vimPlugins.vim-surround # Keybinds for surround characters
|
||||
pkgs.vimPlugins.vim-eunuch # File manipulation commands
|
||||
pkgs.vimPlugins.vim-fugitive # Git commands
|
||||
pkgs.vimPlugins.vim-repeat # Better repeat using .
|
||||
pkgs.vimPlugins.comment-nvim # Smart comment commands
|
||||
pkgs.vimPlugins.impatient-nvim # Faster load times
|
||||
pkgs.vimPlugins.glow-nvim # Markdown preview popup
|
||||
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
|
||||
];
|
||||
|
||||
setup.Comment = { };
|
||||
setup.colorizer = { };
|
||||
|
||||
vim.o = {
|
||||
termguicolors = true; # Set to truecolor
|
||||
hidden = true; # Don't unload buffers when leaving them
|
||||
list = true; # Reveal whitespace with dashes
|
||||
expandtab = true; # Tabs into spaces
|
||||
shiftwidth = 4; # Amount to shift with > key
|
||||
softtabstop = 4; # Amount to shift with <TAB> key
|
||||
ignorecase = true; # Ignore case when searching
|
||||
smartcase = true; # Check case when using capitals in search
|
||||
infercase = true; # Don't match cases when completing suggestions
|
||||
incsearch = true; # Search while typing
|
||||
visualbell = true; # No sounds
|
||||
scrolljump = 1; # Number of lines to scroll
|
||||
scrolloff = 3; # Margin of lines to see while scrolling
|
||||
splitright = true; # Vertical splits on the right side
|
||||
splitbelow = true; # Horizontal splits on the bottom side
|
||||
pastetoggle = "<F3>"; # Use F3 to enter raw paste mode
|
||||
clipboard = "unnamedplus"; # Uses system clipboard for yanking
|
||||
updatetime = 300; # Faster diagnostics
|
||||
mouse = "nv"; # Mouse interaction / scrolling
|
||||
inccommand = "split"; # Live preview search and replace
|
||||
};
|
||||
|
||||
vim.wo = {
|
||||
number = true; # Show line numbers
|
||||
relativenumber = true; # Relative numbers instead of absolute
|
||||
};
|
||||
|
||||
# Better backup, swap and undo storage
|
||||
vim.o.backup = true; # Easier to recover and more secure
|
||||
vim.bo.swapfile = false; # Instead of swaps, create backups
|
||||
vim.bo.undofile = true; # Keeps undos after quit
|
||||
vim.o.backupdir = dsl.rawLua ''vim.fn.stdpath("cache") .. "/backup"'';
|
||||
|
||||
# Required for nvim-cmp completion
|
||||
vim.opt.completeopt = [ "menu" "menuone" "noselect" ];
|
||||
|
||||
lua = lib.mkBefore ''
|
||||
require("impatient")
|
||||
${builtins.readFile ../lua/keybinds.lua};
|
||||
${builtins.readFile ../lua/settings.lua};
|
||||
'';
|
||||
|
||||
vimscript = ''
|
||||
" Remember last position when reopening file
|
||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||
|
||||
" LaTeX options
|
||||
au FileType tex inoremap ;bf \textbf{}<Esc>i
|
||||
au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!
|
||||
|
||||
" Flash highlight when yanking
|
||||
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
|
||||
'';
|
||||
}
|
9
modules/neovim/config/statusline.nix
Normal file
9
modules/neovim/config/statusline.nix
Normal file
@ -0,0 +1,9 @@
|
||||
{ pkgs, ... }: {
|
||||
plugins = [ pkgs.vimPlugins.lualine-nvim ];
|
||||
setup.lualine = {
|
||||
options = {
|
||||
theme = "gruvbox";
|
||||
icons_enabled = true;
|
||||
};
|
||||
};
|
||||
}
|
52
modules/neovim/config/syntax.nix
Normal file
52
modules/neovim/config/syntax.nix
Normal file
@ -0,0 +1,52 @@
|
||||
{ pkgs, ... }: {
|
||||
|
||||
plugins = [
|
||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins:
|
||||
with pkgs.tree-sitter-grammars; [
|
||||
tree-sitter-hcl
|
||||
tree-sitter-python
|
||||
tree-sitter-lua
|
||||
tree-sitter-nix
|
||||
tree-sitter-fish
|
||||
tree-sitter-toml
|
||||
tree-sitter-yaml
|
||||
tree-sitter-json
|
||||
]))
|
||||
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
|
||||
pkgs.vimPlugins.nginx-vim
|
||||
pkgs.vimPlugins.vim-helm
|
||||
pkgs.vimPlugins.vim-puppet
|
||||
];
|
||||
|
||||
setup."nvim-treesitter.configs" = {
|
||||
highlight = { enable = true; };
|
||||
indent = { enable = true; };
|
||||
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true;
|
||||
lookahead = true; # Jump forward automatically
|
||||
|
||||
keymaps = {
|
||||
"['af']" = "@function.outer";
|
||||
"['if']" = "@function.inner";
|
||||
"['ac']" = "@class.outer";
|
||||
"['ic']" = "@class.inner";
|
||||
"['al']" = "@loop.outer";
|
||||
"['il']" = "@loop.inner";
|
||||
"['aa']" = "@call.outer";
|
||||
"['ia']" = "@call.inner";
|
||||
"['ar']" = "@parameter.outer";
|
||||
"['ir']" = "@parameter.inner";
|
||||
"['aC']" = "@comment.outer";
|
||||
"['iC']" = "@comment.outer";
|
||||
"['a/']" = "@comment.outer";
|
||||
"['i/']" = "@comment.outer";
|
||||
"['a;']" = "@statement.outer";
|
||||
"['i;']" = "@statement.outer";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
69
modules/neovim/config/telescope.lua
Normal file
69
modules/neovim/config/telescope.lua
Normal file
@ -0,0 +1,69 @@
|
||||
local telescope = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
|
||||
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
|
||||
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
|
||||
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
|
||||
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
|
||||
vim.keymap.set("n", "<Leader>b", telescope.buffers)
|
||||
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
|
||||
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
|
||||
vim.keymap.set("n", "<Leader>cc", telescope.commands)
|
||||
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
|
||||
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
|
||||
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
|
||||
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
|
||||
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
|
||||
|
||||
vim.keymap.set("n", "<Leader>N", function()
|
||||
local opts = {
|
||||
prompt_title = "Search Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.live_grep(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fN", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Notes",
|
||||
cwd = "$NOTES_PATH",
|
||||
}
|
||||
telescope.find_files(opts)
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<Leader>cr", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 15,
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.command_history(opts)
|
||||
end)
|
||||
|
||||
-- Zoxide
|
||||
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
|
||||
|
||||
-- Project
|
||||
require("telescope").load_extension("project")
|
||||
vim.keymap.set("n", "<C-p>", function()
|
||||
local opts = require("telescope.themes").get_ivy({
|
||||
layout_config = {
|
||||
bottom_pane = {
|
||||
height = 10,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").extensions.project.project(opts)
|
||||
end)
|
||||
|
||||
-- File browser
|
||||
require("telescope").load_extension("file_browser")
|
||||
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
|
||||
vim.keymap.set("n", "<Leader>fD", function()
|
||||
local opts = {
|
||||
prompt_title = "Find Downloads",
|
||||
cwd = "~/downloads",
|
||||
}
|
||||
require("telescope").extensions.file_browser.file_browser(opts)
|
||||
end)
|
34
modules/neovim/config/telescope.nix
Normal file
34
modules/neovim/config/telescope.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [
|
||||
pkgs.vimPlugins.telescope-nvim
|
||||
pkgs.vimPlugins.telescope-project-nvim
|
||||
pkgs.vimPlugins.telescope-fzy-native-nvim
|
||||
pkgs.vimPlugins.telescope-file-browser-nvim
|
||||
pkgs.vimPlugins.telescope-zoxide
|
||||
];
|
||||
|
||||
setup.telescope = {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
"['<esc>']" = dsl.rawLua "require('telescope.actions').close";
|
||||
"['<C-h>']" = "which_key";
|
||||
};
|
||||
};
|
||||
};
|
||||
pickers = {
|
||||
find_files = { theme = "ivy"; };
|
||||
oldfiles = { theme = "ivy"; };
|
||||
buffers = { theme = "dropdown"; };
|
||||
};
|
||||
extensions = {
|
||||
fzy_native = { };
|
||||
zoxide = { };
|
||||
project = { base_dirs = [ "~/dev" ]; };
|
||||
};
|
||||
};
|
||||
|
||||
lua = builtins.readFile ./telescope.lua;
|
||||
|
||||
}
|
40
modules/neovim/config/toggleterm.lua
Normal file
40
modules/neovim/config/toggleterm.lua
Normal file
@ -0,0 +1,40 @@
|
||||
vim.keymap.set("t", "<A-CR>", "<C-\\><C-n>") --- Exit terminal mode
|
||||
|
||||
-- Only set these keymaps for toggleterm
|
||||
vim.api.nvim_create_autocmd("TermOpen", {
|
||||
pattern = "term://*toggleterm#*",
|
||||
callback = function()
|
||||
-- vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") --- Exit terminal mode
|
||||
vim.keymap.set("t", "<C-h>", "<C-\\><C-n><C-w>h")
|
||||
vim.keymap.set("t", "<C-j>", "<C-\\><C-n><C-w>j")
|
||||
vim.keymap.set("t", "<C-k>", "<C-\\><C-n><C-w>k")
|
||||
vim.keymap.set("t", "<C-l>", "<C-\\><C-n><C-w>l")
|
||||
end,
|
||||
})
|
||||
|
||||
local terminal = require("toggleterm.terminal").Terminal
|
||||
|
||||
local basicterminal = terminal:new()
|
||||
function TERM_TOGGLE()
|
||||
basicterminal:toggle()
|
||||
end
|
||||
|
||||
local nixpkgs = terminal:new({ cmd = "nix repl '<nixpkgs>'" })
|
||||
function NIXPKGS_TOGGLE()
|
||||
nixpkgs:toggle()
|
||||
end
|
||||
|
||||
local gitwatch = terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" })
|
||||
function GITWATCH_TOGGLE()
|
||||
gitwatch:toggle()
|
||||
end
|
||||
|
||||
local k9s = terminal:new({ cmd = "k9s" })
|
||||
function K9S_TOGGLE()
|
||||
k9s:toggle()
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Leader>t", TERM_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>P", NIXPKGS_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
|
13
modules/neovim/config/toggleterm.nix
Normal file
13
modules/neovim/config/toggleterm.nix
Normal file
@ -0,0 +1,13 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [ pkgs.vimPlugins.toggleterm-nvim ];
|
||||
|
||||
use.toggleterm.setup = dsl.callWith {
|
||||
open_mapping = dsl.rawLua "[[<c-\\>]]";
|
||||
hide_numbers = true;
|
||||
direction = "float";
|
||||
};
|
||||
|
||||
lua = builtins.readFile ./toggleterm.lua;
|
||||
|
||||
}
|
77
modules/neovim/config/tree.nix
Normal file
77
modules/neovim/config/tree.nix
Normal file
@ -0,0 +1,77 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
|
||||
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
|
||||
|
||||
# Disable netrw eagerly
|
||||
# https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
|
||||
vim.g = {
|
||||
loaded = 1;
|
||||
loaded_netrwPlugin = 1;
|
||||
};
|
||||
|
||||
setup.nvim-tree = {
|
||||
disable_netrw = true;
|
||||
hijack_netrw = true;
|
||||
update_focused_file = {
|
||||
enable = true;
|
||||
update_cwd = true;
|
||||
ignore_list = { };
|
||||
};
|
||||
diagnostics = {
|
||||
enable = true;
|
||||
icons = {
|
||||
hint = "";
|
||||
info = "";
|
||||
warning = "";
|
||||
error = "";
|
||||
};
|
||||
};
|
||||
renderer = {
|
||||
icons = {
|
||||
glyphs = {
|
||||
git = {
|
||||
unstaged = "~";
|
||||
staged = "+";
|
||||
unmerged = "";
|
||||
renamed = "➜";
|
||||
deleted = "";
|
||||
untracked = "?";
|
||||
ignored = "◌";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
view = {
|
||||
width = 30;
|
||||
hide_root_folder = false;
|
||||
side = "left";
|
||||
mappings = {
|
||||
custom_only = false;
|
||||
list = [
|
||||
{
|
||||
key = [ "l" "<CR>" "o" ];
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('edit')";
|
||||
}
|
||||
{
|
||||
key = "h";
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('close_node')";
|
||||
}
|
||||
{
|
||||
key = "v";
|
||||
cb = dsl.rawLua
|
||||
"require('nvim-tree.config').nvim_tree_callback('vsplit')";
|
||||
}
|
||||
];
|
||||
};
|
||||
number = false;
|
||||
relativenumber = false;
|
||||
};
|
||||
};
|
||||
|
||||
lua = ''
|
||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
||||
'';
|
||||
|
||||
}
|
@ -1,30 +1,20 @@
|
||||
{ config, pkgs, lib, ... }: {
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
home-manager.users.${config.user} = {
|
||||
let
|
||||
|
||||
home.packages = with pkgs; [
|
||||
neovim
|
||||
gcc # for tree-sitter
|
||||
tree-sitter # for tree-sitter-gitignore parser
|
||||
nodejs # for tree-sitter-gitignore parser
|
||||
shfmt # used everywhere
|
||||
shellcheck # used everywhere
|
||||
];
|
||||
|
||||
xdg.configFile = {
|
||||
"nvim/init.lua".source = ./init.lua;
|
||||
"nvim/lua" = {
|
||||
source = ./lua;
|
||||
recursive = true; # Allows adding more files
|
||||
};
|
||||
"nvim/lua/packer/colors.lua".source = config.theme.colors.neovimConfig;
|
||||
"nvim/lua/background.lua".text = ''
|
||||
vim.o.background = "${
|
||||
if config.theme.dark == true then "dark" else "light"
|
||||
}"
|
||||
'';
|
||||
neovim = import ./package {
|
||||
inherit pkgs;
|
||||
colors = import config.theme.colors.neovimConfig { inherit pkgs; };
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
home-manager.users.${config.user} =
|
||||
|
||||
{
|
||||
|
||||
home.packages = [ neovim ];
|
||||
|
||||
programs.git.extraConfig.core.editor = "nvim";
|
||||
home.sessionVariables = {
|
||||
EDITOR = "nvim";
|
||||
@ -34,21 +24,16 @@
|
||||
shellAliases = { vim = "nvim"; };
|
||||
shellAbbrs = {
|
||||
v = lib.mkForce "nvim";
|
||||
vl = lib.mkForce "vim -c 'normal! `0' -c 'bdelete 1'";
|
||||
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
|
||||
vll = "nvim -c 'Telescope oldfiles'";
|
||||
};
|
||||
};
|
||||
|
||||
# Always run packer.nvim sync
|
||||
home.activation.nvimPackerSync =
|
||||
config.home-manager.users.${config.user}.lib.dag.entryAfter
|
||||
[ "writeBoundary" ] ''
|
||||
$DRY_RUN_CMD ${pkgs.neovim}/bin/nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
|
||||
'';
|
||||
programs.kitty.settings.scrollback_pager = lib.mkForce ''
|
||||
${neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
|
||||
|
||||
};
|
||||
|
||||
# Used for icons in Vim
|
||||
fonts.fonts = with pkgs; [ nerdfonts ];
|
||||
# # Used for icons in Vim
|
||||
# fonts.fonts = with pkgs; [ nerdfonts ];
|
||||
|
||||
}
|
||||
|
@ -2,94 +2,15 @@
|
||||
-- Settings
|
||||
-- ===========================================================================
|
||||
|
||||
vim.o.termguicolors = true --- Set to truecolor
|
||||
vim.o.hidden = true --- Don't unload buffers when leaving them
|
||||
vim.wo.number = true --- Show line numbers
|
||||
vim.wo.relativenumber = true --- Relative numbers instead of absolute
|
||||
vim.o.list = true --- Reveal whitespace with dashes
|
||||
vim.o.expandtab = true --- Tabs into spaces
|
||||
vim.o.shiftwidth = 4 --- Amount to shift with > key
|
||||
vim.o.softtabstop = 4 --- Amount to shift with <TAB> key
|
||||
vim.o.ignorecase = true --- Ignore case when searching
|
||||
vim.o.smartcase = true --- Check case when using capitals in search
|
||||
vim.o.infercase = true --- Don't match cases when completing suggestions
|
||||
vim.o.incsearch = true --- Search while typing
|
||||
vim.o.visualbell = true --- No sounds
|
||||
vim.o.scrolljump = 1 --- Number of lines to scroll
|
||||
vim.o.scrolloff = 3 --- Margin of lines to see while scrolling
|
||||
vim.o.splitright = true --- Vertical splits on the right side
|
||||
vim.o.splitbelow = true --- Horizontal splits on the bottom side
|
||||
vim.o.pastetoggle = "<F3>" --- Use F3 to enter raw paste mode
|
||||
vim.o.clipboard = "unnamedplus" --- Uses system clipboard for yanking
|
||||
vim.o.updatetime = 300 --- Faster diagnostics
|
||||
vim.o.mouse = "nv" --- Mouse interaction / scrolling
|
||||
|
||||
-- Neovim features
|
||||
vim.o.inccommand = "split" --- Live preview search and replace
|
||||
--- Required for nvim-cmp completion
|
||||
vim.opt.completeopt = {
|
||||
"menu",
|
||||
"menuone",
|
||||
"noselect",
|
||||
}
|
||||
|
||||
-- Remember last position when reopening file
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
-- Better backup, swap and undo storage
|
||||
vim.o.backup = true --- Easier to recover and more secure
|
||||
vim.bo.swapfile = false --- Instead of swaps, create backups
|
||||
vim.bo.undofile = true --- Keeps undos after quit
|
||||
|
||||
-- Create backup directories if they don't exist
|
||||
-- Should be fixed in 0.6 by https://github.com/neovim/neovim/pull/15433
|
||||
vim.o.backupdir = vim.fn.stdpath("cache") .. "/backup"
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
if !isdirectory(&backupdir)
|
||||
call mkdir(&backupdir, "p")
|
||||
endif
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
-- LaTeX options
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
au FileType tex inoremap ;bf \textbf{}<Esc>i
|
||||
au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
-- Highlight when yanking
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
vim.filetype.add({
|
||||
pattern = {
|
||||
[".*%.tfvars"] = "terraform",
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "*.eml",
|
||||
callback = function()
|
||||
vim.o.wrapmargin = 79 -- Wrap text automatically
|
||||
end,
|
||||
})
|
||||
|
||||
-- Netrw
|
||||
vim.g.netrw_liststyle = 3 -- Change style to 'tree' view
|
||||
vim.g.netrw_banner = 0 -- Remove useless banner
|
||||
vim.g.netrw_winsize = 15 -- Explore window takes % of page
|
||||
vim.g.netrw_browse_split = 4 -- Open in previous window
|
||||
vim.g.netrw_altv = 1 -- Always split left
|
||||
|
46
modules/neovim/package/default.nix
Normal file
46
modules/neovim/package/default.nix
Normal file
@ -0,0 +1,46 @@
|
||||
# { inputs, globals, extraConfig ? [ ], ... }:
|
||||
#
|
||||
# let
|
||||
#
|
||||
# pkgs = import inputs.nixpkgs {
|
||||
# system = inputs.system;
|
||||
# overlays = [
|
||||
# (import ./modules/neovim/plugins-overlay.nix inputs)
|
||||
# inputs.nix2vim.overlay
|
||||
# ];
|
||||
# };
|
||||
#
|
||||
# in pkgs.neovimBuilder {
|
||||
# package = pkgs.neovim-unwrapped;
|
||||
# imports = [
|
||||
# ./modules/neovim/plugins/bufferline.nix
|
||||
# ./modules/neovim/plugins/completion.nix
|
||||
# ./modules/neovim/plugins/gitsigns.nix
|
||||
# ./modules/neovim/plugins/lsp.nix
|
||||
# ./modules/neovim/plugins/misc.nix
|
||||
# ./modules/neovim/plugins/statusline.nix
|
||||
# ./modules/neovim/plugins/syntax.nix
|
||||
# ./modules/neovim/plugins/telescope.nix
|
||||
# ./modules/neovim/plugins/toggleterm.nix
|
||||
# ./modules/neovim/plugins/tree.nix
|
||||
# ] ++ extraConfig;
|
||||
# }
|
||||
|
||||
{ pkgs, colors ? { }, ... }:
|
||||
|
||||
pkgs.neovimBuilder {
|
||||
package = pkgs.neovim-unwrapped;
|
||||
imports = [
|
||||
../config/bufferline.nix
|
||||
../config/completion.nix
|
||||
../config/gitsigns.nix
|
||||
../config/lsp.nix
|
||||
../config/misc.nix
|
||||
../config/statusline.nix
|
||||
../config/syntax.nix
|
||||
../config/telescope.nix
|
||||
../config/toggleterm.nix
|
||||
../config/tree.nix
|
||||
colors
|
||||
];
|
||||
}
|
42
modules/neovim/plugins-overlay.nix
Normal file
42
modules/neovim/plugins-overlay.nix
Normal file
@ -0,0 +1,42 @@
|
||||
# Adopted from here: https://github.com/DieracDelta/vimconfig/blob/801b62dd56cfee59574639904a6c95b525725f66/plugins.nix
|
||||
|
||||
inputs: final: prev:
|
||||
|
||||
let
|
||||
|
||||
# Use nixpkgs vimPlugin but with source directly from plugin author
|
||||
withSrc = pkg: src: pkg.overrideAttrs (_: { inherit src; });
|
||||
|
||||
# Package plugin
|
||||
plugin = pname: src:
|
||||
prev.vimUtils.buildVimPluginFrom2Nix {
|
||||
inherit pname src;
|
||||
version = "master";
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
nil = inputs.nil.packages.${prev.system}.nil;
|
||||
|
||||
nvim-lspconfig =
|
||||
(withSrc prev.vimPlugins.nvim-lspconfig inputs.nvim-lspconfig);
|
||||
cmp-nvim-lsp = (withSrc prev.vimPlugins.cmp-nvim-lsp inputs.cmp-nvim-lsp);
|
||||
null-ls-nvim = (withSrc prev.vimPlugins.null-ls-nvim inputs.null-ls-nvim);
|
||||
comment-nvim = (withSrc prev.vimPlugins.comment-nvim inputs.comment-nvim);
|
||||
nvim-treesitter =
|
||||
(withSrc prev.vimPlugins.nvim-treesitter inputs.nvim-treesitter);
|
||||
telescope-nvim =
|
||||
(withSrc prev.vimPlugins.telescope-nvim inputs.telescope-nvim);
|
||||
telescope-project-nvim = (withSrc prev.vimPlugins.telescope-project-nvim
|
||||
inputs.telescope-project-nvim);
|
||||
toggleterm-nvim =
|
||||
(withSrc prev.vimPlugins.toggleterm-nvim inputs.toggleterm-nvim);
|
||||
bufferline-nvim =
|
||||
(withSrc prev.vimPlugins.bufferline-nvim inputs.bufferline-nvim);
|
||||
nvim-tree-lua = (withSrc prev.vimPlugins.nvim-tree-lua inputs.nvim-tree-lua);
|
||||
|
||||
# Packaging plugins with Nix
|
||||
# comment-nvim = plugin "comment-nvim" comment-nvim-src;
|
||||
# plenary-nvim = plugin "plenary-nvim" plenary-nvim-src;
|
||||
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
|
||||
home.packages = with pkgs; [
|
||||
kubectl # Basic Kubernetes queries
|
||||
k9s # Terminal Kubernetes UI
|
||||
kubernetes-helm # Helm CLI
|
||||
fluxcd # Bootstrap clusters with Flux
|
||||
kustomize # Kustomize CLI (for Flux)
|
||||
@ -19,6 +18,123 @@
|
||||
ks = "k9s";
|
||||
};
|
||||
|
||||
# Terminal Kubernetes UI
|
||||
programs.k9s = {
|
||||
enable = true;
|
||||
# settings = { k9s = { headless = true; }; };
|
||||
skin = {
|
||||
k9s = {
|
||||
body = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base00;
|
||||
logoColor = config.theme.colors.base02; # *blue ?
|
||||
};
|
||||
# Search bar
|
||||
prompt = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base00;
|
||||
suggestColor = config.theme.colors.base03;
|
||||
};
|
||||
# Header left side
|
||||
info = {
|
||||
fgColor = config.theme.colors.base04;
|
||||
sectionColor = config.theme.colors.base05;
|
||||
};
|
||||
dialog = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base00;
|
||||
buttonFgColor = config.theme.colors.base06;
|
||||
buttonBgColor = config.theme.colors.base0E;
|
||||
buttonFocusFgColor = config.theme.colors.base07;
|
||||
buttonFocusBgColor = config.theme.colors.base02; # *cyan
|
||||
labelFgColor = config.theme.colors.base09;
|
||||
fieldFgColor = config.theme.colors.base06;
|
||||
};
|
||||
frame = {
|
||||
border = {
|
||||
fgColor = config.theme.colors.base01;
|
||||
focusColor = config.theme.colors.base06;
|
||||
};
|
||||
menu = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
keyColor = config.theme.colors.base0E; # *magenta
|
||||
numKeyColor = config.theme.colors.base0E; # *magenta
|
||||
};
|
||||
crumbs = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base01;
|
||||
activeColor = config.theme.colors.base03;
|
||||
};
|
||||
status = {
|
||||
newColor = config.theme.colors.base04; # *cyan
|
||||
modifyColor = config.theme.colors.base0D; # *blue
|
||||
addColor = config.theme.colors.base0B; # *green
|
||||
errorColor = config.theme.colors.base08; # *red
|
||||
highlightColor = config.theme.colors.base09; # *orange
|
||||
killColor = config.theme.colors.base03; # *comment
|
||||
completedColor = config.theme.colors.base03; # *comment
|
||||
};
|
||||
title = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base00;
|
||||
highlightColor = config.theme.colors.base09; # *orange
|
||||
counterColor = config.theme.colors.base0D; # *blue
|
||||
filterColor = config.theme.colors.base0E; # *magenta
|
||||
};
|
||||
};
|
||||
views = {
|
||||
charts = {
|
||||
bgColor = config.theme.colors.base00;
|
||||
defaultDialColors =
|
||||
[ config.theme.colors.base0D config.theme.colors.base08 ];
|
||||
# - *blue
|
||||
# - *red
|
||||
defaultChartColors =
|
||||
[ config.theme.colors.base0D config.theme.colors.base08 ];
|
||||
# - *blue
|
||||
# - *red
|
||||
};
|
||||
table = {
|
||||
# List of resources
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base00;
|
||||
|
||||
# Row selection
|
||||
cursorFgColor = config.theme.colors.base07;
|
||||
cursorBgColor = config.theme.colors.base01;
|
||||
|
||||
# Header row
|
||||
header = {
|
||||
fgColor = config.theme.colors.base0D;
|
||||
bgColor = config.theme.colors.base00;
|
||||
sorterColor = config.theme.colors.base0A; # *selection
|
||||
};
|
||||
};
|
||||
xray = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base00;
|
||||
cursorColor = config.theme.colors.base06;
|
||||
graphicColor = config.theme.colors.base0D;
|
||||
showIcons = false;
|
||||
};
|
||||
yaml = {
|
||||
keyColor = config.theme.colors.base0D;
|
||||
colonColor = config.theme.colors.base04;
|
||||
fgColor = config.theme.colors.base03;
|
||||
};
|
||||
logs = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base00;
|
||||
indicator = {
|
||||
fgColor = config.theme.colors.base06;
|
||||
bgColor = config.theme.colors.base00;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user