Merge remote-tracking branch 'origin/neovim-lua-config'

This commit is contained in:
Greg Hellings
2023-06-28 21:09:05 -05:00
14 changed files with 604 additions and 337 deletions
+27 -7
View File
@@ -1,25 +1,45 @@
{ agenix, darwin, nixstable, nixunstable, overlays, ... }:
{ inputs, overlays, ... }:
let
mac = {
system ? "aarch64-darwin",
name,
channel ? nixunstable,
channel ? inputs.nixunstable,
extraMods ? []
}:
let
nixpkgs = channel;
in darwin.lib.darwinSystem {
nixpkgs = import channel {
inherit system overlays;
};
in inputs.darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit nixpkgs; };
modules = [
{ nixpkgs.overlays = overlays; }
agenix.nixosModule
inputs.hm.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
users."gregory.hellings" = import ../home/home.nix;
extraSpecialArgs = {
inherit inputs;
gnome = false;
gui = true;
home = "/Users/gregory.hellings";
};
};
users.users."gregory.hellings".home = "/Users/gregory.hellings";
}
../modules-all
../modules-darwin
./${name}
] ++ extraMods;
};
in {
"C02G48H8MD6R" = mac { system = "x86_64-darwin"; name = "work"; };
in rec {
# Duplicate all the things, because nix-darwin does different things with case sensitivity
# depending on where you live
C02G48H8MD6R = mac { system = "x86_64-darwin"; name = "work"; };
c02g48h8md6r = C02G48H8MD6R;
la23002 = mac { name = "ivr"; };
LA23002 = la23002;
}
Generated
+255 -26
View File
@@ -2,14 +2,16 @@
"nodes": {
"agenix": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1665870395,
"narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=",
"lastModified": 1684153753,
"narHash": "sha256-PVbWt3qrjYAK+T5KplFcO+h7aZWfEj1UtyoKlvcDxh0=",
"owner": "ryantm",
"repo": "agenix",
"rev": "a630400067c6d03c9b3e0455347dc8559db14288",
"rev": "db5637d10f797bb251b94ef9040b237f4702cde3",
"type": "github"
},
"original": {
@@ -19,17 +21,39 @@
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1673295039,
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"darwin_2": {
"inputs": {
"nixpkgs": [
"nixunstable"
]
},
"locked": {
"lastModified": 1682773107,
"narHash": "sha256-+h94XeJnG3uk5imJlBi/1lVmcfCbxHpwZp5u7n3Krwg=",
"lastModified": 1687110393,
"narHash": "sha256-SnkdWeZ8PZd3Dc74iFF8xiE7qDp5+z3Yps2mE79tsM0=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "379d42fad6bc5c28f79d5f7ff2fa5f1c90cb7bf8",
"rev": "8a5af0da9d8dab8a188436750489e304ac682085",
"type": "github"
},
"original": {
@@ -44,11 +68,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1682729071,
"narHash": "sha256-N0oJwtZPEo+2waAZtsdxMGOkyGfiPldmHdP0t+vi0pk=",
"lastModified": 1687135984,
"narHash": "sha256-rKYTpYAAqBA07bOKNxnQFDSQ9BjAFFMP3m6k3uNUAJ8=",
"owner": "bandithedoge",
"repo": "nixpkgs-firefox-darwin",
"rev": "04b4ccccef58d9fc3f18192b6edc4b3c5decb3cf",
"rev": "31d984614fa8525646f29bfe1bb4cebe48906e8e",
"type": "github"
},
"original": {
@@ -58,6 +82,22 @@
}
},
"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,
"locked": {
"lastModified": 1673956053,
@@ -106,6 +146,24 @@
"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": {
"inputs": {
"nixpkgs": [
@@ -113,27 +171,134 @@
]
},
"locked": {
"lastModified": 1687204608,
"narHash": "sha256-rZ0e0iAIQM7vlsMd2/pcGfymZzNBRawObFgqIpxE94c=",
"lastModified": 1687163790,
"narHash": "sha256-CmG/ZdswJrWM0CMgJiVyWfO6LqaI4SKEAx9IrnYDrpI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f06a43dca05fb7f1aa44742bf861d9c827b45122",
"rev": "ac53777f52929bc82efcd2830bfc5aa60bcb4337",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"ref": "release-23.05",
"repo": "home-manager",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1682203081,
"narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"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": {
"locked": {
"lastModified": 1665732960,
"narHash": "sha256-WBZ+uSHKFyjvd0w4inbm0cNExYTn8lpYFcHEes8tmec=",
"lastModified": 1677676435,
"narHash": "sha256-6FxdcmQr5JeZqsQvfinIMr0XcTyTuR7EXX0H3ANShpQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4428e23312933a196724da2df7ab78eb5e67a88e",
"rev": "a08d6979dd7c82c4cef0dcc6ac45ab16051c1169",
"type": "github"
},
"original": {
@@ -159,6 +324,22 @@
"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": {
"locked": {
"lastModified": 1685094109,
@@ -177,11 +358,11 @@
},
"nixunstable": {
"locked": {
"lastModified": 1686960236,
"narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=",
"owner": "nixos",
"lastModified": 1684749550,
"narHash": "sha256-0uqCE8cDYvQ53KbGXKB/kNV9u4fhU9A8j7PjceZ7Gq8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "04af42f3b31dba0ef742d254456dc4c14eedac86",
"rev": "fc89970a268de31561c98a4b61e40b6f0636d50a",
"type": "github"
},
"original": {
@@ -191,13 +372,45 @@
"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": {
"locked": {
"lastModified": 1683002478,
"narHash": "sha256-af6LDktTjh3S6jWS2luOla1EW8uic0nFamkLenSvdRM=",
"lastModified": 1687203925,
"narHash": "sha256-DMMZiGmfYFQIzCV9mIWSvpfYbMn232/egV6Wg4ufRUY=",
"owner": "nix-community",
"repo": "NUR",
"rev": "d889aaa91f9185bce2017679380ee9b233bb1c5e",
"rev": "c6e103d3d88ebc99a3e09cc37f54f5957066eade",
"type": "github"
},
"original": {
@@ -209,10 +422,11 @@
"root": {
"inputs": {
"agenix": "agenix",
"darwin": "darwin",
"darwin": "darwin_2",
"ffmac": "ffmac",
"flake-utils": "flake-utils",
"hm": "hm",
"nixneovim": "nixneovim",
"nixstable": "nixstable",
"nixunstable": "nixunstable",
"nurpkgs": "nurpkgs",
@@ -234,10 +448,25 @@
"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": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixunstable"
]
+30 -18
View File
@@ -5,27 +5,41 @@
description = "Greg's machines!";
inputs = {
nixstable.url = "github:nixos/nixpkgs/nixos-23.05";
nixunstable.url = "github:nixos/nixpkgs/nixos-unstable";
agenix.url = "github:ryantm/agenix";
flake-utils.url = "github:numtide/flake-utils";
hm = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixstable";
};
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";
hm = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixstable";
};
nixneovim.url = "github:NixNeovim/NixNeovim";
nixstable.url = "github:nixos/nixpkgs/nixos-23.05";
nixunstable.url = "github:nixos/nixpkgs/nixos-unstable";
nurpkgs.url = "github:nix-community/NUR";
wsl = {
url = "github:nix-community/NixOS-WSL";
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
pkg-sets = (
final: prev: {
@@ -34,24 +48,22 @@
);
local_overlay = import ./overlays;
overlays = [
agenix.overlay
agenix.overlays.default
pkg-sets
local_overlay
nixneovim.overlays.default
nurpkgs.overlay
inputs.ffmac.overlay
ffmac.overlay
];
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; });
defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage);
darwinConfigurations = (import ./darwin { inherit inputs overlays; });
homeConfigurations = (
import ./home {
inherit nixunstable agenix hm overlays flake-utils;
inherit inputs overlays;
nixpkgs = nixunstable;
}
);
+1 -4
View File
@@ -3,7 +3,4 @@ builds:
- '*.x86_64-linux.*'
- '*.aarch64-linux.*'
- nixosConfigurations.*
- defaultPackage.x86_64-linux
- defaultPackage.aarch64-linux
- defaultPackage.x86_64-darwin
- defaultPackage.aarch64-darwin
- darwinConfigurations.*
+8 -10
View File
@@ -1,18 +1,16 @@
{
nixpkgs,
inputs,
overlays,
hm,
flake-utils,
...
}:
let
# I'm "greg" everywhere except Darwin where I'm "gregory.hellings"
user = system:
( if ( nixpkgs.lib.hasSuffix "-darwin" system ) then "gregory.hellings" else "greg" );
( if ( inputs.nixstable.lib.hasSuffix "-darwin" system ) then "gregory.hellings" else "greg" );
home = system: username:
if username == "root" then "/root" else
( if ( nixpkgs.lib.hasSuffix "-darwin" system ) then "/Users/${username}" else "/home/${username}" );
( if ( inputs.nixstable.lib.hasSuffix "-darwin" system ) then "/Users/${username}" else "/home/${username}" );
mkhome = {
system,
@@ -21,30 +19,30 @@ let
username
}:
let
stateVersion = "22.05";
stateVersion = "23.05";
homeDirectory = home system username;
cfg = { home = { inherit username homeDirectory stateVersion; }; };
configDir = "${homeDirectory}/.config";
pkgs = import nixpkgs {
pkgs = import inputs.nixstable {
inherit overlays system;
config.allowUnfree = true;
config.xdg.configHome = configDir;
};
in hm.lib.homeManagerConfiguration rec {
in inputs.hm.lib.homeManagerConfiguration rec {
inherit pkgs;
modules = [
(import ./home.nix {
inherit pkgs gui gnome;
inherit inputs pkgs gui gnome;
inherit (pkgs) config lib stdenv;
})
cfg
];
};
in flake-utils.lib.eachDefaultSystem (system: {
in inputs.flake-utils.lib.eachDefaultSystem (system: {
gui = mkhome {
inherit system;
gui = true;
+5 -2
View File
@@ -1,7 +1,10 @@
{ pkgs, lib, gui, gnome, ...}:
{ pkgs, lib, gui, gnome,
inputs,
...}:
{
imports = [
inputs.nixneovim.nixosModules.default
./modules
./ansible.nix
./bash.nix
@@ -37,7 +40,7 @@
" https://pypiev.ivrtechnology.com/simple/"
]);
home.stateVersion = "22.05";
home.stateVersion = "23.05";
home.packages = with pkgs; [
bitwarden-cli
brew
-242
View File
@@ -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
View File
@@ -27,39 +27,125 @@ in
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;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = with pkgs.vimPlugins; [
ansible-vim
colorscheme = "gruvbox";
globals = {
indent_guides_enable_on_vim_startup = 1;
nix_recommended_style = 0;
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
nerdtree
nvim-cmp
#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
];
#extraConfig = builtins.readFile ./vimrc;
extraLuaConfig = builtins.readFile ./init.lua;
coc = {
enable = true;
};
viAlias = true;
vimAlias = true;
};
}
+44
View File
@@ -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
+33
View File
@@ -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>)
+88
View File
@@ -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
-- ============================================================================
View File
+5 -5
View File
@@ -1,11 +1,11 @@
{ nixstable, nixunstable, overlays, wsl, agenix, ... }:
{ inputs, overlays, ... }:
let
wsl = args: (unstable (args // { extraMods = [ wsl.nixosModules.wsl ]; }));
unstable = args: (machine (args // { channel = nixunstable; }));
wsl = args: (unstable (args // { extraMods = [ inputs.wsl.nixosModules.wsl ]; }));
unstable = args: (machine (args // { channel = inputs.nixunstable; }));
machine = {
system ? "x86_64-linux",
name,
channel ? nixstable,
channel ? inputs.nixstable,
extraMods ? []
}:
let
@@ -14,7 +14,7 @@ let
inherit system;
modules = [
{ nixpkgs.overlays = overlays; }
agenix.nixosModule
inputs.agenix.nixosModules.default
../modules-all
../modules-linux
./${name}
-1
View File
@@ -51,7 +51,6 @@
gregpy
findutils
hms # My own home manager switcher
home-manager
htop
killall
nano