about summary refs log tree commit diff stats
path: root/modules/home/conf/nvim/autocmds
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-18 17:07:46 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-18 17:07:46 +0200
commitc52c7f314ccadcc2fcd91e28c8fd1b88f6d5ce0c (patch)
treee8b947710b467b32740598ff574982097836f66c /modules/home/conf/nvim/autocmds
parentchore(pkgs/yt): 1.2.1 -> 1.3.0 (diff)
downloadnixos-config-c52c7f314ccadcc2fcd91e28c8fd1b88f6d5ce0c.tar.gz
nixos-config-c52c7f314ccadcc2fcd91e28c8fd1b88f6d5ce0c.zip
refactor(modules): Move all system modules to `by-name`
From now on all modules should be added to the new `by-name` directory.
This should help remove the (superficial and utterly useless)
distinction between `home-manager` and `NixOS` modules.
Diffstat (limited to 'modules/home/conf/nvim/autocmds')
-rw-r--r--modules/home/conf/nvim/autocmds/default.nix124
1 files changed, 0 insertions, 124 deletions
diff --git a/modules/home/conf/nvim/autocmds/default.nix b/modules/home/conf/nvim/autocmds/default.nix
deleted file mode 100644
index a8f00bdc..00000000
--- a/modules/home/conf/nvim/autocmds/default.nix
+++ /dev/null
@@ -1,124 +0,0 @@
-{config, ...}: {
-  programs.nixvim = {
-    autoGroups = {
-      cursor_off = {clear = true;};
-      colorcolumn_toggle = {clear = true;};
-      numbertoggle = {clear = true;};
-      coloroverride = {clear = true;};
-      highlight_on_yank = {clear = true;};
-      create_dir = {clear = true;};
-    };
-    autoCmd = [
-      {
-        # Taken from: https://github.com/jghauser/mkdir.nvim
-        event = ["BufWritePre"];
-        pattern = ["*"];
-        callback = {
-          __raw = ''
-            function()
-              -- Get current filename, get full path (:p) and leave only the head (:h)
-              local dir = vim.fn.expand('<afile>:p:h')
-
-              -- This handles URLs using netrw. See ':help netrw-transparent' for details.
-              if dir:find('%l+://') == 1 then
-                return
-              end
-
-              if vim.fn.isdirectory(dir) == 0 then
-                vim.fn.mkdir(dir, 'p')
-              end
-            end
-          '';
-        };
-        group = "create_dir";
-        desc = "Create the directory of the target file on write";
-      }
-      {
-        event = ["TextYankPost"];
-        pattern = ["*"];
-        callback = {
-          __raw = ''
-            function()
-              vim.highlight.on_yank()
-            end
-          '';
-        };
-        group = "highlight_on_yank";
-        desc = "Highlight the yanked text";
-      }
-      {
-        event = ["BufWritePre"];
-        pattern = ["*"];
-        command = ''
-          ks | if search("\\s\\+$", 'n') != 0 | :%s/\s\+$// | endif | 's
-        '';
-        desc = ''
-          Remove trailing whitespace on safe
-          :%s/\s\+$\| \+\ze\t//g >> For trailing spaces and spaces before tabstops
-        '';
-      }
-
-      {
-        event = ["WinLeave"];
-        pattern = ["*"];
-        command = "set nocursorline"; # TODO: possible also nocursorcolumn
-        group = "cursor_off";
-        desc = "Display cursorline and cursorcolumn ONLY in active window.";
-      }
-      {
-        event = ["WinEnter"];
-        pattern = ["*"];
-        command = "set cursorline"; # TODO: possible also cursorcolumn
-        group = "cursor_off";
-        desc = "Display cursorline and cursorcolumn ONLY in active window.";
-      }
-
-      {
-        event = ["InsertEnter"];
-        pattern = ["*"];
-        command = "set colorcolumn=${config.programs.nixvim.opts.colorcolumn}";
-        group = "colorcolumn_toggle";
-        desc = "Only activate the colorcolumn when focused";
-      }
-      {
-        event = ["BufLeave" "FocusLost" "InsertLeave" "WinLeave"];
-        pattern = ["*"];
-        command = "set colorcolumn=0";
-        group = "colorcolumn_toggle";
-        desc = "Only activate the colorcolumn when focused";
-      }
-
-      {
-        event = ["BufEnter" "FocusGained" "InsertLeave" "WinEnter"];
-        pattern = ["*"];
-        command = "if &nu && mode() != \"i\" | set rnu   | endif";
-        group = "numbertoggle";
-        desc = "Change line numbers, when not focused";
-      }
-      {
-        event = ["BufLeave" "FocusLost" "InsertEnter" "WinLeave"];
-        pattern = ["*"];
-        command = "if &nu | set nornu | endif";
-        group = "numbertoggle";
-        desc = "Change line numbers, when not focused";
-      }
-
-      {
-        # Override LineNr
-        event = ["ColorScheme"];
-        pattern = ["*"];
-        command = "highlight LineNr  ctermfg=DarkGrey guifg=DarkGrey ";
-        group = "coloroverride";
-        desc = "Changes Line number colors";
-      }
-      {
-        # Override CursorLineNr
-        event = ["ColorScheme"];
-        pattern = ["*"];
-        command = "highlight CursorLineNr  ctermfg=White guifg=White ";
-        group = "coloroverride";
-        desc = "Changes Line number colors";
-      }
-    ];
-  };
-}