-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfocus-config.lua
More file actions
59 lines (53 loc) · 1.71 KB
/
focus-config.lua
File metadata and controls
59 lines (53 loc) · 1.71 KB
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
local M = {
'nvim-focus/focus.nvim',
event = 'UIEnter',
}
M.init = function()
local ignore_buftypes = { 'nofile', 'prompt', 'popup', 'terminal' }
local ignore_filetypes = { 'codecompanion' }
local augroup = vim.api.nvim_create_augroup('FocusDisable', { clear = true })
vim.api.nvim_create_autocmd('WinEnter', {
group = augroup,
callback = function(_)
if vim.tbl_contains(ignore_buftypes, vim.bo.buftype) then
vim.w.focus_disable = true
else
vim.w.focus_disable = false
end
end,
desc = 'Disable focus autoresize for BufType',
})
vim.api.nvim_create_autocmd('FileType', {
group = augroup,
callback = function(_)
if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
vim.b.focus_disable = true
else
vim.b.focus_disable = false
end
end,
desc = 'Disable focus autoresize for FileType',
})
end
M.opts = {
autoresize = {
minwidth = 30,
minheight = 10,
},
ui = {
signcolumn = false,
}
}
M.keys = function()
local focus_keymaps = require('config.keymaps').focus
return {
{ focus_keymaps.toggle_enable, '<Cmd>FocusToggle<CR>' },
{ focus_keymaps.toggle_size, '<Cmd>FocusMaxOrEqual<CR>' },
{ focus_keymaps.split_cycle, '<Cmd>FocusSplitCycle<CR>' },
{ focus_keymaps.split_left, '<Cmd>FocusSplitLeft<CR>' },
{ focus_keymaps.split_right, '<Cmd>FocusSplitRight<CR>' },
{ focus_keymaps.split_up, '<Cmd>FocusSplitUp<CR>' },
{ focus_keymaps.split_down, '<Cmd>FocusSplitDown<CR>' },
}
end
return M