Moved to more Nix neovim config
This commit is contained in:
+5
-5
@@ -1,27 +1,27 @@
|
|||||||
{ agenix, darwin, nixstable, nixunstable, overlays, hm, flake-utils, ... }:
|
{ inputs, overlays, ... }:
|
||||||
let
|
let
|
||||||
mac = {
|
mac = {
|
||||||
system ? "aarch64-darwin",
|
system ? "aarch64-darwin",
|
||||||
name,
|
name,
|
||||||
channel ? nixunstable,
|
channel ? inputs.nixunstable,
|
||||||
extraMods ? []
|
extraMods ? []
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
nixpkgs = import channel {
|
nixpkgs = import channel {
|
||||||
inherit system overlays;
|
inherit system overlays;
|
||||||
};
|
};
|
||||||
in darwin.lib.darwinSystem {
|
in inputs.darwin.lib.darwinSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = { inherit nixpkgs; };
|
specialArgs = { inherit nixpkgs; };
|
||||||
modules = [
|
modules = [
|
||||||
{ nixpkgs.overlays = overlays; }
|
{ nixpkgs.overlays = overlays; }
|
||||||
agenix.nixosModules.default
|
inputs.hm.darwinModules.home-manager
|
||||||
hm.darwinModules.home-manager
|
|
||||||
{
|
{
|
||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
users."gregory.hellings" = import ../home/home.nix;
|
users."gregory.hellings" = import ../home/home.nix;
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
|
inherit inputs;
|
||||||
gnome = false;
|
gnome = false;
|
||||||
gui = true;
|
gui = true;
|
||||||
home = "/Users/gregory.hellings";
|
home = "/Users/gregory.hellings";
|
||||||
|
|||||||
Generated
+186
-2
@@ -82,6 +82,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1650374568,
|
||||||
|
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673956053,
|
"lastModified": 1673956053,
|
||||||
@@ -130,6 +146,24 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils_3": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1685518550,
|
||||||
|
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"hm": {
|
"hm": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -172,6 +206,92 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"home-manager_2": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixneovim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1687081547,
|
||||||
|
"narHash": "sha256-/JV70TxhvP2r4xYtTlbQ2rrRDcj7MqHnF13r5ZE0oFc=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "28c823032cabfaa340a09e1d84cf45d11375c644",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-flake-tests": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1677844186,
|
||||||
|
"narHash": "sha256-ErJZ/Gs1rxh561CJeWP5bohA2IcTq1rDneu1WT6CVII=",
|
||||||
|
"owner": "antifuchs",
|
||||||
|
"repo": "nix-flake-tests",
|
||||||
|
"rev": "bbd9216bd0f6495bb961a8eb8392b7ef55c67afb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "antifuchs",
|
||||||
|
"repo": "nix-flake-tests",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixneovim": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"home-manager": "home-manager_2",
|
||||||
|
"nix-flake-tests": "nix-flake-tests",
|
||||||
|
"nixneovimplugins": "nixneovimplugins",
|
||||||
|
"nixpkgs": "nixpkgs_3",
|
||||||
|
"nmd": "nmd",
|
||||||
|
"nmt": "nmt"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1687097946,
|
||||||
|
"narHash": "sha256-G0NcZlgFXXpDcjJcUzNsfEKoB2XGQucYfnV1S/gWKiY=",
|
||||||
|
"owner": "NixNeovim",
|
||||||
|
"repo": "NixNeovim",
|
||||||
|
"rev": "479fa83a868c0b3d34bd20688a7fe4d956b98563",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixNeovim",
|
||||||
|
"repo": "NixNeovim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixneovimplugins": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": [
|
||||||
|
"nixneovim",
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixneovim",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1687097822,
|
||||||
|
"narHash": "sha256-2zWuuT6VROxbnpoPpoXVQB3bGpIowBXM0uxg9ZtfHxo=",
|
||||||
|
"owner": "nixneovim",
|
||||||
|
"repo": "nixneovimplugins",
|
||||||
|
"rev": "a57cef180723b7538828149ba0155189499884f1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixneovim",
|
||||||
|
"repo": "nixneovimplugins",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1677676435,
|
"lastModified": 1677676435,
|
||||||
@@ -204,6 +324,22 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1686960236,
|
||||||
|
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixstable": {
|
"nixstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685094109,
|
"lastModified": 1685094109,
|
||||||
@@ -236,6 +372,38 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nmd": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1683614069,
|
||||||
|
"narHash": "sha256-iq5HgZyr5oStuu6sj5xQkYiBRfFvyyfPBYDKwjklPcY=",
|
||||||
|
"owner": "~rycee",
|
||||||
|
"repo": "nmd",
|
||||||
|
"rev": "07a6db31ae19d728ef1e4dc02b9687a6c359c216",
|
||||||
|
"type": "sourcehut"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "~rycee",
|
||||||
|
"repo": "nmd",
|
||||||
|
"type": "sourcehut"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nmt": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1683843030,
|
||||||
|
"narHash": "sha256-2K9tFpypgSORyUTRAL7MFRKCXU4GykmhIDrrIydtPdI=",
|
||||||
|
"owner": "jooooscha",
|
||||||
|
"repo": "nmt",
|
||||||
|
"rev": "f30b96093eb056f1bcc60199545344b4e4a72c5a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "jooooscha",
|
||||||
|
"repo": "nmt",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nurpkgs": {
|
"nurpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687203925,
|
"lastModified": 1687203925,
|
||||||
@@ -258,6 +426,7 @@
|
|||||||
"ffmac": "ffmac",
|
"ffmac": "ffmac",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"hm": "hm",
|
"hm": "hm",
|
||||||
|
"nixneovim": "nixneovim",
|
||||||
"nixstable": "nixstable",
|
"nixstable": "nixstable",
|
||||||
"nixunstable": "nixunstable",
|
"nixunstable": "nixunstable",
|
||||||
"nurpkgs": "nurpkgs",
|
"nurpkgs": "nurpkgs",
|
||||||
@@ -279,10 +448,25 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"wsl": {
|
"wsl": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat_2",
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils_3",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixunstable"
|
"nixunstable"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -5,27 +5,41 @@
|
|||||||
description = "Greg's machines!";
|
description = "Greg's machines!";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixstable.url = "github:nixos/nixpkgs/nixos-23.05";
|
|
||||||
nixunstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
||||||
agenix.url = "github:ryantm/agenix";
|
agenix.url = "github:ryantm/agenix";
|
||||||
|
darwin = {
|
||||||
|
url = "github:lnl7/nix-darwin/master";
|
||||||
|
inputs.nixpkgs.follows = "nixunstable";
|
||||||
|
};
|
||||||
|
ffmac.url = "github:bandithedoge/nixpkgs-firefox-darwin";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
hm = {
|
hm = {
|
||||||
url = "github:nix-community/home-manager/release-23.05";
|
url = "github:nix-community/home-manager/release-23.05";
|
||||||
inputs.nixpkgs.follows = "nixstable";
|
inputs.nixpkgs.follows = "nixstable";
|
||||||
};
|
};
|
||||||
darwin = {
|
nixneovim.url = "github:NixNeovim/NixNeovim";
|
||||||
url = "github:lnl7/nix-darwin/master";
|
nixstable.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||||
inputs.nixpkgs.follows = "nixunstable";
|
nixunstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
};
|
nurpkgs.url = "github:nix-community/NUR";
|
||||||
wsl = {
|
wsl = {
|
||||||
url = "github:nix-community/NixOS-WSL";
|
url = "github:nix-community/NixOS-WSL";
|
||||||
inputs.nixpkgs.follows = "nixunstable";
|
inputs.nixpkgs.follows = "nixunstable";
|
||||||
};
|
};
|
||||||
nurpkgs.url = "github:nix-community/NUR";
|
|
||||||
ffmac.url = "github:bandithedoge/nixpkgs-firefox-darwin";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {nixstable, nixunstable, agenix, hm, nurpkgs, self, wsl, flake-utils, darwin, ...}@inputs:
|
outputs = {
|
||||||
|
agenix,
|
||||||
|
darwin,
|
||||||
|
ffmac,
|
||||||
|
flake-utils,
|
||||||
|
hm,
|
||||||
|
nixneovim,
|
||||||
|
nixstable,
|
||||||
|
nixunstable,
|
||||||
|
nurpkgs,
|
||||||
|
wsl,
|
||||||
|
|
||||||
|
self,
|
||||||
|
...}@inputs:
|
||||||
let
|
let
|
||||||
pkg-sets = (
|
pkg-sets = (
|
||||||
final: prev: {
|
final: prev: {
|
||||||
@@ -37,20 +51,21 @@
|
|||||||
agenix.overlays.default
|
agenix.overlays.default
|
||||||
pkg-sets
|
pkg-sets
|
||||||
local_overlay
|
local_overlay
|
||||||
|
nixneovim.overlays.default
|
||||||
nurpkgs.overlay
|
nurpkgs.overlay
|
||||||
inputs.ffmac.overlay
|
ffmac.overlay
|
||||||
];
|
];
|
||||||
|
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = (import ./hosts { inherit nixstable nixunstable overlays wsl agenix; });
|
nixosConfigurations = (import ./hosts { inherit inputs overlays; });
|
||||||
|
|
||||||
darwinConfigurations = (import ./darwin { inherit agenix darwin nixstable nixunstable overlays hm flake-utils; });
|
darwinConfigurations = (import ./darwin { inherit inputs overlays; });
|
||||||
|
|
||||||
defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage);
|
defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage);
|
||||||
|
|
||||||
homeConfigurations = (
|
homeConfigurations = (
|
||||||
import ./home {
|
import ./home {
|
||||||
inherit nixunstable agenix hm overlays flake-utils;
|
inherit inputs overlays;
|
||||||
nixpkgs = nixunstable;
|
nixpkgs = nixunstable;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
{ pkgs, lib, gui, gnome,
|
{ pkgs, lib, gui, gnome,
|
||||||
|
inputs,
|
||||||
...}:
|
...}:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
inputs.nixneovim.nixosModules.default
|
||||||
./modules
|
./modules
|
||||||
./ansible.nix
|
./ansible.nix
|
||||||
./bash.nix
|
./bash.nix
|
||||||
|
|||||||
-242
@@ -1,242 +0,0 @@
|
|||||||
-- Core vim settings
|
|
||||||
vim.opt.background="dark"
|
|
||||||
vim.opt.copyindent=true
|
|
||||||
vim.opt.expandtab=false
|
|
||||||
vim.opt.hidden=true
|
|
||||||
vim.opt.ignorecase=true
|
|
||||||
vim.opt.mouse="a"
|
|
||||||
vim.opt.number=true
|
|
||||||
vim.opt.relativenumber=true
|
|
||||||
vim.opt.shiftwidth=4
|
|
||||||
vim.opt.smartcase=true
|
|
||||||
vim.opt.tabstop=4
|
|
||||||
vim.opt.preserveindent=true
|
|
||||||
vim.opt.softtabstop=0
|
|
||||||
vim.opt.wrap=false
|
|
||||||
vim.opt.showcmd=true
|
|
||||||
vim.opt.cursorline=true
|
|
||||||
vim.opt.lazyredraw=true
|
|
||||||
vim.opt.showmatch=true
|
|
||||||
vim.opt.hlsearch=true
|
|
||||||
vim.opt.backup=false
|
|
||||||
vim.opt.writebackup=false
|
|
||||||
vim.opt.signcolumn="yes"
|
|
||||||
vim.opt.listchars="tab:→ ,extends:→,precedes:←,trail:·,eol:¬"
|
|
||||||
vim.opt.list=true
|
|
||||||
|
|
||||||
-- dunno about these?
|
|
||||||
-- syntax enable -- on by default in neovim
|
|
||||||
vim.cmd [[colorscheme gruvbox]]
|
|
||||||
|
|
||||||
-- ======================================================================
|
|
||||||
--
|
|
||||||
-- nvim-cmp configuration
|
|
||||||
--
|
|
||||||
-- ======================================================================
|
|
||||||
--local cmp = require'cmp'
|
|
||||||
|
|
||||||
--cmp.setup({
|
|
||||||
--snippet = {
|
|
||||||
--expand = function(args)
|
|
||||||
--vim.fn["vsnip#anonymous"](args.body)
|
|
||||||
--end,
|
|
||||||
--},
|
|
||||||
--window = {
|
|
||||||
---- completion = cmp.config.window.bordered(),
|
|
||||||
---- documentation = cmp.config.window.bordered(),
|
|
||||||
--},
|
|
||||||
--mapping = cmp.mapping.preset.insert({
|
|
||||||
--['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
--['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
--['<C-space>'] = cmp.mapping.complete(),
|
|
||||||
--['<C-e>'] = cmp.mapping.abort(),
|
|
||||||
--['<CR>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
--}),
|
|
||||||
--sources = cmp.config.sources({
|
|
||||||
--{ name = 'nvim_lspconfig' },
|
|
||||||
--{ name = 'vsnip' },
|
|
||||||
--},{
|
|
||||||
--{ name = 'buffer' }
|
|
||||||
--})
|
|
||||||
--})
|
|
||||||
--
|
|
||||||
--cmp.setup.filetype('gitcommit', {
|
|
||||||
--sources = cmp.config.sources({
|
|
||||||
--{ name = 'git' }
|
|
||||||
--},{
|
|
||||||
--{ name = 'buffer' }
|
|
||||||
--})
|
|
||||||
--})
|
|
||||||
--
|
|
||||||
--cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
--mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
--sources = { { name = 'buffer' } }
|
|
||||||
--})
|
|
||||||
--
|
|
||||||
--cmp.setup.cmdline(':', {
|
|
||||||
--mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
--sources = cmp.config.sources({
|
|
||||||
--{ name = 'path' }
|
|
||||||
--},{
|
|
||||||
--{ name = 'cmdline' }
|
|
||||||
--})
|
|
||||||
--})
|
|
||||||
--
|
|
||||||
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
--local lspconfig = require('lspconfig')
|
|
||||||
---- Add each LSP that you have configured here
|
|
||||||
----require('lspconfig')['<LANGUAGE_SERVER_HERE>'].setup {
|
|
||||||
---- capabilities = capabilities
|
|
||||||
----}
|
|
||||||
----lspconfig.pyright.setup { capabilities = capabilities }
|
|
||||||
--lspconfig.ansiblels.setup { capabilities = capabilities }
|
|
||||||
--lspconfig.jedi_language_server.setup { capabilities = capabilities }
|
|
||||||
|
|
||||||
-- ======================================================================
|
|
||||||
--
|
|
||||||
-- automatic commands
|
|
||||||
--
|
|
||||||
-- ======================================================================
|
|
||||||
local api = vim.api
|
|
||||||
|
|
||||||
-- Highlights bad whitespace
|
|
||||||
--api.nvim_create_autocmd("ColorScheme", { command = "highlight ExtraWhitespace ctermbg=red guibg=red" })
|
|
||||||
--api.nvim_create_autocmd("BufWinEnter", { command = "match ExtraWhitespace /\s\+$/" })
|
|
||||||
--api.nvim_create_autocmd("InsertEnter", { command = "match ExtraWhitespace /\s\+\%#\@<!$/" })
|
|
||||||
--api.nvim_create_autocmd("InsertLeave", { command = "match ExtraWhitespace /\s\+$/" })
|
|
||||||
vim.fn.matchadd('errorMsg', [[\s\+$]])
|
|
||||||
api.nvim_create_autocmd("BufWinLeave", { command = "call clearmatches()" })
|
|
||||||
-- Automatically source .vimrc when we write that file
|
|
||||||
-- This is probably no longer valid since we're writing init.lua, but we'll keep it for the sake
|
|
||||||
-- of posterity at the moment
|
|
||||||
api.nvim_create_autocmd("BufWritePost", {
|
|
||||||
pattern = ".vimrc",
|
|
||||||
command = "source $MYVIMRC"
|
|
||||||
})
|
|
||||||
-- Toggles absolute line numbers on/off when a window has focus or not
|
|
||||||
numbertoggle = api.nvim_create_augroup("numbertoggle", { clear = true })
|
|
||||||
api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave" }, {
|
|
||||||
command = "set relativenumber",
|
|
||||||
group = numbertoggle
|
|
||||||
})
|
|
||||||
api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter" }, {
|
|
||||||
command = "set norelativenumber",
|
|
||||||
group = numbertoggle
|
|
||||||
})
|
|
||||||
-- Set file highlighting to Ruby for Vagrantfiles
|
|
||||||
api.nvim_create_autocmd({ "BufRead", "BufNewFile"}, {
|
|
||||||
pattern = "Vagrantfile*",
|
|
||||||
command = "set filetype=ruby"
|
|
||||||
})
|
|
||||||
|
|
||||||
-- ======================================================================
|
|
||||||
--
|
|
||||||
-- Plugin configurations
|
|
||||||
--
|
|
||||||
-- ======================================================================
|
|
||||||
-- Set filetype to the way I want it
|
|
||||||
vim.g.nix_recommended_style=0
|
|
||||||
-- Settings for CtrlP
|
|
||||||
vim.opt.wildignore="*.swp,*.pyc,*.class,.tox"
|
|
||||||
-- Settings for NerdTree
|
|
||||||
vim.g.NERDTreeIgnore = {'\\.pyc$', '\\.o$', '\\.class$'}
|
|
||||||
-- indent guides
|
|
||||||
vim.g.indent_guides_enable_on_vim_startup = 1
|
|
||||||
-- Tell syntastic to use yamllint
|
|
||||||
vim.g.syntastic_yaml_checkers = {'yamllint'}
|
|
||||||
vim.g.syntastic_yaml_yamllint_args = {}
|
|
||||||
vim.g.syntastic_shell = "${pkgs.bash}/bin/bash"
|
|
||||||
-- Shortcuts for resolving git diff conflicts
|
|
||||||
vim.g.diffget_local_map = "gl"
|
|
||||||
vim.g.diffget_upstream_map = "gu"
|
|
||||||
|
|
||||||
-- ======================================================================
|
|
||||||
--
|
|
||||||
-- Custom commands and key mappings
|
|
||||||
--
|
|
||||||
-- ======================================================================
|
|
||||||
local all = {"n", "v", "i"}
|
|
||||||
-- Key mappings
|
|
||||||
-- map <F2> <Esc>\be
|
|
||||||
-- imap <F2> <Esc>\be
|
|
||||||
vim.keymap.set(all, "<F2>", "<Esc>\\be")
|
|
||||||
-- map <F4> <Esc>:NERDTreeToggle<Cr>
|
|
||||||
vim.keymap.set(all, "<F4>", "<Esc>:NERDTreeToggle")
|
|
||||||
-- Which file list to pop up
|
|
||||||
-- silent !git rev-parse --is-inside-work-tree
|
|
||||||
-- if v:shell_error == 0
|
|
||||||
-- map <C-p> :GFiles --cached --others --exclude-standard<CR>
|
|
||||||
-- map <C-o> :GFiles?
|
|
||||||
--else
|
|
||||||
-- map <C-p> :Files<CR>
|
|
||||||
--endif
|
|
||||||
if api.nvim_command_output("!git rev-parse --is-inside-work-tree") == true then
|
|
||||||
vim.keymap.set(all, "<C-p>", ":GFiles --cached --others --exclude-standard<CR>")
|
|
||||||
vim.keymap.set(all, "<C-o>", ":GFiles?")
|
|
||||||
else
|
|
||||||
vim.keymap.set(all, "<C-p>", ":Files")
|
|
||||||
end
|
|
||||||
-- map <F6> <Esc>:Files<Cr>
|
|
||||||
vim.keymap.set(all, "<F6>", "<Esc>:Files<CR>")
|
|
||||||
|
|
||||||
-- Allows navigating splits
|
|
||||||
-- map <C-j> <C-w>j<C-w><Cr>
|
|
||||||
-- map <C-k> <C-w>k<C-w><Cr>
|
|
||||||
-- map <C-h> <C-w>h<C-w><Cr>
|
|
||||||
-- map <C-l> <C-w>l<C-w><Cr>
|
|
||||||
vim.keymap.set(all, "<C-j>", "<C-w>j<C-w><Cr>")
|
|
||||||
vim.keymap.set(all, "<C-k>", "<C-w>k<C-w><Cr>")
|
|
||||||
vim.keymap.set(all, "<C-h>", "<C-w>h<C-w><Cr>")
|
|
||||||
vim.keymap.set(all, "<C-l>", "<C-w>l<C-w><Cr>")
|
|
||||||
|
|
||||||
-- ============================================================================
|
|
||||||
-- User functions to just make life easier
|
|
||||||
-- ============================================================================
|
|
||||||
-- Creates the directory for a file if it doesn't already exist.
|
|
||||||
bufWritePres = vim.cmd [[
|
|
||||||
function! s:MkNonExDir(file, buf)
|
|
||||||
if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
|
|
||||||
let dir=fnamemodify(a:file, ':h')
|
|
||||||
if !isdirectory(dir)
|
|
||||||
call mkdir(dir, 'p')
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
augroup BWCCreateDir
|
|
||||||
autocmd!
|
|
||||||
autocmd BufWritePre * :call s:MkNonExDir(expand('<afile>'), +expand('<abuf>'))
|
|
||||||
augroup END
|
|
||||||
]]
|
|
||||||
|
|
||||||
-- Return indent (all whitespace at start of a line), converted from
|
|
||||||
-- tabs to spaces if what = 1, or from spaces to tabs otherwise.
|
|
||||||
-- When converting to tabs, result has no redundant spaces.
|
|
||||||
vim.cmd [[
|
|
||||||
function! Indenting(indent, what, cols)
|
|
||||||
let spccol = repeat(' ', a:cols)
|
|
||||||
let result = substitute(a:indent, spccol, '\t', 'g')
|
|
||||||
let result = substitute(result, ' \+\ze\t', ''', 'g')
|
|
||||||
if a:what == 1
|
|
||||||
let result = substitute(result, '\t', spccol, 'g')
|
|
||||||
endif
|
|
||||||
return result
|
|
||||||
endfunction
|
|
||||||
]]
|
|
||||||
|
|
||||||
--Convert whitespace used for indenting (before first non-whitespace).
|
|
||||||
--what = 0 (convert spaces to tabs), or 1 (convert tabs to spaces).
|
|
||||||
--cols = string with number of columns per tab, or empty to use 'tabstop'.
|
|
||||||
--The cursor position is restored, but the cursor will be in a different
|
|
||||||
--column when the number of characters in the indent of the line is changed.
|
|
||||||
vim.cmd [[
|
|
||||||
function! IndentConvert(line1, line2, what, cols)
|
|
||||||
let savepos = getpos('.')
|
|
||||||
let cols = empty(a:cols) ? &tabstop : a:cols
|
|
||||||
execute a:line1 . ',' . a:line2 . 's/^\s\+/\=Indenting(submatch(0), a:what, cols)/e'
|
|
||||||
call histdel('search', -1)
|
|
||||||
call setpos('.', savepos)
|
|
||||||
endfunction
|
|
||||||
command! -nargs=? -range=% Space2Tab call IndentConvert(<line1>,<line2>,0,<q-args>)
|
|
||||||
command! -nargs=? -range=% Tab2Space call IndentConvert(<line1>,<line2>,1,<q-args>)
|
|
||||||
command! -nargs=? -range=% RetabIndent call IndentConvert(<line1>,<line2>,&et,<q-args>)
|
|
||||||
]]
|
|
||||||
+108
-22
@@ -27,39 +27,125 @@ in
|
|||||||
pyright
|
pyright
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.neovim = {
|
#programs.neovim = {
|
||||||
|
# enable = true;
|
||||||
|
# viAlias = true;
|
||||||
|
# vimAlias = true;
|
||||||
|
# vimdiffAlias = true;
|
||||||
|
# plugins = with pkgs.vimPlugins; [
|
||||||
|
# ansible-vim
|
||||||
|
# bufexplorer
|
||||||
|
#
|
||||||
|
# #cmp-nvim-lsp
|
||||||
|
# #cmp-vsnip
|
||||||
|
# #nvim-lspconfig
|
||||||
|
# nvim-cmp
|
||||||
|
#
|
||||||
|
# jedi-vim
|
||||||
|
#
|
||||||
|
# context-vim
|
||||||
|
# direnv-vim
|
||||||
|
# fzf-vim
|
||||||
|
# nerdtree
|
||||||
|
# nvim-notify
|
||||||
|
# vim-airline
|
||||||
|
# vim-gitgutter
|
||||||
|
# vim-flake8
|
||||||
|
# vim-fugitive
|
||||||
|
# vim-indent-guides
|
||||||
|
# vim-packer
|
||||||
|
# vim-rooter
|
||||||
|
# vim-xonsh
|
||||||
|
# gruvbox
|
||||||
|
# ];
|
||||||
|
# extraLuaConfig = builtins.readFile ./init.lua;
|
||||||
|
# coc = {
|
||||||
|
# # Currently waiting on resolution of https://github.com/NixOS/nixpkgs/issues/236560
|
||||||
|
# enable = false;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
programs.nixneovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
viAlias = true;
|
colorscheme = "gruvbox";
|
||||||
vimAlias = true;
|
globals = {
|
||||||
vimdiffAlias = true;
|
indent_guides_enable_on_vim_startup = 1;
|
||||||
plugins = with pkgs.vimPlugins; [
|
nix_recommended_style = 0;
|
||||||
ansible-vim
|
NERDTreeIgnore = [
|
||||||
|
"\\.pyc$"
|
||||||
|
"\\.pyo$"
|
||||||
|
"\\.o$"
|
||||||
|
"\\.class$"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
options = {
|
||||||
|
background = "dark";
|
||||||
|
backup = false;
|
||||||
|
copyindent = true;
|
||||||
|
cursorline = true;
|
||||||
|
expandtab = false;
|
||||||
|
hidden = true;
|
||||||
|
hlsearch = true;
|
||||||
|
ignorecase = true;
|
||||||
|
lazyredraw = true;
|
||||||
|
list = true;
|
||||||
|
listchars = "tab:→ ,extends:→,precedes:←,trail:·,eol:¬";
|
||||||
|
mouse = "a";
|
||||||
|
number = true;
|
||||||
|
preserveindent = true;
|
||||||
|
relativenumber = true;
|
||||||
|
shiftwidth = 4;
|
||||||
|
showcmd = true;
|
||||||
|
showmatch = true;
|
||||||
|
signcolumn = "yes";
|
||||||
|
smartcase = true;
|
||||||
|
softtabstop = 4;
|
||||||
|
tabstop = 4;
|
||||||
|
# Setting for CtrlP
|
||||||
|
wildignore = "*.swp,*.pyc,*.class,.tox";
|
||||||
|
wrap = false;
|
||||||
|
writebackup = false;
|
||||||
|
};
|
||||||
|
mappings = {
|
||||||
|
normalVisualOp = {
|
||||||
|
"<F2>" = ''"<Esc>:BufExplorer<CR>"'';
|
||||||
|
"<F4>" = ''"<Esc>:NERDTreeToggle<CR>"'';
|
||||||
|
"<F6>" = ''"<Esc>:Files<CR>"'';
|
||||||
|
"<C-j>" = ''"<C-w>j<C-w><CR>"'';
|
||||||
|
"<C-k>" = ''"<C-w>k<C-w><CR>"'';
|
||||||
|
"<C-h>" = ''"<C-w>h<C-w><CR>"'';
|
||||||
|
"<C-l>" = ''"<C-w>l<C-w><CR>"'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
plugins = {
|
||||||
|
airline.enable = true;
|
||||||
|
gitgutter.enable = true;
|
||||||
|
gruvbox.enable = true;
|
||||||
|
fugitive.enable = true;
|
||||||
|
notify.enable = true;
|
||||||
|
packer = {
|
||||||
|
enable = true;
|
||||||
|
plugins = [
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraConfigLua = builtins.readFile ./vim/extra.lua;
|
||||||
|
extraConfigVim = builtins.readFile ./vim/extra.vimrc;
|
||||||
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
bufexplorer
|
bufexplorer
|
||||||
|
nerdtree
|
||||||
|
nvim-cmp
|
||||||
|
|
||||||
#cmp-nvim-lsp
|
jedi-vim
|
||||||
#cmp-vsnip
|
|
||||||
#nvim-lspconfig
|
|
||||||
#nvim-cmp
|
|
||||||
|
|
||||||
context-vim
|
context-vim
|
||||||
direnv-vim
|
direnv-vim
|
||||||
fzf-vim
|
fzf-vim
|
||||||
nerdtree
|
|
||||||
nvim-notify
|
|
||||||
vim-airline
|
|
||||||
vim-gitgutter
|
|
||||||
vim-flake8
|
vim-flake8
|
||||||
vim-fugitive
|
|
||||||
vim-indent-guides
|
vim-indent-guides
|
||||||
vim-packer
|
|
||||||
vim-rooter
|
vim-rooter
|
||||||
vim-xonsh
|
vim-xonsh
|
||||||
gruvbox
|
|
||||||
];
|
];
|
||||||
#extraConfig = builtins.readFile ./vimrc;
|
viAlias = true;
|
||||||
extraLuaConfig = builtins.readFile ./init.lua;
|
vimAlias = true;
|
||||||
coc = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
-- ======================================================================
|
||||||
|
--
|
||||||
|
-- automatic commands
|
||||||
|
--
|
||||||
|
-- ======================================================================
|
||||||
|
local api = vim.api
|
||||||
|
local all = {"n", "v", "i"}
|
||||||
|
|
||||||
|
-- Highlights bad whitespace
|
||||||
|
--api.nvim_create_autocmd("ColorScheme", { command = "highlight ExtraWhitespace ctermbg=red guibg=red" })
|
||||||
|
--api.nvim_create_autocmd("BufWinEnter", { command = "match ExtraWhitespace /\s\+$/" })
|
||||||
|
--api.nvim_create_autocmd("InsertEnter", { command = "match ExtraWhitespace /\s\+\%#\@<!$/" })
|
||||||
|
--api.nvim_create_autocmd("InsertLeave", { command = "match ExtraWhitespace /\s\+$/" })
|
||||||
|
vim.fn.matchadd('errorMsg', [[\s\+$]])
|
||||||
|
api.nvim_create_autocmd("BufWinLeave", { command = "call clearmatches()" })
|
||||||
|
-- Automatically source .vimrc when we write that file
|
||||||
|
-- This is probably no longer valid since we're writing init.lua, but we'll keep it for the sake
|
||||||
|
-- of posterity at the moment
|
||||||
|
api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
pattern = ".vimrc",
|
||||||
|
command = "source $MYVIMRC"
|
||||||
|
})
|
||||||
|
-- Toggles absolute line numbers on/off when a window has focus or not
|
||||||
|
numbertoggle = api.nvim_create_augroup("numbertoggle", { clear = true })
|
||||||
|
api.nvim_create_autocmd({ "BufEnter", "FocusGained", "InsertLeave" }, {
|
||||||
|
command = "set relativenumber",
|
||||||
|
group = numbertoggle
|
||||||
|
})
|
||||||
|
api.nvim_create_autocmd({ "BufLeave", "FocusLost", "InsertEnter" }, {
|
||||||
|
command = "set norelativenumber",
|
||||||
|
group = numbertoggle
|
||||||
|
})
|
||||||
|
-- Set file highlighting to Ruby for Vagrantfiles
|
||||||
|
api.nvim_create_autocmd({ "BufRead", "BufNewFile"}, {
|
||||||
|
pattern = "Vagrantfile*",
|
||||||
|
command = "set filetype=ruby"
|
||||||
|
})
|
||||||
|
|
||||||
|
if api.nvim_command_output("!git rev-parse --is-inside-work-tree") == true then
|
||||||
|
vim.keymap.set(all, "<C-p>", ":GFiles --cached --others --exclude-standard<CR>")
|
||||||
|
vim.keymap.set(all, "<C-o>", ":GFiles?<CR>")
|
||||||
|
else
|
||||||
|
vim.keymap.set(all, "<C-p>", ":Files<CR>")
|
||||||
|
end
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
function! s:MkNonExDir(file, buf)
|
||||||
|
if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
|
||||||
|
let dir=fnamemodify(a:file, ':h')
|
||||||
|
if !isdirectory(dir)
|
||||||
|
call mkdir(dir, 'p')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
augroup BWCCreateDir
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePre * :call s:MkNonExDir(expand('<afile>'), +expand('<abuf>'))
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
function! Indenting(indent, what, cols)
|
||||||
|
let spccol = repeat(' ', a:cols)
|
||||||
|
let result = substitute(a:indent, spccol, '\t', 'g')
|
||||||
|
let result = substitute(result, ' \+\ze\t', ''', 'g')
|
||||||
|
if a:what == 1
|
||||||
|
let result = substitute(result, '\t', spccol, 'g')
|
||||||
|
endif
|
||||||
|
return result
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! IndentConvert(line1, line2, what, cols)
|
||||||
|
let savepos = getpos('.')
|
||||||
|
let cols = empty(a:cols) ? &tabstop : a:cols
|
||||||
|
execute a:line1 . ',' . a:line2 . 's/^\s\+/\=Indenting(submatch(0), a:what, cols)/e'
|
||||||
|
call histdel('search', -1)
|
||||||
|
call setpos('.', savepos)
|
||||||
|
endfunction
|
||||||
|
command! -nargs=? -range=% Space2Tab call IndentConvert(<line1>,<line2>,0,<q-args>)
|
||||||
|
command! -nargs=? -range=% Tab2Space call IndentConvert(<line1>,<line2>,1,<q-args>)
|
||||||
|
command! -nargs=? -range=% RetabIndent call IndentConvert(<line1>,<line2>,&et,<q-args>)
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
-- ======================================================================
|
||||||
|
--
|
||||||
|
-- nvim-cmp configuration
|
||||||
|
--
|
||||||
|
-- ======================================================================
|
||||||
|
local cmp = require'cmp'
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lspconfig' },
|
||||||
|
{ name = 'vsnip' },
|
||||||
|
},{
|
||||||
|
{ name = 'buffer' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'git' }
|
||||||
|
},{
|
||||||
|
{ name = 'buffer' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = { { name = 'buffer' } }
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
},{
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
-- Add each LSP that you have configured here
|
||||||
|
--require('lspconfig')['<LANGUAGE_SERVER_HERE>'].setup {
|
||||||
|
-- capabilities = capabilities
|
||||||
|
--}
|
||||||
|
--lspconfig.pyright.setup { capabilities = capabilities }
|
||||||
|
lspconfig.ansiblels.setup { capabilities = capabilities }
|
||||||
|
--lspconfig.jedi_language_server.setup { capabilities }
|
||||||
|
|
||||||
|
-- ======================================================================
|
||||||
|
--
|
||||||
|
-- Plugin configurations
|
||||||
|
--
|
||||||
|
-- ======================================================================
|
||||||
|
-- Set filetype to the way I want it
|
||||||
|
-- Settings for CtrlP
|
||||||
|
vim.opt.wildignore="*.swp,*.pyc,*.class,.tox"
|
||||||
|
-- Settings for NerdTree
|
||||||
|
vim.g.NERDTreeIgnore = {'\\.pyc$', '\\.o$', '\\.class$'}
|
||||||
|
-- indent guides
|
||||||
|
vim.g.indent_guides_enable_on_vim_startup = 1
|
||||||
|
-- Tell syntastic to use yamllint
|
||||||
|
vim.g.syntastic_yaml_checkers = {'yamllint'}
|
||||||
|
vim.g.syntastic_yaml_yamllint_args = {}
|
||||||
|
vim.g.syntastic_shell = "${pkgs.bash}/bin/bash"
|
||||||
|
-- Shortcuts for resolving git diff conflicts
|
||||||
|
vim.g.diffget_local_map = "gl"
|
||||||
|
vim.g.diffget_upstream_map = "gu"
|
||||||
|
|
||||||
|
|
||||||
|
-- ============================================================================
|
||||||
|
-- User functions to just make life easier
|
||||||
|
-- ============================================================================
|
||||||
Reference in New Issue
Block a user