Created
May 27, 2016 10:25
-
-
Save Schniz/5cfc225920486ffa2fb447545b9f6d24 to your computer and use it in GitHub Desktop.
toggle background color for vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if exists("*ToggleBackground") == 0 | |
function ToggleBackground() | |
if &background == "dark" | |
set background=light | |
else | |
set background=dark | |
endif | |
endfunction | |
command BG call ToggleBackground() | |
endif |
In lua the above can be writeen like:
local create_cmd = vim.api.nvim_create_user_command
create_cmd("ToggleBackground", function ()
if vim.o.background == 'dark' then
vim.cmd'set bg=light'
else
vim.cmd'set bg=dark'
end
end, {})
thx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice