ui.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. local MiniBufremove = require('mini.bufremove')
  2. local MiniFiles = require('mini.files')
  3. local MiniIndentscope = require('mini.indentscope')
  4. local MiniNotify = require('mini.notify')
  5. local MiniStatusline = require('mini.statusline')
  6. local function section_git(args)
  7. if MiniStatusline.is_truncated(args.trunc_width) then return '' end
  8. return vim.fn.FugitiveHead()
  9. end
  10. MiniStatusline.setup({
  11. content = {
  12. -- copy-pasted from default, we just want to remove the icon
  13. active = function()
  14. local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
  15. local git = section_git({ trunc_width = 75 })
  16. local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75, icon = '' })
  17. local filename = MiniStatusline.section_filename({ trunc_width = 140 })
  18. local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
  19. local location = MiniStatusline.section_location({ trunc_width = 75 })
  20. return MiniStatusline.combine_groups({
  21. { hl = mode_hl, strings = { mode } },
  22. { hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics } },
  23. '%<', -- Mark general truncate point
  24. { hl = 'MiniStatuslineFilename', strings = { filename } },
  25. '%=', -- End left alignment
  26. { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } },
  27. { hl = mode_hl, strings = { location } },
  28. })
  29. end
  30. },
  31. })
  32. -- notifications
  33. MiniNotify.setup()
  34. vim.notify = MiniNotify.make_notify()
  35. vim.keymap.set('n', '<Leader>n', MiniNotify.show_history)
  36. -- file explorer
  37. MiniFiles.setup({
  38. content = {
  39. -- remove icons
  40. prefix = function() end,
  41. }
  42. })
  43. vim.keymap.set('n', '<Leader>ft', function() MiniFiles.open(MiniFiles.get_latest_path()) end)
  44. vim.keymap.set('n', '<Leader>fc', function() MiniFiles.open(vim.api.nvim_buf_get_name(0)) end)
  45. -- delete buffer while preserving layout
  46. MiniBufremove.setup()
  47. vim.keymap.set('n', '<Leader>q', MiniBufremove.delete)
  48. vim.keymap.set('n', '<Leader>Q', function() MiniBufremove.delete(0, true) end)
  49. -- shows a line indicating the current indentation scope
  50. MiniIndentscope.setup()
  51. -- cursor display
  52. vim.keymap.set('n', '<Leader>c', '<cmd>set cursorline! cursorcolumn!<CR>')