summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorKyren223 <ulmliad223@gmail.com>2024-08-05 22:12:19 +0300
committerKyren223 <ulmliad223@gmail.com>2024-08-05 22:12:19 +0300
commitd1aa9a979cbfe8b581f63295d30d49b77cad5b84 (patch)
treed9437b8dbd42cc154307c93f0bbc64bf7a9f1365 /.config
parentd350630fad47ee669353f5c1c2bd8af63acbfcb8 (diff)
refactor(nvim)!: Notify function signature and Notify usages
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/lua/custom/config/commands.lua10
-rw-r--r--.config/nvim/lua/custom/globals.lua19
2 files changed, 18 insertions, 11 deletions
diff --git a/.config/nvim/lua/custom/config/commands.lua b/.config/nvim/lua/custom/config/commands.lua
index 9cec025..acb2cbb 100644
--- a/.config/nvim/lua/custom/config/commands.lua
+++ b/.config/nvim/lua/custom/config/commands.lua
@@ -32,19 +32,19 @@ vim.api.nvim_create_user_command('FormatToggle', function(args)
if is_global then
vim.g.disable_autoformat = not vim.g.disable_autoformat
if vim.g.disable_autoformat then
- Notify('Autoformat-on-save disabled globally', 'info')
+ Notify('Autoformat on save disabled globally')
else
- Notify('Autoformat-on-save enabled globally', 'info')
+ Notify('Autoformat on save enabled globally')
end
else
vim.b.disable_autoformat = not vim.b.disable_autoformat
if vim.b.disable_autoformat then
- Notify('Autoformat-on-save disabled for this buffer', 'info')
+ Notify('Autoformat on save disabled for this buffer')
else
- Notify('Autoformat-on-save enabled for this buffer', 'info')
+ Notify('Autoformat on save enabled for this buffer')
end
end
end, {
- desc = 'Toggle autoformat-on-save',
+ desc = 'Toggle autoformat on save',
bang = true,
})
diff --git a/.config/nvim/lua/custom/globals.lua b/.config/nvim/lua/custom/globals.lua
index ccadddd..106009a 100644
--- a/.config/nvim/lua/custom/globals.lua
+++ b/.config/nvim/lua/custom/globals.lua
@@ -1,16 +1,23 @@
-function Notify(title, message, level)
+function Notify(message, title, level)
+ if not title then
+ if not level then
+ title = 'info'
+ else
+ title = level
+ end
+ end
local notify = require('notify')
- notify(message, level, { title = title })
+ notify(message, level, { title = ' ' .. title })
end
function ToggleWrap()
if vim.wo.wrap then
vim.wo.wrap = false
- Notify('Wrap disabled', 'info')
+ Notify('Wrap disabled')
else
vim.wo.wrap = true
vim.wo.number = false
- Notify('Wrap enabled', 'info')
+ Notify('Wrap enabled')
end
end
@@ -18,8 +25,8 @@ function ToggleInlayHints()
local is_enabled = vim.lsp.inlay_hint.is_enabled({})
vim.lsp.inlay_hint.enable(not is_enabled)
if is_enabled then
- Notify('Inlay Hints disabled', 'info')
+ Notify('Inlay Hints disabled')
else
- Notify('Inlay Hints enabled', 'info')
+ Notify('Inlay Hints enabled')
end
end