Skip to content

Commit

Permalink
feat: nixvim add notify and toggle formatting keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Jan 31, 2024
1 parent 6aa88f0 commit eedfcf1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/home/cli-apps/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ in
extraPlugins = with pkgs.vimPlugins; [
vim-wakatime
];

extraConfigLuaPre = /* lua */ ''
function bool2str(bool) return bool and "on" or "off" end
'';
};

# TODO: setup onchange to either be after sops-nix or not load wakatime in headless
Expand Down
13 changes: 13 additions & 0 deletions modules/home/cli-apps/neovim/keymappings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@
desc = "Toggle LazyGit";
};
};

"<leader>uf" = {
action = /*lua*/ ''
function ()
vim.g.autoformat_enabled = not vim.g.autoformat_enabled
vim.notify(string.format("Global autoformatting %s", bool2str(vim.g.autoformat_enabled), "info"))
end'';
lua = true;
options = {
desc = "Toggle autoformatting";
};
};
};
visual =
lib.mapAttrsToList
Expand Down Expand Up @@ -117,3 +129,4 @@
(normal ++ visual);
};
}

7 changes: 7 additions & 0 deletions modules/home/cli-apps/neovim/plugins/notify.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ ... }: {
programs.nixvim = {
plugins.notify = {
enable = true;
};
};
}

0 comments on commit eedfcf1

Please sign in to comment.