feat: isolate neovim and begin second configuration to nixify the first

This commit is contained in:
oddlama 2023-09-21 23:11:36 +02:00
parent 8de313d277
commit bf7ec956ae
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
6 changed files with 121 additions and 18 deletions

View file

@ -1,11 +1,5 @@
{ {
programs.neovim = { programs.neovim-custom.enable = true;
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
};
home.persistence."/state".directories = [ home.persistence."/state".directories = [
".local/share/nvim" ".local/share/nvim"

View file

@ -1,5 +1,6 @@
{...}: { {...}: {
imports = [ imports = [
./neovim.nix
./secrets.nix ./secrets.nix
./uid.nix ./uid.nix

19
users/modules/neovim.nix Normal file
View file

@ -0,0 +1,19 @@
{
lib,
config,
pkgs,
...
}: {
options.programs.neovim-custom = {
enable = lib.mkEnableOption "Neovim";
package = lib.mkPackageOption pkgs "neovim" {};
};
config = lib.mkIf config.programs.neovim-custom.enable {
home = {
# TODO packages = [config.programs.neovim-custom.package];
sessionVariables.EDITOR = "nvim";
shellAliases.vimdiff = "nvim -d";
};
};
}

View file

@ -37,6 +37,7 @@
zathura zathura
]; ];
# TODO kitty terminfo missing with ssh root@localhost
# TODO nix repl cltr+del doesnt work # TODO nix repl cltr+del doesnt work
# TODO wrap neovim for kitty hist # TODO wrap neovim for kitty hist
# TODO neovim gitsigns toggle_deleted keybind # TODO neovim gitsigns toggle_deleted keybind
@ -59,8 +60,6 @@
# TODO screenshot selection and scan qr and copy clipboard # TODO screenshot selection and scan qr and copy clipboard
# TODO screenshot selection and ocr and copy clipboard # TODO screenshot selection and ocr and copy clipboard
# TODO sway shortcuts # TODO sway shortcuts
# TODO kitty terminfo missing with ssh root@localhost
# TODO nvim coloscheme missing on reboot.... what state is missing?
# TODO VP9 hardware video decoding blocklisted # TODO VP9 hardware video decoding blocklisted
# TODO gpg switch to sk # TODO gpg switch to sk
# TODO some font icons not showing neovim because removed from nerdfonts, replace with bertter . # TODO some font icons not showing neovim because removed from nerdfonts, replace with bertter .

View file

@ -0,0 +1,66 @@
local opt = vim.opt
local g = vim.g
g.mapleader = ","
----------------------------------------------------------------------------------------------------
-- General
----------------------------------------------------------------------------------------------------
opt.undolevels = 1000000 -- Set maximum undo levels
opt.undofile = true -- Enable persistent undo which persists undo history across vim sessions
opt.updatetime = 300 -- Save swap file after 300ms
opt.mouse = "a" -- Enable full mouse support
----------------------------------------------------------------------------------------------------
-- Editor visuals
----------------------------------------------------------------------------------------------------
opt.termguicolors = true -- Enable true color in terminals
opt.splitkeep = "screen" -- Try not to move text when opening/closing splits
opt.wrap = false -- Do not wrap text longer than the window's width
opt.scrolloff = 2 -- Keep 2 lines above and below the cursor.
opt.sidescrolloff = 2 -- Keep 2 lines left and right of the cursor.
opt.number = true -- Show line numbers
opt.cursorline = true -- Enable cursorline, colorscheme only shows this in number column
opt.wildmode = { "list", "full" } -- Only complete the longest common prefix and list all results
opt.fillchars = { stlnc = "" } -- Show separators in inactive window statuslines
-- FIXME: disabled because this really fucks everything up in the terminal.
opt.title = false -- Sets the window title
--opt.titlestring = "%t%( %M%)%( (%{expand(\"%:~:.:h\")})%) - nvim" -- The format for the window title
-- Hide line numbers in terminal windows
vim.api.nvim_exec([[au BufEnter term://* setlocal nonumber]], false)
----------------------------------------------------------------------------------------------------
-- Editing behavior
----------------------------------------------------------------------------------------------------
opt.whichwrap = "" -- Never let the curser switch to the next line when reaching line end
opt.ignorecase = true -- Ignore case in search by default
opt.smartcase = true -- Be case sensitive when an upper-case character is included
opt.expandtab = false
opt.tabstop = 4 -- Set indentation of tabs to be equal to 4 spaces.
opt.shiftwidth = 4
opt.softtabstop = 4
opt.shiftround = true -- Round indentation commands to next multiple of shiftwidth
opt.formatoptions = "rqj" -- 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
opt.virtualedit = "all" -- 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
opt.selection = "old" -- Do not include line ends in past the-line selections
opt.smartindent = true -- Use smart auto indenting for all file types
opt.timeoutlen = 20 -- Only wait 20 milliseconds for characters to arrive (see :help timeout)
opt.ttimeoutlen = 20
opt.timeout = false -- Disable timeout, but enable ttimeout (only timeout on keycodes)
opt.ttimeout = true
opt.grepprg = "rg --vimgrep --smart-case --follow" -- Replace grep with ripgrep

View file

@ -1,16 +1,40 @@
{pkgs, ...}: { {
programs.neovim = { config,
withPython3 = true; pkgs,
extraPython3Packages = pyPkgs: with pyPkgs; [openai]; ...
withNodeJs = true; }: {
}; programs.neovim-custom.package = let
nvimConfig =
pkgs.neovimUtils.makeNeovimConfig {
wrapRc = false;
withPython3 = true;
withRuby = true;
withNodeJs = true;
#extraPython3Packages = p: [];
#plugins = [
# { plugin = pkgs.; config = ''''; optional = false; }
#];
}
// {
wrapperArgs = ["--add-flags" "--clean -u ${./aaa/init.lua}"];
};
in
pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped nvimConfig;
home.packages = let
nvimConfig = pkgs.neovimUtils.makeNeovimConfig {
wrapRc = false;
withPython3 = true;
withRuby = true;
withNodeJs = true;
extraPython3Packages = p: with p; [openai];
};
in [(pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped nvimConfig)];
xdg.configFile = { xdg.configFile = {
"nvim/ftplugin".source = ./ftplugin; "nvim/ftplugin".source = ./ftplugin;
"nvim/init.lua".source = ./init.lua; "nvim/init.lua".source = ./init.lua;
"nvim/lua".source = ./lua; "nvim/lua".source = ./lua;
}; };
home.sessionVariables.E = "${config.programs.neovim-custom.package}/bin/nvim";
# TODO NO! NO! all of this goes away
home.packages = with pkgs; [gcc shellcheck stylua];
} }