feat: v0.7
This commit is contained in:
commit
1f9910235e
41 changed files with 418 additions and 390 deletions
4
init.lua
4
init.lua
|
@ -1,5 +1,5 @@
|
||||||
if vim.fn.has('nvim-0.10') == 0 then
|
if vim.fn.has('nvim-0.11') == 0 then
|
||||||
error('Need Neovim v0.10+ (Nightly) in order to run Cosmic!')
|
error('Need Neovim v0.11+ (Nightly) in order to run Cosmic!')
|
||||||
end
|
end
|
||||||
|
|
||||||
local ok, err = pcall(require, 'cosmic')
|
local ok, err = pcall(require, 'cosmic')
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
{
|
{
|
||||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||||
|
<<<<<<< HEAD
|
||||||
"LuaSnip": { "branch": "master", "commit": "ac7cbc0e85710db7cba6510b1d8e6a1a551444f7" },
|
"LuaSnip": { "branch": "master", "commit": "ac7cbc0e85710db7cba6510b1d8e6a1a551444f7" },
|
||||||
"SchemaStore.nvim": { "branch": "main", "commit": "3e54f4bbebea598646b141aa8aeca8a01b6ba601" },
|
"SchemaStore.nvim": { "branch": "main", "commit": "3e54f4bbebea598646b141aa8aeca8a01b6ba601" },
|
||||||
"auto-session": { "branch": "main", "commit": "3cd531ce4d46fb156268ddedf5f3e6822ef26af7" },
|
"auto-session": { "branch": "main", "commit": "3cd531ce4d46fb156268ddedf5f3e6822ef26af7" },
|
||||||
|
=======
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" },
|
||||||
|
"SchemaStore.nvim": { "branch": "main", "commit": "ae75241aed204d829fe15595bbf05e6fbf3d49dd" },
|
||||||
|
"auto-session": { "branch": "main", "commit": "0e9aa77525b5217e8eacb36007edd3d02bb2a91a" },
|
||||||
|
>>>>>>> v0.7
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
"cosmic-ui": { "branch": "main", "commit": "c0b14531999f2bfef3d927c4dcd57a1a8fed5ee9" },
|
"cosmic-ui": { "branch": "main", "commit": "c0b14531999f2bfef3d927c4dcd57a1a8fed5ee9" },
|
||||||
|
<<<<<<< HEAD
|
||||||
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
|
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "ee7634ab4f0a6606438fe13e16cbf2065589a5ed" },
|
"gitsigns.nvim": { "branch": "main", "commit": "ee7634ab4f0a6606438fe13e16cbf2065589a5ed" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
|
"lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
|
||||||
|
@ -41,4 +48,40 @@
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "4867d10ead04e69872b24818d0d306539305cf87" },
|
"tokyonight.nvim": { "branch": "main", "commit": "4867d10ead04e69872b24818d0d306539305cf87" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
|
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }
|
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }
|
||||||
|
=======
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "899e993850084ea33d001ec229d237bc020c19ae" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||||
|
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
||||||
|
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||||
|
"noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" },
|
||||||
|
"none-ls-extras.nvim": { "branch": "main", "commit": "dfdc998a8c7bb728abab156942bd43ed2345845a" },
|
||||||
|
"none-ls-shellcheck.nvim": { "branch": "main", "commit": "0f84461241e76e376a95fb7391deac82dc3efdbf" },
|
||||||
|
"none-ls.nvim": { "branch": "main", "commit": "203f5ebde4a1af48ba2eb146401b5be2e7866942" },
|
||||||
|
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
|
||||||
|
"nvim-autopairs": { "branch": "master", "commit": "19606af7c039271d5aa96bceff101e7523af3136" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||||
|
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "2a6f00ff66e276ab3289be8bb9f844f7ab385848" },
|
||||||
|
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||||
|
"nvim-tree.lua": { "branch": "master", "commit": "d43ab67d0eb4317961c5e9d15fffe908519debe0" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "7a64148896289a91cb2a92e9da3f76d5512a3fb8" },
|
||||||
|
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
|
||||||
|
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
|
||||||
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "375c2d86cee6674afd75b4f727ce3a80065552f7" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
|
||||||
|
"nx.nvim": { "branch": "main", "commit": "f8a3a21b3d540889401a40d1f2803083794c0372" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
|
||||||
|
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
||||||
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" },
|
||||||
|
"todo-comments.nvim": { "branch": "main", "commit": "8f45f353dc3649cb9b44cecda96827ea88128584" },
|
||||||
|
"toggleterm.nvim": { "branch": "main", "commit": "137d06fb103952a0fb567882bb8527e2f92d327d" },
|
||||||
|
"tokyonight.nvim": { "branch": "main", "commit": "b0e7c7382a7e8f6456f2a95655983993ffda745e" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }
|
||||||
|
>>>>>>> v0.7
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
-- Override Cosmic configuration options
|
-- Override Cosmic configuration options
|
||||||
|
|
||||||
-- You can require null-ls if needed
|
|
||||||
-- local null_ls = require('null-ls')
|
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
-- See :h nvim_open_win for possible border options
|
-- See :h nvim_open_win for possible border options
|
||||||
border = 'rounded',
|
border = 'rounded',
|
||||||
|
@ -10,8 +7,6 @@ local config = {
|
||||||
lsp = {
|
lsp = {
|
||||||
-- Enable/disable inlay hints
|
-- Enable/disable inlay hints
|
||||||
inlay_hint = false,
|
inlay_hint = false,
|
||||||
-- True/false or table of filetypes {'.ts', '.js',}
|
|
||||||
format_on_save = true,
|
|
||||||
-- Time in MS before format timeout
|
-- Time in MS before format timeout
|
||||||
format_timeout = 3000,
|
format_timeout = 3000,
|
||||||
-- Set to false to disable rename notification
|
-- Set to false to disable rename notification
|
||||||
|
@ -24,30 +19,13 @@ local config = {
|
||||||
'rust_analyzer',
|
'rust_analyzer',
|
||||||
},
|
},
|
||||||
|
|
||||||
-- lsp servers that should be enabled
|
-- See Cosmic defaults cosmic/plugins/null-ls/init.lua and https://github.com/jose-elias-alvarez/null-ls.nvim/
|
||||||
servers = {
|
-- If adding additional sources, be sure to also copy the defaults that you would like to preserve from cosmic/plugins/null-ls/init.lua
|
||||||
-- Enable rust_analyzer
|
|
||||||
rust_analyzer = true,
|
|
||||||
|
|
||||||
-- Enable ts_ls w/custom settings
|
|
||||||
ts_ls = {
|
|
||||||
-- Disable formatting (defaults to true)
|
|
||||||
format = false,
|
|
||||||
-- OR add/override server options
|
|
||||||
opts = {
|
|
||||||
on_attach = function(client, bufnr) end,
|
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 150,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- See Cosmic defaults lsp/providers/null_ls.lua and https://github.com/jose-elias-alvarez/null-ls.nvim/
|
|
||||||
-- If adding additional sources, be sure to also copy the defaults that you would like to preserve from lsp/providers/null_ls.lua
|
|
||||||
null_ls = {
|
null_ls = {
|
||||||
-- Disable default list of sources provided by CosmicNvim
|
-- Disable default list of sources provided by CosmicNvim
|
||||||
default_cosmic_sources = false,
|
default_cosmic_sources = false,
|
||||||
--disable formatting
|
--disable formatting
|
||||||
format = false,
|
format_on_save = false,
|
||||||
-- Add additional sources here
|
-- Add additional sources here
|
||||||
get_sources = function()
|
get_sources = function()
|
||||||
local null_ls = require('null-ls')
|
local null_ls = require('null-ls')
|
||||||
|
@ -62,6 +40,25 @@ local config = {
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- lsp servers that should be enabled
|
||||||
|
servers = {
|
||||||
|
-- Enable rust_analyzer
|
||||||
|
rust_analyzer = true,
|
||||||
|
|
||||||
|
-- Enable ts_ls w/custom settings
|
||||||
|
ts_ls = {
|
||||||
|
-- Disable formatting (defaults to true)
|
||||||
|
format_on_save = false,
|
||||||
|
-- OR add/override server options
|
||||||
|
opts = {
|
||||||
|
on_attach = function(client, bufnr) end,
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
},
|
||||||
|
settings = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -77,14 +74,6 @@ local config = {
|
||||||
diagnostic = {},
|
diagnostic = {},
|
||||||
-- See :h gitsigns-usage
|
-- See :h gitsigns-usage
|
||||||
gitsigns = {},
|
gitsigns = {},
|
||||||
-- See https://git.sr.ht/~whynothugo/lsp_lines.nvim
|
|
||||||
lsp_lines = {
|
|
||||||
-- additional flag only for CosmicNvim
|
|
||||||
-- true - loads plugin and is enabled at start
|
|
||||||
-- false - loads plugin but is not enabled at start
|
|
||||||
-- you may use <leader>ld to toggle
|
|
||||||
enable_on_start = true,
|
|
||||||
},
|
|
||||||
-- See https://github.com/nvim-lualine/lualine.nvim#default-configuration
|
-- See https://github.com/nvim-lualine/lualine.nvim#default-configuration
|
||||||
lualine = {},
|
lualine = {},
|
||||||
-- See https://github.com/L3MON4D3/LuaSnip/blob/577045e9adf325e58f690f4d4b4a293f3dcec1b3/README.md#config
|
-- See https://github.com/L3MON4D3/LuaSnip/blob/577045e9adf325e58f690f4d4b4a293f3dcec1b3/README.md#config
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
-- Override Cosmic editor options
|
-- Override Cosmic editor options
|
||||||
|
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
local map = require('cosmic.utils').map
|
local map = require('cosmic.utils').set_keymap
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
|
|
||||||
-- Default leader is <space>
|
-- Default leader is <space>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local map = require('cosmic.utils').map
|
local map = require('cosmic.utils').set_keymap
|
||||||
|
|
||||||
-- Quickfix mappings
|
-- Quickfix mappings
|
||||||
map('n', '<leader>ck', ':cexpr []<cr>', { desc = 'Clear list' })
|
map('n', '<leader>ck', ':cexpr []<cr>', { desc = 'Clear list' })
|
||||||
|
@ -9,9 +9,11 @@ map('n', '<leader>cp', ':cprev<cr>zz', { desc = 'Prev Item' })
|
||||||
map('n', '<leader>cn', ':cnext<cr>zz', { desc = 'Next Item' })
|
map('n', '<leader>cn', ':cnext<cr>zz', { desc = 'Next Item' })
|
||||||
|
|
||||||
-- buffer navigation
|
-- buffer navigation
|
||||||
map('n', '<leader>bp', ':bprev<cr>', { desc = 'Prev buffer' })
|
map('n', '<leader>kp', ':bprev<cr>', { desc = 'Prev buffer' })
|
||||||
map('n', '<leader>bn', ':bnext<cr>', { desc = 'Next buffer' })
|
map('n', '<leader>kn', ':bnext<cr>', { desc = 'Next buffer' })
|
||||||
map('n', '<leader>bd', ':bdelete<cr>', { desc = 'Delete buffer' })
|
map('n', '<leader>kd', ':bdelete<cr>', { desc = 'Delete buffer' })
|
||||||
|
map('n', '<leader>kc', ':new<cr>', { desc = 'New buffer' })
|
||||||
|
map('n', '<leader>ko', '<cmd>%bd|e#<cr>', { desc = 'Close all buffers but the current one' }) -- https://stackoverflow.com/a/42071865/516188
|
||||||
|
|
||||||
-- tab navigation
|
-- tab navigation
|
||||||
map('n', '<leader>tp', ':tabprevious<cr>', { desc = 'Prev tab' })
|
map('n', '<leader>tp', ':tabprevious<cr>', { desc = 'Prev tab' })
|
||||||
|
@ -33,5 +35,3 @@ map('n', '<C-Up>', ':resize -2<CR>', { desc = 'Resize -2' })
|
||||||
map('n', '<C-Down>', ':resize +2<CR>', { desc = 'Resize +2' })
|
map('n', '<C-Down>', ':resize +2<CR>', { desc = 'Resize +2' })
|
||||||
map('n', '<C-Left>', ':vertical resize -2<CR>', { desc = 'Vertical Resize -2' })
|
map('n', '<C-Left>', ':vertical resize -2<CR>', { desc = 'Vertical Resize -2' })
|
||||||
map('n', '<C-Right>', ':vertical resize +2<CR>', { desc = 'Vertical Resize +2' })
|
map('n', '<C-Right>', ':vertical resize +2<CR>', { desc = 'Vertical Resize +2' })
|
||||||
|
|
||||||
map('n', '<leader>bo', '<cmd>%bd|e#<cr>', { desc = 'Close all buffers but the current one' }) -- https://stackoverflow.com/a/42071865/516188
|
|
||||||
|
|
|
@ -9,18 +9,9 @@ local default_config = {
|
||||||
border = 'rounded',
|
border = 'rounded',
|
||||||
disable_builtin_plugins = {},
|
disable_builtin_plugins = {},
|
||||||
add_plugins = {},
|
add_plugins = {},
|
||||||
plugins = {
|
plugins = {},
|
||||||
lsp_lines = {
|
|
||||||
-- additional flag only for CosmicNvim
|
|
||||||
-- true - loads plugin and is enabled at start
|
|
||||||
-- false - loads plugin but is not enabled at start
|
|
||||||
-- you may use <leader>ld to toggle
|
|
||||||
enable_on_start = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lsp = {
|
lsp = {
|
||||||
inlay_hint = false,
|
inlay_hint = false,
|
||||||
format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',}
|
|
||||||
format_timeout = 500,
|
format_timeout = 500,
|
||||||
rename_notification = true,
|
rename_notification = true,
|
||||||
-- table of callbacks pushed via plugins
|
-- table of callbacks pushed via plugins
|
||||||
|
@ -49,11 +40,11 @@ local default_config = {
|
||||||
tailwindcss = true,
|
tailwindcss = true,
|
||||||
eslint = true,
|
eslint = true,
|
||||||
jsonls = {
|
jsonls = {
|
||||||
format = false,
|
format_on_save = false,
|
||||||
},
|
},
|
||||||
pyright = true,
|
pyright = true,
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
format = false,
|
format_on_save = false,
|
||||||
},
|
},
|
||||||
gopls = true,
|
gopls = true,
|
||||||
html = true,
|
html = true,
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
local u = require('cosmic.utils')
|
|
||||||
local icons = require('cosmic.utils.icons')
|
|
||||||
local user_config = require('cosmic.core.user')
|
|
||||||
|
|
||||||
local function format_diagnostic(diagnostic)
|
|
||||||
local icon = icons.error
|
|
||||||
if diagnostic.severity == vim.diagnostic.severity.WARN then
|
|
||||||
icon = icons.warn
|
|
||||||
elseif diagnostic.severity == vim.diagnostic.severity.INFO then
|
|
||||||
icon = icons.info
|
|
||||||
elseif diagnostic.severity == vim.diagnostic.severity.HINT then
|
|
||||||
icon = icons.hint
|
|
||||||
end
|
|
||||||
|
|
||||||
local message = string.format('%s %s', icon, diagnostic.message)
|
|
||||||
if diagnostic.code and diagnostic.source then
|
|
||||||
message = string.format('%s [%s][%s] %s', icon, diagnostic.source, diagnostic.code, diagnostic.message)
|
|
||||||
elseif diagnostic.code or diagnostic.source then
|
|
||||||
message = string.format('%s [%s] %s', icon, diagnostic.code or diagnostic.source, diagnostic.message)
|
|
||||||
end
|
|
||||||
|
|
||||||
return message .. ' '
|
|
||||||
end
|
|
||||||
|
|
||||||
local config = u.merge({
|
|
||||||
underline = true,
|
|
||||||
signs = true,
|
|
||||||
update_in_insert = false,
|
|
||||||
severity_sort = true,
|
|
||||||
float = {
|
|
||||||
border = user_config.border,
|
|
||||||
focusable = false,
|
|
||||||
header = { icons.debug .. ' Diagnostics:', 'DiagnosticInfo' },
|
|
||||||
scope = 'line',
|
|
||||||
suffix = '',
|
|
||||||
source = false,
|
|
||||||
format = format_diagnostic,
|
|
||||||
},
|
|
||||||
virtual_text = {
|
|
||||||
prefix = '',
|
|
||||||
spacing = 2,
|
|
||||||
source = false,
|
|
||||||
severity = {
|
|
||||||
min = vim.diagnostic.severity.HINT,
|
|
||||||
},
|
|
||||||
format = format_diagnostic,
|
|
||||||
},
|
|
||||||
}, user_config.diagnostic or {})
|
|
||||||
|
|
||||||
return config
|
|
|
@ -1,19 +1,64 @@
|
||||||
|
local u = require('cosmic.utils')
|
||||||
local icons = require('cosmic.utils.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
local config = require('cosmic.lsp.diagnostics.config')
|
local user_config = require('cosmic.core.user')
|
||||||
|
|
||||||
-- set up LSP signs
|
local function format_diagnostic(diagnostic)
|
||||||
local signs = {
|
local icon = icons.error
|
||||||
Error = icons.error .. ' ',
|
if diagnostic.severity == vim.diagnostic.severity.WARN then
|
||||||
Warn = icons.warn .. ' ',
|
icon = icons.warn
|
||||||
Hint = icons.hint .. ' ',
|
elseif diagnostic.severity == vim.diagnostic.severity.INFO then
|
||||||
Info = icons.info .. ' ',
|
icon = icons.info
|
||||||
}
|
elseif diagnostic.severity == vim.diagnostic.severity.HINT then
|
||||||
|
icon = icons.hint
|
||||||
-- Set up diagnostic signs
|
|
||||||
for type, icon in pairs(signs) do
|
|
||||||
local hl = 'DiagnosticSign' .. type
|
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local message = string.format('%s %s', icon, diagnostic.message)
|
||||||
|
if diagnostic.code and diagnostic.source then
|
||||||
|
message = string.format('%s [%s][%s] %s', icon, diagnostic.source, diagnostic.code, diagnostic.message)
|
||||||
|
elseif diagnostic.code or diagnostic.source then
|
||||||
|
message = string.format('%s [%s] %s', icon, diagnostic.code or diagnostic.source, diagnostic.message)
|
||||||
|
end
|
||||||
|
|
||||||
|
return message .. ' '
|
||||||
|
end
|
||||||
|
|
||||||
|
local config = u.merge({
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = false,
|
||||||
|
severity_sort = true,
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = icons.error .. ' ',
|
||||||
|
[vim.diagnostic.severity.HINT] = icons.hint .. ' ',
|
||||||
|
[vim.diagnostic.severity.INFO] = icons.info .. ' ',
|
||||||
|
[vim.diagnostic.severity.WARN] = icons.warn .. ' ',
|
||||||
|
},
|
||||||
|
numhl = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = 'ErrorMsg',
|
||||||
|
[vim.diagnostic.severity.HINT] = 'DiagnosticsSignHint',
|
||||||
|
[vim.diagnostic.severity.INFO] = 'DiagnosticsSignInfo',
|
||||||
|
[vim.diagnostic.severity.WARN] = 'WarningMsg',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
float = {
|
||||||
|
border = user_config.border,
|
||||||
|
focusable = false,
|
||||||
|
header = { icons.debug .. ' Diagnostics:', 'DiagnosticInfo' },
|
||||||
|
scope = 'line',
|
||||||
|
suffix = '',
|
||||||
|
source = false,
|
||||||
|
format = format_diagnostic,
|
||||||
|
},
|
||||||
|
virtual_text = {
|
||||||
|
prefix = '',
|
||||||
|
spacing = 2,
|
||||||
|
source = false,
|
||||||
|
severity = {
|
||||||
|
min = vim.diagnostic.severity.HINT,
|
||||||
|
},
|
||||||
|
format = format_diagnostic,
|
||||||
|
},
|
||||||
|
}, user_config.diagnostic or {})
|
||||||
|
|
||||||
-- set up diagnostics
|
-- set up diagnostics
|
||||||
vim.diagnostic.config(config)
|
vim.diagnostic.config(config)
|
||||||
|
|
|
@ -44,8 +44,10 @@ function M.init(client, bufnr)
|
||||||
buf_map('v', '<leader>la', '<cmd>lua vim.lsp.buf.range_code_actions()<cr>', { desc = 'Range Code Actions' })
|
buf_map('v', '<leader>la', '<cmd>lua vim.lsp.buf.range_code_actions()<cr>', { desc = 'Range Code Actions' })
|
||||||
|
|
||||||
-- formatting
|
-- formatting
|
||||||
buf_map('n', '<leader>lf', '', { desc = 'Format', callback = lsp_utils.format })
|
if client.supports_method('textDocument/formatting') then
|
||||||
|
buf_map('n', '<leader>lf', '', { desc = 'Format', callback = lsp_utils.buf_format })
|
||||||
buf_map('v', '<leader>lf', '<cmd>lua vim.lsp.buf.range_formatting()<cr>', { desc = 'Range Format' })
|
buf_map('v', '<leader>lf', '<cmd>lua vim.lsp.buf.range_formatting()<cr>', { desc = 'Range Format' })
|
||||||
|
end
|
||||||
|
|
||||||
-- lsp workspace
|
-- lsp workspace
|
||||||
buf_map('n', '<leader>lwa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<cr>', { desc = 'Add workspace folder' })
|
buf_map('n', '<leader>lwa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<cr>', { desc = 'Add workspace folder' })
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
local M = {}
|
|
||||||
local augroup_name = 'CosmicNvimLspFormat'
|
|
||||||
local group = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
|
||||||
local user_config = require('cosmic.core.user')
|
|
||||||
local u = require('cosmic.utils')
|
|
||||||
|
|
||||||
function M.on_attach(client, bufnr)
|
|
||||||
local function buf_set_option(name, value)
|
|
||||||
vim.api.nvim_set_option_value(name, value, {
|
|
||||||
buf = bufnr,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
|
|
||||||
if user_config.lsp.inlay_hint and client.supports_method('textDocument/inlayHint') then
|
|
||||||
vim.lsp.inlay_hint(bufnr, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
if client.supports_method('textDocument/formatting') then
|
|
||||||
-- set up :LspFormat for clients that are capable
|
|
||||||
vim.cmd(string.format("command! -nargs=? LspFormat lua require('cosmic.utils.lsp').format(%s, <q-args>)", bufnr))
|
|
||||||
|
|
||||||
-- set up auto format on save
|
|
||||||
if user_config.lsp.format_on_save then
|
|
||||||
-- check user config to see if we can format on save
|
|
||||||
-- collect filetype(s) from user config
|
|
||||||
local filetype_patterns = {}
|
|
||||||
local filetype_allowed = false
|
|
||||||
if vim.tbl_islist(user_config.lsp.format_on_save) then
|
|
||||||
filetype_patterns = user_config.lsp.format_on_save
|
|
||||||
else -- any filetype if none set
|
|
||||||
filetype_allowed = true
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_clear_autocmds({
|
|
||||||
group = group,
|
|
||||||
buffer = bufnr,
|
|
||||||
})
|
|
||||||
-- autocommand for format on save with specified filetype(s)
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
callback = function(ev)
|
|
||||||
for _, pattern in pairs(filetype_patterns) do
|
|
||||||
if string.match(ev.file, pattern) then
|
|
||||||
filetype_allowed = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if filetype_allowed then
|
|
||||||
require('cosmic.utils.lsp').format(bufnr)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
buffer = bufnr,
|
|
||||||
group = group,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set up default mappings
|
|
||||||
require('cosmic.lsp.mappings').init(client, bufnr)
|
|
||||||
|
|
||||||
-- set up any additional mappings/overrides from user config
|
|
||||||
for _, callback in pairs(user_config.lsp.on_attach_mappings) do
|
|
||||||
callback(client, bufnr)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
M.capabilities = u.merge(capabilities, {
|
|
||||||
-- See: https://github.com/neovim/neovim/issues/23291
|
|
||||||
workspace = {
|
|
||||||
didChangeWatchedFiles = {
|
|
||||||
dynamicRegistration = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
M.root_dir = function(fname)
|
|
||||||
local util = require('lspconfig').util
|
|
||||||
return util.root_pattern('.git', 'tsconfig.base.json', 'tsconfig.json', 'package.json', '.eslint.js', '.eslint.json')(
|
|
||||||
fname
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
|
@ -1,10 +0,0 @@
|
||||||
local default_on_attach = require('cosmic.lsp.providers.defaults').on_attach
|
|
||||||
return {
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
default_on_attach(client, bufnr)
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
buffer = bufnr,
|
|
||||||
command = 'EslintFixAll',
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
local default_on_attach = require('cosmic.lsp.providers.defaults').on_attach
|
|
||||||
local M = {}
|
|
||||||
|
|
||||||
function M.on_attach(client, bufnr)
|
|
||||||
default_on_attach(client, bufnr)
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
70
lua/cosmic/lsp/servers/defaults.lua
Normal file
70
lua/cosmic/lsp/servers/defaults.lua
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
local M = {}
|
||||||
|
local augroup_name = 'CosmicNvimLspFormat'
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
local u = require('cosmic.utils')
|
||||||
|
local lsp_utils = require('cosmic.utils.lsp')
|
||||||
|
local lsp_mappings = require('cosmic.lsp.mappings')
|
||||||
|
|
||||||
|
M.augroup = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
||||||
|
|
||||||
|
function M.on_attach(client, bufnr)
|
||||||
|
local function buf_set_option(name, value)
|
||||||
|
vim.api.nvim_set_option_value(name, value, {
|
||||||
|
buf = bufnr,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
|
if user_config.lsp.inlay_hint and client.supports_method('textDocument/inlayHint') then
|
||||||
|
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||||
|
end
|
||||||
|
|
||||||
|
if client.supports_method('textDocument/formatting') then
|
||||||
|
-- set up :LspFormat for clients that are capable
|
||||||
|
vim.cmd(
|
||||||
|
string.format("command! -nargs=? LspFormat lua require('cosmic.utils.lsp').buf_format(%s, <q-args>)", bufnr)
|
||||||
|
)
|
||||||
|
|
||||||
|
-- set up auto format on save
|
||||||
|
vim.api.nvim_clear_autocmds({
|
||||||
|
group = M.augroup,
|
||||||
|
buffer = bufnr,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
callback = function()
|
||||||
|
if lsp_utils.format_on_save_enabled then
|
||||||
|
vim.lsp.buf.format({
|
||||||
|
timeout_ms = user_config.lsp.format_timeout,
|
||||||
|
bufnr = bufnr,
|
||||||
|
filter = function()
|
||||||
|
return lsp_utils.can_client_format_on_save(client)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
buffer = bufnr,
|
||||||
|
group = M.augroup,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- set up default mappings
|
||||||
|
lsp_mappings.init(client, bufnr)
|
||||||
|
|
||||||
|
-- set up any additional mappings/overrides from user config
|
||||||
|
for _, callback in pairs(user_config.lsp.on_attach_mappings) do
|
||||||
|
callback(client, bufnr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.capabilities = u.merge(require('cmp_nvim_lsp').default_capabilities(), {
|
||||||
|
-- See: https://github.com/neovim/neovim/issues/23291
|
||||||
|
workspace = {
|
||||||
|
didChangeWatchedFiles = {
|
||||||
|
dynamicRegistration = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return M
|
14
lua/cosmic/lsp/servers/eslint.lua
Normal file
14
lua/cosmic/lsp/servers/eslint.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
local defaults = require('cosmic.lsp.servers.defaults')
|
||||||
|
local can_format_on_save = require('cosmic.utils.lsp').can_client_format_on_save
|
||||||
|
return {
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
defaults.on_attach(client, bufnr)
|
||||||
|
if can_format_on_save(client) then
|
||||||
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
buffer = bufnr,
|
||||||
|
command = 'EslintFixAll',
|
||||||
|
group = defaults.augroup,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
16
lua/cosmic/lsp/servers/tsserver.lua
Normal file
16
lua/cosmic/lsp/servers/tsserver.lua
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.root_dir = function(fname)
|
||||||
|
local util = require('lspconfig').util
|
||||||
|
return util.root_pattern(
|
||||||
|
'.git',
|
||||||
|
'tsconfig.base.json',
|
||||||
|
'tsconfig.json',
|
||||||
|
'package.json',
|
||||||
|
'.eslint.js',
|
||||||
|
'.eslint.json',
|
||||||
|
'eslint.config.js'
|
||||||
|
)(fname)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -1,4 +1,4 @@
|
||||||
local map = require('cosmic.utils').map
|
local map = require('cosmic.utils').set_keymap
|
||||||
|
|
||||||
-- session
|
-- session
|
||||||
map('n', '<leader>sl', '<cmd>silent RestoreSession<cr>', { desc = 'Restore session' })
|
map('n', '<leader>sl', '<cmd>silent RestoreSession<cr>', { desc = 'Restore session' })
|
||||||
|
|
|
@ -53,30 +53,30 @@ return {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'Stage hunk' })
|
map('n', '<leader>vs', gs.stage_hunk, { desc = 'Stage hunk' })
|
||||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'Reset hunk' })
|
map('n', '<leader>vr', gs.reset_hunk, { desc = 'Reset hunk' })
|
||||||
map('v', '<leader>hs', function()
|
map('v', '<leader>vs', function()
|
||||||
gs.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') })
|
gs.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') })
|
||||||
end, {
|
end, {
|
||||||
desc = 'Stage hunk selection',
|
desc = 'Stage hunk selection',
|
||||||
})
|
})
|
||||||
map('v', '<leader>hr', function()
|
map('v', '<leader>vr', function()
|
||||||
gs.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') })
|
gs.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') })
|
||||||
end, {
|
end, {
|
||||||
desc = 'Reset hunk selection',
|
desc = 'Reset hunk selection',
|
||||||
})
|
})
|
||||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'Stage buffer' })
|
map('n', '<leader>vS', gs.stage_buffer, { desc = 'Stage buffer' })
|
||||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'Undo stage hunk' })
|
map('n', '<leader>vu', gs.undo_stage_hunk, { desc = 'Undo stage hunk' })
|
||||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'Reset buffer' })
|
map('n', '<leader>vR', gs.reset_buffer, { desc = 'Reset buffer' })
|
||||||
map('n', '<leader>hp', gs.preview_hunk, { desc = 'Preview hunk' })
|
map('n', '<leader>vp', gs.preview_hunk, { desc = 'Preview hunk' })
|
||||||
map('n', '<leader>hb', function()
|
map('n', '<leader>vb', function()
|
||||||
gs.blame_line({ full = true })
|
gs.blame_line({ full = true })
|
||||||
end, {
|
end, {
|
||||||
desc = 'Blame line',
|
desc = 'Blame line',
|
||||||
})
|
})
|
||||||
map('n', '<leader>htb', gs.toggle_current_line_blame, { desc = 'Toggle blame current line' })
|
map('n', '<leader>vtb', gs.toggle_current_line_blame, { desc = 'Toggle blame current line' })
|
||||||
map('n', '<leader>hd', gs.diffthis, { desc = 'Diff buffer' })
|
map('n', '<leader>vd', gs.diffthis, { desc = 'Diff buffer' })
|
||||||
map('n', '<leader>hD', function()
|
map('n', '<leader>vD', function()
|
||||||
gs.diffthis('~')
|
gs.diffthis('~')
|
||||||
end, { desc = 'Diff project' })
|
end, { desc = 'Diff project' })
|
||||||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'Toggle delete' })
|
map('n', '<leader>td', gs.toggle_deleted, { desc = 'Toggle delete' })
|
||||||
|
|
18
lua/cosmic/plugins/lazydev/init.lua
Normal file
18
lua/cosmic/plugins/lazydev/init.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
return {
|
||||||
|
'folke/lazydev.nvim',
|
||||||
|
ft = 'lua', -- only load on lua files
|
||||||
|
opts = {
|
||||||
|
library = {
|
||||||
|
-- See the configuration section for more details
|
||||||
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
|
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
||||||
|
'lazy.nvim',
|
||||||
|
'toggleterm.nvim',
|
||||||
|
--[[ { path = 'plenary.nvim/lua/plenary', words = { 'plenary' } }, ]]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
dependencies = { { 'Bilal2453/luvit-meta', lazy = true } },
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'lazydev'),
|
||||||
|
event = 'VeryLazy',
|
||||||
|
}
|
|
@ -56,7 +56,7 @@ return {
|
||||||
custom_sections.diff,
|
custom_sections.diff,
|
||||||
},
|
},
|
||||||
lualine_x = { 'diagnostics' },
|
lualine_x = { 'diagnostics' },
|
||||||
lualine_y = { lsp_utils.get_active_clients_str },
|
lualine_y = { lsp_utils.buf_get_active_clients_str },
|
||||||
lualine_z = { 'location', 'progress' },
|
lualine_z = { 'location', 'progress' },
|
||||||
},
|
},
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
local user_config = require('cosmic.core.user')
|
|
||||||
local u = require('cosmic.utils')
|
|
||||||
|
|
||||||
return {
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
config = function()
|
|
||||||
local ls = require('luasnip')
|
|
||||||
ls.config.set_config(u.merge({
|
|
||||||
history = true,
|
|
||||||
-- Update more often, :h events for more info.
|
|
||||||
updateevents = 'TextChanged,TextChangedI',
|
|
||||||
enable_autosnippets = true,
|
|
||||||
}, user_config.plugins.luasnip or {}))
|
|
||||||
|
|
||||||
-- extend html snippets to react files
|
|
||||||
require('luasnip').filetype_extend('javascriptreact', { 'html' })
|
|
||||||
require('luasnip').filetype_extend('typescriptreact', { 'html' })
|
|
||||||
|
|
||||||
-- load snippets (friendly-snippets)
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
end,
|
|
||||||
dependencies = {
|
|
||||||
'rafamadriz/friendly-snippets',
|
|
||||||
},
|
|
||||||
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'luasnip'),
|
|
||||||
}
|
|
|
@ -13,38 +13,24 @@ return {
|
||||||
|
|
||||||
-- set up lsp servers
|
-- set up lsp servers
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
local default_config = require('cosmic.lsp.providers.defaults')
|
local default_config = require('cosmic.lsp.servers.defaults')
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
local start_server = function(server)
|
local start_server = function(server)
|
||||||
-- null_ls doesn't need/can't to be started via lspconfig
|
local server_config = default_config
|
||||||
if server == 'null_ls' or server == 'typescript-tools' then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local opts = default_config
|
|
||||||
|
|
||||||
-- set up default cosmic options
|
-- set up default cosmic options
|
||||||
if server == 'tsserver' then
|
local ok, cosmic_server_config = pcall(require, 'cosmic.lsp.servers.' .. server)
|
||||||
opts = u.merge(opts, require('cosmic.lsp.providers.tsserver'))
|
if ok then
|
||||||
elseif server == 'jsonls' then
|
server_config = u.merge(server_config, cosmic_server_config)
|
||||||
opts = u.merge(opts, require('cosmic.lsp.providers.jsonls'))
|
|
||||||
elseif server == 'pyright' then
|
|
||||||
opts = u.merge(opts, require('cosmic.lsp.providers.pyright'))
|
|
||||||
elseif server == 'eslint' then
|
|
||||||
opts = u.merge(opts, require('cosmic.lsp.providers.eslint'))
|
|
||||||
elseif server == 'lua_ls' then
|
|
||||||
opts = u.merge(opts, require('cosmic.lsp.providers.lua_ls'))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- override options if user definds them
|
-- override options if user defines them
|
||||||
if type(user_config.lsp.servers[server]) == 'table' then
|
if type(user_config.lsp.servers[server]) == 'table' and user_config.lsp.servers[server].opts ~= nil then
|
||||||
if user_config.lsp.servers[server].opts ~= nil then
|
server_config = u.merge(server_config, user_config.lsp.servers[server].opts)
|
||||||
opts = u.merge(opts, user_config.lsp.servers[server].opts)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig[server].setup(opts)
|
lspconfig[server].setup(server_config)
|
||||||
end
|
end
|
||||||
|
|
||||||
for config_server, config_opt in pairs(user_config.lsp.servers) do
|
for config_server, config_opt in pairs(user_config.lsp.servers) do
|
||||||
|
@ -56,5 +42,6 @@ return {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
},
|
},
|
||||||
event = 'BufEnter',
|
lazy = false,
|
||||||
|
--[[ event = 'BufEnter', ]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
return { 'folke/neodev.nvim', opt = {} }
|
|
|
@ -1,6 +1,6 @@
|
||||||
local user_config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
local map = require('cosmic.utils').map
|
local map = require('cosmic.utils').set_keymap
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'folke/noice.nvim',
|
'folke/noice.nvim',
|
||||||
|
|
|
@ -8,11 +8,11 @@ return {
|
||||||
'gbprod/none-ls-shellcheck.nvim',
|
'gbprod/none-ls-shellcheck.nvim',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local defaults = require('cosmic.lsp.providers.defaults')
|
local defaults = require('cosmic.lsp.servers.defaults')
|
||||||
local null_ls = require('null-ls')
|
local null_ls = require('null-ls')
|
||||||
local config_opts = u.merge(user_config.lsp.servers.null_ls or {}, {
|
local config_opts = u.merge({
|
||||||
default_cosmic_sources = true,
|
default_cosmic_sources = true,
|
||||||
})
|
}, user_config.lsp.null_ls or {})
|
||||||
if config_opts.default_cosmic_sources then
|
if config_opts.default_cosmic_sources then
|
||||||
local function get_user_config_sources()
|
local function get_user_config_sources()
|
||||||
if not config_opts.add_sources then
|
if not config_opts.add_sources then
|
||||||
|
@ -25,9 +25,6 @@ return {
|
||||||
config_opts.sources = u.merge_list({
|
config_opts.sources = u.merge_list({
|
||||||
null_ls.builtins.code_actions.gitsigns,
|
null_ls.builtins.code_actions.gitsigns,
|
||||||
null_ls.builtins.diagnostics.markdownlint,
|
null_ls.builtins.diagnostics.markdownlint,
|
||||||
--[[ require('none-ls.diagnostics.eslint_d'), ]]
|
|
||||||
--[[ require('none-ls.formatting.eslint_d'), ]]
|
|
||||||
--[[ require('none-ls.code_actions.eslint_d'), ]]
|
|
||||||
null_ls.builtins.formatting.prettierd.with({
|
null_ls.builtins.formatting.prettierd.with({
|
||||||
env = {
|
env = {
|
||||||
PRETTIERD_LOCAL_PRETTIER_ONLY = 1,
|
PRETTIERD_LOCAL_PRETTIER_ONLY = 1,
|
||||||
|
@ -40,6 +37,7 @@ return {
|
||||||
|
|
||||||
null_ls.setup(u.merge(defaults, config_opts))
|
null_ls.setup(u.merge(defaults, config_opts))
|
||||||
end,
|
end,
|
||||||
event = 'BufReadPre',
|
--[[ event = 'BufEnter', ]]
|
||||||
|
lazy = false,
|
||||||
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'null_ls'),
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'null_ls'),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,27 @@
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
local luasnip = require('luasnip')
|
|
||||||
local user_config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local icons = require('cosmic.utils.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
|
||||||
|
local user_has_luasnip = not vim.tbl_contains(user_config.disable_builtin_plugins, 'luasnip')
|
||||||
|
local _, luasnip = pcall(require, 'luasnip')
|
||||||
|
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
unpack = unpack or table.unpack
|
unpack = unpack or table.unpack
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local snippet = {}
|
||||||
|
if user_has_luasnip then
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
local default_cmp_opts = {
|
local default_cmp_opts = {
|
||||||
enabled = function()
|
enabled = function()
|
||||||
-- disable completion in comments
|
-- disable completion in comments
|
||||||
|
@ -22,11 +33,7 @@ local default_cmp_opts = {
|
||||||
return not context.in_treesitter_capture('comment') and not context.in_syntax_group('Comment')
|
return not context.in_treesitter_capture('comment') and not context.in_syntax_group('Comment')
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
snippet = {
|
snippet = snippet,
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||||
['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||||
|
@ -42,7 +49,7 @@ local default_cmp_opts = {
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif luasnip.expand_or_jumpable() then
|
elseif user_has_luasnip and luasnip.expand_or_jumpable() then
|
||||||
luasnip.expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
elseif has_words_before() then
|
elseif has_words_before() then
|
||||||
cmp.complete()
|
cmp.complete()
|
||||||
|
@ -56,7 +63,7 @@ local default_cmp_opts = {
|
||||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif luasnip.jumpable(-1) then
|
elseif user_has_luasnip and luasnip.jumpable(-1) then
|
||||||
luasnip.jump(-1)
|
luasnip.jump(-1)
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local user_config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
|
@ -7,12 +8,36 @@ return {
|
||||||
end,
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
{
|
||||||
'saadparwaiz1/cmp_luasnip',
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'luasnip'),
|
||||||
|
},
|
||||||
'hrsh7th/cmp-buffer',
|
'hrsh7th/cmp-buffer',
|
||||||
'hrsh7th/cmp-cmdline',
|
'hrsh7th/cmp-cmdline',
|
||||||
'hrsh7th/cmp-path',
|
'hrsh7th/cmp-path',
|
||||||
-- has configs
|
{
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
|
config = function()
|
||||||
|
local ls = require('luasnip')
|
||||||
|
ls.config.set_config(u.merge({
|
||||||
|
history = true,
|
||||||
|
-- Update more often, :h events for more info.
|
||||||
|
updateevents = 'TextChanged,TextChangedI',
|
||||||
|
enable_autosnippets = true,
|
||||||
|
}, user_config.plugins.luasnip or {}))
|
||||||
|
|
||||||
|
-- extend html snippets to react files
|
||||||
|
require('luasnip').filetype_extend('javascriptreact', { 'html' })
|
||||||
|
require('luasnip').filetype_extend('typescriptreact', { 'html' })
|
||||||
|
|
||||||
|
-- load snippets (friendly-snippets)
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
end,
|
||||||
|
dependencies = {
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
|
},
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'luasnip'),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
event = 'InsertEnter',
|
event = 'InsertEnter',
|
||||||
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-cmp'),
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-cmp'),
|
||||||
|
|
|
@ -46,7 +46,7 @@ return {
|
||||||
require('nvim-tree').setup(u.merge(args, user_config.plugins.nvim_tree or {}))
|
require('nvim-tree').setup(u.merge(args, user_config.plugins.nvim_tree or {}))
|
||||||
end,
|
end,
|
||||||
init = function()
|
init = function()
|
||||||
local map = require('cosmic.utils').map
|
local map = require('cosmic.utils').set_keymap
|
||||||
|
|
||||||
map('n', '<C-n>', ':NvimTreeToggle<CR>', { desc = 'Toggle Tree' })
|
map('n', '<C-n>', ':NvimTreeToggle<CR>', { desc = 'Toggle Tree' })
|
||||||
map('n', '<leader>nt', ':NvimTreeToggle<CR>', { desc = 'Toggle Tree' })
|
map('n', '<leader>nt', ':NvimTreeToggle<CR>', { desc = 'Toggle Tree' })
|
||||||
|
|
|
@ -15,7 +15,7 @@ return {
|
||||||
init = function()
|
init = function()
|
||||||
-- normal mappings
|
-- normal mappings
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
local map = u.map
|
local map = u.set_keymap
|
||||||
|
|
||||||
map('n', '<leader>ff', '', {
|
map('n', '<leader>ff', '', {
|
||||||
callback = require('cosmic.plugins.telescope.utils').project_files,
|
callback = require('cosmic.plugins.telescope.utils').project_files,
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
local set_highlight = require('cosmic.utils.theme').set_highlight
|
|
||||||
|
|
||||||
-- terminal highlights
|
|
||||||
set_highlight('FloatBorder', {
|
|
||||||
guibg = 'None',
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.cmd('hi! link FloatermBorder FloatBorder')
|
|
|
@ -1,23 +0,0 @@
|
||||||
local user_config = require('cosmic.core.user')
|
|
||||||
|
|
||||||
return {
|
|
||||||
'voldikss/vim-floaterm',
|
|
||||||
cmd = { 'FloatermToggle', 'FloatermNew' },
|
|
||||||
keys = {
|
|
||||||
{ '<C-l>', '<cmd>FloatermToggle<cr>', desc = 'Floating Terminal' },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local g = vim.g
|
|
||||||
local title = vim.env.SHELL
|
|
||||||
|
|
||||||
g.floaterm_width = 0.7
|
|
||||||
g.floaterm_height = 0.8
|
|
||||||
g.floaterm_title = '[' .. title .. ']:($1/$2)'
|
|
||||||
g.floaterm_borderchars = '─│─│╭╮╯╰'
|
|
||||||
g.floaterm_opener = 'vsplit'
|
|
||||||
|
|
||||||
require('cosmic.plugins.terminal.highlights')
|
|
||||||
require('cosmic.plugins.terminal.mappings')
|
|
||||||
end,
|
|
||||||
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'terminal'),
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
local map = require('cosmic.utils').map
|
|
||||||
|
|
||||||
map('n', '<C-l>', ':FloatermToggle<CR>', { desc = 'Toggle Floaterm' })
|
|
||||||
map('t', '<C-l>', [[<C-\><C-n>]], { desc = 'Close Floaterm' })
|
|
||||||
map('t', '<C-w>l', [[<C-\><C-n>:FloatermNext<CR>]], { desc = 'Next terminal' })
|
|
||||||
map('t', '<C-w>h', [[<C-\><C-n>:FloatermPrev<CR>]], { desc = 'Prev terminal' })
|
|
||||||
map('t', '<C-w>n', [[<C-\><C-n>:FloatermNew<CR>]], { desc = 'New terminal' })
|
|
||||||
map('t', '<C-w>c', [[<C-\><C-n>:FloatermKill<CR>]], { desc = 'Kill current terminal' })
|
|
35
lua/cosmic/plugins/toggleterm/init.lua
Normal file
35
lua/cosmic/plugins/toggleterm/init.lua
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
local map = require('cosmic.utils').set_keymap
|
||||||
|
return {
|
||||||
|
'akinsho/toggleterm.nvim',
|
||||||
|
config = function()
|
||||||
|
require('toggleterm').setup({
|
||||||
|
direction = 'float',
|
||||||
|
float_opts = {
|
||||||
|
border = user_config.border,
|
||||||
|
},
|
||||||
|
highlights = {
|
||||||
|
FloatBorder = {
|
||||||
|
link = 'FloatBorder',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
local terminal_utils = require('cosmic.plugins.toggleterm.utils')
|
||||||
|
|
||||||
|
-- toggle terminals
|
||||||
|
map('n', '<leader>xx', ':ToggleTerm<CR>', { desc = 'Toggle Terminal' })
|
||||||
|
|
||||||
|
-- new terminal
|
||||||
|
map('n', '<leader>xn', terminal_utils.new_terminal, { desc = 'New terminal' })
|
||||||
|
|
||||||
|
-- select terminal to open
|
||||||
|
map('n', '<leader>fx', ':TermSelect<CR>', { desc = 'Find open terminal' })
|
||||||
|
|
||||||
|
-- rename terminal
|
||||||
|
map('n', '<leader>xr', ':ToggleTermSetName<CR>', { desc = 'Rename terminal', buffer = 0 })
|
||||||
|
|
||||||
|
-- terminal only mappings
|
||||||
|
vim.cmd("autocmd! TermOpen term://* lua require('cosmic.plugins.toggleterm.utils').set_terminal_keymaps()")
|
||||||
|
end,
|
||||||
|
lazy = false,
|
||||||
|
}
|
18
lua/cosmic/plugins/toggleterm/utils.lua
Normal file
18
lua/cosmic/plugins/toggleterm/utils.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
local M = {}
|
||||||
|
local map = require('cosmic.utils').set_keymap
|
||||||
|
local Terminal = require('toggleterm.terminal').Terminal
|
||||||
|
|
||||||
|
function M.new_terminal()
|
||||||
|
local terminal = Terminal:new()
|
||||||
|
terminal:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.set_terminal_keymaps()
|
||||||
|
map('t', '<C-n>', [[<C-\><C-n>]], { desc = 'Visual mode' })
|
||||||
|
-- map('t', '<leader>xx', [[<C-\><C-n>]] .. ':ToggleTerm<CR>', { desc = 'Toggle Terminal' })
|
||||||
|
-- map('t', '<leader>xn', M.new_terminal, { desc = 'New terminal' })
|
||||||
|
-- map('t', '<leader>fx', [[<C-\><C-n>]] .. ':TermSelect<CR>', { desc = 'Find open terminal' })
|
||||||
|
-- map('t', '<leader>xr', [[<C-\><C-n>]] .. ':ToggleTermSetName<CR>', { desc = 'Rename terminal', buffer = 0 })
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -16,6 +16,7 @@ local defaults = {
|
||||||
'php',
|
'php',
|
||||||
'python',
|
'python',
|
||||||
'regex',
|
'regex',
|
||||||
|
'styled',
|
||||||
'scss',
|
'scss',
|
||||||
'tsx',
|
'tsx',
|
||||||
'typescript',
|
'typescript',
|
||||||
|
|
|
@ -12,7 +12,7 @@ return {
|
||||||
--[[ winblend = 20, ]]
|
--[[ winblend = 20, ]]
|
||||||
},
|
},
|
||||||
layout = {
|
layout = {
|
||||||
height = { min = 4, max = 25 },
|
height = { min = 10, max = 25 },
|
||||||
width = { min = 20, max = 50 },
|
width = { min = 20, max = 50 },
|
||||||
spacing = 8,
|
spacing = 8,
|
||||||
align = 'center',
|
align = 'center',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.map(mode, lhs, rhs, opts)
|
function M.set_keymap(mode, lhs, rhs, opts)
|
||||||
local defaults = {
|
local defaults = {
|
||||||
silent = true,
|
silent = true,
|
||||||
noremap = true,
|
noremap = true,
|
||||||
|
@ -10,7 +10,7 @@ end
|
||||||
|
|
||||||
function M.create_buf_map(bufnr, opts)
|
function M.create_buf_map(bufnr, opts)
|
||||||
return function(mode, lhs, rhs, map_opts)
|
return function(mode, lhs, rhs, map_opts)
|
||||||
M.map(
|
M.set_keymap(
|
||||||
mode,
|
mode,
|
||||||
lhs,
|
lhs,
|
||||||
rhs,
|
rhs,
|
||||||
|
|
|
@ -1,81 +1,68 @@
|
||||||
local user_config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.format_disabled_override = false
|
M.format_on_save_enabled = true
|
||||||
|
|
||||||
local function can_client_format(client)
|
function M.can_client_format_on_save(client)
|
||||||
|
local user_server_config = user_config.lsp.servers[client.name]
|
||||||
-- formatting enabled by default if server=true
|
-- formatting enabled by default if server=true
|
||||||
if user_config.lsp.servers[client.name] == true or client.name == 'null-ls' then
|
if user_server_config == true then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check config server settings
|
-- check config server settings
|
||||||
if user_config.lsp.servers[client.name] then
|
if user_server_config then
|
||||||
-- default to true if no format flag on server settings is set
|
-- default to true if no format flag on server settings is set
|
||||||
if user_config.lsp.servers[client.name].format == nil then
|
if user_server_config.format_on_save == nil then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check format flag on server settings
|
-- check format flag on server settings
|
||||||
return (user_config.lsp.servers[client.name].format == true)
|
return user_server_config.format_on_save == true
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.toggle_format_on_save()
|
function M.toggle_format_on_save()
|
||||||
M.format_disabled_override = not M.format_disabled_override
|
M.format_on_save_enabled = not M.format_on_save_enabled
|
||||||
vim.notify(string.format('Format on save disabled: %s', M.format_disabled_override))
|
vim.notify(string.format('Format on save: %s', M.format_on_save_enabled))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- format current buffer w/user settings
|
function M.buf_format(bufnr, timeout)
|
||||||
function M.format(bufnr, timeout)
|
|
||||||
if timeout == '' or timeout == nil then
|
if timeout == '' or timeout == nil then
|
||||||
timeout = user_config.lsp.format_timeout
|
timeout = user_config.lsp.format_timeout
|
||||||
else
|
else
|
||||||
timeout = timeout * 1000
|
timeout = timeout * 1000
|
||||||
end
|
end
|
||||||
local filter = can_client_format
|
|
||||||
if M.format_disabled_override then
|
|
||||||
filter = function(client)
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
vim.lsp.buf.format({
|
vim.lsp.buf.format({
|
||||||
timeout_ms = timeout,
|
timeout_ms = timeout,
|
||||||
filter = filter,
|
bufnr = bufnr or vim.api.nvim_get_current_buf(),
|
||||||
bufnr = bufnr or 0,
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_active_lsp_clients()
|
function M.buf_get_active_clients_str()
|
||||||
local active_clients = vim.lsp.get_clients()
|
local active_clients = vim.lsp.get_clients({
|
||||||
|
bufnr = vim.api.nvim_get_current_buf(),
|
||||||
|
})
|
||||||
local client_names = {}
|
local client_names = {}
|
||||||
|
|
||||||
for _, client in pairs(active_clients or {}) do
|
for _, client in pairs(active_clients or {}) do
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
|
||||||
-- only return attached buffers
|
|
||||||
if vim.lsp.buf_is_attached(buf, client.id) then
|
|
||||||
table.insert(client_names, client.name)
|
table.insert(client_names, client.name)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if not vim.tbl_isempty(client_names) then
|
if not vim.tbl_isempty(client_names) then
|
||||||
table.sort(client_names)
|
table.sort(client_names)
|
||||||
end
|
end
|
||||||
return client_names
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.get_active_clients_str()
|
|
||||||
local clients = M.get_active_lsp_clients()
|
|
||||||
local client_str = ''
|
local client_str = ''
|
||||||
|
|
||||||
if #clients < 1 then
|
if #client_names < 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, client in ipairs(clients) do
|
for i, client_name in ipairs(client_names) do
|
||||||
client_str = client_str .. client
|
client_str = client_str .. client_name
|
||||||
if i < #clients then
|
if i < #client_names then
|
||||||
client_str = client_str .. ', '
|
client_str = client_str .. ', '
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -87,7 +74,9 @@ function M.toggle_inlay_hints()
|
||||||
local enabled = user_config.lsp.inlay_hint
|
local enabled = user_config.lsp.inlay_hint
|
||||||
return function()
|
return function()
|
||||||
enabled = not enabled
|
enabled = not enabled
|
||||||
vim.lsp.inlay_hint(vim.api.nvim_get_current_buf() or 0, enabled)
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({
|
||||||
|
bufnr = vim.api.nvim_get_current_buf(),
|
||||||
|
}))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<h1 align="center">💫 CosmicNvim</h1>
|
<h1 align="center">💫 CosmicNvim</h1>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="Neovim Minimum Version" src="https://img.shields.io/badge/Neovim-0.10.0+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white)](https://github.com/neovim/neovim">
|
<img alt="Neovim Minimum Version" src="https://img.shields.io/badge/Neovim-0.11.0+-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=white)](https://github.com/neovim/neovim">
|
||||||
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/CosmicNvim/CosmicNvim?style=flat-square&logo=Github">
|
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/CosmicNvim/CosmicNvim?style=flat-square&logo=Github">
|
||||||
<a href="https://discord.gg/EwdrKzVbvJ">
|
<a href="https://discord.gg/EwdrKzVbvJ">
|
||||||
<img alt="Discord" src="https://img.shields.io/discord/901609359291854899?style=flat-square&logo=Discord">
|
<img alt="Discord" src="https://img.shields.io/discord/901609359291854899?style=flat-square&logo=Discord">
|
||||||
|
@ -38,7 +38,7 @@ Full featured native LSP functionality!
|
||||||
- Custom statusline via [lualine](https://github.com/nvim-lualine/lualine.nvim)
|
- Custom statusline via [lualine](https://github.com/nvim-lualine/lualine.nvim)
|
||||||
- Explore files via [nvim-tree](https://github.com/kyazdani42/nvim-tree.lua)
|
- Explore files via [nvim-tree](https://github.com/kyazdani42/nvim-tree.lua)
|
||||||
- Fuzzy finder via [Telescope](https://github.com/nvim-telescope/telescope.nvim)
|
- Fuzzy finder via [Telescope](https://github.com/nvim-telescope/telescope.nvim)
|
||||||
- Floating terminal with [vim-floaterm](https://github.com/voldikss/vim-floaterm)
|
- Floating terminal with [toggleterm.nvim](https://github.com/akinsho/toggleterm.nvim)
|
||||||
- Auto LSP/formatter/linter installation via [mason.nvim](https://github.com/williamboman/mason.nvim)
|
- Auto LSP/formatter/linter installation via [mason.nvim](https://github.com/williamboman/mason.nvim)
|
||||||
- Autocompletion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
|
- Autocompletion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
|
||||||
- Snippet support via [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
|
- Snippet support via [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
|
||||||
|
@ -55,10 +55,9 @@ experience with any LSP supported language._
|
||||||
|
|
||||||
#### Prerequisites
|
#### Prerequisites
|
||||||
|
|
||||||
- Neovim (+0.10.0) nightly
|
- Neovim (+0.11.0) nightly
|
||||||
- [Node.js](https://nodejs.org/en/)
|
- [Node.js](https://nodejs.org/en/)
|
||||||
- [prettierd](https://github.com/fsouza/prettierd)
|
- [prettierd](https://github.com/fsouza/prettierd)
|
||||||
- [eslint_d](https://www.npmjs.com/package/eslint_d) (for eslint w/null_ls, optional)
|
|
||||||
|
|
||||||
#### Install
|
#### Install
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue