Created
March 8, 2021 22:34
-
-
Save olimorris/f874b574fec2d1f48514d45d5ab0d18b to your computer and use it in GitHub Desktop.
This file contains 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
----------------------------- Terminal Toggle ------------------------------ {{{ | |
-- Uses the awesome kassio/neoterm plugin | |
function TermToggle(height) | |
-- Always open the terminal in a horizontal pane at the bottom | |
g.neoterm_default_mod = 'botright' | |
-- Set the height of the terminal | |
g.neoterm_size = height | |
cmd ':Ttoggle' | |
end | |
utils.map('n', '<C-x>', ':call v:lua.TermToggle(8)<cr>', {silent = true}) | |
utils.map('i', '<C-x>', '<esc>:call v:lua.TermToggle(8)<cr>', {silent = true}) | |
utils.map('t', '<C-x>', '<C-\\><C-n>:call v:lua.TermToggle(8)<cr>', {silent = true}) | |
---------------------------------------------------------------------------- }}} | |
------------------------------- Minimal Mode ------------------------------- {{{ | |
minimal_mode = 0 | |
function ToggleMinimal() | |
if minimal_mode == 0 then | |
minimal_mode = 1 | |
w.number = false | |
w.colorcolumn = '0' | |
w.signcolumn = 'no' | |
o.laststatus = 0 | |
o.showtabline = 0 | |
cmd 'ScrollViewDisable' | |
else | |
minimal_mode = 0 | |
w.number = true | |
w.colorcolumn = '80' | |
w.signcolumn = 'yes' | |
o.laststatus = 2 | |
o.showtabline = 2 | |
cmd 'ScrollViewEnable' | |
end | |
end | |
utils.map('n', '<S-m>', ':call v:lua.ToggleMinimal()<cr>', {silent = true}) | |
---------------------------------------------------------------------------- }}} | |
------------------------------- Theme Toggle ------------------------------- {{{ | |
function SetTheme(mode) | |
vim.api.nvim_set_option('background', mode) | |
theme = 'colorscheme '..colorschemes[mode] | |
cmd(theme) | |
end | |
function ThemeToggle() | |
if vim.api.nvim_get_option('background') == 'dark' then | |
mode = 'light' | |
else | |
mode = 'dark' | |
end | |
return pcall(SetTheme, mode) | |
end | |
utils.map('n', '<leader>1', ':call v:lua.ThemeToggle()<cr>', {silent = true}) | |
---------------------------------------------------------------------------- }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment