From 2122a01f99c6da466b8f0f55c965c11a9043d117 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 9 Nov 2024 12:35:44 +0100 Subject: refactor(modules/legacy/conf/nvim): Move to `by-name` --- .../plgs/telescope/extensions/bibtex/default.nix | 17 ----- .../nvim/plgs/telescope/extensions/default.nix | 9 --- .../plgs/telescope/extensions/frecency/default.nix | 22 ------- .../telescope/extensions/fzy-native/default.nix | 5 -- .../plgs/telescope/extensions/rooter/default.nix | 7 -- .../telescope/extensions/rooter/lua/rooter.lua | 76 ---------------------- .../plgs/telescope/extensions/symbols/default.nix | 52 --------------- 7 files changed, 188 deletions(-) delete mode 100644 modules/home.legacy/conf/nvim/plgs/telescope/extensions/bibtex/default.nix delete mode 100644 modules/home.legacy/conf/nvim/plgs/telescope/extensions/default.nix delete mode 100644 modules/home.legacy/conf/nvim/plgs/telescope/extensions/frecency/default.nix delete mode 100644 modules/home.legacy/conf/nvim/plgs/telescope/extensions/fzy-native/default.nix delete mode 100644 modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/default.nix delete mode 100644 modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua delete mode 100644 modules/home.legacy/conf/nvim/plgs/telescope/extensions/symbols/default.nix (limited to 'modules/home.legacy/conf/nvim/plgs/telescope/extensions') diff --git a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/bibtex/default.nix b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/bibtex/default.nix deleted file mode 100644 index 6f3cc2ea..00000000 --- a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/bibtex/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{pkgs, ...}: { - # WARNING: This is only activated in tex files via the ftplugin. - programs.nixvim = { - extraPlugins = [ - pkgs.vimExtraPlugins.telescope-bibtex-nvim - ]; - keymaps = [ - { - key = "ib"; - # This is registered in the ftplugin file, so we set this to null here - action = ""; - mode = "n"; - options.desc = "[i]nsert a [b]atex citation"; - } - ]; - }; -} diff --git a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/default.nix b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/default.nix deleted file mode 100644 index 0b1e033a..00000000 --- a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{...}: { - imports = [ - ./bibtex - ./frecency - ./fzy-native - ./rooter - ./symbols - ]; -} diff --git a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/frecency/default.nix b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/frecency/default.nix deleted file mode 100644 index 0e007b80..00000000 --- a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/frecency/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{...}: { - programs.nixvim = { - keymaps = [ - { - key = "gff"; - mode = "n"; - action.__raw = "function() require('telescope').extensions.frecency.frecency() end"; - options.desc = "activate the frecency file selection"; - } - ]; - plugins.telescope = { - extensions.frecency = { - enable = true; - settings = { - show_scores = true; - db_safe_mode = false; - default_workspace = "CWD"; # or 'LSP' - }; - }; - }; - }; -} diff --git a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/fzy-native/default.nix b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/fzy-native/default.nix deleted file mode 100644 index ce0bdccc..00000000 --- a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/fzy-native/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - programs.nixvim.plugins.telescope.extensions.fzy-native = { - enable = true; - }; -} diff --git a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/default.nix b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/default.nix deleted file mode 100644 index 779448cc..00000000 --- a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{lib, ...}: { - programs.nixvim = { - extraConfigLuaPost = '' - ${lib.strings.fileContents ./lua/rooter.lua} - ''; - }; -} diff --git a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua deleted file mode 100644 index 48a8588d..00000000 --- a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua +++ /dev/null @@ -1,76 +0,0 @@ --- Taken from: https://github.com/desdic/telescope-rooter.nvim/blob/69423216c75a5f1f1477bbf8faf6b0dc8af04099/lua/telescope/_extensions/rooter.lua -local has_telescope, telescope = pcall(require, "telescope") -if not has_telescope then - error("This extension requires telescope.nvim") - return -end - -local has_plenary, plenary = pcall(require, "plenary") -if not has_plenary then - error("This extension requires plenary") - return -end - -local log = plenary.log.new({ plugin = "telescope_rooter", level = "info" }) - --- TODO: expose this function -local toggle = function(_) - vim.g["Telescope#rooter#enabled"] = not vim.g["Telescope#rooter#enabled"] - print("Telescope#rooter#enabled=" .. vim.inspect(vim.g["Telescope#rooter#enabled"])) -end - -local config = { patterns = { ".git" }, enable = true, debug = false } - --- default enabled -vim.g["Telescope#rooter#enabled"] = vim.F.if_nil(config.enable, true) - --- redefine log if debug enabled -if vim.F.if_nil(config.debug, false) then log = plenary.log.new({ plugin = "telescope_rooter", level = "debug" }) end - -local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true }) - -vim.api.nvim_create_autocmd({ "DirChangedPre" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end - - if vim.g["Telescope#rooter#oldpwd"] == nil then - vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() - log.debug("before " .. vim.inspect(vim.loop.cwd())) - end - end, - group = group, -}) - -vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end - - vim.schedule(function() - if vim.bo.filetype == "TelescopePrompt" then - local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true })[1]) - if rootdir ~= nil then - vim.api.nvim_set_current_dir(rootdir) - log.debug("changing dir to " .. rootdir) - end - end - end) - end, - group = group, -}) - -vim.api.nvim_create_autocmd({ "BufWinLeave" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end - - vim.schedule(function() - if vim.bo.filetype ~= "TelescopePrompt" then - if vim.g["Telescope#rooter#oldpwd"] ~= nil then - log.debug("restoring " .. vim.g["Telescope#rooter#oldpwd"]) - vim.api.nvim_set_current_dir(vim.g["Telescope#rooter#oldpwd"]) - vim.g["Telescope#rooter#oldpwd"] = nil - end - end - end) - end, - group = group, -}) diff --git a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/symbols/default.nix b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/symbols/default.nix deleted file mode 100644 index 05b4a4f2..00000000 --- a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/symbols/default.nix +++ /dev/null @@ -1,52 +0,0 @@ -{pkgs, ...}: { - programs.nixvim = { - extraPlugins = [ - # Source of symbols for telescope symbols - pkgs.vimPlugins.telescope-symbols-nvim - ]; - keymaps = [ - { - key = "il"; - mode = "n"; - action.__raw = '' - function() - require('telescope.builtin').symbols{ sources = { - 'latex' - }} - end - ''; - options.desc = "[i]nsert a [l]atex symbol"; - } - { - key = "ie"; - mode = "n"; - action.__raw = '' - function() - require('telescope.builtin').symbols{ sources = { - 'emoji', - }} - end - ''; - options.desc = "[i]nsert a [e]moji"; - } - { - key = "is"; - mode = "n"; - action.__raw = '' - function() - require('telescope.builtin').symbols{ sources = { - 'emoji', - 'gitmoji', - 'julia', - 'kaomoji', - 'latex', - 'math', - 'nerd', - }} - end - ''; - options.desc = "[i]nsert a [s]ymbol (like emojis)"; - } - ]; - }; -} -- cgit 1.4.1