summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--nvim/.config/nvim/init.lua1
-rw-r--r--nvim/.config/nvim/lazy-lock.json2
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/noice.lua93
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/notify.lua36
-rw-r--r--nvim/.config/nvim/lua/tobyvin/utils/log.lua40
5 files changed, 106 insertions, 66 deletions
diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua
index 7215c31..1a15372 100644
--- a/nvim/.config/nvim/init.lua
+++ b/nvim/.config/nvim/init.lua
@@ -1,2 +1 @@
-require("tobyvin.utils.log")
require("tobyvin")
diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json
index 6bf95c5..049bd6e 100644
--- a/nvim/.config/nvim/lazy-lock.json
+++ b/nvim/.config/nvim/lazy-lock.json
@@ -36,6 +36,8 @@
"neodev.nvim": { "branch": "main", "commit": "8e06acf88e0621badd9499cfcafbce5ca97dfe8e" },
"neogit": { "branch": "master", "commit": "0d6002c6af432343937283fb70791fc76fa7227c" },
"neovim-session-manager": { "branch": "master", "commit": "f8c85da390c5d1ad3bfd229ac2ed805c5742263d" },
+ "noice.nvim": { "branch": "main", "commit": "7816fcd8a43a9de84d7f4695b0688b4f54b25570" },
+ "nui.nvim": { "branch": "main", "commit": "4939282919885e1c83aff68ecb35b3cadf6015a9" },
"null-ls.nvim": { "branch": "main", "commit": "647a1eeeefc43ce15d941972642210637c370471" },
"nvim-bqf": { "branch": "main", "commit": "b418b0a241d36509196944a6f6bee886c775d54f" },
"nvim-cmp": { "branch": "main", "commit": "e55033fce468c9c578b946948807f2ac48a6ee08" },
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/noice.lua b/nvim/.config/nvim/lua/tobyvin/plugins/noice.lua
new file mode 100644
index 0000000..28a44cd
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/noice.lua
@@ -0,0 +1,93 @@
+local focused = true
+
+local M = {
+ "folke/noice.nvim",
+ event = "VeryLazy",
+ dependencies = {
+ "MunifTanjim/nui.nvim",
+ "rcarriga/nvim-notify",
+ },
+ config = {
+ cmdline = { enabled = false },
+ messages = { enabled = false },
+ popupmenu = { enabled = false },
+ lsp = {
+ override = {
+ ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
+ ["vim.lsp.util.stylize_markdown"] = true,
+ ["cmp.entry.get_documentation"] = true,
+ },
+ progress = { enabled = false },
+ -- hover = { enabled = false },
+ -- signature = { enabled = false },
+ messages = { enabled = false },
+ },
+ commands = {
+ all = {
+ view = "split",
+ opts = { enter = true, format = "details" },
+ filter = {},
+ },
+ },
+ routes = {
+ {
+ filter = {
+ cond = function()
+ return not focused
+ end,
+ },
+ view = "notify_send",
+ opts = { stop = false },
+ },
+ },
+ },
+}
+
+function M.init()
+ vim.api.nvim_create_autocmd("FocusGained", {
+ callback = function()
+ focused = true
+ end,
+ })
+
+ vim.api.nvim_create_autocmd("FocusLost", {
+ callback = function()
+ focused = false
+ end,
+ })
+
+ vim.keymap.set("n", "<leader>nl", function()
+ require("noice").cmd("last")
+ end)
+
+ vim.keymap.set("n", "<leader>nn", function()
+ require("noice").cmd("history")
+ end)
+
+ vim.keymap.set("n", "<leader>nh", function()
+ require("noice").cmd("all")
+ end)
+
+ vim.keymap.set("n", "<C-d>", function()
+ if not require("noice.lsp").scroll(4) then
+ return "<C-d>"
+ end
+ end, { expr = true })
+
+ vim.keymap.set("n", "<C-u>", function()
+ if not require("noice.lsp").scroll(-4) then
+ return "<C-u>"
+ end
+ end, { expr = true })
+
+ vim.api.nvim_create_autocmd("FileType", {
+ pattern = "markdown",
+ callback = function(event)
+ vim.schedule(function()
+ require("noice.text.markdown").keys(event.buf)
+ end)
+ end,
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/notify.lua b/nvim/.config/nvim/lua/tobyvin/plugins/notify.lua
index 4bfdd77..31189cb 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins/notify.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/notify.lua
@@ -1,35 +1,21 @@
local M = {
"rcarriga/nvim-notify",
event = "VeryLazy",
- dependencies = {
- { "nvim-telescope/telescope.nvim" },
- },
-}
-
-function M.config()
- local notify = require("notify")
-
- local global_instance, _ = notify.instance({
- max_width = 100,
- on_open = function(win)
- vim.api.nvim_win_set_option(win, "wrap", true)
+ config = {
+ timeout = 3000,
+ level = vim.log.levels.INFO,
+ fps = 20,
+ max_height = function()
+ return math.floor(vim.o.lines * 0.75)
end,
- })
-
- vim.notify.use_console = false
- vim.api.nvim_create_autocmd("User", {
- group = vim.api.nvim_create_augroup("tobyvin_nvim-notify", { clear = true }),
- pattern = "Notify",
- callback = function(args)
- global_instance.notify(unpack(args.data))
+ max_width = function()
+ return math.floor(vim.o.columns * 0.75)
end,
- })
+ },
+}
+function M.init()
vim.api.nvim_set_hl(0, "NotifyBackground", { link = "WinBar" })
-
- vim.keymap.set("n", "<leader>fn", function()
- require("telescope").extensions.notify.notify()
- end, { desc = "notifications" })
end
return M
diff --git a/nvim/.config/nvim/lua/tobyvin/utils/log.lua b/nvim/.config/nvim/lua/tobyvin/utils/log.lua
deleted file mode 100644
index 65bf4ca..0000000
--- a/nvim/.config/nvim/lua/tobyvin/utils/log.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-local log = {}
-
-local status_ok, Log = pcall(require, "plenary.log")
-if status_ok then
- log = Log.new({ plugin = "notify" })
-end
-
-local levels = {}
-
-for k, v in pairs(vim.log.levels) do
- levels[v] = k:lower()
- levels[k] = k:lower()
- levels[k:lower()] = k:lower()
-end
-
-setmetatable(log, {
- __call = function(t, m, l, o)
- local msg
-
- if type(m) == "table" then
- msg = table.concat(msg, "\n")
- else
- msg = m
- end
-
- if o and o.title then
- msg = string.format("%s: %s", o.title, msg)
- end
-
- local level = vim.F.if_nil(levels[l], "info")
- pcall(t[level], msg)
-
- vim.api.nvim_exec_autocmds("User", {
- pattern = "Notify",
- data = { m, l, o },
- })
- end,
-})
-
-vim.notify = log