-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bindings.lua
72 lines (65 loc) · 2.2 KB
/
bindings.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
local fn = require('tmux.lib.fn')
local cmds = require('tmux.commands')
return fn.nested(2, function (P, M)
M.bind(P.prefix, cmds.send_prefix {} )
-- splits
M.bind('c', cmds.new_window {} )
M.bind('n', cmds.next_window {} )
M.bind('p', cmds.previous_window {} )
M.bind('%', cmds.split_window { 'v' } )
M.bind('"', cmds.split_window { 'h' } )
M.bind('&', cmds.kill_window {} )
M.bind(',', cmds.command_prompt {
I = function ()
return vim.fn.fnamemodify(
vim.api.nvim_buf_get_var(0, 'term_title'), ':t'
)
end,
p = '(rename window) ',
cmds.rename_window
})
M.bind('<space>', cmds.next_layout {} )
M.bind('<C-o>', cmds.rotate_window {} )
M.bind('<A-o>', cmds.rotate_window { 'U' } )
-- move between windows
for idx = 1, 10 do
M.bind(
string.format('%s', idx - 1),
cmds.select_window { t = idx - 1 }
)
end
M.bind('l', cmds.select_window { 'l' } )
-- pane management
M.bind('!', cmds.break_pane {} )
M.bind('x', cmds.confirm_before {
p = function ()
return string.format('kill pane %s? (y/n)', vim.fn.winnr())
end,
cmds.kill_pane {}
})
M.bind('{', cmds.swap_pane { 'U' } )
M.bind('}', cmds.swap_pane { 'D' } )
-- move between panes
M.bind('<left>', cmds.select_pane { 'L' } )
M.bind('<down>', cmds.select_pane { 'D' } )
M.bind('<up>', cmds.select_pane { 'U' } )
M.bind('<right>', cmds.select_pane { 'R' } )
M.bind(';', cmds.last_pane {} )
M.bind('o', cmds.select_pane { t = ':.+' } )
-- resize
M.bind('<A-left>', cmds.resize_pane { L = 8 }, { 'r' })
M.bind('<A-right>', cmds.resize_pane { R = 8 }, { 'r' })
M.bind('<A-up>', cmds.resize_pane { U = 4 }, { 'r' })
M.bind('<A-down>', cmds.resize_pane { D = 4 }, { 'r' })
M.bind('<C-left>', cmds.resize_pane { L = 1 }, { 'r' })
M.bind('<C-right>', cmds.resize_pane { R = 1 }, { 'r' })
M.bind('<C-up>', cmds.resize_pane { U = 1 }, { 'r' })
M.bind('<C-down>', cmds.resize_pane { D = 1 }, { 'r' })
M.bind('z', cmds.resize_pane { 'Z' })
-- command prompt
M.bind(':', cmds.command_prompt {} )
-- copy mode (back to normal mode)
M.bind('[', cmds.copy_mode {} )
M.bind(']', cmds.paste_buffer {} )
M.bind('q', cmds.cancel {}, { T = 'copy-mode' })
end)