feat: continue nixvim implementation

This commit is contained in:
Patrick Großmann 2023-11-07 21:16:39 +01:00
parent 98f240f063
commit 11fcef7c93
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
8 changed files with 228 additions and 42 deletions

1
.gitignore vendored
View file

@ -1,3 +1,2 @@
.pre-commit-config.yaml .pre-commit-config.yaml
.direnv .direnv
todo*

View file

@ -37,6 +37,8 @@
- `graphical.nix` configuration for users utilizing a graphical interface - `graphical.nix` configuration for users utilizing a graphical interface
- `<username>/` configuration for users - `<username>/` configuration for users
- `impermanence.nix` users persistence configuration - `impermanence.nix` users persistence configuration
- `keys` collection of yubikeys public key parts for decryption
- `img` images, encrypted to not break any copyright by redistribution
## Hosts ## Hosts
- `patricknix` Patricks main laptop - `patricknix` Patricks main laptop

View file

@ -44,6 +44,6 @@
}; };
system.activationScripts.decryptKey.text = '' system.activationScripts.decryptKey.text = ''
ln -s ${../../keys/PatC.key} /run/decrypt.key.pub ln -f -s ${../../keys/PatC.key} /run/decrypt.key.pub
''; '';
} }

View file

@ -51,6 +51,6 @@
}; };
}; };
system.activationScripts.decryptKey.text = '' system.activationScripts.decryptKey.text = ''
ln -s ${../../keys/PatC.key} /run/decrypt.key.pub ln -f -s ${../../keys/PatC.key} /run/decrypt.key.pub
''; '';
} }

View file

@ -4,6 +4,14 @@
zsh-histdb-skim = super.callPackage ./zsh-histdb-skim.nix {}; zsh-histdb-skim = super.callPackage ./zsh-histdb-skim.nix {};
zsh-histdb = super.callPackage ./zsh-histdb.nix {}; zsh-histdb = super.callPackage ./zsh-histdb.nix {};
deploy = super.callPackage ./deploy.nix {}; deploy = super.callPackage ./deploy.nix {};
neovim-clean = super.neovim-unwrapped.overrideAttrs (_neovimFinal: neovimPrev: {
nativeBuildInputs = (neovimPrev.nativeBuildInputs or []) ++ [super.makeWrapper];
postInstall =
(neovimPrev.postInstall or "")
+ ''
wrapProgram $out/bin/nvim --add-flags "--clean"
'';
});
formats = formats =
super.formats super.formats
// { // {

View file

@ -34,15 +34,81 @@
".cache/nvim" ".cache/nvim"
]; ];
home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim { home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim {
package = pkgs.neovim-unwrapped.overrideAttrs (_final: prev: { package = pkgs.neovim-clean;
nativeBuildInputs = (prev.nativeBuildInputs or []) ++ [pkgs.makeWrapper];
postInstall =
(prev.postInstall or "")
+ ''
wrapProgram $out/bin/nvim --add-flags "--clean"
'';
});
colorscheme = "onedark";
colorschemes.onedark.enable = true; colorschemes.onedark.enable = true;
options = import ./nixvim/options.nix;
glkbals.mapleader = " ";
keymaps = let
options = {
noremap = true;
silent = true;
};
in [
{
key = "<M-down>";
action = "<C-w><down>";
inherit options;
}
{
key = "<M-up>";
action = "<C-w><up>";
inherit options;
}
{
key = "<M-left>";
action = "<C-w><left>";
inherit options;
}
{
key = "<M-right>";
action = "<C-w><right>";
inherit options;
}
{
key = "<M-r>";
action = "<C-w><down>";
inherit options;
}
{
key = "<M-l>";
action = "<C-w><up>";
inherit options;
}
{
key = "<M-n>";
action = "<C-w><left>";
inherit options;
}
{
key = "<M-s>";
action = "<C-w><right>";
inherit options;
}
# scroll with cursor lock
{
key = "<S-down>";
action = "<C-e>";
inherit options;
}
{
key = "<S-up>";
action = "<C-y>";
inherit options;
}
{
key = "<S-down>";
action = "<C-[><C-e>a";
inherit options;
mode = "i";
}
{
key = "<S-up>";
action = "<C-[><C-y>a";
inherit options;
mode = "i";
}
];
}); });
} }

View file

@ -0,0 +1,79 @@
{
# Set maximum undo levels
undolevels = 1000000;
# Persistent Undo
undofile = true;
undodir = "~/.cache/nvim/undo";
# swap file save interval
updatetime = 300;
# Ignore *.o and *~ files in wildmenu
wildignore = "*.o,*~";
# Only complete the longest common prefix and list all results.
# You can use the cursor keys to select an item in this list
wildmode = ["list" "full"];
# set case handling
ignorecase = true;
smartcase = true;
# ╓──────────────────╖
# ║ Editor visuals ║
# ╙──────────────────╜
# Enable true color in terminals
termguicolors = true;
# set font
guifont = "FiraCode Nerd Font Mono:h10.5";
# full mouse support
mouse = "a";
# Do not wrap text longer than the window's width
wrap = false;
# Show line numbers
number = true;
relativenumber = false;
# Keep 2 lines around the cursor.
scrolloff = 2;
sidescrolloff = 2;
# Set indentation of tabs to be equal to 4 spaces.
tabstop = 4;
shiftwidth = 4;
softtabstop = 4;
#round indentation to shifwidth
shiftround = true;
# ╓────────────────────╖
# ║ Editing behavior ║
# ╙────────────────────╜
# r = insert comment leader when hitting <Enter> in insert mode
# q = allow explicit formatting with gq
# j = remove comment leaders when joining lines if it makes sense
formatoptions = "rqj";
# Allow the curser to be positioned on cells that have no actual character;
# Like moving beyond EOL or on any visual 'space' of a tab character
virtualedit = "all";
# Do not include line ends in past the-line selections
selection = "old";
# Use smart auto indenting for all file types
smartindent = true;
# Only wait 20 milliseconds for characters to arrive (see :help timeout)
timeoutlen = 20;
ttimeoutlen = 20;
# Disable timeout, set ttimeout (only timeout on keycodes)
timeout = false;
ttimeout = true;
# replace grep with ripgrep
grepprg = "rg --vimgrep --smartcase --follow";
}

View file

@ -1,33 +1,65 @@
{pkgs, ...}: let {
initLua = pkgs.writeText "init.lua" '' pkgs,
vim.opt.buftype = "nowrite" lib,
vim.opt.backup = false ...
vim.opt.modeline = false }: {
vim.opt.shelltemp = false home.sessionVariables.MANPAGER = lib.getExe (pkgs.nixvim.makeNixvim {
vim.opt.swapfile = false package = pkgs.neovim-clean;
vim.opt.undofile = false
vim.opt.writebackup = false
vim.opt.shadafile = vim.fn.stdpath "state" .. "/shada/man.shada"
vim.opt.virtualedit = "all"
vim.opt.splitkeep = "screen"
vim.opt.termguicolors = false options = {
buftype = "nowrite";
vim.keymap.set('n', '<CR>', '<C-]>', {silent = true, desc = "Jump to tag under cursor"}) backup = false;
vim.keymap.set('n', '<Bs>', ':pop<CR>', {silent = true, desc = "Jump to tag under cursor"}) modeline = false;
vim.keymap.set('n', '<C-Left>', ':pop<CR>', {silent = true, desc = "Jump to tag under cursor"}) shelltemp = false;
vim.keymap.set('n', '<C-Right>', ':tag<CR>', {silent = true, desc = "Jump to tag under cursor"}) swapfile = false;
''; undofile = false;
nvimPager = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped neovimConfig; writebackup = false;
neovimConfig = virtualedit = "all";
pkgs.neovimUtils.makeNeovimConfig { splitkeep = "screen";
wrapRc = false; termguicolors = false;
withPython3 = false;
withRuby = false;
}
// {
wrapperArgs = ["--add-flags" "--clean -u ${initLua}"];
}; };
in {
home.sessionVariables.MANPAGER = "${nvimPager}/bin/nvim '+Man!'"; extraConfigLua = ''
vim.opt.shadafile = vim.fn.stdpath "state" .. "/shada/man.shada";
'';
keymaps = [
{
action = "<C-]>";
key = "<CR>";
mode = ["n"];
options = {
silent = true;
desc = "Jump to tag under cursor";
};
}
{
action = ":pop<CR>";
key = "<BS>";
mode = ["n"];
options = {
silent = true;
desc = "Jump to previous tag in stack";
};
}
{
action = ":pop<CR>";
key = "<C-Left>";
mode = ["n"];
options = {
silent = true;
desc = "Jump to previous tag in stack";
};
}
{
action = ":tag<CR>";
key = "<C-Right>";
mode = ["n"];
options = {
silent = true;
desc = "Jump to next tag in stack";
};
}
];
});
} }