Skip to content

Instantly share code, notes, and snippets.

@soyuka
Created October 9, 2023 12:53
Show Gist options
  • Save soyuka/cce8910180b43230e0ef0c8bf2ec68d5 to your computer and use it in GitHub Desktop.
Save soyuka/cce8910180b43230e0ef0c8bf2ec68d5 to your computer and use it in GitHub Desktop.
No distraction mode neovim
local NoDistraction = { enabled = 0 }
NoDistraction.enable = function()
NoDistraction.enabled = 1
vim.cmd([[
set noshowmode
set noruler
set laststatus=0
set noshowcmd
set nonumber
set showtabline=0
]])
end
NoDistraction.disable = function()
NoDistraction.enabled = 0
vim.cmd([[
set showmode
set ruler
set laststatus=2
set showcmd
set number
set showtabline=2
]])
end
NoDistraction.toggle = function()
if NoDistraction.enabled == 0 then
NoDistraction.enable()
else
NoDistraction.disable()
end
end
vim.keymap.set('n', '<Leader>F', function()
NoDistraction.toggle()
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment