💫
Cosmic-UI
🚀
Stellar Features
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!
- Diagnostics UI
- Sane
vim.diagnostic
default settings - Pretty sign icons
- Sane
- LSP UI
- Signature help
- Hover
- Autocompletion documentation
- Rename floating popup
- Rename file change notification
- Code Actions
Coming soon...
- Highlighting documentation
- Preview windows?
- LSP definition, references, etc?
📷
Screenshots
Code Actions
Rename Floating Popup
🛠
Installation
use({
'CosmicNvim/cosmic-ui',
config = function()
require('cosmic-ui').setup()
end,
requires = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' },
})
To enable lsp_signature
integration, ensure that cosmic-ui
initializes after your LSP servers
use({
'CosmicNvim/cosmic-ui',
config = function()
require('cosmic-ui').setup()
end,
requires = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim', 'ray-x/lsp_signature.nvim' },
after = 'nvim-lspconfig',
})
Autocomplete functionality is disabled by default, if you would like to set it up. Ensure that Cosmic-UI is also initialized after nvim-cmp.
use({
'CosmicNvim/cosmic-ui',
requires = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim', 'ray-x/lsp_signature.nvim' },
config = function()
require('cosmic-ui').setup({
autocomplete = {
-- add any nvim-cmp settings you would like to override
}
})
end,
})
If you would like to continue to lazy load nvim-cmp, you may alter your setup to the below.
use({
'hrsh7th/nvim-cmp',
config = function()
require('cosmic-ui').setup_autocomplete({
-- add any nvim-cmp settings you would like to override
})
end,
requires = {...},
event = 'InsertEnter',
disable = vim.tbl_contains(user_plugins.disable, 'autocomplete'),
})
⚙️
Configuration
You may override any of the settings below by passing a config object to .setup
{
-- default border to use
-- 'single', 'double', 'rounded', 'solid', 'shadow'
border = 'rounded'
-- icons used for lsp diagnostic signs
icons = {
warn = '',
info = '',
error = '',
hint = '',
},
-- autocomplete settings, see `:h cmp-config`
autocomplete = false,
-- see h: vim.diagnostic.config
-- `false` to disable
diagnostic = {
underline = true,
signs = true,
update_in_insert = false,
severity_sort = true,
float = {
header = false,
source = 'always',
-- override border if desired
border = 'rounded',
},
virtual_text = {
spacing = 4,
source = 'always',
severity = {
min = vim.diagnostic.severity.HINT,
},
},
},
-- settings for vim.lsp.handlers['textDocument/hover']
-- `false` to disable
hover = {
-- override default handler
handler = vim.lsp.handlers.hover,
-- see :h lsp-handlers
float = {
-- override border if desired
border = 'rounded',
},
},
-- settings for vim.lsp.handlers['textDocument/signatureHelp']
-- `false` to disable
signature_help = {
-- override default handler
handler = vim.lsp.handlers.signature_help,
-- see :h lsp-handlers
float = {
-- override border if desired
border = 'rounded',
},
},
-- lsp_signature settings
-- `false` to disable
lsp_signature = {
bind = true,
handler_opts = {
-- override border if desired
border = 'rounded',
},
},
-- rename popup settings
rename = {
prompt = '> '
}
code_actions = {
popup_opts = {
position = {
row = 1,
col = 0,
},
relative = 'cursor',
border = {
highlight = 'FloatBorder',
text = {
top = 'Code Actions',
top_align = 'center',
},
padding = { 0, 1 },
},
},
min_width = {}
}
}
✨
Utilities
Rename
function map(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
map('n', 'gn', 'lua require("cosmic-ui").rename()' )
Code Actions
map('n', 'ga' , 'lua require("cosmic-ui").code_actions() ) map('v', '' ga' , 'lua require("cosmic-ui").range_code_actions() )'
More coming soon...