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
|
return {
{
'junegunn/goyo.vim',
cond = function() return vim.fn.has('gui_running') == 1 end,
dependencies = {
{
'junegunn/limelight.vim',
},
},
keys = {
{ '<leader>z', '<cmd>Goyo<CR>', desc = 'Goyo' },
},
config = function()
local goyo_enter = function()
vim.opt.showmode = false
vim.opt.showcmd = false
vim.opt.scrolloff = 999
vim.opt.laststatus = 0
local gl = require('galaxyline')
local gls = gl.section
gls.left = {}
gls.mid = {}
gls.right = {}
vim.cmd('Limelight')
vim.cmd('VimRToggleFullscreen')
end
local goyo_leave = function()
local function script_path()
local str = debug.getinfo(2, 'S').source:sub(2)
return str:match('(.*/)') or './'
end
vim.opt.showmode = true
vim.opt.showcmd = true
vim.opt.scrolloff = 5
dofile(script_path() .. '../config/galaxyline.lua')
vim.opt.laststatus = 3
vim.cmd('Limelight!')
vim.cmd('VimRToggleFullscreen')
end
local goyo_augroup = vim.api.nvim_create_augroup('Goyo', { clear = true })
vim.api.nvim_create_autocmd('User',
{
pattern = 'GoyoEnter',
group = goyo_augroup,
callback = goyo_enter,
})
vim.api.nvim_create_autocmd('User',
{
pattern = 'GoyoLeave',
group = goyo_augroup,
callback = goyo_leave,
})
end,
},
}
|