Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui)!: improve user experience wrt transparent bg #865

Merged
merged 2 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/core/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ vim.api.nvim_create_autocmd("BufEnter", {
local layout = vim.api.nvim_call_function("winlayout", {})
if
layout[1] == "leaf"
and vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(layout[2]), "filetype") == "NvimTree"
and vim.api.nvim_get_option_value("filetype", { buf = vim.api.nvim_win_get_buf(layout[2]) }) == "NvimTree"
and layout[3] == nil
then
vim.api.nvim_command([[confirm quit]])
Expand Down
6 changes: 4 additions & 2 deletions lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ local function load_options()
local global_local = {
-- backupdir = global.cache_dir .. "backup/",
-- directory = global.cache_dir .. "swap/",
-- pumblend = 10,
-- spellfile = global.cache_dir .. "spell/en.uft-8.add",
-- viewdir = global.cache_dir .. "view/",
-- winblend = 10,
autoindent = true,
autoread = true,
autowrite = true,
Expand Down Expand Up @@ -53,6 +51,8 @@ local function load_options()
mousescroll = "ver:3,hor:6",
number = true,
previewheight = 12,
-- Do NOT adjust the following option (pumblend) if you're using transparent background
pumblend = 0,
pumheight = 15,
redrawtime = 1500,
relativenumber = true,
Expand Down Expand Up @@ -95,6 +95,8 @@ local function load_options()
whichwrap = "h,l,<,>,[,],~",
wildignore = ".git,.hg,.svn,*.pyc,*.o,*.out,*.jpg,*.jpeg,*.png,*.gif,*.zip,**/tmp/**,*.DS_Store,**/node_modules/**,**/bower_modules/**",
wildignorecase = true,
-- Do NOT adjust the following option (winblend) if you're using transparent background
winblend = 0,
winminwidth = 10,
winwidth = 30,
wrap = false,
Expand Down
2 changes: 1 addition & 1 deletion lua/modules/configs/ui/bufferline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ return function()
highlights = require("catppuccin.groups.integrations.bufferline").get({
styles = { "italic", "bold" },
custom = {
mocha = {
all = {
-- Hint
hint = { fg = cp.rosewater },
hint_visible = { fg = cp.rosewater },
Expand Down
1 change: 1 addition & 0 deletions lua/modules/configs/ui/catppuccin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ return function()
TroubleNormal = { bg = transparent_background and cp.none or cp.base },

-- For telescope.nvim
TelescopeMatching = { fg = cp.lavender },
TelescopeResultsDiffAdd = { fg = cp.green },
TelescopeResultsDiffChange = { fg = cp.yellow },
TelescopeResultsDiffDelete = { fg = cp.red },
Expand Down
6 changes: 3 additions & 3 deletions lua/modules/configs/ui/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ return function()

lsp = {
function()
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
local buf_ft = vim.api.nvim_get_option_value("filetype", { scope = "local" })
local clients = vim.lsp.get_active_clients()
local lsp_lists = {}
local available_servers = {}
Expand Down Expand Up @@ -206,7 +206,7 @@ return function()
return venv
end

if vim.api.nvim_buf_get_option(0, "filetype") == "python" then
if vim.api.nvim_get_option_value("filetype", { scope = "local" }) == "python" then
local venv = os.getenv("CONDA_DEFAULT_ENV")
if venv then
return string.format("%s", env_cleanup(venv))
Expand All @@ -224,7 +224,7 @@ return function()

tabwidth = {
function()
return icons.ui.Tab .. vim.api.nvim_buf_get_option(0, "shiftwidth")
return icons.ui.Tab .. vim.api.nvim_get_option_value("shiftwidth", { scope = "local" })
end,
padding = 1,
},
Expand Down
12 changes: 8 additions & 4 deletions lua/modules/configs/ui/notify.lua
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
return function()
local notify = require("notify")
local colors = require("modules.utils").get_palette()
local icons = {
diagnostics = require("modules.utils.icons").get("diagnostics"),
ui = require("modules.utils.icons").get("ui"),
}

notify.setup({
---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" }
stages = "slide",
stages = "fade",
---@usage Function called when a new window is opened, use for changing win settings/config
on_open = nil,
on_open = function(win)
vim.api.nvim_set_option_value("winblend", 0, { scope = "local", win = win })
vim.api.nvim_win_set_config(win, { zindex = 90 })
end,
---@usage Function called when a window is closed
on_close = nil,
---@usage timeout for notifications in ms, default 5000
timeout = 2000,
-- @usage User render fps value
fps = 30,
fps = 20,
-- Render function for notifications. See notify-render()
render = "default",
---@usage highlight behind the window for stages that change opacity
background_colour = "Normal",
background_colour = colors.base,
---@usage minimum width for notification windows
minimum_width = 50,
---@usage notifications with level lower than this would be ignored. [ERROR > WARN > INFO > DEBUG > TRACE]
Expand Down
2 changes: 1 addition & 1 deletion lua/modules/configs/ui/scrollview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return function()
require("scrollview").setup({
scrollview_mode = "virtual",
excluded_filetypes = { "NvimTree", "terminal", "nofile" },
winblend = 55,
winblend = 0,
signs_on_startup = { "diagnostics", "folds", "marks", "search", "spell" },
diagnostics_error_symbol = icons.diagnostics.Error,
diagnostics_warn_symbol = icons.diagnostics.Warning,
Expand Down
2 changes: 1 addition & 1 deletion lua/modules/configs/ui/specs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ return function()
inc_ms = 10, -- time increments used for fade/resize effects
blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
width = 10,
winhl = "PMenu",
winhl = "PmenuSbar",
fader = require("specs").pulse_fader,
resizer = require("specs").shrink_resizer,
},
Expand Down
1 change: 0 additions & 1 deletion lua/modules/utils/icons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ local data = {
misc = {
Campass = "󰀹",
Code = "",
EscapeST = "",
Gavel = "",
Glass = "󰂖",
NoActiveLsp = "󱚧",
Expand Down