From 4dbec7bade23c3814eb95ef5f85c39c8968633e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 15 Jul 2023 12:45:11 +0200 Subject: [PATCH] refactor(nvim): better name and lazy loading --- modules/programs/nvim/default.nix | 4 ++-- modules/programs/nvim/plugins/default.nix | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 7e88008..568e3c8 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -48,9 +48,9 @@ let listToStringMultiLine id ([ "dir = ${quote plugin}" - "name = ${quote plugin.name}" - "lazy = ${boolToString lazy}" + "name = ${quote (getName plugin)}" ] + ++ (optional (!lazy) "lazy = ${boolToString lazy}") ++ (optional (!enabled) "enabled = ${boolToString enabled}") ++ (optional (dependencies != [ ]) "dependencies = ${listToStringMultiLine id (map lazySpecFromPlugin dependencies)}") ++ (optional (init != null) "init = function(plugin)\n${toString init}\nend") diff --git a/modules/programs/nvim/plugins/default.nix b/modules/programs/nvim/plugins/default.nix index fa83949..cb16242 100644 --- a/modules/programs/nvim/plugins/default.nix +++ b/modules/programs/nvim/plugins/default.nix @@ -200,8 +200,7 @@ with builtins; conf = readFile ./smartcolumn-nvim.lua; } { - plugin = telescope-fzf-native-nvim; - conf = readFile ./telescope-fzf-native-nvim.lua; + plugin = telescope-nvim; cmd = [ "Telescope" ]; keys = [ { key = "ff"; cmd = "Telescope find_files"; desc = "Find files"; } @@ -220,13 +219,15 @@ with builtins; { key = "gs"; cmd = "Telescope git_status"; desc = "Status"; } ]; dependencies = [ - { - plugin = telescope-nvim; - dependencies = [ - { plugin = plenary-nvim; } - { plugin = which-key-nvim; } - ]; - } + { plugin = plenary-nvim; } + { plugin = which-key-nvim; } + ]; + } + { + plugin = telescope-fzf-native-nvim; + conf = readFile ./telescope-fzf-native-nvim.lua; + dependencies = [ + { plugin = telescope-nvim; } ]; } { @@ -241,7 +242,9 @@ with builtins; { plugin = comment-nvim; event = [ "BufReadPost" "BufNewFile" ]; - conf = "require('Comment').setup()"; + conf = '' + require("Comment").setup() + ''; } { plugin = leap-nvim;