vim.pack.add { { src = 'https://github.com/alexpasmantier/tv.nvim', version = 'main', }, } -- Built-in tv.nvim handlers. local h = require('tv').handlers require('tv').setup { layout = 'landscape', -- 'landscape' (default) or 'portrait' window = { width = 0.8, height = 0.8, border = 'none', title = ' tv.nvim ', title_pos = 'center', }, channels = { files = { layout = 'portrait', keybinding = '', handlers = { [''] = h.open_as_files, [''] = h.send_to_quickfix, [''] = h.open_in_split, [''] = h.open_in_vsplit, [''] = h.copy_to_clipboard, }, }, text = { layout = 'portrait', keybinding = '', handlers = { [''] = h.open_at_line, [''] = h.send_to_quickfix, [''] = h.open_in_split, [''] = h.open_in_vsplit, [''] = h.copy_to_clipboard, }, }, ['git-log'] = { keybinding = 'gl', handlers = { [''] = 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, [''] = h.copy_to_clipboard, }, }, ['git-branch'] = { keybinding = 'gb', handlers = { [''] = h.execute_shell_command 'git checkout {}', [''] = h.copy_to_clipboard, }, }, ['docker-images'] = { keybinding = 'di', window = { title = ' Docker Images ' }, handlers = { [''] = 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, [''] = h.copy_to_clipboard, }, }, env = { keybinding = 'ev', handlers = { [''] = h.insert_at_cursor, [''] = h.insert_on_new_line, [''] = h.copy_to_clipboard, }, }, alias = { keybinding = 'al', handlers = { [''] = h.insert_at_cursor, [''] = h.copy_to_clipboard, }, }, }, tv_binary = 'tv', global_keybindings = { channels = 'tv', }, quickfix = { auto_open = true, }, }