nvf refactoring, devshell working

This commit is contained in:
Charlie Root 2024-07-22 01:20:41 +02:00
commit 9a25c80e74
17 changed files with 100 additions and 310 deletions

View file

@ -7,7 +7,6 @@
in {
environment.systemPackages = with pkgs; [
abaddon
alejandra
alsa-utils
asciinema
bibata-cursors

View file

@ -24,11 +24,6 @@
nvf = inputs.neovim-flake;
in {
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
typstyle
];
};
imports = concatLists [
# neovim-flake home-manager module
[nvf.nixosModules.default]

View file

@ -12,7 +12,7 @@ local options = {
backspace = { 'indent', 'eol', 'start' }, -- backspace through everything in insert mode
hidden = true, -- Enable background buffers
history = 100, -- Remember N lines in history
lazyredraw = true, -- Faster scrolling if enabled, breaks noice
lazyredraw = false, -- Faster scrolling if enabled, breaks noice
synmaxcol = 240, -- Max column for syntax highlight
updatetime = 250, -- ms to wait for trigger an event

View file

@ -7,7 +7,7 @@ if vim.g.neovide then
vim.g.neovide_transparency = 0.80
vim.g.neovide_show_border = true
vim.g.neovide_input_macos_alt_is_meta = true
vim.g.neovide_cursor_animate_command_line = true -- noice incompat
vim.g.neovide_cursor_animate_command_line = false -- noice incompat
vim.g.neovide_cursor_smooth_blink = true
vim.g.neovide_cursor_vfx_mode = 'ripple'

View file

@ -1,4 +1,4 @@
--local noice = require('noice')
local noice = require('noice')
local no_top_text = {
opts = {
border = {
@ -6,7 +6,6 @@ local no_top_text = {
},
},
}
--[[
-- luacheck: ignore
noice.setup({
cmdline = {
@ -69,4 +68,3 @@ noice.setup({
},
},
})
--]]

View file

@ -2,9 +2,8 @@
programs.neovim-flake.settings.vim.maps = {
normal = {
"<leader>gg".action = "<cmd>LazyGit<CR>";
/*
# General
"<leader>fd".action = ":lua vim.g.formatsave = not vim.g.formatsave<CR>";
"<leader>fd".action = "<cmd>lua vim.g.formatsave = not vim.g.formatsave<CR>";
"<leader>zt".action = ":<C-U>let g:default_terminal = v:count1<CR>";
# "<leader>ld".action = ":lua vim.diagnostic.setqflist({open = true})<CR>";
# "<leader>lf".action = ":lua vim.lsp.buf.format()<CR>";
@ -12,11 +11,11 @@
"<leader>;".action = "A;<esc>"; # Append #
# Diffview
"<leader>gdq".action = ":DiffviewClose<CR>";
"<leader>gdd".action = ":DiffviewOpen ";
"<leader>gdm".action = ":DiffviewOpen<CR>";
"<leader>gdh".action = ":DiffviewFileHistory %<CR>";
"<leader>gde".action = ":DiffviewToggleFiles<CR>";
"<leader>gdq".action = "<cmd>DiffviewClose<CR>";
"<leader>gdd".action = "<cmd>DiffviewOpen ";
"<leader>gdm".action = "<cmd>DiffviewOpen<CR>";
"<leader>gdh".action = "<cmd>DiffviewFileHistory %<CR>";
"<leader>gde".action = "<cmd>DiffviewToggleFiles<CR>";
# Git
"<leader>gu".action = "<cmd>Gitsigns undo_stage_hunk<CR>";
@ -28,7 +27,6 @@
"<leader>gb".action = "<cmd>Gitsigns blame_line<CR>";
"<leader>gD".action = "<cmd>Gitsigns diffthis HEAD<CR>";
"<leader>gw".action = "<cmd>Gitsigns toggle_word_diff<CR>";
*/
# Movement
"<C-h>".action = "<C-W>h";
"<C-j>".action = "<C-W>j";
@ -36,22 +34,13 @@
"<C-l>".action = "<C-W>l";
# Telescope
"<M-f>".action = "<cmd>Telescope resume<CR>";
"<leader>fq".action = ":Telescope quickfix<CR>";
"<leader>f/".action = ":Telescope live_grep<cr>";
/*
# Aerial
"<S-O>".action = ":AerialToggle<CR>";
# vsnip
#"<C-jn>".action = "<Plug>(vsnip-jump-next)";
#"<C-jp>".action = "<Plug>(vsnip-jump-prev)";
*/
"<leader>fq".action = "<cmd>Telescope quickfix<CR>";
"<leader>f/".action = "<cmd>Telescope live_grep<cr>";
};
normalVisualOp = {
/*
"<leader>gs".action = ":Gitsigns stage_hunk<CR>";
"<leader>gr".action = ":Gitsigns reset_hunk<CR>";
"<leader>gs".action = "<cmd>Gitsigns stage_hunk<CR>";
"<leader>gr".action = "<cmd>Gitsigns reset_hunk<CR>";
"<leader>lr".action = "<cmd>lua vim.lsp.buf.references()<CR>";
# ssr.nvim
@ -63,7 +52,6 @@
action = "':ToggleTermSendVisualLines ' . v:count == 0 ? g:default_terminal : v:count";
expr = true;
};
*/
};
};
}

View file

@ -1,190 +0,0 @@
# Thank your Mr. poz! (https://git.jacekpoz.pl/jacekpoz/niksos)
{
config,
inputs,
lib,
pkgs,
...
}: let
cfg = config.modules.editors.neovim;
inherit (config.modules.other.system) username;
inherit (lib) mkEnableOption mkIf;
in {
options.modules.editors.neovim.enable = mkEnableOption "neovim";
config = mkIf cfg.enable {
environment.sessionVariables = {EDITOR = "nvim";};
home-manager.users.${username} = {
imports = [inputs.neovim-flake.homeManagerModules.default];
programs.nvf = {
enable = true;
settings.vim = {
package =
inputs.neovim-nightly-overlay.packages.${pkgs.system}.neovim;
viAlias = false;
vimAlias = false;
enableLuaLoader = true;
scrollOffset = 7;
preventJunkFiles = true;
tabWidth = 4;
autoIndent = false;
cmdHeight = 1;
useSystemClipboard = false;
theme = {
enable = true;
name = "catppuccin";
style = "mocha";
transparent = true;
};
maps = {
normal = {
"<leader>v" = {
action = "<CMD>Neotree toggle<CR>";
silent = true;
};
"<leader>m" = {
action = "<CMD>MarkdownPreviewToggle<CR>";
silent = true;
};
};
terminal = {
# get out of terminal mode in toggleterm
"<ESC>" = {
action = "<C-\\><C-n>";
silent = true;
};
};
};
statusline.lualine = {
enable = true;
theme = "catppuccin";
};
extraPlugins = with pkgs.vimPlugins; {
zen-mode.package = zen-mode-nvim;
unicode.package = unicode-vim;
};
treesitter = {
enable = true;
fold = true;
context.enable = true;
};
autocomplete = {
enable = true;
alwaysComplete = false;
};
filetree.nvimTree = {enable = true;};
terminal.toggleterm = {
enable = true;
setupOpts.direction = "tab";
mappings.open = "<C-\\>";
# TODO shading_factor
# TODO shade_terminals
# TODO size
};
git = {
enable = true;
gitsigns = {
enable = true;
# TODO enable / disable all the settings
};
};
lsp = {
enable = true;
lspSignature.enable = true;
lspconfig.enable = true;
mappings = {
addWorkspaceFolder = "<leader>wa";
codeAction = "<leader>a";
format = "<C-f>";
goToDeclaration = "gD";
goToDefinition = "gd";
hover = "K";
listImplementations = "gi";
listReferences = "gr";
listWorkspaceFolders = "<leader>wl";
nextDiagnostic = "<leader>k";
previousDiagnostic = "<leader>j";
openDiagnosticFloat = "<leader>e";
removeWorkspaceFolder = "<leader>wr";
renameSymbol = "<leader>r";
signatureHelp = "<C-k>";
};
};
languages = {
enableDAP = true;
enableExtraDiagnostics = true;
enableFormat = true;
enableLSP = true;
enableTreesitter = true;
bash.enable = true;
clang = {
enable = true;
cHeader = true;
};
css.enable = true;
html.enable = true;
java.enable = true;
markdown.enable = true;
nix.enable = true;
ocaml.enable = true;
rust = {
enable = true;
crates.enable = true;
};
ts.enable = true;
};
utility = {
motion.leap.enable = true;
preview.markdownPreview.enable = true;
# TODO settings.theme = "dark";
surround = {
enable = true;
useVendoredKeybindings = true;
};
};
visuals.fidget-nvim.enable = true;
# TODO laytan/cloak.nvim
telescope.enable = true;
comments.comment-nvim.enable = true;
# TODO learn and add harpoon
notes = {
todo-comments = {
enable = true;
mappings.telescope = "<leader>tt";
setupOpts.highlight.pattern = ".*<(KEYWORDS)s*";
};
orgmode = {
enable = true;
setupOpts = {
org_agenda_files = ["~/Notes/org"];
org_default_notes_file = "~/Notes/org/refile.org";
};
treesitter.enable = true;
};
};
};
};
};
};
}

View file

@ -82,7 +82,7 @@
in {
programs.neovim-flake.settings.vim.extraPlugins = {
# plugins that are pulled from nixpkgs
# direnv = {package = direnv-vim;};
direnv = {package = direnv-vim;};
friendly-snippets = {package = friendly-snippets;};
mkdir-nvim = {package = mkdir-nvim;};
lazygit-nvim = {package = lazygit-nvim;};
@ -95,7 +95,7 @@ in {
package = nvim-surround;
setup = "require('nvim-surround').setup {}";
};
/*
undotree = {
package = undotree;
setup = ''
@ -103,7 +103,7 @@ in {
vim.g.undotree_TreeVertShape = ''
'';
};
*/
ssr-nvim = {
package = ssr-nvim;
setup = "require('ssr').setup {}";
@ -141,7 +141,7 @@ in {
package = pluginSources.smart-splits;
setup = "require('smart-splits').setup {}";
};
/*
neotab-nvim = {
package = pluginSources.neotab-nvim;
setup = ''
@ -173,7 +173,7 @@ in {
}
'';
};
*/
specs-nvim = {
package = pluginSources.specs-nvim;
setup = ''

View file

@ -2,7 +2,7 @@ _: {
programs.neovim-flake.settings.vim = {
terminal = {
toggleterm = {
enable = false;
enable = true;
mappings.open = "<C-t>";
setupOpts = {

View file

@ -1,6 +1,4 @@
{config, ...}: let
inherit (config.modules.other.system) username;
in {
_: {
programs.neovim-flake.settings.vim = {
theme = {
enable = true;

View file

@ -1,15 +1,9 @@
{
config,
pkgs,
...
}: let
inherit (config.modules.other.system) username;
in {
_: {
programs.neovim-flake.settings.vim = {
ui = {
noice.enable = false;
noice.enable = true;
colorizer.enable = true;
modes-nvim.enable = true;
modes-nvim.enable = false;
illuminate.enable = true;
breadcrumbs = {

View file

@ -9,12 +9,12 @@
enable = true;
cli-package = pkgs.wakatime-cli;
};
#
# motion = {
# hop.enable = false;
# leap.enable = false;
# };
#
motion = {
hop.enable = false;
leap.enable = false;
};
preview = {
glow.enable = true;
markdownPreview.enable = true;

View file

@ -10,7 +10,7 @@
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.strings) hasSuffix fileContents;
inherit (lib.attrsets) genAttrs;
inherit (lib) mkIf mkEnableOption;
inherit (lib) mkIf;
cfg = config.modules.system.programs.editors.neovim;
nvf = inputs.neovim-flake;

View file

@ -16,8 +16,10 @@ in {
config = mkIf cfg.enable {
home-manager = {
verbose = true;
useUserPackages = true;
useGlobalPkgs = true;
backupFileExtension = "hm.old";
extraSpecialArgs = {inherit inputs self;};
users.${username} = {
programs = {
@ -33,6 +35,12 @@ in {
homeDirectory = "/home/${username}";
stateVersion = lib.mkDefault "23.11";
};
manual = {
manpages.enable = false;
html.enable = false;
json.enable = false;
};
};
};
};

View file

@ -322,7 +322,7 @@ in {
# "${waybar}/bin/waybar"
# run persistent special workspace windows
"[workspace special:nixos; silent;tile] ${foot}/bin/foot -D ~/repos/nichts nvim"
"[workspace special:nixos; silent;tile] ${foot}/bin/foot -D ~/projects/nichts nvim"
"[workspace special:keepassxc; silent;tile] ${pkgs.keepassxc}/bin/keepassxc"

View file

@ -9,6 +9,9 @@
treefmt = {
projectRootFile = "flake.nix";
enableDefaultExcludes = true;
settings = {
global.excludes = ["*.png"];
};
programs = {
alejandra.enable = true;
@ -17,10 +20,7 @@
prettier = {
enable = true;
package = pkgs.prettierd;
excludes = ["*.age"];
settings = {
editorconfig = true;
};
settings.editorconfig = true;
};
shfmt = {

View file

@ -7,9 +7,9 @@
devShells.default = pkgs.mkShellNoCC {
name = "nichts";
shellHook = ''
${config.pre-commit.installationScript}
'';
# shellHook = ''
# # ${config.pre-commit.installationScript}
# '';
DIRENV_LOG_FORMAT = "";