feat: continue nixvim implementation
This commit is contained in:
parent
98f240f063
commit
11fcef7c93
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
|||
.pre-commit-config.yaml
|
||||
.direnv
|
||||
todo*
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
- `graphical.nix` configuration for users utilizing a graphical interface
|
||||
- `<username>/` configuration for users
|
||||
- `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
|
||||
- `patricknix` Patricks main laptop
|
||||
|
|
|
@ -44,6 +44,6 @@
|
|||
};
|
||||
|
||||
system.activationScripts.decryptKey.text = ''
|
||||
ln -s ${../../keys/PatC.key} /run/decrypt.key.pub
|
||||
ln -f -s ${../../keys/PatC.key} /run/decrypt.key.pub
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -51,6 +51,6 @@
|
|||
};
|
||||
};
|
||||
system.activationScripts.decryptKey.text = ''
|
||||
ln -s ${../../keys/PatC.key} /run/decrypt.key.pub
|
||||
ln -f -s ${../../keys/PatC.key} /run/decrypt.key.pub
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -4,6 +4,14 @@
|
|||
zsh-histdb-skim = super.callPackage ./zsh-histdb-skim.nix {};
|
||||
zsh-histdb = super.callPackage ./zsh-histdb.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 =
|
||||
super.formats
|
||||
// {
|
||||
|
|
|
@ -34,15 +34,81 @@
|
|||
".cache/nvim"
|
||||
];
|
||||
home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim {
|
||||
package = pkgs.neovim-unwrapped.overrideAttrs (_final: prev: {
|
||||
nativeBuildInputs = (prev.nativeBuildInputs or []) ++ [pkgs.makeWrapper];
|
||||
postInstall =
|
||||
(prev.postInstall or "")
|
||||
+ ''
|
||||
wrapProgram $out/bin/nvim --add-flags "--clean"
|
||||
'';
|
||||
});
|
||||
colorscheme = "onedark";
|
||||
package = pkgs.neovim-clean;
|
||||
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";
|
||||
}
|
||||
];
|
||||
});
|
||||
}
|
||||
|
|
79
users/common/programs/nvim/nixvim/options.nix
Normal file
79
users/common/programs/nvim/nixvim/options.nix
Normal 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";
|
||||
}
|
|
@ -1,33 +1,65 @@
|
|||
{pkgs, ...}: let
|
||||
initLua = pkgs.writeText "init.lua" ''
|
||||
vim.opt.buftype = "nowrite"
|
||||
vim.opt.backup = false
|
||||
vim.opt.modeline = false
|
||||
vim.opt.shelltemp = false
|
||||
vim.opt.swapfile = false
|
||||
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"
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
home.sessionVariables.MANPAGER = lib.getExe (pkgs.nixvim.makeNixvim {
|
||||
package = pkgs.neovim-clean;
|
||||
|
||||
vim.opt.termguicolors = false
|
||||
|
||||
vim.keymap.set('n', '<CR>', '<C-]>', {silent = true, desc = "Jump to tag under cursor"})
|
||||
vim.keymap.set('n', '<Bs>', ':pop<CR>', {silent = true, desc = "Jump to tag under cursor"})
|
||||
vim.keymap.set('n', '<C-Left>', ':pop<CR>', {silent = true, desc = "Jump to tag under cursor"})
|
||||
vim.keymap.set('n', '<C-Right>', ':tag<CR>', {silent = true, desc = "Jump to tag under cursor"})
|
||||
'';
|
||||
nvimPager = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped neovimConfig;
|
||||
neovimConfig =
|
||||
pkgs.neovimUtils.makeNeovimConfig {
|
||||
wrapRc = false;
|
||||
withPython3 = false;
|
||||
withRuby = false;
|
||||
}
|
||||
// {
|
||||
wrapperArgs = ["--add-flags" "--clean -u ${initLua}"];
|
||||
options = {
|
||||
buftype = "nowrite";
|
||||
backup = false;
|
||||
modeline = false;
|
||||
shelltemp = false;
|
||||
swapfile = false;
|
||||
undofile = false;
|
||||
writebackup = false;
|
||||
virtualedit = "all";
|
||||
splitkeep = "screen";
|
||||
termguicolors = false;
|
||||
};
|
||||
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";
|
||||
};
|
||||
}
|
||||
];
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue