]> git.rmz.io Git - dotfiles.git/blob - nvim/lua/plugins/ui.lua
nvim: start popups in normal mode
[dotfiles.git] / nvim / lua / plugins / ui.lua
1 ---@type LazyPluginSpec
2 return {
3 {
4 "nvim-notify",
5 },
6 {
7 "bufferline.nvim",
8 ---@type BufferlineConfig
9 opts = {
10 options = {
11 always_show_bufferline = false,
12 },
13 },
14 },
15 {
16 "stevearc/dressing.nvim",
17 lazy = true,
18 opts = {
19 input = {
20 start_in_insert = false,
21 insert_only = false,
22 },
23 },
24 },
25 {
26 "noice.nvim",
27 enabled = false,
28 ---@type NoiceConfig
29 opts = {
30 presets = {
31 command_palette = false, -- don't position the cmdline and popupmenu together
32 lsp_doc_border = true,
33 long_message_to_split = true,
34 },
35 cmdline = {
36 view = "cmdline",
37 },
38 routes = {
39 { -- send file written messages to mini
40 filter = {
41 event = "msg_show",
42 kind = "",
43 find = "%[w%]",
44 },
45 opts = { skip = true },
46 },
47 },
48 },
49 config = function(_, opts)
50 -- ensure [w] is written to msg_show so we can match it
51 vim.opt.shortmess:append("w")
52 vim.opt.shortmess:remove("W")
53
54 require("noice").setup(opts)
55 end,
56 },
57 {
58 "lualine.nvim",
59 --TODO: Things that were in vim but are missing
60 -- - git line add/mod/del ar next to branch name rather on right
61 -- - one status line per splits
62 -- - maybe a single one is OK too?
63 -- - I think I want a line stating wihch file is in the split though
64 -- - unix/dos eof markers
65 -- - really I only want to know if it's not unix
66 -- - filetype in text form. It's quite important to glance this quickly
67 },
68 {
69 "indent-blankline.nvim",
70 },
71 {
72 "mini.indentscope",
73 opts = {
74 draw = {
75 animation = require("mini.indentscope").gen_animation.linear({ duration = 10 }),
76 },
77 },
78 },
79 {
80 "nvimdev/dashboard-nvim",
81 -- TODO: create cool dashboard header
82 -- generate logo from text here:
83 -- https://patorjk.com/software/taag/#p=testall&v=0&f=Computer&t=NEOVIM
84 -- Can also use use `chafa` and aplha.term to generate text from cli, see
85 -- https://github.com/goolord/alpha-nvim/discussions/16#discussioncomment-4915947
86 -- https://github.com/goolord/alpha-nvim/discussions/16#discussioncomment-5065731
87 -- To add orgmode agenda button in alpha
88 -- dashboard.button("a", "󰕪 " .. " View Agenda", ":lua require('orgmode').action('agenda.agenda')<CR>"),
89 opts = function()
90 local logo = [[
91 ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
92 ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
93 ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
94 ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
95 ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
96 ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
97 ]]
98
99 logo = string.rep("\n", 8) .. logo .. "\n\n"
100
101 local opts = {
102 theme = "doom",
103 hide = {
104 -- this is taken care of by lualine
105 -- enabling this messes up the actual laststatus setting after loading a file
106 statusline = false,
107 },
108 config = {
109 header = vim.split(logo, "\n"),
110 -- stylua: ignore
111 center = {
112 { action = [[lua require('orgmode').action('agenda.agenda')]], desc = " View Agenda", icon = "󰕪 ", key = "a" },
113 { action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" },
114 { action = "ene | startinsert", desc = " New file", icon = " ", key = "n" },
115 { action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" },
116 { action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = " Config", icon = " ", key = "c" },
117 { action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
118 { action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" },
119 { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" },
120 },
121 footer = function()
122 local stats = require("lazy").stats()
123 local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
124 return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
125 end,
126 },
127 }
128
129 for _, button in ipairs(opts.config.center) do
130 button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
131 button.key_format = " %s"
132 end
133
134 -- close Lazy and re-open when the dashboard is ready
135 if vim.o.filetype == "lazy" then
136 vim.cmd.close()
137 vim.api.nvim_create_autocmd("User", {
138 pattern = "DashboardLoaded",
139 callback = function()
140 require("lazy").show()
141 end,
142 })
143 end
144
145 return opts
146 end
147 },
148 {
149 "nvim-navic",
150 },
151 {
152 "nvim-web-devicons",
153 },
154 {
155 "nui.nvim",
156 },
157 }