Skip to content

Commit

Permalink
set up dashboard via snacks plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
gvolpe committed Dec 8, 2024
1 parent cfa07c5 commit f9c87bc
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 1 deletion.
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@
flake = false;
};

# Dashboard
snacks = {
url = github:folke/snacks.nvim;
flake = false;
};

# Git
vim-fugitive = {
url = github:tpope/vim-fugitive;
Expand Down
Binary file added img/neovim-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lib/ide.nix
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ let
harpoon.enable = true;
hop.enable = true;
notifications.enable = true;
snacks.enable = true;
tide.enable = true;
todo.enable = true;
zen.enable = true;
Expand Down
1 change: 1 addition & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
./neovim
./notifications
./plantuml
./snacks
./snippets
./spider
./statusline
Expand Down
2 changes: 1 addition & 1 deletion modules/filetree/nvimtreelua.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ in
};

openOnSetup = mkOption {
default = true;
default = false;
description = "Open when vim is started on a directory";
type = types.bool;
};
Expand Down
54 changes: 54 additions & 0 deletions modules/snacks/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.vim.snacks;
neovim = config.vim.neovim.package;
in
{
options.vim.snacks = {
enable = mkOption {
type = types.bool;
description = "Enable dashboard from the Snacks plugin";
};
};

config = mkIf cfg.enable {
vim.startPlugins = [ pkgs.neovimPlugins.snacks ];

vim.luaConfigRC = ''
require('snacks').setup({
bigfile = { enabled = false },
dashboard = {
enabled = true,
width = 60,
preset = {
keys = {
{ icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
{ icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" },
{ icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
{ icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" },
{ icon = " ", key = "q", desc = "Exit", action = ":qa" },
},
},
sections = {
{
section = "terminal",
cmd = "${pkgs.chafa}/bin/chafa ${../../img/neovim-logo.png}",
},
{ text = "Version: ${neovim.version}", align = "center", padding = 1 },
{ section = "keys", gap = 1, padding = 1 },
},
},
notifier = {
enabled = false,
timeout = 2000,
},
quickfile = { enabled = false },
statuscolumn = { enabled = false },
words = { enabled = false },
})
'';
};
}

0 comments on commit f9c87bc

Please sign in to comment.