Browse Source

quick toggle light and dark mode

pull/14/head
Leslie Kerman 2 years ago
parent
commit
f75351249c
  1. 21
      lua/core/keymaps.lua
  2. 2
      lua/core/theme.lua

21
lua/core/keymaps.lua

@ -1,9 +1,25 @@
local function set_bg_light()
vim.cmd('set background=light')
local colors_name = vim.g.colors_name
vim.cmd('colorscheme shine')
vim.cmd('colorscheme ' .. colors_name)
end
local function set_bg_dark()
vim.cmd('set background=dark')
local colors_name = vim.g.colors_name
vim.cmd('colorscheme ron')
vim.cmd('colorscheme ' .. colors_name)
end
vim.g.mapleader = ';'
-- keymaps
vim.keymap.set('i', '<C-g>', '<esc>')
vim.keymap.set('i', '<C-;>', '::') -- for C++ and Rust
vim.keymap.set('n', '\\', ':')
vim.keymap.set('n', '<leader>vl', set_bg_light)
vim.keymap.set('n', '<leader>vd', set_bg_dark)
vim.keymap.set('n', '<leader>', ':')
-- f: file tree
vim.keymap.set('n', '<F3>', ':NvimTreeToggle<cr>')
vim.keymap.set('n', '<leader>ft', ':NvimTreeToggle<cr>')
@ -75,8 +91,9 @@ vim.keymap.set('n', '<leader>wl', function() print(vim.inspect(vim.lsp.buf.list_
-- t: terminal
-- use <f5> to toggle terminal, this can be set in lua/configs/terminal.lua
-- the default position is also set in lua/configs/terminal.lua
vim.keymap.set('t', '<esc>', '<C-\\><C-n>')
vim.keymap.set('t', '<C-g>', '<C-\\><C-n>')
vim.keymap.set('n', '<leader>tt', ':ToggleTerm direction=tab<cr>')
vim.keymap.set('n', '<leader>tn', function() require('toggleterm.terminal').Terminal:new():toggle() end)
vim.keymap.set('n', '<leader>tf', ':ToggleTerm direction=float<cr>')
vim.keymap.set('n', '<leader>th', ':ToggleTerm direction=horizontal<cr>')
vim.keymap.set('n', '<leader>tv', ':ToggleTerm direction=vertical<cr>')

2
lua/core/theme.lua

@ -49,7 +49,7 @@
vim.g.edge_style = 'aura' -- neon, aura
vim.g.edge_better_performance = 1
vim.cmd("colorscheme edge")
vim.cmd("set background=dark")
vim.cmd("set background=light")
-- github
-- vim.cmd("colorscheme github_dark")

Loading…
Cancel
Save