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