From 457ce9e6017c081e02a566895fa1fe488cd87b9c Mon Sep 17 00:00:00 2001 From: Michaƫl Ball Date: Thu, 18 Jul 2024 09:07:05 +0100 Subject: Refactor plugins for lazy.nvim --- neovim/.config/nvim/lua/plugins/goyo.lua | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 neovim/.config/nvim/lua/plugins/goyo.lua (limited to 'neovim/.config/nvim/lua/plugins/goyo.lua') diff --git a/neovim/.config/nvim/lua/plugins/goyo.lua b/neovim/.config/nvim/lua/plugins/goyo.lua new file mode 100644 index 0000000..7de7150 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/goyo.lua @@ -0,0 +1,43 @@ +return { + { + 'junegunn/goyo.vim', + cond = function() return vim.fn.exists('g:gui_vimr') == 1 end, + dependencies = { + { + 'junegunn/limelight.vim', + }, + }, + keys = { + { 'z', 'Goyo', desc = 'Goyo' }, + }, + config = function() + local goyo_enter = function() + vim.opt.showmode = false + vim.opt.showcmd = false + vim.opt.scrolloff = 999 + vim.cmd('Limelight') + end + + local goyo_leave = function() + vim.opt.showmode = true + vim.opt.showcmd = true + vim.opt.scrolloff = 5 + vim.cmd('Limelight!') + 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, + }, +} -- cgit v1.2.3