Skip to content

Cosmic-UI is a simple wrapper around specific vim functionality. Built in order to provide a quick and easy way to create a Cosmic UI experience with Neovim!

License

Notifications You must be signed in to change notification settings

CosmicNvim/cosmic-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

56 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’« Cosmic-UI

Neovim Minimum Version GitHub last commit Discord

πŸš€ Stellar Features

Warning: Under heavy development

Cosmic-UI is a simple wrapper around specific vim functionality. Built in order to provide a quick and easy way to create a Cosmic UI experience with Neovim!

  • Rename floating popup & file change notification
  • Code Actions
  • Formatter toggles (LSP + Conform.nvim)

πŸ“· Screenshots

Code Actions

Screen Shot 2021-12-10 at 3 37 38 PM

Rename Floating Popup

Screen Shot 2021-12-10 at 4 22 28 PM

πŸ›  Installation

  use({
    'CosmicNvim/cosmic-ui',
    requires = {
      'MunifTanjim/nui.nvim',
      'nvim-lua/plenary.nvim',
      'nvim-tree/nvim-web-devicons',
    },
    config = function()
      require('cosmic-ui').setup()
    end,
  })

βš™οΈ Configuration

Call setup() before using any module. Calling module APIs before setup will warn and no-op.

Modules are enabled only when their key is present as a table in setup.

You may override any of the settings below by passing a config object to .setup:

{
  notify_title = "CosmicUI",

  rename = {
    enabled = true, -- optional (defaults to true when table exists)
    border = {
      highlight = 'FloatBorder',
      style = nil, -- falls back to vim.o.winborder
      title = 'Rename',
      title_align = 'left',
      title_hl = 'FloatBorder',
    },
    prompt = '> ',
    prompt_hl = 'Comment',
  },

  codeactions = {
    enabled = true, -- optional (defaults to true when table exists)
    min_width = nil,
    border = {
      bottom_hl = 'FloatBorder',
      highlight = 'FloatBorder',
      style = nil, -- falls back to vim.o.winborder
      title = 'Code Actions',
      title_align = 'center',
      title_hl = 'FloatBorder',
    },
  },

  formatters = {
    enabled = true, -- optional (defaults to true when table exists)
  },
}

Notes:

  • Missing module key means disabled.
  • enabled = false disables a module.
  • Unknown setup keys are ignored with a warning.
  • code_actions is not a supported key; use codeactions.

πŸ“š Module Docs

Feature modules

Core modules

✨ Usage

Setup

local CosmicUI = require("cosmic-ui")

CosmicUI.setup({
  rename = {},
  codeactions = {},
  formatters = {},
})

Rename

vim.keymap.set("n", "gn", function()
  require("cosmic-ui").rename.open()
end, { silent = true, desc = "Rename" })

Codeactions

vim.keymap.set("n", "<leader>ga", function()
  require("cosmic-ui").codeactions.open()
end, { silent = true, desc = "Code actions" })

vim.keymap.set("v", "<leader>ga", function()
  require("cosmic-ui").codeactions.range()
end, { silent = true, desc = "Range code actions" })

Formatters

vim.keymap.set("n", "<leader>gf", function()
  require("cosmic-ui").formatters.open()
end, { silent = true, desc = "Toggle formatters (buffer)" })

vim.keymap.set("n", "<leader>gF", function()
  require("cosmic-ui").formatters.open({ scope = "global" })
end, { silent = true, desc = "Toggle formatters (global)" })

vim.keymap.set("n", "<leader>fm", function()
  require("cosmic-ui").formatters.format()
end, { silent = true, desc = "Format buffer" })

Formatting behavior:

  • If Conform.nvim is installed and conform backend is enabled, format() uses Conform.
  • If Conform.nvim is unavailable (or conform backend is disabled), format() falls back to LSP when LSP backend is enabled.
  • When Conform is used, LSP backend toggle controls Conform LSP usage (lsp_format is clamped to "never" when LSP is disabled).
  • When LSP is enabled, Conform mode precedence is: opts.conform.lsp_format > filetype-specific Conform mode > global Conform mode > "never".
  • Fallback visibility is shown globally and per-LSP in the formatter UI, and exposed via formatters.status().

More usage examples:

About

Cosmic-UI is a simple wrapper around specific vim functionality. Built in order to provide a quick and easy way to create a Cosmic UI experience with Neovim!

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages