summaryrefslogtreecommitdiff
path: root/neovim/.config/nvim/lua/config/goyo.lua
diff options
context:
space:
mode:
Diffstat (limited to 'neovim/.config/nvim/lua/config/goyo.lua')
-rw-r--r--neovim/.config/nvim/lua/config/goyo.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/neovim/.config/nvim/lua/config/goyo.lua b/neovim/.config/nvim/lua/config/goyo.lua
new file mode 100644
index 0000000..dcb7134
--- /dev/null
+++ b/neovim/.config/nvim/lua/config/goyo.lua
@@ -0,0 +1,30 @@
+vim.keymap.set('', '<Leader>z', '<cmd>Goyo<CR><CR>', {})
+vim.keymap.set('x', '<Leader>z', '<cmd>Goyo<CR>', {})
+
+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,
+ })