start of a nixvim setup.

This commit is contained in:
Gabe Venberg 2024-03-19 16:57:23 -05:00
parent 507d4a3d08
commit 030822d6c1
13 changed files with 635 additions and 6 deletions

View file

@ -57,7 +57,7 @@ opt.shiftwidth = 0 --zero inherrits tabstop.
opt.autoindent = true
opt.smartindent = true
opt.smarttab = true
-- for space based tabs, change expandtab to false.
-- for space based tabs, change expandtab to true.
opt.expandtab = true
opt.softtabstop = -1 --negative value inherrits shiftwidth.
--highlight search results as you type.

View file

@ -1,5 +1,136 @@
{
"nodes": {
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710156081,
"narHash": "sha256-4PMY6aumJi5dLFjBzF5O4flKXmadMNq3AGUHKYfchh0=",
"owner": "numtide",
"repo": "devshell",
"rev": "bc68b058dc7e6d4d6befc4ec6c60082b6e844b7d",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixvim",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703887061,
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -20,6 +151,48 @@
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710714957,
"narHash": "sha256-eZCxuF58YWgaJMMRrn8oRkwRhxooe5kBS/s2wRVr9PA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "7b3fca5adcf6c709874a8f2e0c364fe9c58db989",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1710717205,
"narHash": "sha256-Wf3gHh5uV6W1TV/A8X8QJf99a5ypDSugY4sNtdJDe0A=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "bcc8afd06e237df060c85bad6af7128e05fd61a3",
"type": "github"
},
"original": {
"owner": "lnl7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1710631334,
@ -36,10 +209,95 @@
"type": "github"
}
},
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": {
"lastModified": 1710856562,
"narHash": "sha256-JM24d2f60/9q7D7nzyhGm0gcH+HQsrY8Q0rGOFcJzeQ=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "0a5e0c68b829f9fec135f479e3ec34332660f93d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1708018599,
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"nixvim": "nixvim"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"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"
}
}
},

View file

@ -8,11 +8,16 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
nixpkgs,
home-manager,
nixvim,
...
}: let
system = "x86_64-linux";
@ -26,6 +31,7 @@
# the path to your home.nix.
modules = [
./home.nix
nixvim.homeManagerModules.nixvim
];
# Optionally use extraSpecialArgs

View file

@ -1,7 +1,6 @@
{
config,
pgks,
lib,
...
}: {
programs.git = {

View file

@ -1,7 +1,6 @@
{
config,
pkgs,
lib,
...
}: {
# Home Manager needs a bit of information about you and the paths it should
@ -47,6 +46,7 @@
./zsh.nix
./git.nix
./starship.nix
./nvim/nvim.nix
];
programs.yazi.enable = true;

View file

@ -3,3 +3,6 @@ switch:
bootstrap:
nix run --extra-experimental-features "nix-command flakes" --no-write-lock-file github:nix-community/home-manager/ -- --extra-experimental-features "nix-command flakes" --flake . switch
check:
home-manager --flake . build

View file

@ -1,7 +1,6 @@
{
config,
pkgs,
lib,
...
}: {
#sessionVariables, sessionPath and shellAliases are not applied to nushell.

77
nix/nvim/lualine.nix Normal file
View file

@ -0,0 +1,77 @@
{
configs,
pkg,
...
}: {
programs.nixvim = {
plugins.lualine = {
enable = true;
alwaysDivideMiddle = true;
iconsEnabled = true;
sections = {
lualine_a = [
{name = "mode";}
];
lualine_b = [
{name = "branch";}
{name = "diff";}
{name = "diagnostics";}
];
lualine_c = [
{
name = "filename";
extraConfig = {path = 1;};
}
];
lualine_x = [
{name = "encoding";}
{name = "fileformat";}
{name = "filetype";}
];
lualine_y = [
{name = "progress";}
];
lualine_z = [
{name = "location";}
];
};
inactiveSections = {
lualine_a = [];
lualine_b = [];
lualine_c = [{name = "filename";}];
lualine_x = [{name = "filetype";}];
lualine_y = [];
lualine_z = [];
};
tabline = {
lualine_a = [
{
name = "buffers";
extraConfig = {mode = 4;};
}
];
lualine_b = [];
lualine_c = [];
lualine_x = [];
lualine_y = [];
lualine_z = [
{
name = "tabs";
extraConfig = {mode = 2;};
}
];
};
winbar = {
lualine_a = [];
lualine_b = [];
lualine_c = [];
lualine_x = [];
lualine_y = [];
lualine_z = [];
};
};
};
}

31
nix/nvim/nvim-tree.nix Normal file
View file

@ -0,0 +1,31 @@
{
configs,
pkg,
...
}: {
programs.nixvim = {
plugins.nvim-tree = {
enable = true;
disableNetrw = true;
hijackCursor = true;
hijackNetrw = true;
hijackUnnamedBufferWhenOpening = true;
actions = {
useSystemClipboard = true;
changeDir.enable = true;
};
filesystemWatchers.enable = true;
};
keymaps = [
{
action = ":NvimTreeToggle<CR>";
key = "<leader>t";
mode = "n";
options = {
silent = true;
desc = "toggle file browser";
};
}
];
};
}

173
nix/nvim/nvim.nix Normal file
View file

@ -0,0 +1,173 @@
{
configs,
pkg,
...
}: {
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
colorschemes.base16 = {
colorscheme = "gruvbox-dark-medium";
enable = true;
};
options = {
mouse = "a";
lazyredraw = true;
termguicolors = true;
autoread = true;
swapfile = false;
history = 500;
formatoptions = "rojq";
# dont hard wrap
textwidth = 0;
wrapmargin = 0;
breakindent = true;
# highlight after col
colorcolumn = "80,100,120";
# add ruler to side of screen
number = true;
numberwidth = 3;
#display cursor cordinates
ruler = true;
#always leave 5 cells between cursor and side of window
scrolloff = 5;
# better command line completion
wildmenu = true;
# ignore case if all lowercase
ignorecase = true;
smartcase = true;
# show unfinished keycombos in statusbar
showcmd = true;
# regex stuff
magic = true;
# always show statusline
laststatus = 2;
# tab stuff
tabstop = 4;
shiftwidth = 0;
autoindent = true;
smartindent = true;
smarttab = true;
# for true tabs, change to false
expandtab = true;
softtabstop = -1;
# highlight search results as you type
hlsearch = true;
incsearch = true;
# folding stuff
foldlevelstart = 5;
foldmethod = "indent";
foldcolumn = "auto:4";
foldenable = true;
# display whitespace as other chars
list = true;
listchars = {
tab = ">-";
eol = "";
nbsp = "";
trail = "";
extends = "";
precedes = "";
};
showbreak = "";
};
clipboard.providers.xsel.enable = true;
globals = {
mapleader = ";";
};
keymaps = [
{
action = ":setlocal spell!<CR>";
key = "<leader>cs";
mode = "n";
options = {
silent = true;
desc = "toggle spell check";
};
}
{
action = ":bnext<CR>";
key = "gf";
mode = "n";
options = {
silent = true;
desc = "next buffer";
};
}
{
action = ":bprevious<CR>";
key = "gF";
mode = "n";
options = {
silent = true;
desc = "prev buffer";
};
}
{
action = "<C-w>h";
key = "<C-h>";
mode = "n";
options = {
silent = true;
desc = "move to right split";
};
}
{
action = "<C-w>j";
key = "<C-j>";
mode = "n";
options = {
silent = true;
desc = "move to below split";
};
}
{
action = "<C-w>k";
key = "<C-k>";
mode = "n";
options = {
silent = true;
desc = "move to above split";
};
}
{
action = "<C-w>l";
key = "<C-l>";
mode = "n";
options = {
silent = true;
desc = "move to left split";
};
}
{
action = "za";
key = "<Space>";
mode = "n";
options = {
silent = true;
desc = "toggle fold";
};
}
{
action = ":nohls<CR>";
key = "<leader>h";
mode = "n";
options = {
silent = true;
desc = "clear highlighting";
};
}
];
};
imports = [
./lualine.nix
./nvim-tree.nix
./toggleterm.nix
];
}

View file

@ -0,0 +1,52 @@
asciidoc
ASCIISite
asciidoctor
ASCIIsite
asciiDoc
nextcloud
filesystem
zsh
backend
Incrementals
incrementals
Ransomware
ransomware
hypervisor
offsite
FTL
superintelligent
homeworld
toolchain
Kata
ctl
NDSU
rebasing
posix
tmux
keybinds
dotfile
dotfiles
ctrl
sed
NGINX
timezones
Proxmox
Gabe
Venberg
Github
dotfiles
config
nvim
neovim
config
Syncthing
homelab
microcontrollers
nushell
datatypes
datetimes
filesizes
filetypes
datastructures
footguns
csv

32
nix/nvim/toggleterm.nix Normal file
View file

@ -0,0 +1,32 @@
{
configs,
pkg,
...
}: {
programs.nixvim = {
plugins.toggleterm={
enable=true;
direction="horizontal";
insertMappings=false;
};
keymaps = [
{
action = "function() Floatingterm:toggle() end";
key = "<leader>s";
lua=true;
mode = "n";
options = {
silent = true;
desc = "toggle scratch terminal";
};
}
];
extraConfigLuaPre = ''
local Terminal = require('toggleterm.terminal').Terminal
Floatingterm = Terminal:new({
hidden = true,
direction = "float"
})
'';
};
}

View file

@ -1,7 +1,6 @@
{
config,
pkgs,
lib,
...
}: {
programs.starship.enableZshIntegration = true;