Lazy.nvim (#88)
* feat: init lazy.nvim * refactor: easy plugin init * feat: user defined plugins * refactor: clean up user config * refactor: clean up lsp plugins * fix: lsp signature * fix: null ls user config * feat: replace commands * feat: optimize lazy loading * fix: lsp_signature working * fix: documentation hover/sig help * fix: autopairs * feat: clean up luasnips * fix auto complete * moar laziness * feat: add markdown_inline to ensured_installed for TS * clean up * clean up auto-session
This commit is contained in:
parent
2aca7635e5
commit
daaafc1f8d
47 changed files with 913 additions and 1045 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,6 +2,8 @@ pack/**
|
||||||
sessions/**
|
sessions/**
|
||||||
.netrwhist
|
.netrwhist
|
||||||
plugin/
|
plugin/
|
||||||
|
minimal.lua
|
||||||
|
.repro
|
||||||
lua/cosmic/compiled.lua
|
lua/cosmic/compiled.lua
|
||||||
lua/cosmic/config/editor.lua
|
lua/cosmic/config/editor.lua
|
||||||
lua/cosmic/config/config.lua
|
lua/cosmic/config/config.lua
|
||||||
|
|
8
init.lua
8
init.lua
|
@ -2,14 +2,6 @@ if vim.fn.has('nvim-0.8') == 0 then
|
||||||
error('Need Neovim v0.8+ in order to run Cosmic!')
|
error('Need Neovim v0.8+ in order to run Cosmic!')
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
|
||||||
local ok, _ = pcall(require, 'impatient')
|
|
||||||
|
|
||||||
if not ok then
|
|
||||||
vim.notify('impatient.nvim not installed', vim.log.levels.WARN)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local ok, err = pcall(require, 'cosmic')
|
local ok, err = pcall(require, 'cosmic')
|
||||||
|
|
||||||
if not ok then
|
if not ok then
|
||||||
|
|
|
@ -4,18 +4,8 @@
|
||||||
-- local null_ls = require('null-ls')
|
-- local null_ls = require('null-ls')
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
-- See https://github.com/rmagatti/auto-session#%EF%B8%8F-configuration
|
|
||||||
auto_session = {},
|
|
||||||
-- See :h nvim_open_win for possible border options
|
-- See :h nvim_open_win for possible border options
|
||||||
border = 'rounded',
|
border = 'rounded',
|
||||||
-- https://github.com/numToStr/Comment.nvim#configuration-optional
|
|
||||||
comment_nvim = {},
|
|
||||||
-- See https://github.com/CosmicNvim/cosmic-ui#%EF%B8%8F-configuration
|
|
||||||
cosmic_ui = {},
|
|
||||||
-- See :h vim.diagnostic.config for all diagnostic configuration options
|
|
||||||
diagnostic = {},
|
|
||||||
-- See :h gitsigns-usage
|
|
||||||
gitsigns = {},
|
|
||||||
-- LSP settings
|
-- LSP settings
|
||||||
lsp = {
|
lsp = {
|
||||||
-- True/false or table of filetypes {'.ts', '.js',}
|
-- True/false or table of filetypes {'.ts', '.js',}
|
||||||
|
@ -47,35 +37,61 @@ local config = {
|
||||||
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
|
||||||
|
format = false,
|
||||||
-- Add additional sources here
|
-- Add additional sources here
|
||||||
sources = {},
|
get_sources = function()
|
||||||
|
local null_ls = require('null-ls')
|
||||||
|
return {
|
||||||
|
null_ls.builtins.diagnostics.shellcheck,
|
||||||
|
null_ls.builtins.diagnostics.actionlint.with({
|
||||||
|
condition = function()
|
||||||
|
local cwd = vim.fn.expand('%:p:.')
|
||||||
|
return cwd:find('.github/workflows')
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- See Cosmic defaults lsp/providers/tsserver.lua
|
-- See Cosmic defaults lsp/providers/tsserver.lua
|
||||||
ts_utils = {},
|
ts_utils = {},
|
||||||
},
|
},
|
||||||
-- See https://github.com/ray-x/lsp_signature.nvim#full-configuration-with-default-values
|
-- adjust build in plugin settings
|
||||||
lsp_signature = {},
|
plugins = {
|
||||||
-- See https://github.com/nvim-lualine/lualine.nvim#default-configuration
|
-- See https://github.com/rmagatti/auto-session#%EF%B8%8F-configuration
|
||||||
lualine = {},
|
auto_session = {},
|
||||||
-- See https://github.com/L3MON4D3/LuaSnip/blob/577045e9adf325e58f690f4d4b4a293f3dcec1b3/README.md#config
|
-- https://github.com/numToStr/Comment.nvim#configuration-optional
|
||||||
luasnip = {},
|
comment_nvim = {},
|
||||||
-- See :h telescope.setup
|
-- See https://github.com/CosmicNvim/cosmic-ui#%EF%B8%8F-configuration
|
||||||
telescope = {},
|
cosmic_ui = {},
|
||||||
-- See https://github.com/folke/todo-comments.nvim#%EF%B8%8F-configuration
|
-- See :h vim.diagnostic.config for all diagnostic configuration options
|
||||||
todo_comments = {},
|
diagnostic = {},
|
||||||
-- See :h nvim-treesitter-quickstart
|
-- See :h gitsigns-usage
|
||||||
treesitter = {},
|
gitsigns = {},
|
||||||
-- See :h cmp-usage
|
-- See https://github.com/ray-x/lsp_signature.nvim#full-configuration-with-default-values
|
||||||
nvim_cmp = {},
|
lsp_signature = {},
|
||||||
-- See :h nvim-tree.setup
|
-- See https://github.com/nvim-lualine/lualine.nvim#default-configuration
|
||||||
nvim_tree = {},
|
lualine = {},
|
||||||
-- Add additional plugins
|
-- See https://github.com/L3MON4D3/LuaSnip/blob/577045e9adf325e58f690f4d4b4a293f3dcec1b3/README.md#config
|
||||||
|
luasnip = {},
|
||||||
|
-- See :h telescope.setup
|
||||||
|
telescope = {},
|
||||||
|
-- See https://github.com/folke/todo-comments.nvim#%EF%B8%8F-configuration
|
||||||
|
todo_comments = {},
|
||||||
|
-- See :h nvim-treesitter-quickstart
|
||||||
|
treesitter = {},
|
||||||
|
-- See :h cmp-usage
|
||||||
|
nvim_cmp = {},
|
||||||
|
-- See :h nvim-tree.setup
|
||||||
|
nvim_tree = {},
|
||||||
|
},
|
||||||
|
-- Add additional plugins (lazy.nvim)
|
||||||
add_plugins = {
|
add_plugins = {
|
||||||
'ggandor/lightspeed.nvim',
|
'ggandor/lightspeed.nvim',
|
||||||
{
|
{
|
||||||
'romgrk/barbar.nvim',
|
'romgrk/barbar.nvim',
|
||||||
requires = { 'kyazdani42/nvim-web-devicons' },
|
dependencies = { 'kyazdani42/nvim-web-devicons' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- Disable plugins enabled by CosmicNvim
|
-- Disable plugins enabled by CosmicNvim
|
||||||
|
|
|
@ -7,7 +7,6 @@ vim.api.nvim_create_autocmd('VimResized', {
|
||||||
|
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
command! CosmicUpdate lua require('cosmic.utils.cosmic').update()
|
command! CosmicUpdate lua require('cosmic.utils.cosmic').update()
|
||||||
command! CosmicReload lua require('cosmic.utils.cosmic').reload_user_config(true)
|
command! CosmicSync lua require('cosmic.utils.cosmic').sync_plugins(true)
|
||||||
command! CosmicReloadSync lua require('cosmic.utils.cosmic').reload_user_config_sync()
|
|
||||||
command! LspFormat lua vim.lsp.buf.format()
|
command! LspFormat lua vim.lsp.buf.format()
|
||||||
]])
|
]])
|
||||||
|
|
|
@ -2,11 +2,26 @@ local cosmic_modules = {
|
||||||
'cosmic.core.disabled',
|
'cosmic.core.disabled',
|
||||||
'cosmic.core.editor',
|
'cosmic.core.editor',
|
||||||
'cosmic.core.pluginsInit',
|
'cosmic.core.pluginsInit',
|
||||||
|
'cosmic.lsp',
|
||||||
'cosmic.core.commands',
|
'cosmic.core.commands',
|
||||||
'cosmic.core.mappings',
|
'cosmic.core.mappings',
|
||||||
'cosmic.config.editor',
|
'cosmic.config.editor',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- set up lazy.nvim to install plugins
|
||||||
|
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
'git',
|
||||||
|
'clone',
|
||||||
|
'--filter=blob:none',
|
||||||
|
'--single-branch',
|
||||||
|
'https://github.com/folke/lazy.nvim.git',
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.runtimepath:prepend(lazypath)
|
||||||
|
|
||||||
for _, mod in ipairs(cosmic_modules) do
|
for _, mod in ipairs(cosmic_modules) do
|
||||||
local ok, err = pcall(require, mod)
|
local ok, err = pcall(require, mod)
|
||||||
if not ok and not mod:find('cosmic.config') then
|
if not ok and not mod:find('cosmic.config') then
|
||||||
|
|
|
@ -1,252 +1,6 @@
|
||||||
local user_config = require('cosmic.core.user')
|
require('lazy').setup('cosmic.plugins', {
|
||||||
local cosmic_packer = require('cosmic.packer')
|
defaults = { lazy = true },
|
||||||
local packer = cosmic_packer.packer
|
ui = {
|
||||||
local use = packer.use
|
border = 'rounded',
|
||||||
|
},
|
||||||
return packer.startup(function()
|
})
|
||||||
use({
|
|
||||||
'wbthomason/packer.nvim',
|
|
||||||
'lewis6991/impatient.nvim',
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'folke/noice.nvim',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.noice')
|
|
||||||
end,
|
|
||||||
requires = {
|
|
||||||
'MunifTanjim/nui.nvim',
|
|
||||||
{
|
|
||||||
'rcarriga/nvim-notify',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- initialize theme plugins
|
|
||||||
use({ -- color scheme
|
|
||||||
'folke/tokyonight.nvim',
|
|
||||||
as = 'tokyonight',
|
|
||||||
config = function()
|
|
||||||
-- set up theme
|
|
||||||
require('cosmic.plugins.tokyonight')
|
|
||||||
end,
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'tokyonight'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- theme stuff
|
|
||||||
use({
|
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.lualine')
|
|
||||||
end,
|
|
||||||
requires = { 'nvim-tree/nvim-web-devicons' },
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'lualine'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- file explorer
|
|
||||||
use({
|
|
||||||
'kyazdani42/nvim-tree.lua',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.nvim-tree')
|
|
||||||
end,
|
|
||||||
cmd = {
|
|
||||||
'NvimTreeClipboard',
|
|
||||||
'NvimTreeClose',
|
|
||||||
'NvimTreeFindFile',
|
|
||||||
'NvimTreeOpen',
|
|
||||||
'NvimTreeRefresh',
|
|
||||||
'NvimTreeToggle',
|
|
||||||
},
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-tree'),
|
|
||||||
event = 'VimEnter',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'CosmicNvim/cosmic-ui',
|
|
||||||
requires = {
|
|
||||||
'MunifTanjim/nui.nvim',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.cosmic-ui')
|
|
||||||
end,
|
|
||||||
event = 'BufWinEnter',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.lsp')
|
|
||||||
end,
|
|
||||||
requires = {
|
|
||||||
{ 'b0o/SchemaStore.nvim' },
|
|
||||||
{ 'williamboman/nvim-lsp-installer' },
|
|
||||||
{ 'jose-elias-alvarez/nvim-lsp-ts-utils' },
|
|
||||||
{
|
|
||||||
'jose-elias-alvarez/null-ls.nvim',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.lsp.providers.null_ls')
|
|
||||||
end,
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'null-ls'),
|
|
||||||
after = 'nvim-lspconfig',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
event = 'BufWinEnter',
|
|
||||||
})
|
|
||||||
|
|
||||||
-- autocompletion
|
|
||||||
use({
|
|
||||||
'hrsh7th/nvim-cmp',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.nvim-cmp')
|
|
||||||
end,
|
|
||||||
requires = {
|
|
||||||
{
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.luasnip')
|
|
||||||
end,
|
|
||||||
requires = {
|
|
||||||
'rafamadriz/friendly-snippets',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp' },
|
|
||||||
{ 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp' },
|
|
||||||
{ 'hrsh7th/cmp-buffer', after = 'nvim-cmp' },
|
|
||||||
{ 'hrsh7th/cmp-nvim-lua', after = 'nvim-cmp' },
|
|
||||||
{ 'hrsh7th/cmp-path', after = 'nvim-cmp' },
|
|
||||||
{
|
|
||||||
'windwp/nvim-autopairs',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.auto-pairs')
|
|
||||||
end,
|
|
||||||
after = 'nvim-cmp',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
event = 'InsertEnter',
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-cmp'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- git commands
|
|
||||||
use({
|
|
||||||
'tpope/vim-fugitive',
|
|
||||||
opt = true,
|
|
||||||
cmd = 'Git',
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'fugitive'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- git column signs
|
|
||||||
use({
|
|
||||||
'lewis6991/gitsigns.nvim',
|
|
||||||
requires = { 'nvim-lua/plenary.nvim' },
|
|
||||||
opt = true,
|
|
||||||
event = 'BufWinEnter',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.gitsigns')
|
|
||||||
end,
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'gitsigns'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- floating terminal
|
|
||||||
use({
|
|
||||||
'voldikss/vim-floaterm',
|
|
||||||
opt = true,
|
|
||||||
event = 'BufWinEnter',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.terminal')
|
|
||||||
end,
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'terminal'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- file navigation
|
|
||||||
use({
|
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
requires = {
|
|
||||||
'nvim-lua/popup.nvim',
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
{
|
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
|
||||||
run = 'make',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.telescope.mappings').init()
|
|
||||||
require('cosmic.plugins.telescope')
|
|
||||||
end,
|
|
||||||
event = 'BufWinEnter',
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'telescope'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- session/project management
|
|
||||||
use({
|
|
||||||
'glepnir/dashboard-nvim',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.dashboard')
|
|
||||||
end,
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'dashboard'),
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'rmagatti/auto-session',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.auto-session')
|
|
||||||
end,
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'auto-session'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- lang/syntax stuff
|
|
||||||
use({
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
requires = {
|
|
||||||
'windwp/nvim-ts-autotag',
|
|
||||||
'JoosepAlviste/nvim-ts-context-commentstring',
|
|
||||||
'nvim-treesitter/nvim-treesitter-refactor',
|
|
||||||
},
|
|
||||||
run = ':TSUpdate',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.treesitter')
|
|
||||||
end,
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'treesitter'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- comments and stuff
|
|
||||||
use({
|
|
||||||
'numToStr/Comment.nvim',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.comments')
|
|
||||||
end,
|
|
||||||
event = 'BufWinEnter',
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'comment-nvim'),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- todo highlights
|
|
||||||
use({
|
|
||||||
'folke/todo-comments.nvim',
|
|
||||||
requires = 'nvim-lua/plenary.nvim',
|
|
||||||
config = function()
|
|
||||||
require('cosmic.plugins.todo-comments')
|
|
||||||
end,
|
|
||||||
event = 'BufWinEnter',
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'todo-comments'),
|
|
||||||
})
|
|
||||||
-- colorized hex codes
|
|
||||||
use({
|
|
||||||
'norcalli/nvim-colorizer.lua',
|
|
||||||
opt = true,
|
|
||||||
cmd = { 'ColorizerToggle' },
|
|
||||||
config = function()
|
|
||||||
require('colorizer').setup()
|
|
||||||
end,
|
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'colorizer'),
|
|
||||||
})
|
|
||||||
|
|
||||||
if user_config.add_plugins and not vim.tbl_isempty(user_config.add_plugins) then
|
|
||||||
for _, plugin in pairs(user_config.add_plugins) do
|
|
||||||
use(plugin)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if cosmic_packer.first_install then
|
|
||||||
packer.sync()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
-- DEFAULT USER SETTINGS
|
-- DEFAULT USER SETTINGS
|
||||||
local ok, user_config = pcall(require, 'cosmic.config.config')
|
local user_config = require('cosmic.config.config')
|
||||||
|
|
||||||
if not ok then
|
|
||||||
user_config = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
local default_config = {
|
local default_config = {
|
||||||
border = 'rounded',
|
border = 'rounded',
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
local mods = {
|
local mods = {
|
||||||
'cosmic.compiled',
|
|
||||||
'cosmic.core',
|
'cosmic.core',
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, mod in ipairs(mods) do
|
for _, mod in ipairs(mods) do
|
||||||
local ok, err = pcall(require, mod)
|
local ok, err = pcall(require, mod)
|
||||||
if mod == 'cosmic.compiled' and not ok then
|
if not ok and not mod:find('cosmic.core.user') then
|
||||||
vim.notify('Run :PackerCompile!', vim.log.levels.WARN, {
|
|
||||||
title = 'CosmicNvim',
|
|
||||||
})
|
|
||||||
elseif not ok and not mod:find('cosmic.core.user') then
|
|
||||||
error(('Error loading %s...\n\n%s'):format(mod, err))
|
error(('Error loading %s...\n\n%s'):format(mod, err))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
local config = require('cosmic.core.user')
|
|
||||||
|
|
||||||
-- set up lsp servers
|
-- set up lsp servers
|
||||||
require('cosmic.lsp.providers')
|
|
||||||
require('cosmic.lsp.diagnostics')
|
require('cosmic.lsp.diagnostics')
|
||||||
require('cosmic.lsp.commands')
|
require('cosmic.lsp.commands')
|
||||||
|
|
||||||
-- currently handled by noice
|
-- handled via noice
|
||||||
--
|
|
||||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
|
|
||||||
border = config.border,
|
|
||||||
})
|
|
||||||
|
|
||||||
--[[ vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { ]]
|
--[[ vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { ]]
|
||||||
--[[ border = config.border, ]]
|
--[[ border = user_config.border, ]]
|
||||||
|
--[[ }) ]]
|
||||||
|
--[[]]
|
||||||
|
--[[ vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { ]]
|
||||||
|
--[[ border = user_config.border, ]]
|
||||||
--[[ }) ]]
|
--[[ }) ]]
|
||||||
|
|
|
@ -34,9 +34,6 @@ function M.init(client, bufnr)
|
||||||
set_keymap('n', '<leader>gf', '<cmd>lua vim.lsp.buf.formatting()<cr>')
|
set_keymap('n', '<leader>gf', '<cmd>lua vim.lsp.buf.formatting()<cr>')
|
||||||
set_keymap('v', '<leader>gf', '<cmd>lua vim.lsp.buf.range_formatting()<cr>')
|
set_keymap('v', '<leader>gf', '<cmd>lua vim.lsp.buf.range_formatting()<cr>')
|
||||||
|
|
||||||
-- signature help
|
|
||||||
set_keymap('n', '<C-K>', '<cmd>lua require("lsp_signature").signature()<cr>')
|
|
||||||
|
|
||||||
-- lsp workspace
|
-- lsp workspace
|
||||||
set_keymap('n', '<leader>wd', '<cmd>Telescope diagnostics<cr>')
|
set_keymap('n', '<leader>wd', '<cmd>Telescope diagnostics<cr>')
|
||||||
set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<cr>')
|
set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<cr>')
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.on_attach(client, bufnr)
|
function M.on_attach(client, bufnr)
|
||||||
|
@ -15,7 +16,7 @@ M.flags = {
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
}
|
}
|
||||||
|
|
||||||
M.capabilities = {}
|
M.capabilities = capabilities
|
||||||
|
|
||||||
M.root_dir = function(fname)
|
M.root_dir = function(fname)
|
||||||
local util = require('lspconfig').util
|
local util = require('lspconfig').util
|
||||||
|
|
|
@ -1,46 +1,11 @@
|
||||||
local u = require('cosmic.utils')
|
|
||||||
local default_on_attach = require('cosmic.lsp.providers.defaults').on_attach
|
local default_on_attach = require('cosmic.lsp.providers.defaults').on_attach
|
||||||
local config = require('cosmic.core.user')
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.on_attach(client, bufnr)
|
function M.on_attach(client, bufnr)
|
||||||
default_on_attach(client, bufnr)
|
default_on_attach(client, bufnr)
|
||||||
|
|
||||||
local ts_utils = require('nvim-lsp-ts-utils')
|
-- ts utils must be setup on "on_attach"
|
||||||
|
require('cosmic.plugins.nvim-lsp-ts-utils.config').setup(client)
|
||||||
-- defaults
|
|
||||||
ts_utils.setup(u.merge({
|
|
||||||
debug = false,
|
|
||||||
disable_commands = false,
|
|
||||||
enable_import_on_completion = true,
|
|
||||||
|
|
||||||
-- import all
|
|
||||||
import_all_timeout = 5000, -- ms
|
|
||||||
import_all_priorities = {
|
|
||||||
buffers = 4, -- loaded buffer names
|
|
||||||
buffer_content = 3, -- loaded buffer content
|
|
||||||
local_files = 2, -- git files or files with relative path markers
|
|
||||||
same_file = 1, -- add to existing import statement
|
|
||||||
},
|
|
||||||
import_all_scan_buffers = 100,
|
|
||||||
import_all_select_source = false,
|
|
||||||
|
|
||||||
-- inlay hints
|
|
||||||
auto_inlay_hints = true,
|
|
||||||
inlay_hints_highlight = 'Comment',
|
|
||||||
|
|
||||||
-- update imports on file move
|
|
||||||
update_imports_on_move = true,
|
|
||||||
require_confirmation_on_move = false,
|
|
||||||
watch_dir = nil,
|
|
||||||
|
|
||||||
-- filter diagnostics
|
|
||||||
filter_out_diagnostics_by_severity = {},
|
|
||||||
filter_out_diagnostics_by_code = {},
|
|
||||||
}, config.lsp.ts_utils or {}))
|
|
||||||
|
|
||||||
-- required to fix code action ranges and filter diagnostics
|
|
||||||
ts_utils.setup_client(client)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
local cmd = vim.cmd
|
|
||||||
|
|
||||||
local present, packer = pcall(require, 'packer')
|
|
||||||
|
|
||||||
local first_install = false
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
local packer_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
|
|
||||||
|
|
||||||
print('Cloning packer..')
|
|
||||||
-- remove the dir before cloning
|
|
||||||
vim.fn.delete(packer_path, 'rf')
|
|
||||||
vim.fn.system({
|
|
||||||
'git',
|
|
||||||
'clone',
|
|
||||||
'https://github.com/wbthomason/packer.nvim',
|
|
||||||
'--depth',
|
|
||||||
'20',
|
|
||||||
packer_path,
|
|
||||||
})
|
|
||||||
|
|
||||||
cmd('packadd packer.nvim')
|
|
||||||
present, packer = pcall(require, 'packer')
|
|
||||||
|
|
||||||
if present then
|
|
||||||
print('Packer cloned successfully.')
|
|
||||||
first_install = true
|
|
||||||
else
|
|
||||||
error("Couldn't clone packer !\nPacker path: " .. packer_path .. '\n' .. packer)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
packer.init({
|
|
||||||
display = {
|
|
||||||
open_fn = function()
|
|
||||||
return require('packer.util').float({ border = 'rounded' })
|
|
||||||
end,
|
|
||||||
prompt_border = 'rounded',
|
|
||||||
},
|
|
||||||
git = {
|
|
||||||
clone_timeout = 800, -- Timeout, in seconds, for git clones
|
|
||||||
},
|
|
||||||
compile_path = vim.fn.stdpath('config') .. '/lua/cosmic/compiled.lua',
|
|
||||||
snapshot_path = vim.fn.stdpath('config') .. '/snapshots',
|
|
||||||
auto_clean = true,
|
|
||||||
compile_on_sync = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
packer = packer,
|
|
||||||
first_install = first_install,
|
|
||||||
}
|
|
|
@ -1,14 +1,19 @@
|
||||||
require('nvim-autopairs').setup({
|
local user_config = require('cosmic.core.user')
|
||||||
check_ts = true,
|
local u = require('cosmic.utils')
|
||||||
ts_config = {
|
|
||||||
lua = { 'string', 'source' },
|
|
||||||
javascript = { 'string', 'template_string' },
|
|
||||||
java = false,
|
|
||||||
},
|
|
||||||
disable_filetype = { 'TelescopePrompt', 'vim' },
|
|
||||||
fast_wrap = {},
|
|
||||||
})
|
|
||||||
|
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
return {
|
||||||
local cmp = require('cmp')
|
'windwp/nvim-autopairs',
|
||||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
config = function()
|
||||||
|
require('nvim-autopairs').setup(u.merge({
|
||||||
|
check_ts = true,
|
||||||
|
ts_config = {
|
||||||
|
lua = { 'string', 'source' },
|
||||||
|
javascript = { 'string', 'template_string' },
|
||||||
|
java = false,
|
||||||
|
},
|
||||||
|
disable_filetype = { 'TelescopePrompt', 'vim' },
|
||||||
|
fast_wrap = {},
|
||||||
|
}, user_config.plugins.nvim_autopairs or {}))
|
||||||
|
end,
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'autopairs'),
|
||||||
|
}
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
local config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
local defaults = {
|
local defaults = {
|
||||||
pre_save_cmds = { 'NvimTreeClose', 'cclose', 'lua vim.notify.dismiss()' },
|
pre_save_cmds = { 'NvimTreeClose', 'cclose', 'lua vim.notify.dismiss()' },
|
||||||
post_restore_cmds = { 'NvimTreeRefresh' },
|
|
||||||
auto_session_enabled = false,
|
auto_session_enabled = false,
|
||||||
auto_save_enabled = true,
|
auto_save_enabled = true,
|
||||||
auto_restore_enabled = false,
|
auto_restore_enabled = false,
|
||||||
|
auto_session_use_git_branch = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
require('auto-session').setup(u.merge(defaults, config.auto_session or {}))
|
return {
|
||||||
|
'rmagatti/auto-session',
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require('auto-session').setup(u.merge(defaults, user_config.plugins.auto_session or {}))
|
||||||
|
end,
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'auto-session'),
|
||||||
|
}
|
||||||
|
|
11
lua/cosmic/plugins/colorizer/init.lua
Normal file
11
lua/cosmic/plugins/colorizer/init.lua
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'norcalli/nvim-colorizer.lua',
|
||||||
|
cmd = { 'ColorizerToggle' },
|
||||||
|
config = function()
|
||||||
|
require('colorizer').setup(u.merge({}, user_config.plugins.colorizer or {}))
|
||||||
|
end,
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'colorizer'),
|
||||||
|
}
|
|
@ -1,19 +1,26 @@
|
||||||
local config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
require('Comment').setup(u.merge({
|
return {
|
||||||
pre_hook = function(ctx)
|
'numToStr/Comment.nvim',
|
||||||
local U = require('Comment.utils')
|
config = function()
|
||||||
local location = nil
|
require('Comment').setup(u.merge({
|
||||||
if ctx.ctype == U.ctype.block then
|
pre_hook = function(ctx)
|
||||||
location = require('ts_context_commentstring.utils').get_cursor_location()
|
local U = require('Comment.utils')
|
||||||
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
local location = nil
|
||||||
location = require('ts_context_commentstring.utils').get_visual_start_location()
|
if ctx.ctype == U.ctype.block then
|
||||||
end
|
location = require('ts_context_commentstring.utils').get_cursor_location()
|
||||||
|
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
||||||
|
location = require('ts_context_commentstring.utils').get_visual_start_location()
|
||||||
|
end
|
||||||
|
|
||||||
return require('ts_context_commentstring.internal').calculate_commentstring({
|
return require('ts_context_commentstring.internal').calculate_commentstring({
|
||||||
key = ctx.ctype == U.ctype.line and '__default' or '__multiline',
|
key = ctx.ctype == U.ctype.line and '__default' or '__multiline',
|
||||||
location = location,
|
location = location,
|
||||||
})
|
})
|
||||||
|
end,
|
||||||
|
}, user_config.plugins.comment_nvim or {}))
|
||||||
end,
|
end,
|
||||||
}, config.comment_nvim or {}))
|
event = 'BufEnter',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'comment-nvim'),
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
local config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
local defaults = {
|
local defaults = {
|
||||||
border_style = 'rounded',
|
border_style = 'rounded',
|
||||||
}
|
}
|
||||||
|
|
||||||
require('cosmic-ui').setup(u.merge(defaults, config.cosmic_ui or {}))
|
return {
|
||||||
|
'CosmicNvim/cosmic-ui',
|
||||||
|
dependencies = {
|
||||||
|
'MunifTanjim/nui.nvim',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('cosmic-ui').setup(u.merge(defaults, user_config.plugins.cosmic_ui or {}))
|
||||||
|
end,
|
||||||
|
event = 'VeryLazy',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'cosmic-ui'),
|
||||||
|
}
|
||||||
|
|
|
@ -1,45 +1,52 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
local icons = require('cosmic.utils.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
g.dashboard_custom_header = {
|
return {
|
||||||
'',
|
'glepnir/dashboard-nvim',
|
||||||
'',
|
config = function()
|
||||||
'',
|
g.dashboard_custom_header = {
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
' ██████╗ ██████╗ ███████╗███╗ ███╗██╗ ██████╗███╗ ██╗██╗ ██╗██╗███╗ ███╗',
|
'',
|
||||||
'██╔════╝██╔═══██╗██╔════╝████╗ ████║██║██╔════╝████╗ ██║██║ ██║██║████╗ ████║',
|
'',
|
||||||
'██║ ██║ ██║███████╗██╔████╔██║██║██║ ██╔██╗ ██║██║ ██║██║██╔████╔██║',
|
'',
|
||||||
'██║ ██║ ██║╚════██║██║╚██╔╝██║██║██║ ██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║',
|
' ██████╗ ██████╗ ███████╗███╗ ███╗██╗ ██████╗███╗ ██╗██╗ ██╗██╗███╗ ███╗',
|
||||||
'╚██████╗╚██████╔╝███████║██║ ╚═╝ ██║██║╚██████╗██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║',
|
'██╔════╝██╔═══██╗██╔════╝████╗ ████║██║██╔════╝████╗ ██║██║ ██║██║████╗ ████║',
|
||||||
' ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝',
|
'██║ ██║ ██║███████╗██╔████╔██║██║██║ ██╔██╗ ██║██║ ██║██║██╔████╔██║',
|
||||||
'',
|
'██║ ██║ ██║╚════██║██║╚██╔╝██║██║██║ ██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║',
|
||||||
'',
|
'╚██████╗╚██████╔╝███████║██║ ╚═╝ ██║██║╚██████╗██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║',
|
||||||
'',
|
' ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
}
|
||||||
|
|
||||||
|
g.dashboard_default_executive = 'telescope'
|
||||||
|
|
||||||
|
g.dashboard_session_directory = vim.fn.stdpath('data') .. '/sessions'
|
||||||
|
|
||||||
|
g.dashboard_custom_section = {
|
||||||
|
find_file = {
|
||||||
|
description = { icons.file1 .. ' Find File <leader>ff' },
|
||||||
|
command = 'lua require("cosmic.plugins.telescope.mappings").project_files()',
|
||||||
|
},
|
||||||
|
file_explorer = {
|
||||||
|
description = { icons.file2 .. ' File Manager <C-n> ' },
|
||||||
|
command = 'NvimTreeToggle',
|
||||||
|
},
|
||||||
|
find_string = {
|
||||||
|
description = { icons.word .. ' Grep String <leader>fs' },
|
||||||
|
command = 'Telescope grep_string',
|
||||||
|
},
|
||||||
|
last_session = {
|
||||||
|
description = { icons.clock .. ' Load Session <leader>sl' },
|
||||||
|
command = 'lua vim.cmd(":silent RestoreSession")',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
g.dashboard_custom_footer = { '💫 github.com/CosmicNvim/CosmicNvim' }
|
||||||
|
end,
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'dashboard'),
|
||||||
}
|
}
|
||||||
|
|
||||||
g.dashboard_default_executive = 'telescope'
|
|
||||||
|
|
||||||
g.dashboard_session_directory = vim.fn.stdpath('data') .. '/sessions'
|
|
||||||
|
|
||||||
g.dashboard_custom_section = {
|
|
||||||
find_file = {
|
|
||||||
description = { icons.file1 .. ' Find File <leader>ff' },
|
|
||||||
command = 'lua require("cosmic.plugins.telescope.mappings").project_files()',
|
|
||||||
},
|
|
||||||
file_explorer = {
|
|
||||||
description = { icons.file2 .. ' File Manager <C-n> ' },
|
|
||||||
command = 'NvimTreeToggle',
|
|
||||||
},
|
|
||||||
find_string = {
|
|
||||||
description = { icons.word .. ' Grep String <leader>fs' },
|
|
||||||
command = 'Telescope grep_string',
|
|
||||||
},
|
|
||||||
last_session = {
|
|
||||||
description = { icons.clock .. ' Load Session <leader>sl' },
|
|
||||||
command = 'lua vim.cmd(":silent RestoreSession")',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
g.dashboard_custom_footer = { '💫 github.com/CosmicNvim/CosmicNvim' }
|
|
||||||
|
|
7
lua/cosmic/plugins/fugitive/init.lua
Normal file
7
lua/cosmic/plugins/fugitive/init.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
return {
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
opt = true,
|
||||||
|
cmd = 'Git',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'fugitive'),
|
||||||
|
}
|
68
lua/cosmic/plugins/gitsigns/config.lua
Normal file
68
lua/cosmic/plugins/gitsigns/config.lua
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
|
require('gitsigns').setup(u.merge({
|
||||||
|
signs = {
|
||||||
|
add = { hl = 'GitSignsAdd', text = '│', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
||||||
|
change = { hl = 'GitSignsChange', text = '│', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
||||||
|
delete = { hl = 'GitSignsDelete', text = '_', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
||||||
|
topdelete = { hl = 'GitSignsDelete', text = '‾', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
||||||
|
changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
||||||
|
},
|
||||||
|
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||||
|
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||||
|
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||||
|
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||||
|
keymaps = {
|
||||||
|
-- Default keymap options
|
||||||
|
noremap = true,
|
||||||
|
|
||||||
|
['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'" },
|
||||||
|
['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'" },
|
||||||
|
|
||||||
|
['n <leader>hs'] = '<cmd>Gitsigns stage_hunk<CR>',
|
||||||
|
['v <leader>hs'] = ':Gitsigns stage_hunk<CR>',
|
||||||
|
['n <leader>hu'] = '<cmd>Gitsigns undo_stage_hunk<CR>',
|
||||||
|
['n <leader>hr'] = '<cmd>Gitsigns reset_hunk<CR>',
|
||||||
|
['v <leader>hr'] = ':Gitsigns reset_hunk<CR>',
|
||||||
|
['n <leader>hR'] = '<cmd>Gitsigns reset_buffer<CR>',
|
||||||
|
['n <leader>hp'] = '<cmd>Gitsigns preview_hunk<CR>',
|
||||||
|
['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line{full=true}<CR>',
|
||||||
|
['n <leader>hS'] = '<cmd>Gitsigns stage_buffer<CR>',
|
||||||
|
['n <leader>hU'] = '<cmd>Gitsigns reset_buffer_index<CR>',
|
||||||
|
|
||||||
|
-- Text objects
|
||||||
|
['o ih'] = ':<C-U>Gitsigns select_hunk<CR>',
|
||||||
|
['x ih'] = ':<C-U>Gitsigns select_hunk<CR>',
|
||||||
|
},
|
||||||
|
watch_gitdir = {
|
||||||
|
interval = 1000,
|
||||||
|
follow_files = true,
|
||||||
|
},
|
||||||
|
attach_to_untracked = true,
|
||||||
|
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||||
|
current_line_blame_opts = {
|
||||||
|
virt_text = true,
|
||||||
|
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||||
|
delay = 1000,
|
||||||
|
ignore_whitespace = false,
|
||||||
|
},
|
||||||
|
current_line_blame_formatter_opts = {
|
||||||
|
relative_time = false,
|
||||||
|
},
|
||||||
|
sign_priority = 6,
|
||||||
|
update_debounce = 100,
|
||||||
|
status_formatter = nil, -- Use default
|
||||||
|
max_file_length = 40000,
|
||||||
|
preview_config = {
|
||||||
|
-- Options passed to nvim_open_win
|
||||||
|
border = user_config.border,
|
||||||
|
style = 'minimal',
|
||||||
|
relative = 'cursor',
|
||||||
|
row = 0,
|
||||||
|
col = 1,
|
||||||
|
},
|
||||||
|
yadm = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
}, user_config.plugins.gitsigns or {}))
|
|
@ -1,68 +1,12 @@
|
||||||
local config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local u = require('cosmic.utils')
|
|
||||||
|
|
||||||
require('gitsigns').setup(u.merge({
|
return {
|
||||||
signs = {
|
'lewis6991/gitsigns.nvim',
|
||||||
add = { hl = 'GitSignsAdd', text = '│', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
change = { hl = 'GitSignsChange', text = '│', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
opt = true,
|
||||||
delete = { hl = 'GitSignsDelete', text = '_', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
event = 'VeryLazy',
|
||||||
topdelete = { hl = 'GitSignsDelete', text = '‾', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
config = function()
|
||||||
changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
require('cosmic.plugins.gitsigns.config')
|
||||||
},
|
end,
|
||||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'gitsigns'),
|
||||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
}
|
||||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
|
||||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
|
||||||
keymaps = {
|
|
||||||
-- Default keymap options
|
|
||||||
noremap = true,
|
|
||||||
|
|
||||||
['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'" },
|
|
||||||
['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'" },
|
|
||||||
|
|
||||||
['n <leader>hs'] = '<cmd>Gitsigns stage_hunk<CR>',
|
|
||||||
['v <leader>hs'] = ':Gitsigns stage_hunk<CR>',
|
|
||||||
['n <leader>hu'] = '<cmd>Gitsigns undo_stage_hunk<CR>',
|
|
||||||
['n <leader>hr'] = '<cmd>Gitsigns reset_hunk<CR>',
|
|
||||||
['v <leader>hr'] = ':Gitsigns reset_hunk<CR>',
|
|
||||||
['n <leader>hR'] = '<cmd>Gitsigns reset_buffer<CR>',
|
|
||||||
['n <leader>hp'] = '<cmd>Gitsigns preview_hunk<CR>',
|
|
||||||
['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line{full=true}<CR>',
|
|
||||||
['n <leader>hS'] = '<cmd>Gitsigns stage_buffer<CR>',
|
|
||||||
['n <leader>hU'] = '<cmd>Gitsigns reset_buffer_index<CR>',
|
|
||||||
|
|
||||||
-- Text objects
|
|
||||||
['o ih'] = ':<C-U>Gitsigns select_hunk<CR>',
|
|
||||||
['x ih'] = ':<C-U>Gitsigns select_hunk<CR>',
|
|
||||||
},
|
|
||||||
watch_gitdir = {
|
|
||||||
interval = 1000,
|
|
||||||
follow_files = true,
|
|
||||||
},
|
|
||||||
attach_to_untracked = true,
|
|
||||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
|
||||||
current_line_blame_opts = {
|
|
||||||
virt_text = true,
|
|
||||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
|
||||||
delay = 1000,
|
|
||||||
ignore_whitespace = false,
|
|
||||||
},
|
|
||||||
current_line_blame_formatter_opts = {
|
|
||||||
relative_time = false,
|
|
||||||
},
|
|
||||||
sign_priority = 6,
|
|
||||||
update_debounce = 100,
|
|
||||||
status_formatter = nil, -- Use default
|
|
||||||
max_file_length = 40000,
|
|
||||||
preview_config = {
|
|
||||||
-- Options passed to nvim_open_win
|
|
||||||
border = config.border,
|
|
||||||
style = 'minimal',
|
|
||||||
relative = 'cursor',
|
|
||||||
row = 0,
|
|
||||||
col = 1,
|
|
||||||
},
|
|
||||||
yadm = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
}, config.gitsigns or {}))
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
local config = require('cosmic.core.user')
|
|
||||||
local u = require('cosmic.utils')
|
|
||||||
|
|
||||||
require('lsp_signature').setup(u.merge({
|
|
||||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
|
||||||
handler_opts = {
|
|
||||||
border = config.border,
|
|
||||||
},
|
|
||||||
}, config.lsp_signature or {}))
|
|
|
@ -1,4 +1,4 @@
|
||||||
local config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local utils = require('cosmic.utils')
|
local utils = require('cosmic.utils')
|
||||||
local lsp_utils = require('cosmic.utils.lsp')
|
local lsp_utils = require('cosmic.utils.lsp')
|
||||||
local icons = require('cosmic.utils.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
|
@ -30,63 +30,71 @@ local custom_sections = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require('lualine').setup(utils.merge({
|
return {
|
||||||
options = {
|
'nvim-lualine/lualine.nvim',
|
||||||
theme = 'tokyonight',
|
lazy = false,
|
||||||
},
|
config = function()
|
||||||
sections = {
|
require('lualine').setup(utils.merge({
|
||||||
lualine_a = { 'mode' },
|
options = {
|
||||||
lualine_b = {
|
theme = 'tokyonight',
|
||||||
{
|
|
||||||
'filetype',
|
|
||||||
icon_only = true,
|
|
||||||
padding = {
|
|
||||||
left = 1,
|
|
||||||
right = 0,
|
|
||||||
},
|
|
||||||
separator = '',
|
|
||||||
},
|
},
|
||||||
custom_sections.shortenedFilePath,
|
sections = {
|
||||||
},
|
lualine_a = { 'mode' },
|
||||||
lualine_c = { custom_sections.diff },
|
lualine_b = {
|
||||||
lualine_x = { 'diagnostics' },
|
{
|
||||||
lualine_y = { lsp_utils.get_lsp_status_str },
|
'filetype',
|
||||||
lualine_z = { 'location', 'progress' },
|
icon_only = true,
|
||||||
},
|
padding = {
|
||||||
inactive_sections = {
|
left = 1,
|
||||||
lualine_a = {},
|
right = 0,
|
||||||
lualine_b = {
|
},
|
||||||
{
|
separator = '',
|
||||||
'filetype',
|
},
|
||||||
icon_only = true,
|
custom_sections.shortenedFilePath,
|
||||||
padding = {
|
|
||||||
left = 1,
|
|
||||||
right = 0,
|
|
||||||
},
|
},
|
||||||
separator = '',
|
lualine_c = { custom_sections.diff },
|
||||||
|
lualine_x = { 'diagnostics' },
|
||||||
|
lualine_y = { lsp_utils.get_lsp_status_str },
|
||||||
|
lualine_z = { 'location', 'progress' },
|
||||||
},
|
},
|
||||||
custom_sections.shortenedFilePath,
|
inactive_sections = {
|
||||||
},
|
lualine_a = {},
|
||||||
lualine_c = { custom_sections.diff },
|
lualine_b = {
|
||||||
lualine_x = { 'diagnostics' },
|
{
|
||||||
lualine_y = { 'location', 'progress' },
|
'filetype',
|
||||||
lualine_z = {},
|
icon_only = true,
|
||||||
},
|
padding = {
|
||||||
winbar = {
|
left = 1,
|
||||||
lualine_a = { utils.get_short_cwd },
|
right = 0,
|
||||||
lualine_b = { custom_sections.branch },
|
},
|
||||||
lualine_c = { custom_sections.relativeFilePath },
|
separator = '',
|
||||||
lualine_x = { 'filetype' },
|
},
|
||||||
lualine_y = {},
|
custom_sections.shortenedFilePath,
|
||||||
lualine_z = {},
|
},
|
||||||
},
|
lualine_c = { custom_sections.diff },
|
||||||
inactive_winbar = {
|
lualine_x = { 'diagnostics' },
|
||||||
lualine_a = { utils.get_short_cwd },
|
lualine_y = { 'location', 'progress' },
|
||||||
lualine_b = { custom_sections.branch },
|
lualine_z = {},
|
||||||
lualine_c = { custom_sections.relativeFilePath },
|
},
|
||||||
lualine_x = { 'filetype' },
|
winbar = {
|
||||||
lualine_y = {},
|
lualine_a = { utils.get_short_cwd },
|
||||||
lualine_z = {},
|
lualine_b = { custom_sections.branch },
|
||||||
},
|
lualine_c = { custom_sections.relativeFilePath },
|
||||||
extensions = { 'quickfix', 'fugitive', 'nvim-tree' },
|
lualine_x = { 'filetype' },
|
||||||
}, config.lualine or {}))
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
inactive_winbar = {
|
||||||
|
lualine_a = { utils.get_short_cwd },
|
||||||
|
lualine_b = { custom_sections.branch },
|
||||||
|
lualine_c = { custom_sections.relativeFilePath },
|
||||||
|
lualine_x = { 'filetype' },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
extensions = { 'quickfix', 'fugitive', 'nvim-tree' },
|
||||||
|
}, user_config.plugins.lualine or {}))
|
||||||
|
end,
|
||||||
|
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'lualine'),
|
||||||
|
}
|
||||||
|
|
|
@ -1,33 +1,27 @@
|
||||||
local config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local ls = require('luasnip')
|
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
-- some shorthands...
|
return {
|
||||||
--[[ local s = ls.snippet
|
'L3MON4D3/LuaSnip',
|
||||||
local sn = ls.snippet_node
|
config = function()
|
||||||
local t = ls.text_node
|
local ls = require('luasnip')
|
||||||
local i = ls.insert_node
|
-- Every unspecified option will be set to the default.
|
||||||
local f = ls.function_node
|
ls.config.set_config(u.merge({
|
||||||
local c = ls.choice_node
|
history = true,
|
||||||
local d = ls.dynamic_node ]]
|
-- Update more often, :h events for more info.
|
||||||
|
updateevents = 'TextChanged,TextChangedI',
|
||||||
|
enable_autosnippets = true,
|
||||||
|
}, user_config.plugins.luasnip or {}))
|
||||||
|
|
||||||
-- Every unspecified option will be set to the default.
|
-- extend html snippets to react files
|
||||||
ls.config.set_config(u.merge({
|
require('luasnip').filetype_extend('javascriptreact', { 'html' })
|
||||||
history = true,
|
require('luasnip').filetype_extend('typescriptreact', { 'html' })
|
||||||
-- Update more often, :h events for more info.
|
|
||||||
updateevents = 'TextChanged,TextChangedI',
|
|
||||||
enable_autosnippets = true,
|
|
||||||
}, config.luasnip or {}))
|
|
||||||
|
|
||||||
ls.snippets = {
|
-- load snippets (friendly-snippets)
|
||||||
all = {},
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
html = {},
|
end,
|
||||||
|
dependencies = {
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
|
},
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'luasnip'),
|
||||||
}
|
}
|
||||||
|
|
||||||
-- enable html snippets in javascript/javascript(REACT)
|
|
||||||
ls.snippets.javascript = ls.snippets.html
|
|
||||||
ls.snippets.javascriptreact = ls.snippets.html
|
|
||||||
ls.snippets.typescriptreact = ls.snippets.html
|
|
||||||
|
|
||||||
-- You can also use lazy loading so you only get in memory snippets of languages you use
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
|
|
|
@ -1,20 +1,41 @@
|
||||||
require('noice').setup({
|
local user_config = require('cosmic.core.user')
|
||||||
views = {
|
local u = require('cosmic.utils')
|
||||||
notify = {
|
|
||||||
merge = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lsp = {
|
|
||||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
|
||||||
hover = {
|
|
||||||
enabled = false,
|
|
||||||
},
|
|
||||||
override = {
|
|
||||||
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
|
||||||
['vim.lsp.util.stylize_markdown'] = true,
|
|
||||||
['cmp.entry.get_documentation'] = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
require('cosmic.plugins.noice.mappings')
|
return {
|
||||||
|
'folke/noice.nvim',
|
||||||
|
config = function()
|
||||||
|
local config = u.merge({
|
||||||
|
presets = {
|
||||||
|
lsp_doc_border = true,
|
||||||
|
},
|
||||||
|
views = {
|
||||||
|
notify = {
|
||||||
|
merge = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lsp = {
|
||||||
|
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||||
|
hover = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
signature = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
override = {
|
||||||
|
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
||||||
|
['vim.lsp.util.stylize_markdown'] = true,
|
||||||
|
-- @TODO: why doesn't this work?
|
||||||
|
['cmp.entry.get_documentation'] = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, user_config.plugins.noice or {})
|
||||||
|
|
||||||
|
require('noice').setup(config)
|
||||||
|
require('cosmic.plugins.noice.mappings')
|
||||||
|
end,
|
||||||
|
event = 'VeryLazy',
|
||||||
|
dependencies = {
|
||||||
|
'MunifTanjim/nui.nvim',
|
||||||
|
'rcarriga/nvim-notify',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
vim.keymap.set('n', '<c-f>', function()
|
local map = require('cosmic.utils').map
|
||||||
if not require('noice.lsp').scroll(4) then
|
|
||||||
return '<c-f>'
|
|
||||||
end
|
|
||||||
end, {
|
|
||||||
silent = true,
|
|
||||||
expr = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<c-b>', function()
|
map('n', '<c-k>', function()
|
||||||
if not require('noice.lsp').scroll(-4) then
|
if not require('noice.lsp').scroll(4) then
|
||||||
return '<c-b>'
|
return '<c-k>'
|
||||||
end
|
end
|
||||||
end, {
|
end)
|
||||||
silent = true,
|
|
||||||
expr = true,
|
map('n', '<c-j>', function()
|
||||||
})
|
if not require('noice.lsp').scroll(-4) then
|
||||||
|
return '<c-j>'
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
|
@ -21,7 +21,7 @@ if config_opts.default_cosmic_sources then
|
||||||
}),
|
}),
|
||||||
null_ls.builtins.formatting.stylua,
|
null_ls.builtins.formatting.stylua,
|
||||||
null_ls.builtins.code_actions.gitsigns,
|
null_ls.builtins.code_actions.gitsigns,
|
||||||
}, config_opts.sources or {})
|
}, config_opts.get_sources() or {})
|
||||||
end
|
end
|
||||||
|
|
||||||
require('null-ls').setup(u.merge(defaults, config_opts))
|
null_ls.setup(u.merge(defaults, config_opts))
|
10
lua/cosmic/plugins/null-ls/init.lua
Normal file
10
lua/cosmic/plugins/null-ls/init.lua
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'jose-elias-alvarez/null-ls.nvim',
|
||||||
|
config = function()
|
||||||
|
require('cosmic.plugins.null-ls.config')
|
||||||
|
end,
|
||||||
|
event = 'BufEnter',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'null_ls'),
|
||||||
|
}
|
141
lua/cosmic/plugins/nvim-cmp/config.lua
Normal file
141
lua/cosmic/plugins/nvim-cmp/config.lua
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local u = require('cosmic.utils')
|
||||||
|
local luasnip = require('luasnip')
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
local icons = require('cosmic.utils.icons')
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
|
||||||
|
local has_words_before = function()
|
||||||
|
unpack = unpack or table.unpack
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
local default_cmp_opts = {
|
||||||
|
enabled = function()
|
||||||
|
-- disable completion in comments
|
||||||
|
local context = require('cmp.config.context')
|
||||||
|
-- keep command mode completion enabled when cursor is in a comment
|
||||||
|
if vim.api.nvim_get_mode().mode == 'c' then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return not context.in_treesitter_capture('comment') and not context.in_syntax_group('Comment')
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||||
|
['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||||
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||||
|
['<C-e>'] = cmp.mapping({
|
||||||
|
i = cmp.mapping.abort(),
|
||||||
|
c = cmp.mapping.close(),
|
||||||
|
}),
|
||||||
|
-- disabled for autopairs mapping
|
||||||
|
['<CR>'] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = true,
|
||||||
|
}),
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
'i',
|
||||||
|
's',
|
||||||
|
}),
|
||||||
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {
|
||||||
|
'i',
|
||||||
|
's',
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
window = {
|
||||||
|
completion = {
|
||||||
|
border = user_config.border,
|
||||||
|
winhighlight = 'FloatBorder:FloatBorder,Normal:Normal',
|
||||||
|
},
|
||||||
|
documentation = {
|
||||||
|
border = user_config.border,
|
||||||
|
winhighlight = 'FloatBorder:FloatBorder,Normal:Normal',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = true,
|
||||||
|
},
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
|
{ name = 'path' },
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
format = function(entry, vim_item)
|
||||||
|
-- Kind icons
|
||||||
|
vim_item.kind = string.format('%s %s', icons.kind_icons[vim_item.kind], vim_item.kind)
|
||||||
|
vim_item.menu = ({
|
||||||
|
nvim_lsp = '[lsp]',
|
||||||
|
luasnip = '[snip]',
|
||||||
|
buffer = '[buf]',
|
||||||
|
path = '[path]',
|
||||||
|
nvim_lua = '[nvim_api]',
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- set up autopairs
|
||||||
|
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||||
|
|
||||||
|
cmp.setup(u.merge(default_cmp_opts, user_config.plugins.nvim_cmp or {}))
|
||||||
|
|
||||||
|
-- Set configuration for specific filetype.
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.filetype('TelescopePrompt', {
|
||||||
|
enabled = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' },
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' },
|
||||||
|
}),
|
||||||
|
})
|
|
@ -1,135 +1,20 @@
|
||||||
local cmp = require('cmp')
|
|
||||||
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 has_words_before = function()
|
return {
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
'hrsh7th/nvim-cmp',
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
|
config = function()
|
||||||
end
|
require('cosmic.plugins.nvim-cmp.config')
|
||||||
|
|
||||||
local default_cmp_opts = {
|
|
||||||
enabled = function()
|
|
||||||
-- disable completion in comments
|
|
||||||
local context = require('cmp.config.context')
|
|
||||||
-- keep command mode completion enabled when cursor is in a comment
|
|
||||||
if vim.api.nvim_get_mode().mode == 'c' then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return not context.in_treesitter_capture('comment') and not context.in_syntax_group('Comment')
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
snippet = {
|
dependencies = {
|
||||||
expand = function(args)
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
luasnip.lsp_expand(args.body)
|
'saadparwaiz1/cmp_luasnip',
|
||||||
end,
|
'hrsh7th/cmp-buffer',
|
||||||
},
|
'hrsh7th/cmp-nvim-lua',
|
||||||
mapping = cmp.mapping.preset.insert({
|
'hrsh7th/cmp-cmdline',
|
||||||
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
'hrsh7th/cmp-path',
|
||||||
['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
-- has configs
|
||||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
'L3MON4D3/LuaSnip',
|
||||||
['<C-e>'] = cmp.mapping({
|
|
||||||
i = cmp.mapping.abort(),
|
|
||||||
c = cmp.mapping.close(),
|
|
||||||
}),
|
|
||||||
-- disabled for autopairs mapping
|
|
||||||
['<CR>'] = cmp.mapping.confirm({
|
|
||||||
behavior = cmp.ConfirmBehavior.Insert,
|
|
||||||
select = true,
|
|
||||||
}),
|
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, {
|
|
||||||
'i',
|
|
||||||
's',
|
|
||||||
}),
|
|
||||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, {
|
|
||||||
'i',
|
|
||||||
's',
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
window = {
|
|
||||||
completion = {
|
|
||||||
border = user_config.border,
|
|
||||||
winhighlight = 'FloatBorder:FloatBorder,Normal:Normal',
|
|
||||||
},
|
|
||||||
documentation = {
|
|
||||||
border = user_config.border,
|
|
||||||
winhighlight = 'FloatBorder:FloatBorder,Normal:Normal',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
experimental = {
|
|
||||||
ghost_text = true,
|
|
||||||
},
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'nvim_lua' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
{ name = 'buffer' },
|
|
||||||
{ name = 'path' },
|
|
||||||
}),
|
|
||||||
formatting = {
|
|
||||||
format = function(entry, vim_item)
|
|
||||||
-- Kind icons
|
|
||||||
vim_item.kind = string.format('%s %s', icons.kind_icons[vim_item.kind], vim_item.kind)
|
|
||||||
vim_item.menu = ({
|
|
||||||
nvim_lsp = '[lsp]',
|
|
||||||
luasnip = '[snip]',
|
|
||||||
buffer = '[buf]',
|
|
||||||
path = '[path]',
|
|
||||||
nvim_lua = '[nvim_api]',
|
|
||||||
})[entry.source.name]
|
|
||||||
return vim_item
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
event = 'InsertEnter',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-cmp'),
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp.setup(u.merge(default_cmp_opts, user_config.nvim_cmp or {}))
|
|
||||||
|
|
||||||
-- Set configuration for specific filetype.
|
|
||||||
cmp.setup.filetype('gitcommit', {
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.filetype('TelescopePrompt', {
|
|
||||||
enabled = false,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' },
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' },
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
9
lua/cosmic/plugins/nvim-lsp-installer/init.lua
Normal file
9
lua/cosmic/plugins/nvim-lsp-installer/init.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
return {
|
||||||
|
'williamboman/nvim-lsp-installer',
|
||||||
|
config = function()
|
||||||
|
require('cosmic.plugins.nvim-lsp-installer.config')
|
||||||
|
end,
|
||||||
|
event = 'BufEnter',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-lsp-installer'),
|
||||||
|
}
|
42
lua/cosmic/plugins/nvim-lsp-ts-utils/config.lua
Normal file
42
lua/cosmic/plugins/nvim-lsp-ts-utils/config.lua
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
local u = require('cosmic.utils')
|
||||||
|
local config = require('cosmic.core.user')
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.setup = function(client)
|
||||||
|
local ts_utils = require('nvim-lsp-ts-utils')
|
||||||
|
|
||||||
|
ts_utils.setup(u.merge({
|
||||||
|
debug = false,
|
||||||
|
disable_commands = false,
|
||||||
|
enable_import_on_completion = true,
|
||||||
|
|
||||||
|
-- import all
|
||||||
|
import_all_timeout = 5000, -- ms
|
||||||
|
import_all_priorities = {
|
||||||
|
buffers = 4, -- loaded buffer names
|
||||||
|
buffer_content = 3, -- loaded buffer content
|
||||||
|
local_files = 2, -- git files or files with relative path markers
|
||||||
|
same_file = 1, -- add to existing import statement
|
||||||
|
},
|
||||||
|
import_all_scan_buffers = 100,
|
||||||
|
import_all_select_source = false,
|
||||||
|
|
||||||
|
-- inlay hints
|
||||||
|
auto_inlay_hints = true,
|
||||||
|
inlay_hints_highlight = 'Comment',
|
||||||
|
|
||||||
|
-- update imports on file move
|
||||||
|
update_imports_on_move = true,
|
||||||
|
require_confirmation_on_move = false,
|
||||||
|
watch_dir = nil,
|
||||||
|
|
||||||
|
-- filter diagnostics
|
||||||
|
filter_out_diagnostics_by_severity = {},
|
||||||
|
filter_out_diagnostics_by_code = {},
|
||||||
|
}, config.lsp.ts_utils or {}))
|
||||||
|
|
||||||
|
-- required to fix code action ranges and filter diagnostics
|
||||||
|
ts_utils.setup_client(client)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
6
lua/cosmic/plugins/nvim-lsp-ts-utils/init.lua
Normal file
6
lua/cosmic/plugins/nvim-lsp-ts-utils/init.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'jose-elias-alvarez/nvim-lsp-ts-utils',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-lsp-ts-utils'),
|
||||||
|
}
|
6
lua/cosmic/plugins/nvim-lspconfig/init.lua
Normal file
6
lua/cosmic/plugins/nvim-lspconfig/init.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-lspconfig'),
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
local 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 u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
local augroup_name = 'CosmicNvimNvimTree'
|
|
||||||
local group = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
|
||||||
|
|
||||||
-- set up args
|
-- set up args
|
||||||
local args = {
|
local args = {
|
||||||
|
@ -46,11 +44,17 @@ local args = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Autoclose nvim is nvim-tree is only buffer open
|
return {
|
||||||
vim.api.nvim_create_autocmd('BufEnter', {
|
'kyazdani42/nvim-tree.lua',
|
||||||
command = [[if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif]],
|
config = function()
|
||||||
group = group,
|
require('nvim-tree').setup(u.merge(args, user_config.plugins.nvim_tree or {}))
|
||||||
nested = true,
|
end,
|
||||||
})
|
cmd = {
|
||||||
|
'NvimTreeClipboard',
|
||||||
require('nvim-tree').setup(u.merge(args, config.nvim_tree or {}))
|
'NvimTreeFindFile',
|
||||||
|
'NvimTreeOpen',
|
||||||
|
'NvimTreeRefresh',
|
||||||
|
'NvimTreeToggle',
|
||||||
|
},
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'nvim-tree'),
|
||||||
|
}
|
||||||
|
|
1
lua/cosmic/plugins/schemastore/init.lua
Normal file
1
lua/cosmic/plugins/schemastore/init.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
return { 'b0o/SchemaStore.nvim' }
|
137
lua/cosmic/plugins/telescope/config.lua
Normal file
137
lua/cosmic/plugins/telescope/config.lua
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
local actions = require('telescope.actions')
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
local icons = require('cosmic.utils.icons')
|
||||||
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
|
local default_mappings = {
|
||||||
|
n = {
|
||||||
|
['Q'] = actions.smart_add_to_qflist + actions.open_qflist,
|
||||||
|
['q'] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||||
|
['<tab>'] = actions.toggle_selection + actions.move_selection_next,
|
||||||
|
['<s-tab>'] = actions.toggle_selection + actions.move_selection_previous,
|
||||||
|
['v'] = actions.file_vsplit,
|
||||||
|
['s'] = actions.file_split,
|
||||||
|
['<cr>'] = actions.file_edit,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local opts_cursor = {
|
||||||
|
initial_mode = 'normal',
|
||||||
|
sorting_strategy = 'ascending',
|
||||||
|
layout_strategy = 'cursor',
|
||||||
|
results_title = false,
|
||||||
|
layout_config = {
|
||||||
|
width = 0.5,
|
||||||
|
height = 0.4,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local opts_vertical = {
|
||||||
|
initial_mode = 'normal',
|
||||||
|
sorting_strategy = 'ascending',
|
||||||
|
layout_strategy = 'vertical',
|
||||||
|
results_title = false,
|
||||||
|
layout_config = {
|
||||||
|
width = 0.3,
|
||||||
|
height = 0.5,
|
||||||
|
prompt_position = 'top',
|
||||||
|
mirror = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local opts_flex = {
|
||||||
|
layout_strategy = 'flex',
|
||||||
|
layout_config = {
|
||||||
|
width = 0.7,
|
||||||
|
height = 0.7,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('telescope').setup(u.merge({
|
||||||
|
defaults = {
|
||||||
|
prompt_prefix = '🔍 ',
|
||||||
|
selection_caret = icons.folder.arrow_closed,
|
||||||
|
file_ignore_patterns = {
|
||||||
|
'.git/',
|
||||||
|
},
|
||||||
|
dynamic_preview_title = true,
|
||||||
|
vimgrep_arguments = {
|
||||||
|
'rg',
|
||||||
|
'--ignore',
|
||||||
|
'--hidden',
|
||||||
|
'--color=never',
|
||||||
|
'--no-heading',
|
||||||
|
'--with-filename',
|
||||||
|
'--line-number',
|
||||||
|
'--column',
|
||||||
|
'--smart-case',
|
||||||
|
'--trim',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true, -- false will only do exact matching
|
||||||
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
|
override_file_sorter = true, -- override the file sorter
|
||||||
|
case_mode = 'smart_case', -- or "ignore_case" or "respect_case"
|
||||||
|
-- the default case_mode is "smart_case"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
buffers = u.merge(opts_flex, {
|
||||||
|
prompt_title = '✨ Search Buffers ✨',
|
||||||
|
mappings = u.merge({
|
||||||
|
n = {
|
||||||
|
['d'] = actions.delete_buffer,
|
||||||
|
},
|
||||||
|
}, default_mappings),
|
||||||
|
sort_mru = true,
|
||||||
|
preview_title = false,
|
||||||
|
}),
|
||||||
|
lsp_code_actions = u.merge(opts_cursor, {
|
||||||
|
prompt_title = 'Code Actions',
|
||||||
|
}),
|
||||||
|
lsp_range_code_actions = u.merge(opts_vertical, {
|
||||||
|
prompt_title = 'Code Actions',
|
||||||
|
}),
|
||||||
|
lsp_document_diagnostics = u.merge(opts_vertical, {
|
||||||
|
prompt_title = 'Document Diagnostics',
|
||||||
|
mappings = default_mappings,
|
||||||
|
}),
|
||||||
|
lsp_implementations = u.merge(opts_cursor, {
|
||||||
|
prompt_title = 'Implementations',
|
||||||
|
mappings = default_mappings,
|
||||||
|
}),
|
||||||
|
lsp_definitions = u.merge(opts_cursor, {
|
||||||
|
prompt_title = 'Definitions',
|
||||||
|
mappings = default_mappings,
|
||||||
|
}),
|
||||||
|
lsp_references = u.merge(opts_vertical, {
|
||||||
|
prompt_title = 'References',
|
||||||
|
mappings = default_mappings,
|
||||||
|
}),
|
||||||
|
find_files = u.merge(opts_flex, {
|
||||||
|
prompt_title = '✨ Search Project ✨',
|
||||||
|
mappings = default_mappings,
|
||||||
|
hidden = true,
|
||||||
|
}),
|
||||||
|
diagnostics = u.merge(opts_vertical, {
|
||||||
|
mappings = default_mappings,
|
||||||
|
}),
|
||||||
|
git_files = u.merge(opts_flex, {
|
||||||
|
prompt_title = '✨ Search Git Project ✨',
|
||||||
|
mappings = default_mappings,
|
||||||
|
hidden = true,
|
||||||
|
}),
|
||||||
|
live_grep = u.merge(opts_flex, {
|
||||||
|
prompt_title = '✨ Live Grep ✨',
|
||||||
|
mappings = default_mappings,
|
||||||
|
}),
|
||||||
|
grep_string = u.merge(opts_vertical, {
|
||||||
|
prompt_title = '✨ Grep String ✨',
|
||||||
|
mappings = default_mappings,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}, user_config.plugins.telescope or {}))
|
||||||
|
|
||||||
|
require('telescope').load_extension('fzf')
|
|
@ -1,137 +1,18 @@
|
||||||
local actions = require('telescope.actions')
|
local user_config = require('cosmic.core.user')
|
||||||
local config = require('cosmic.core.user')
|
return {
|
||||||
local icons = require('cosmic.utils.icons')
|
'nvim-telescope/telescope.nvim',
|
||||||
local u = require('cosmic.utils')
|
dependencies = {
|
||||||
|
'nvim-lua/popup.nvim',
|
||||||
local default_mappings = {
|
'nvim-lua/plenary.nvim',
|
||||||
n = {
|
{
|
||||||
['Q'] = actions.smart_add_to_qflist + actions.open_qflist,
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
['q'] = actions.smart_send_to_qflist + actions.open_qflist,
|
build = 'make',
|
||||||
['<tab>'] = actions.toggle_selection + actions.move_selection_next,
|
|
||||||
['<s-tab>'] = actions.toggle_selection + actions.move_selection_previous,
|
|
||||||
['v'] = actions.file_vsplit,
|
|
||||||
['s'] = actions.file_split,
|
|
||||||
['<cr>'] = actions.file_edit,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local opts_cursor = {
|
|
||||||
initial_mode = 'normal',
|
|
||||||
sorting_strategy = 'ascending',
|
|
||||||
layout_strategy = 'cursor',
|
|
||||||
results_title = false,
|
|
||||||
layout_config = {
|
|
||||||
width = 0.5,
|
|
||||||
height = 0.4,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local opts_vertical = {
|
|
||||||
initial_mode = 'normal',
|
|
||||||
sorting_strategy = 'ascending',
|
|
||||||
layout_strategy = 'vertical',
|
|
||||||
results_title = false,
|
|
||||||
layout_config = {
|
|
||||||
width = 0.3,
|
|
||||||
height = 0.5,
|
|
||||||
prompt_position = 'top',
|
|
||||||
mirror = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local opts_flex = {
|
|
||||||
layout_strategy = 'flex',
|
|
||||||
layout_config = {
|
|
||||||
width = 0.7,
|
|
||||||
height = 0.7,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require('telescope').setup(u.merge({
|
|
||||||
defaults = {
|
|
||||||
prompt_prefix = '🔍 ',
|
|
||||||
selection_caret = icons.folder.arrow_closed,
|
|
||||||
file_ignore_patterns = {
|
|
||||||
'.git/',
|
|
||||||
},
|
|
||||||
dynamic_preview_title = true,
|
|
||||||
vimgrep_arguments = {
|
|
||||||
'rg',
|
|
||||||
'--ignore',
|
|
||||||
'--hidden',
|
|
||||||
'--color=never',
|
|
||||||
'--no-heading',
|
|
||||||
'--with-filename',
|
|
||||||
'--line-number',
|
|
||||||
'--column',
|
|
||||||
'--smart-case',
|
|
||||||
'--trim',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
extensions = {
|
config = function()
|
||||||
fzf = {
|
require('cosmic.plugins.telescope.mappings').init()
|
||||||
fuzzy = true, -- false will only do exact matching
|
require('cosmic.plugins.telescope.config')
|
||||||
override_generic_sorter = true, -- override the generic sorter
|
end,
|
||||||
override_file_sorter = true, -- override the file sorter
|
event = 'VeryLazy',
|
||||||
case_mode = 'smart_case', -- or "ignore_case" or "respect_case"
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'telescope'),
|
||||||
-- the default case_mode is "smart_case"
|
}
|
||||||
},
|
|
||||||
},
|
|
||||||
pickers = {
|
|
||||||
buffers = u.merge(opts_flex, {
|
|
||||||
prompt_title = '✨ Search Buffers ✨',
|
|
||||||
mappings = u.merge({
|
|
||||||
n = {
|
|
||||||
['d'] = actions.delete_buffer,
|
|
||||||
},
|
|
||||||
}, default_mappings),
|
|
||||||
sort_mru = true,
|
|
||||||
preview_title = false,
|
|
||||||
}),
|
|
||||||
lsp_code_actions = u.merge(opts_cursor, {
|
|
||||||
prompt_title = 'Code Actions',
|
|
||||||
}),
|
|
||||||
lsp_range_code_actions = u.merge(opts_vertical, {
|
|
||||||
prompt_title = 'Code Actions',
|
|
||||||
}),
|
|
||||||
lsp_document_diagnostics = u.merge(opts_vertical, {
|
|
||||||
prompt_title = 'Document Diagnostics',
|
|
||||||
mappings = default_mappings,
|
|
||||||
}),
|
|
||||||
lsp_implementations = u.merge(opts_cursor, {
|
|
||||||
prompt_title = 'Implementations',
|
|
||||||
mappings = default_mappings,
|
|
||||||
}),
|
|
||||||
lsp_definitions = u.merge(opts_cursor, {
|
|
||||||
prompt_title = 'Definitions',
|
|
||||||
mappings = default_mappings,
|
|
||||||
}),
|
|
||||||
lsp_references = u.merge(opts_vertical, {
|
|
||||||
prompt_title = 'References',
|
|
||||||
mappings = default_mappings,
|
|
||||||
}),
|
|
||||||
find_files = u.merge(opts_flex, {
|
|
||||||
prompt_title = '✨ Search Project ✨',
|
|
||||||
mappings = default_mappings,
|
|
||||||
hidden = true,
|
|
||||||
}),
|
|
||||||
diagnostics = u.merge(opts_vertical, {
|
|
||||||
mappings = default_mappings,
|
|
||||||
}),
|
|
||||||
git_files = u.merge(opts_flex, {
|
|
||||||
prompt_title = '✨ Search Git Project ✨',
|
|
||||||
mappings = default_mappings,
|
|
||||||
hidden = true,
|
|
||||||
}),
|
|
||||||
live_grep = u.merge(opts_flex, {
|
|
||||||
prompt_title = '✨ Live Grep ✨',
|
|
||||||
mappings = default_mappings,
|
|
||||||
}),
|
|
||||||
grep_string = u.merge(opts_vertical, {
|
|
||||||
prompt_title = '✨ Grep String ✨',
|
|
||||||
mappings = default_mappings,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
}, config.telescope or {}))
|
|
||||||
|
|
||||||
require('telescope').load_extension('fzf')
|
|
||||||
|
|
|
@ -1,11 +1,21 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
local title = vim.env.SHELL
|
local title = vim.env.SHELL
|
||||||
|
|
||||||
g.floaterm_width = 0.7
|
return {
|
||||||
g.floaterm_height = 0.8
|
'voldikss/vim-floaterm',
|
||||||
g.floaterm_title = '[' .. title .. ']:($1/$2)'
|
keys = {
|
||||||
g.floaterm_borderchars = '─│─│╭╮╯╰'
|
{ '<C-l>', '<cmd>FloatermToggle<cr>', desc = 'Floating Terminal' },
|
||||||
g.floaterm_opener = 'vsplit'
|
},
|
||||||
|
config = function()
|
||||||
|
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.mappings')
|
require('cosmic.plugins.terminal.mappings')
|
||||||
require('cosmic.plugins.terminal.highlights')
|
require('cosmic.plugins.terminal.highlights')
|
||||||
|
end,
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'terminal'),
|
||||||
|
}
|
||||||
|
|
|
@ -1,26 +1,34 @@
|
||||||
local 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 u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
require('todo-comments').setup(u.merge({
|
return {
|
||||||
keywords = {
|
'folke/todo-comments.nvim',
|
||||||
FIX = {
|
dependencies = 'nvim-lua/plenary.nvim',
|
||||||
icon = icons.debug, -- icon used for the sign, and in search results
|
config = function()
|
||||||
color = 'error', -- can be a hex color, or a named color (see below)
|
require('todo-comments').setup(u.merge({
|
||||||
alt = { 'FIXME', 'BUG', 'FIXIT', 'ISSUE', 'fix', 'fixme', 'bug' }, -- a set of other keywords that all map to this FIX keywords
|
keywords = {
|
||||||
-- signs = false, -- configure signs for some keywords individually
|
FIX = {
|
||||||
},
|
icon = icons.debug, -- icon used for the sign, and in search results
|
||||||
TODO = { icon = icons.check, color = 'info' },
|
color = 'error', -- can be a hex color, or a named color (see below)
|
||||||
HACK = { icon = icons.flame, color = 'warning' },
|
alt = { 'FIXME', 'BUG', 'FIXIT', 'ISSUE', 'fix', 'fixme', 'bug' }, -- a set of other keywords that all map to this FIX keywords
|
||||||
WARN = { icon = icons.warn, color = 'warning', alt = { 'WARNING', 'XXX' } },
|
-- signs = false, -- configure signs for some keywords individually
|
||||||
PERF = { icon = icons.perf, alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } },
|
},
|
||||||
NOTE = { icon = icons.note, color = 'hint', alt = { 'INFO' } },
|
TODO = { icon = icons.check, color = 'info' },
|
||||||
},
|
HACK = { icon = icons.flame, color = 'warning' },
|
||||||
colors = {
|
WARN = { icon = icons.warn, color = 'warning', alt = { 'WARNING', 'XXX' } },
|
||||||
error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' },
|
PERF = { icon = icons.perf, alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } },
|
||||||
warning = { 'DiagnosticWarn', 'WarningMsg', '#FBBF24' },
|
NOTE = { icon = icons.note, color = 'hint', alt = { 'INFO' } },
|
||||||
info = { 'DiagnosticInfo', '#2563EB' },
|
},
|
||||||
hint = { 'DiagnosticHint', '#10B981' },
|
colors = {
|
||||||
default = { 'Identifier', '#7C3AED' },
|
error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' },
|
||||||
},
|
warning = { 'DiagnosticWarn', 'WarningMsg', '#FBBF24' },
|
||||||
}, config.todo_comments or {}))
|
info = { 'DiagnosticInfo', '#2563EB' },
|
||||||
|
hint = { 'DiagnosticHint', '#10B981' },
|
||||||
|
default = { 'Identifier', '#7C3AED' },
|
||||||
|
},
|
||||||
|
}, user_config.plugins.todo_comments or {}))
|
||||||
|
end,
|
||||||
|
event = 'BufEnter',
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'todo-comments'),
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
local config = {
|
local user_config = require('cosmic.core.user')
|
||||||
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
|
local config = u.merge({
|
||||||
|
|
||||||
-- use the night style
|
-- use the night style
|
||||||
style = 'night',
|
style = 'night',
|
||||||
light_style = 'moon',
|
light_style = 'moon',
|
||||||
sidebars = { 'qf', 'packer', 'help' },
|
sidebars = { 'qf', 'packer', 'help' },
|
||||||
}
|
}, user_config.plugins.tokyonight or {})
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
local config = require('cosmic.plugins.tokyonight.config')
|
local user_config = require('cosmic.core.user')
|
||||||
|
return {
|
||||||
require('tokyonight').setup(config)
|
{ -- color scheme
|
||||||
|
'folke/tokyonight.nvim',
|
||||||
vim.cmd('color tokyonight')
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
local config = require('cosmic.plugins.tokyonight.config')
|
||||||
|
require('tokyonight').setup(config)
|
||||||
|
vim.cmd('color tokyonight')
|
||||||
|
end,
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'tokyonight'),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
local defaults = {
|
local defaults = {
|
||||||
|
@ -11,6 +11,7 @@ local defaults = {
|
||||||
'json',
|
'json',
|
||||||
'lua',
|
'lua',
|
||||||
'markdown',
|
'markdown',
|
||||||
|
'markdown_inline',
|
||||||
'php',
|
'php',
|
||||||
'python',
|
'python',
|
||||||
'regex',
|
'regex',
|
||||||
|
@ -38,4 +39,17 @@ local defaults = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require('nvim-treesitter.configs').setup(u.merge(defaults, config.treesitter or {}))
|
return {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
dependencies = {
|
||||||
|
'windwp/nvim-ts-autotag',
|
||||||
|
'JoosepAlviste/nvim-ts-context-commentstring',
|
||||||
|
'nvim-treesitter/nvim-treesitter-refactor',
|
||||||
|
},
|
||||||
|
event = 'BufEnter',
|
||||||
|
build = ':TSUpdate',
|
||||||
|
config = function()
|
||||||
|
require('nvim-treesitter.configs').setup(u.merge(defaults, user_config.plugins.treesitter or {}))
|
||||||
|
end,
|
||||||
|
enabled = not vim.tbl_contains(user_config.disable_builtin_plugins, 'treesitter'),
|
||||||
|
}
|
||||||
|
|
2
lua/cosmic/plugins/user/init.lua
Normal file
2
lua/cosmic/plugins/user/init.lua
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
local user_config = require('cosmic.core.user')
|
||||||
|
return user_config.add_plugins
|
|
@ -1,9 +1,4 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
local augroup_name = 'CosmicNvimUtils'
|
|
||||||
local group = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
|
||||||
local function clear_cache()
|
|
||||||
vim.cmd(':LuaCacheClear')
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_install_dir()
|
local function get_install_dir()
|
||||||
local config_dir = os.getenv('COSMICNVIM_INSTALL_DIR')
|
local config_dir = os.getenv('COSMICNVIM_INSTALL_DIR')
|
||||||
|
@ -13,54 +8,8 @@ local function get_install_dir()
|
||||||
return config_dir
|
return config_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
local function unload(module_pattern, reload)
|
function M.sync_plugins()
|
||||||
reload = reload or false
|
vim.cmd(':Lazy sync')
|
||||||
for module, _ in pairs(package.loaded) do
|
|
||||||
if module:match(module_pattern) then
|
|
||||||
package.loaded[module] = nil
|
|
||||||
if reload then
|
|
||||||
require(module)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function post_reload(msg)
|
|
||||||
local Logger = require('cosmic.utils.logger')
|
|
||||||
unload('cosmic.utils', true)
|
|
||||||
unload('cosmic.theme', true)
|
|
||||||
unload('cosmic.plugins.statusline', true)
|
|
||||||
msg = msg or 'User config reloaded!'
|
|
||||||
Logger:log(msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.reload_user_config_sync()
|
|
||||||
clear_cache()
|
|
||||||
unload('cosmic.core.user', true)
|
|
||||||
unload('cosmic.core.pluginsInit', true)
|
|
||||||
vim.api.nvim_create_autocmd('User PackerComplete', {
|
|
||||||
callback = function()
|
|
||||||
post_reload()
|
|
||||||
end,
|
|
||||||
group = group,
|
|
||||||
once = true,
|
|
||||||
})
|
|
||||||
vim.cmd(':PackerSync')
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.reload_user_config(compile)
|
|
||||||
compile = compile or false
|
|
||||||
unload('cosmic.core.user', true)
|
|
||||||
if compile then
|
|
||||||
vim.api.nvim_create_autocmd('User PackerCompileDone', {
|
|
||||||
callback = function()
|
|
||||||
post_reload()
|
|
||||||
end,
|
|
||||||
group = group,
|
|
||||||
once = true,
|
|
||||||
})
|
|
||||||
vim.cmd(':PackerCompile')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- update instance of CosmicNvim
|
-- update instance of CosmicNvim
|
||||||
|
|
Loading…
Add table
Reference in a new issue