Add theme-set/switching logic, and minor nvim, tmux, obsidian changes
This commit is contained in:
34
src_files/.config/nvim/lua/util_functions.lua
Normal file
34
src_files/.config/nvim/lua/util_functions.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
function ThemeUpdate()
|
||||
local scheme_name = "tokyodark" -- default if unable to parse from file
|
||||
local current_theme_file = vim.fn.stdpath("config") .. "/current-theme"
|
||||
local ok, theme = pcall(dofile, current_theme_file)
|
||||
if ok then
|
||||
scheme_name = theme.colorscheme_name
|
||||
end
|
||||
vim.cmd.colorscheme(scheme_name)
|
||||
pcall(dofile, vim.fn.stdpath('config') .. '/lua/theme_transparency.lua')
|
||||
end
|
||||
|
||||
function TmpBuff(split_opt)
|
||||
local new_cmd = split_opt or "enew"
|
||||
vim.cmd(new_cmd)
|
||||
vim.opt_local.buftype = "nofile"
|
||||
vim.opt_local.bufhidden = "hide"
|
||||
vim.opt_local.swapfile = false
|
||||
vim.cmd("file tmp_" .. os.date("%Y%m%d_%H%M%S"))
|
||||
end
|
||||
|
||||
function ReadShellCmd(command)
|
||||
vim.cmd("read !" .. command)
|
||||
end
|
||||
|
||||
function ToggleTabsSpaces()
|
||||
if vim.opt.expandtab:get() then
|
||||
vim.opt.expandtab = false
|
||||
print("using actual tabs")
|
||||
else
|
||||
vim.opt.expandtab = true
|
||||
print("using spaces in place of tabs")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user