Skip to content

Commit 6d05793

Browse files
plugins/tv: init
1 parent ae02d8b commit 6d05793

File tree

3 files changed

+140
-0
lines changed

3 files changed

+140
-0
lines changed

plugins/by-name/tv/default.nix

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{ lib, ... }:
2+
lib.nixvim.plugins.mkNeovimPlugin {
3+
name = "tv";
4+
package = "tv-nvim";
5+
6+
dependencies = [
7+
"fd"
8+
"television"
9+
];
10+
11+
maintainers = [ lib.maintainers.HeitorAugustoLN ];
12+
13+
settingsExample = {
14+
global_keybindings.channels = "<leader>tv";
15+
quickfix.auto_open = false;
16+
tv_binary = "tv";
17+
};
18+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{ lib, ... }:
2+
{
3+
empty = {
4+
plugins.tv.enable = true;
5+
};
6+
7+
defaults = {
8+
plugins.tv = {
9+
enable = true;
10+
settings = {
11+
window = {
12+
width = 0.8;
13+
height = 0.8;
14+
border = "none";
15+
title = " tv.nvim ";
16+
title_pos = "center";
17+
};
18+
19+
channels = {
20+
files = {
21+
keybinding = "<C-p>";
22+
handlers = {
23+
"<CR>" = lib.nixvim.mkRaw "require('tv').handlers.open_as_files";
24+
"<C-q>" = lib.nixvim.mkRaw "require('tv').handlers.send_to_quickfix";
25+
"<C-s>" = lib.nixvim.mkRaw "require('tv').handlers.open_in_split";
26+
"<C-v>" = lib.nixvim.mkRaw "require('tv').handlers.open_in_vsplit";
27+
"<C-y>" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard";
28+
};
29+
};
30+
text = {
31+
keybinding = "<leader><leader>";
32+
handlers = {
33+
"<CR>" = lib.nixvim.mkRaw "require('tv').handlers.open_at_line";
34+
"<C-q>" = lib.nixvim.mkRaw "require('tv').handlers.send_to_quickfix";
35+
"<C-s>" = lib.nixvim.mkRaw "require('tv').handlers.open_in_split";
36+
"<C-v>" = lib.nixvim.mkRaw "require('tv').handlers.open_in_vsplit";
37+
"<C-y>" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard";
38+
};
39+
};
40+
git-log = {
41+
keybinding = "<leader>gl";
42+
handlers = {
43+
"<CR>" = lib.nixvim.mkRaw ''
44+
function(entries, config)
45+
if #entries > 0 then
46+
vim.cmd('enew | setlocal buftype=nofile bufhidden=wipe')
47+
vim.cmd('silent 0read !git show ' .. vim.fn.shellescape(entries[1]))
48+
vim.cmd('1delete _ | setlocal filetype=git nomodifiable')
49+
vim.cmd('normal! gg')
50+
end
51+
end
52+
'';
53+
"<C-y>" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard";
54+
};
55+
};
56+
git-branch = {
57+
keybinding = "<leader>gb";
58+
handlers = {
59+
"<CR>" = lib.nixvim.mkRaw "require('tv').handlers.execute_shell_command('git checkout {}')";
60+
"<C-y>" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard";
61+
};
62+
};
63+
docker-images = {
64+
keybinding = "<leader>di";
65+
window = {
66+
title = " Docker Images ";
67+
};
68+
handlers = {
69+
"<CR>" = lib.nixvim.mkRaw ''
70+
function(entries, config)
71+
if #entries > 0 then
72+
vim.ui.input({
73+
prompt = 'Container name: ',
74+
default = 'my-container',
75+
}, function(name)
76+
if name and name ~= "" then
77+
local cmd = string.format('docker run -it --name %s %s', name, entries[1])
78+
vim.cmd('!' .. cmd)
79+
end
80+
end)
81+
end
82+
end
83+
'';
84+
"<C-y>" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard";
85+
};
86+
};
87+
env = {
88+
keybinding = "<leader>ev";
89+
handlers = {
90+
"<CR>" = lib.nixvim.mkRaw "require('tv').handlers.insert_at_cursor";
91+
"<C-l>" = lib.nixvim.mkRaw "require('tv').handlers.insert_on_new_line";
92+
"<C-y>" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard";
93+
};
94+
};
95+
alias = {
96+
keybinding = "<leader>al";
97+
handlers = {
98+
"<CR>" = lib.nixvim.mkRaw "require('tv').handlers.insert_at_cursor";
99+
"<C-y>" = lib.nixvim.mkRaw "require('tv').handlers.copy_to_clipboard";
100+
};
101+
};
102+
};
103+
global_keybindings.channels = "<leader>tv";
104+
quickfix.auto_open = false;
105+
tv_binary = "tv";
106+
};
107+
};
108+
};
109+
110+
example = {
111+
plugins.tv = {
112+
enable = true;
113+
114+
settings = {
115+
global_keybindings.channels = "<leader>tv";
116+
quickfix.auto_open = false;
117+
tv_binary = "tv";
118+
};
119+
};
120+
};
121+
}

typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tro = "tro" # ./plugins/utils/spectre.nix
1616
protols = "protols" # ./plugins/lsp/lsp-packages.nix
1717
compatibilty = "compatibilty" # ./plugins/by-name/visual-multi/default.nix
1818
Maco = "Maco" # ./plugins/by-name/femaco
19+
enew = "enew"
1920

2021
[type.patch]
2122
extend-glob = ["*.patch"]

0 commit comments

Comments
 (0)