diff --git a/plugins/by-name/tv/default.nix b/plugins/by-name/tv/default.nix new file mode 100644 index 00000000..b908a568 --- /dev/null +++ b/plugins/by-name/tv/default.nix @@ -0,0 +1,18 @@ +{ lib, ... }: +lib.nixvim.plugins.mkNeovimPlugin { + name = "tv"; + package = "tv-nvim"; + + dependencies = [ + "fd" + "television" + ]; + + maintainers = [ lib.maintainers.HeitorAugustoLN ]; + + settingsExample = { + global_keybindings.channels = "tv"; + quickfix.auto_open = false; + tv_binary = "tv"; + }; +} diff --git a/tests/test-sources/plugins/by-name/tv/default.nix b/tests/test-sources/plugins/by-name/tv/default.nix new file mode 100644 index 00000000..37bb5f6d --- /dev/null +++ b/tests/test-sources/plugins/by-name/tv/default.nix @@ -0,0 +1,121 @@ +{ lib }: +{ + empty = { + plugins.tv.enable = true; + }; + + defaults = { + plugins.tv = { + enable = true; + settings = { + window = { + width = 0.8; + height = 0.8; + border = "none"; + title = " tv.nvim "; + title_pos = "center"; + }; + + channels = { + files = { + keybinding = ""; + handlers = { + "" = lib.nixvim.mkRaw "require('tv').handlers.open_as_files"; + "" = lib.nixvim.mkRaw "require('tv').handlers.send_to_quickfix"; + "" = lib.nixvim.mkRaw "require('tv').handlers.open_in_split"; + "" = lib.nixvim.mkRaw "require('tv').handlers.open_in_vsplit"; + "" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard"; + }; + }; + text = { + keybinding = ""; + handlers = { + "" = lib.nixvim.mkRaw "require('tv').handlers.open_at_line"; + "" = lib.nixvim.mkRaw "require('tv').handlers.send_to_quickfix"; + "" = lib.nixvim.mkRaw "require('tv').handlers.open_in_split"; + "" = lib.nixvim.mkRaw "require('tv').handlers.open_in_vsplit"; + "" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard"; + }; + }; + git-log = { + keybinding = "gl"; + handlers = { + "" = lib.nixvim.mkRaw '' + function(entries, config) + if #entries > 0 then + vim.cmd('enew | setlocal buftype=nofile bufhidden=wipe') + vim.cmd('silent 0read !git show ' .. vim.fn.shellescape(entries[1])) + vim.cmd('1delete _ | setlocal filetype=git nomodifiable') + vim.cmd('normal! gg') + end + end + ''; + "" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard"; + }; + }; + git-branch = { + keybinding = "gb"; + handlers = { + "" = lib.nixvim.mkRaw "require('tv').handlers.execute_shell_command('git checkout {}')"; + "" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard"; + }; + }; + docker-images = { + keybinding = "di"; + window = { + title = " Docker Images "; + }; + handlers = { + "" = lib.nixvim.mkRaw '' + function(entries, config) + if #entries > 0 then + vim.ui.input({ + prompt = 'Container name: ', + default = 'my-container', + }, function(name) + if name and name ~= "" then + local cmd = string.format('docker run -it --name %s %s', name, entries[1]) + vim.cmd('!' .. cmd) + end + end) + end + end + ''; + "" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard"; + }; + }; + env = { + keybinding = "ev"; + handlers = { + "" = lib.nixvim.mkRaw "require('tv').handlers.insert_at_cursor"; + "" = lib.nixvim.mkRaw "require('tv').handlers.insert_on_new_line"; + "" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard"; + }; + }; + alias = { + keybinding = "al"; + handlers = { + "" = lib.nixvim.mkRaw "require('tv').handlers.insert_at_cursor"; + "" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard"; + }; + }; + }; + global_keybindings.channels = "tv"; + quickfix.auto_open = false; + tv_binary = "tv"; + }; + }; + }; + + example = { + plugins.tv = { + enable = true; + + settings = { + global_keybindings.channels = "tv"; + quickfix.auto_open = false; + tv_binary = "tv"; + }; + }; + }; +} diff --git a/typos.toml b/typos.toml index 863ad310..86fe0d2a 100644 --- a/typos.toml +++ b/typos.toml @@ -16,6 +16,7 @@ tro = "tro" # ./plugins/utils/spectre.nix protols = "protols" # ./plugins/lsp/lsp-packages.nix compatibilty = "compatibilty" # ./plugins/by-name/visual-multi/default.nix Maco = "Maco" # ./plugins/by-name/femaco +enew = "enew" # ./tests/test-sources/plugins/by-name/tv/default.nix [type.patch] extend-glob = ["*.patch"]