1
0
Fork 0

nvim: migrate to lazy.nvim

This commit is contained in:
Vladimír Dudr 2023-01-01 23:38:24 +01:00
parent 459afa8312
commit d0130764bf
20 changed files with 616 additions and 435 deletions

View file

@ -0,0 +1,3 @@
nnoremap <buffer> q :q<CR>
setlocal nonumber
setlocal signcolumn=auto

View file

@ -1,8 +1,18 @@
require('configs.packages').setup()
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)
require('lazy').setup('configs.packages', { install = {} })
require('configs.options').setup()
require('configs.neoray')
require('configs.colors')
require('configs.misc')
-- vim: sw=2: ts=2: fdm=marker:
require('configs.misc').setup()
require('configs.keys').setup()

View file

@ -0,0 +1,43 @@
{
"Colorizer": { "branch": "master", "commit": "715c91303f0f7a59b21af39c9d168d975ca2c831" },
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
"ctrlsf.vim": { "branch": "master", "commit": "32236a8b376d9311dec9b5fe795ca99d32060b13" },
"editorconfig-vim": { "branch": "master", "commit": "30ddc057f71287c3ac2beca876e7ae6d5abe26a0" },
"fidget.nvim": { "branch": "main", "commit": "44585a0c0085765195e6961c15529ba6c5a2a13b" },
"gitsigns.nvim": { "branch": "main", "commit": "2ab3bdf0a40bab53033048c6be75bda86316b55d" },
"gruvbox": { "branch": "master", "commit": "2b5b1f777f0583ffb39086d6c16f39e6e37459c0" },
"indent-blankline.nvim": { "branch": "master", "commit": "c4c203c3e8a595bc333abaf168fcb10c13ed5fb7" },
"kommentary": { "branch": "main", "commit": "981d56735ecc13e3c52b2d0cae269f5b9dcfe8ff" },
"lazy.nvim": { "branch": "main", "commit": "c7122d64cdf16766433588486adcee67571de6d0" },
"linediff.vim": { "branch": "main", "commit": "b4d3c3f03eed00caa741c2650e13db5b7b7ce0ef" },
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
"lualine.nvim": { "branch": "master", "commit": "32a7382a75a52e8ad05f4cec7eeb8bbfbe80d461" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "3b41f0d17139bb156f1acd907608f63e0e307caf" },
"neodev.nvim": { "branch": "main", "commit": "8e06acf88e0621badd9499cfcafbce5ca97dfe8e" },
"nette.vim": { "branch": "master", "commit": "3f5c7f61d3552856ba95b0285d4acb485c1d61ea" },
"nui.nvim": { "branch": "main", "commit": "4939282919885e1c83aff68ecb35b3cadf6015a9" },
"null-ls.nvim": { "branch": "main", "commit": "647a1eeeefc43ce15d941972642210637c370471" },
"nvim-cmp": { "branch": "main", "commit": "e55033fce468c9c578b946948807f2ac48a6ee08" },
"nvim-lspconfig": { "branch": "master", "commit": "d066a47be7713dba46736aece1792a4e13aaf1de" },
"nvim-navic": { "branch": "master", "commit": "7a2b823152fe4de65ee7925b0e32d26ed73bc57c" },
"nvim-treesitter": { "branch": "master", "commit": "fb36ed4c9e962d9fbfa608cd4a5d9313b1e8a8b1" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "247e392a8beb28c5d43a1375f93f8f90f1cc11ad" },
"nvim-web-devicons": { "branch": "master", "commit": "05e1072f63f6c194ac6e867b567e6b437d3d4622" },
"nvim-yati": { "branch": "main", "commit": "b76ca0c8c4617b49c7572f055e7b9caed96f783f" },
"playground": { "branch": "master", "commit": "8a887bcf66017bd775a0fb19c9d8b7a4d6759c48" },
"plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"schemastore.nvim": { "branch": "main", "commit": "f36196d7044da6abf13ed3abf824fd5f3625f35d" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "fab3e2212e206f4f8b3bbaa656e129443c9b802e" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
"telescope.nvim": { "branch": "master", "commit": "a606bd10c79ec5989c76c49cc6f736e88b63f0da" },
"trouble.nvim": { "branch": "main", "commit": "897542f90050c3230856bc6e45de58b94c700bbf" },
"vdebug": { "branch": "master", "commit": "247f2be7fe3108038276615cb9493b82fced0001" },
"vim-matchup": { "branch": "master", "commit": "db5120dd9887c988de7cd973ddb951e465d413e5" },
"vim-vsnip": { "branch": "master", "commit": "8dde8c0ef10bb1afdbb301e2bd7eb1c153dd558e" },
"zig.vim": { "branch": "master", "commit": "c33e1e312fc0f9523d09d7ddb845ea5d52db41d0" }
}

View file

@ -1,260 +0,0 @@
local function normalizeTSHighlight() --- {{{
-- helper {{{
local hl = function(group, opts)
if (opts.default == nil) then
opts.default = true
end
vim.api.nvim_set_hl(0, group, opts)
end
-- }}}
-- Misc {{{
hl('@comment', { link = 'Comment' })
hl('@none', { bg = 'NONE', fg = 'NONE' })
hl('@preproc', { link = 'PreProc' })
hl('@define', { link = 'Define' })
hl('@operator', { link = 'Operator' })
-- }}}
-- Punctuation {{{
hl('@punctuation.delimiter', { link = 'Delimiter' })
hl('@punctuation.bracket', { link = 'Delimiter' })
hl('@punctuation.special', { link = 'Delimiter' })
-- }}}
-- Literals {{{
hl('@string', { link = 'String' })
hl('@string.regex', { link = 'String' })
hl('@string.escape', { link = 'SpecialChar' })
hl('@string.special', { link = 'SpecialChar' })
hl('@character', { link = 'Character' })
hl('@character.special', { link = 'SpecialChar' })
hl('@boolean', { link = 'Boolean' })
hl('@number', { link = 'Number' })
hl('@float', { link = 'Float' })
-- }}}
-- Functions {{{
hl('@function', { link = 'Function' })
hl('@function.call', { link = 'Function' })
hl('@function.builtin', { link = 'Special' })
hl('@function.macro', { link = 'Macro' })
hl('@method', { link = 'Function' })
hl('@method.call', { link = 'Function' })
hl('@constructor', { link = 'Special' })
hl('@parameter', { link = 'Identifier' })
-- }}}
-- Keywords {{{
hl('@keyword', { link = 'Keyword' })
hl('@keyword.function', { link = 'Keyword' })
hl('@keyword.operator', { link = 'Keyword' })
hl('@keyword.return', { link = 'Keyword' })
hl('@conditional', { link = 'Conditional' })
hl('@repeat', { link = 'Repeat' })
hl('@debug', { link = 'Debug' })
hl('@label', { link = 'Label' })
hl('@include', { link = 'Include' })
hl('@exception', { link = 'Exception' })
-- }}}
-- Types {{{
hl('@type', { link = 'Type' })
hl('@type.builtin', { link = 'Type' })
hl('@type.qualifier', { link = 'Keyword' }) -- protected, public & friends
hl('@type.definition', { link = 'Typedef' })
hl('@storageclass', { link = 'StorageClass' })
hl('@attribute', { link = 'PreProc' })
hl('@field', { link = 'Identifier' })
hl('@property', { link = 'Identifier' })
-- }}}
-- Identifiers {{{
hl('@variable', { link = 'Identifier' })
hl('@variable.builtin', { link = 'Identifier' })
hl('@constant', { link = 'Constant' })
hl('@constant.builtin', { link = 'Special' })
hl('@constant.macro', { link = 'Define' })
hl('@namespace', { link = 'Include' })
hl('@symbol', { link = 'Identifier' })
-- }}}
-- Text {{{
hl('@text', {})
hl('@text.strong', { bold = true })
hl('@text.emphasis', { italic = true })
hl('@text.underline', { underline = true })
hl('@text.strike', { strikethrough = true })
hl('@text.title', { link = 'Title' })
hl('@text.literal', { link = 'String' })
hl('@text.uri', { link = 'Underlined' })
hl('@text.math', { link = 'Special' })
hl('@text.environment', { link = 'Macro' })
hl('@text.environment.name', { link = 'Type' })
hl('@text.reference', { link = 'Constant' })
hl('@text.todo', { link = 'Todo' })
hl('@text.note', { link = 'SpecialComment' })
hl('@text.warning', { link = 'WarningMsg' })
hl('@text.danger', { link = 'ErrorMsg' })
-- }}}
-- Tags {{{
hl('@tag', { link = 'Tag' })
hl('@tag.attribute', { link = 'Identifier' })
hl('@tag.delimiter', { link = 'Delimiter' })
-- }}}
end -- }}}
local function normalizeTerminal() -- {{{
vim.g.terminal_color_0 = 0
vim.g.terminal_color_1 = 1
vim.g.terminal_color_2 = 2
vim.g.terminal_color_3 = 3
vim.g.terminal_color_4 = 4
vim.g.terminal_color_5 = 5
vim.g.terminal_color_6 = 6
vim.g.terminal_color_7 = 7
vim.g.terminal_color_8 = 8
vim.g.terminal_color_9 = 9
vim.g.terminal_color_10 = 10
vim.g.terminal_color_11 = 11
vim.g.terminal_color_12 = 12
vim.g.terminal_color_13 = 13
vim.g.terminal_color_14 = 14
vim.g.terminal_color_15 = 15
end -- }}}
local function normalizeCmpKindHighlight() -- {{{
vim.api.nvim_set_hl(0, 'CmpItemKindClass', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindConstant', { link = 'Constant' })
vim.api.nvim_set_hl(0, 'CmpItemKindConstructor', { link = 'Special' })
vim.api.nvim_set_hl(0, 'CmpItemKindEnum', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindEnumMember', { link = 'String' })
vim.api.nvim_set_hl(0, 'CmpItemKindField', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindFile', { link = 'File' })
vim.api.nvim_set_hl(0, 'CmpItemKindFolder', { link = 'Directory' })
vim.api.nvim_set_hl(0, 'CmpItemKindFunction', { link = 'Function' })
vim.api.nvim_set_hl(0, 'CmpItemKindInterface', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindKeyword', { link = 'Keyword' })
vim.api.nvim_set_hl(0, 'CmpItemKindMethod', { link = 'Function' })
vim.api.nvim_set_hl(0, 'CmpItemKindModule', { link = 'Include' })
vim.api.nvim_set_hl(0, 'CmpItemKindProperty', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindSnippet', { link = 'Special' })
vim.api.nvim_set_hl(0, 'CmpItemKindStruct', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindText', { link = 'String' })
vim.api.nvim_set_hl(0, 'CmpItemKindTypeParameter', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindValue', { link = 'String' })
vim.api.nvim_set_hl(0, 'CmpItemKindVariable', { link = 'Identifier' })
end -- }}}
local function copyFg(to, from, opts)
local cterm = vim.api.nvim_get_hl_by_name(from, false)
local gui = vim.api.nvim_get_hl_by_name(from, true)
local o = vim.tbl_extend('force', { ctermfg = cterm.foreground, fg = gui.foreground }, opts or {})
vim.api.nvim_set_hl(0, to, o)
end
local function clear(hl)
vim.api.nvim_set_hl(0, hl, {})
end
local function link(hl, to)
vim.api.nvim_set_hl(0, hl, { link = to })
end
local function normalizeTroubleHighlight() -- {{{
copyFg('TroubleText', 'Normal')
copyFg('TroubleFoldIcon', 'CursorLineNr')
copyFg('TroubleLocation', 'LineNr')
copyFg('TroubleIndent', 'LineNr')
copyFg('TroubleSignInformation', 'DiagnosticSignInfo')
-- TroubleCount xxx links to TabLineSel
-- copyFg('TroubleError', 'DiagnosticError')
link('TroubleSignError', 'DiagnosticError')
link('TroubleSignWarning', 'DiagnosticWarn')
link('TroubleSignHint', 'DiagnosticHint')
vim.api.nvim_set_hl(0, 'TroubleNormal', {})
end -- }}}
local function customLinks()
copyFg('Function', 'Normal')
copyFg('Operator', 'Normal')
end
local augr = vim.api.nvim_create_augroup('config_colorscheme', {});
vim.api.nvim_create_autocmd('Colorscheme', {
group = augr,
pattern = '*',
callback = function()
normalizeTSHighlight()
customLinks()
normalizeTerminal()
normalizeCmpKindHighlight()
normalizeTroubleHighlight()
end
})
local troublegr = vim.api.nvim_create_augroup('TroubleCursorline', { clear = true })
vim.api.nvim_create_autocmd('WinEnter', {
group = troublegr,
pattern = '*Trouble',
callback = function()
vim.wo.cursorline = true
end
})
vim.api.nvim_create_autocmd('WinLeave', {
group = troublegr,
pattern = '*Trouble',
callback = function()
vim.wo.cursorline = false
end
})
vim.api.nvim_create_autocmd('Colorscheme', {
group = augr,
pattern = 'gruvbox',
callback = function()
vim.api.nvim_set_hl(0, 'Directory', { link = 'GruvboxGreen' })
vim.api.nvim_set_hl(0, 'TelescopeSelection', { link = 'GruvboxOrangeSign' })
vim.api.nvim_set_hl(0, 'TelescopeMatching', { link = 'GruvboxAqua' })
vim.api.nvim_set_hl(0, 'NeoTreeGitAdded', { link = 'GruvboxGreen' })
vim.api.nvim_set_hl(0, 'NeoTreeGitDeleted', { link = 'GruvboxRed' })
vim.api.nvim_set_hl(0, 'NeoTreeGitModified', { link = 'GruvboxOrange' })
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { link = 'GruvboxAquaBold' })
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { link = 'GruvboxAquaBold' })
local tbg = vim.api.nvim_get_hl_by_name('GruvboxBg0', false)
local bg = vim.api.nvim_get_hl_by_name('GruvboxBg0', true)
local tfg = vim.api.nvim_get_hl_by_name('GruvboxGray', false)
local fg = vim.api.nvim_get_hl_by_name('GruvboxGray', true)
vim.api.nvim_set_hl(0, 'LineNr',
{ fg = fg.foreground,
bg = bg.foreground,
ctermfg = tfg.foreground,
ctermbg = tbg.foreground,
underdotted = true
})
end
})
vim.api.nvim_create_autocmd('ColorschemePre', {
group = augr,
pattern = '*',
callback = function()
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
end
})
local term = vim.env.TERM
if (term ~= 'linux' or vim.g.neoray)
then
vim.o.termguicolors = true
vim.g.gruvbox_contrast_dark = 'hard'
vim.cmd('colorscheme gruvbox')
end

View file

@ -0,0 +1,14 @@
local M = {}
function M.setup()
-- scroll up and down with shift+arrow
vim.keymap.set('n', '<S-Down>', '<C-E>')
vim.keymap.set('n', '<S-Up>', '<C-Y>')
--}}}
vim.keymap.set('n', '<Space>li', '<Cmd>LspInfo<CR>', { desc = 'Lsp info'})
vim.keymap.set('n', '<Space>ll', '<Cmd>LspLog<CR>', {desc = 'Lsp log'})
end
return M

View file

@ -1,3 +1,6 @@
local M = {}
function M.setup()
-- {{{ LAYA
local aug = vim.api.nvim_create_augroup('laya', {})
@ -41,8 +44,31 @@ vim.cmd([[
]])
-- }}}
--- Keys {{{
-- scroll up and down with shift+arrow
vim.keymap.set('n', '<S-Down>', '<C-E>')
vim.keymap.set('n', '<S-Up>', '<C-Y>')
--}}}
-- qf {{{
-- local pad = function (str, n)
-- if #str > n then
-- return str
-- else
-- return str .. string.rep(' ', n - #str)
-- end
-- end
-- QuickfixFunc = function(info)
-- local items
-- if info.quickfix then
-- items = vim.fn.getqflist({ id = info.id, items = 1 }).items
-- else
-- items = vim.fn.getloclist(info.id, { items = 1 }).items
-- end
-- local res = {};
-- for i = info.start_idx, info.end_idx, 1 do
-- local item = items[i]
-- table.insert(res, pad
-- end
-- end
-- }}}
end
return M

View file

@ -0,0 +1,18 @@
require('noice').setup({
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = false, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
})

View file

@ -24,21 +24,6 @@ function M.setup()
end,
}
use {
'neovim/nvim-lspconfig',
config = function() require('configs.lsp').setup() end,
requires = { 'b0o/schemastore.nvim' }
}
use {
'hrsh7th/nvim-cmp',
requires = { 'neovim/nvim-lspconfig' },
config = function() require('configs.nvim-cmp').setup() end
}
use { 'hrsh7th/cmp-nvim-lsp', requires = { 'hrsh7th/nvim-cmp' } }
use { 'hrsh7th/cmp-buffer', requires = { 'hrsh7th/nvim-cmp' } }
use { 'hrsh7th/cmp-path', requires = { 'hrsh7th/nvim-cmp' } }
use { 'hrsh7th/cmp-nvim-lua', requires = { 'hrsh7th/nvim-cmp' } }
use { 'hrsh7th/vim-vsnip', config = function()
vim.api.nvim_exec([[
imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
@ -48,15 +33,10 @@ function M.setup()
]], false)
end }
use { 'SmiteshP/nvim-navic', requires = 'neovim/nvim-lspconfig' }
use { 'j-hui/fidget.nvim', config = function() require('fidget').setup({}) end }
use { 'rafamadriz/friendly-snippets' }
use 'hrsh7th/cmp-nvim-lsp-signature-help'
use { 'hrsh7th/cmp-vsnip', requires = { 'hrsh7th/nvim-cmp', 'hrsh7th/vim-vsnip' } }
use { 'onsails/lspkind.nvim' }
use 'ray-x/lsp_signature.nvim'
use { 'RishabhRD/nvim-lsputils', requires = { 'RishabhRD/popfix' } }
@ -69,44 +49,13 @@ function M.setup()
-- end }
use { 'jose-elias-alvarez/null-ls.nvim', requires = { 'nvim-lua/plenary.nvim' },
config = function() require('configs.null-ls').setup() end
}
use { 'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
config = function() require('configs.treesitter').setup() end,
}
use 'nvim-treesitter/playground'
use({ 'yioneko/nvim-yati', requires = 'nvim-treesitter/nvim-treesitter', tag = 'legacy' })
use({ 'nvim-treesitter/nvim-treesitter-textobjects', requires = 'nvim-treesitter/nvim-treesitter' })
use { 'nvim-telescope/telescope.nvim',
requires = { 'nvim-lua/popup.nvim', 'nvim-lua/plenary.nvim' },
config = function() require('configs.telescope').setup() end,
}
use { 'nvim-telescope/telescope-ui-select.nvim' }
use { 'nvim-telescope/telescope-fzf-native.nvim',
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
}
use { 'gruvbox-community/gruvbox' }
use { 'chrisbra/Colorizer', cmd = 'ColorToggle', keys = { 'n', '<space>c <Cmd>ColorToggle<CR>' } }
use { 'numToStr/FTerm.nvim',
config = function() require('configs.fterm').setup() end,
}
use { 'lewis6991/gitsigns.nvim',
requires = { 'nvim-lua/plenary.nvim' },
config = function() require 'gitsigns'.setup({}) end }
use { 'hoob3rt/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons' },
config = require('configs.lualine').setup
}
use { 'AndrewRadev/linediff.vim', cmd = 'LineDiffAdd' }
use 'lukas-reineke/indent-blankline.nvim'
@ -122,17 +71,6 @@ function M.setup()
use 'editorconfig/editorconfig-vim'
use {
'nvim-neo-tree/neo-tree.nvim',
branch = 'v2.x',
requires = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
},
config = function() require('configs.neotree').setup() end,
}
use {
'vlada-dudr/vdebug',
opt = true,

View file

@ -0,0 +1,271 @@
local M = {
'gruvbox-community/gruvbox',
lazy = false,
priority = 999,
}
function M.config()
local function normalizeTSHighlight() --- {{{
-- helper {{{
local hl = function(group, opts)
if (opts.default == nil) then
opts.default = true
end
vim.api.nvim_set_hl(0, group, opts)
end
-- }}}
-- Misc {{{
hl('@comment', { link = 'Comment' })
hl('@none', { bg = 'NONE', fg = 'NONE' })
hl('@preproc', { link = 'PreProc' })
hl('@define', { link = 'Define' })
hl('@operator', { link = 'Operator' })
-- }}}
-- Punctuation {{{
hl('@punctuation.delimiter', { link = 'Delimiter' })
hl('@punctuation.bracket', { link = 'Delimiter' })
hl('@punctuation.special', { link = 'Delimiter' })
-- }}}
-- Literals {{{
hl('@string', { link = 'String' })
hl('@string.regex', { link = 'String' })
hl('@string.escape', { link = 'SpecialChar' })
hl('@string.special', { link = 'SpecialChar' })
hl('@character', { link = 'Character' })
hl('@character.special', { link = 'SpecialChar' })
hl('@boolean', { link = 'Boolean' })
hl('@number', { link = 'Number' })
hl('@float', { link = 'Float' })
-- }}}
-- Functions {{{
hl('@function', { link = 'Function' })
hl('@function.call', { link = 'Function' })
hl('@function.builtin', { link = 'Special' })
hl('@function.macro', { link = 'Macro' })
hl('@method', { link = 'Function' })
hl('@method.call', { link = 'Function' })
hl('@constructor', { link = 'Special' })
hl('@parameter', { link = 'Identifier' })
-- }}}
-- Keywords {{{
hl('@keyword', { link = 'Keyword' })
hl('@keyword.function', { link = 'Keyword' })
hl('@keyword.operator', { link = 'Keyword' })
hl('@keyword.return', { link = 'Keyword' })
hl('@conditional', { link = 'Conditional' })
hl('@repeat', { link = 'Repeat' })
hl('@debug', { link = 'Debug' })
hl('@label', { link = 'Label' })
hl('@include', { link = 'Include' })
hl('@exception', { link = 'Exception' })
-- }}}
-- Types {{{
hl('@type', { link = 'Type' })
hl('@type.builtin', { link = 'Type' })
hl('@type.qualifier', { link = 'Keyword' }) -- protected, public & friends
hl('@type.definition', { link = 'Typedef' })
hl('@storageclass', { link = 'StorageClass' })
hl('@attribute', { link = 'PreProc' })
hl('@field', { link = 'Identifier' })
hl('@property', { link = 'Identifier' })
-- }}}
-- Identifiers {{{
hl('@variable', { link = 'Identifier' })
hl('@variable.builtin', { link = 'Identifier' })
hl('@constant', { link = 'Constant' })
hl('@constant.builtin', { link = 'Special' })
hl('@constant.macro', { link = 'Define' })
hl('@namespace', { link = 'Include' })
hl('@symbol', { link = 'Identifier' })
-- }}}
-- Text {{{
hl('@text', {})
hl('@text.strong', { bold = true })
hl('@text.emphasis', { italic = true })
hl('@text.underline', { underline = true })
hl('@text.strike', { strikethrough = true })
hl('@text.title', { link = 'Title' })
hl('@text.literal', { link = 'String' })
hl('@text.uri', { link = 'Underlined' })
hl('@text.math', { link = 'Special' })
hl('@text.environment', { link = 'Macro' })
hl('@text.environment.name', { link = 'Type' })
hl('@text.reference', { link = 'Constant' })
hl('@text.todo', { link = 'Todo' })
hl('@text.note', { link = 'SpecialComment' })
hl('@text.warning', { link = 'WarningMsg' })
hl('@text.danger', { link = 'ErrorMsg' })
-- }}}
-- Tags {{{
hl('@tag', { link = 'Tag' })
hl('@tag.attribute', { link = 'Identifier' })
hl('@tag.delimiter', { link = 'Delimiter' })
-- }}}
end -- }}}
local function normalizeTerminal() -- {{{
vim.g.terminal_color_0 = 0
vim.g.terminal_color_1 = 1
vim.g.terminal_color_2 = 2
vim.g.terminal_color_3 = 3
vim.g.terminal_color_4 = 4
vim.g.terminal_color_5 = 5
vim.g.terminal_color_6 = 6
vim.g.terminal_color_7 = 7
vim.g.terminal_color_8 = 8
vim.g.terminal_color_9 = 9
vim.g.terminal_color_10 = 10
vim.g.terminal_color_11 = 11
vim.g.terminal_color_12 = 12
vim.g.terminal_color_13 = 13
vim.g.terminal_color_14 = 14
vim.g.terminal_color_15 = 15
end -- }}}
local function normalizeCmpKindHighlight() -- {{{
vim.api.nvim_set_hl(0, 'CmpItemKindClass', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindConstant', { link = 'Constant' })
vim.api.nvim_set_hl(0, 'CmpItemKindConstructor', { link = 'Special' })
vim.api.nvim_set_hl(0, 'CmpItemKindEnum', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindEnumMember', { link = 'String' })
vim.api.nvim_set_hl(0, 'CmpItemKindField', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindFile', { link = 'File' })
vim.api.nvim_set_hl(0, 'CmpItemKindFolder', { link = 'Directory' })
vim.api.nvim_set_hl(0, 'CmpItemKindFunction', { link = 'Function' })
vim.api.nvim_set_hl(0, 'CmpItemKindInterface', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindKeyword', { link = 'Keyword' })
vim.api.nvim_set_hl(0, 'CmpItemKindMethod', { link = 'Function' })
vim.api.nvim_set_hl(0, 'CmpItemKindModule', { link = 'Include' })
vim.api.nvim_set_hl(0, 'CmpItemKindProperty', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindSnippet', { link = 'Special' })
vim.api.nvim_set_hl(0, 'CmpItemKindStruct', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindText', { link = 'String' })
vim.api.nvim_set_hl(0, 'CmpItemKindTypeParameter', { link = 'Identifier' })
vim.api.nvim_set_hl(0, 'CmpItemKindValue', { link = 'String' })
vim.api.nvim_set_hl(0, 'CmpItemKindVariable', { link = 'Identifier' })
end -- }}}
local function copyFg(to, from, opts)
local cterm = vim.api.nvim_get_hl_by_name(from, false)
local gui = vim.api.nvim_get_hl_by_name(from, true)
local o = vim.tbl_extend('force', { ctermfg = cterm.foreground, fg = gui.foreground }, opts or {})
vim.api.nvim_set_hl(0, to, o)
end
local function clear(hl)
vim.api.nvim_set_hl(0, hl, {})
end
local function link(hl, to)
vim.api.nvim_set_hl(0, hl, { link = to })
end
local function normalizeTroubleHighlight() -- {{{
copyFg('TroubleText', 'Normal')
copyFg('TroubleFoldIcon', 'CursorLineNr')
copyFg('TroubleLocation', 'LineNr')
copyFg('TroubleIndent', 'LineNr')
copyFg('TroubleSignInformation', 'DiagnosticSignInfo')
-- TroubleCount xxx links to TabLineSel
-- copyFg('TroubleError', 'DiagnosticError')
link('TroubleSignError', 'DiagnosticError')
link('TroubleSignWarning', 'DiagnosticWarn')
link('TroubleSignHint', 'DiagnosticHint')
vim.api.nvim_set_hl(0, 'TroubleNormal', {})
end -- }}}
local function customLinks()
copyFg('Function', 'Normal')
copyFg('Operator', 'Normal')
end
local troublegr = vim.api.nvim_create_augroup('TroubleCursorline', { clear = true })
vim.api.nvim_create_autocmd('WinEnter', {
group = troublegr,
pattern = '*Trouble',
callback = function()
vim.wo.cursorline = true
end
})
vim.api.nvim_create_autocmd('WinLeave', {
group = troublegr,
pattern = '*Trouble',
callback = function()
vim.wo.cursorline = false
end
})
local augr = vim.api.nvim_create_augroup('config_colorscheme', {});
vim.api.nvim_create_autocmd('Colorscheme', {
group = augr,
pattern = '*',
callback = function()
normalizeTSHighlight()
customLinks()
normalizeTerminal()
normalizeCmpKindHighlight()
normalizeTroubleHighlight()
end
})
vim.api.nvim_create_autocmd('Colorscheme', {
group = augr,
pattern = 'gruvbox',
callback = function()
vim.api.nvim_set_hl(0, 'Directory', { link = 'GruvboxGreen' })
vim.api.nvim_set_hl(0, 'TelescopeSelection', { link = 'GruvboxOrangeSign' })
vim.api.nvim_set_hl(0, 'TelescopeMatching', { link = 'GruvboxAqua' })
vim.api.nvim_set_hl(0, 'NeoTreeGitAdded', { link = 'GruvboxGreen' })
vim.api.nvim_set_hl(0, 'NeoTreeGitDeleted', { link = 'GruvboxRed' })
vim.api.nvim_set_hl(0, 'NeoTreeGitModified', { link = 'GruvboxOrange' })
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { link = 'GruvboxAquaBold' })
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { link = 'GruvboxAquaBold' })
local tbg = vim.api.nvim_get_hl_by_name('GruvboxBg0', false)
local bg = vim.api.nvim_get_hl_by_name('GruvboxBg0', true)
local tfg = vim.api.nvim_get_hl_by_name('GruvboxGray', false)
local fg = vim.api.nvim_get_hl_by_name('GruvboxGray', true)
vim.api.nvim_set_hl(0, 'LineNr',
{ fg = fg.foreground,
bg = bg.foreground,
ctermfg = tfg.foreground,
ctermbg = tbg.foreground,
underdotted = true
})
end
})
vim.api.nvim_create_autocmd('ColorschemePre', {
group = augr,
pattern = '*',
callback = function()
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
end
})
local term = vim.env.TERM
if (term ~= 'linux' or vim.g.neoray)
then
vim.o.termguicolors = true
vim.g.gruvbox_contrast_dark = 'hard'
vim.cmd.colorscheme('gruvbox')
end
end
return M

View file

@ -1,6 +1,10 @@
local M = {}
local M = {
'numToStr/FTerm.nvim',
keys = { "<Space>g", "<Space>h"},
lazy = true,
}
function M.setup()
function M.config()
local fterm = require('FTerm')
@ -26,8 +30,8 @@ function M.setup()
})
end
vim.keymap.set('n', '<Space>g', function() lazygit:toggle() end,{ desc = 'Toggle lazygit'} )
vim.keymap.set('n', '<Space>H', git_history, { desc = 'Show git history'})
vim.keymap.set('n', '<Space>g', function() lazygit:toggle() end, { desc = 'Toggle lazygit' })
vim.keymap.set('n', '<Space>H', git_history, { desc = 'Show git history' })
end
return M

View file

@ -0,0 +1,62 @@
return {
{ 'chrisbra/Colorizer', cmd = 'ColorToggle'},
{
'lewis6991/gitsigns.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
config = true,
},
{ 'AndrewRadev/linediff.vim', cmd = 'LineDiffAdd' },
{ 'lukas-reineke/indent-blankline.nvim', event = "BufReadPre" },
{
'b3nj5m1n/kommentary',
config = function()
local kommentary = require('kommentary.config')
kommentary.configure_language('php', { prefer_single_line_comments = true, })
kommentary.configure_language('lua', { prefer_single_line_comments = true, })
end
},
{
'hrsh7th/vim-vsnip',
config = function()
vim.api.nvim_exec([[
imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
smap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
imap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
smap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
]], false)
end
},
'editorconfig/editorconfig-vim',
{
'vlada-dudr/vdebug',
lazy = true,
keys = {'<F5>'},
},
{ 'dyng/ctrlsf.vim', cmd = 'CtrlSF' },
{ 'andymass/vim-matchup' },
{ 'fpob/nette.vim', ft = 'nette' },
{ 'ziglang/zig.vim', ft = 'zig' },
{
'folke/trouble.nvim',
dependencies = { 'kyazdani42/nvim-web-devicons' },
lazy = true,
cmd = { 'Trouble', 'TroubleToggle' },
keys = { {'<Space>t', ':TroubleToggle<CR>' } },
config = {
mode = 'document_diagnostics'
}
},
}

View file

@ -1,72 +1,79 @@
local M = {}
local formatting_filter = function(c)
local bl = {
'phpactor'
local M = {
'neovim/nvim-lspconfig',
dependencies = {
'folke/neodev.nvim',
'b0o/schemastore.nvim',
'SmiteshP/nvim-navic',
{ 'j-hui/fidget.nvim', config = true },
}
for _, name in ipairs(bl) do
if c.name == name then
return false;
}
function M.config()
require('neodev').setup({})
local formatting_filter = function(c)
local bl = {
'phpactor'
}
for _, name in ipairs(bl) do
if c.name == name then
return false;
end
end
return true
end
local function on_attach(args)
-- require "lsp_signature".on_attach()
-- require'completion'.on_attach()
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
if (client.server_capabilities.documentSymbolProvider) then
require('nvim-navic').attach(client, bufnr)
end
-- Mappings.
local opts = { noremap = true, silent = true, buffer = args.buf }
-- use LSP default tagfunc
-- if client.server_capabilities.definitionProvider then
-- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
-- end
if client.server_capabilities.declarationProvider then
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
end
if client.supports_method('textDocument/hover') and client.name ~= 'null-ls' then
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
end
if client.server_capabilities.implementationProvider then
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
end
if client.server_capabilities.signatureHelpProvider then
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, opts)
end
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('v', '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
vim.keymap.set('n', '<space>F', function() vim.lsp.buf.format({ async = true, filter = formatting_filter, }) end, opts)
if (formatting_filter(client)) then
vim.api.nvim_buf_set_option(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')
end
end
return true
end
local function on_attach(args)
-- require "lsp_signature".on_attach()
-- require'completion'.on_attach()
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
if (client.server_capabilities.documentSymbolProvider) then
require('nvim-navic').attach(client, bufnr)
end
-- Mappings.
local opts = { noremap = true, silent = true, buffer = args.buf }
-- use LSP default tagfunc
-- if client.server_capabilities.definitionProvider then
-- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
-- end
if client.server_capabilities.declarationProvider then
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
end
if client.supports_method('textDocument/hover') and client.name ~= 'null-ls' then
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
end
if client.server_capabilities.implementationProvider then
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
end
if client.server_capabilities.signatureHelpProvider then
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('i', '<C-k>', vim.lsp.buf.signature_help, opts)
end
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('v', '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
vim.keymap.set('n', '<space>F', function() vim.lsp.buf.format({ async = true, filter = formatting_filter, }) end, opts)
if (formatting_filter(client)) then
vim.api.nvim_buf_set_option(bufnr, 'formatexpr', 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')
end
end
function M.setup()
require('neodev').setup({})
vim.api.nvim_create_autocmd('LspAttach', {
callback = on_attach
@ -126,7 +133,7 @@ function M.setup()
settings = {
validate = { enable = true },
json = {
schemas = require('schemastore').json.schemas { },
schemas = require('schemastore').json.schemas {},
},
},
}
@ -139,10 +146,10 @@ function M.setup()
local u = require('lspconfig.util')
return u.search_ancestors(startpath, function(path)
return not string.find(path, '/vendor/') and (
u.path.exists(u.path.join(path, 'composer.json'))
or u.path.exists(u.path.join(path, 'sharedLibs'))
or u.path.exists(u.path.join(path, '.git'))
)
u.path.exists(u.path.join(path, 'composer.json'))
or u.path.exists(u.path.join(path, 'sharedLibs'))
or u.path.exists(u.path.join(path, '.git'))
)
end)
end
}

View file

@ -1,6 +1,11 @@
local M = {}
local M = {
'hoob3rt/lualine.nvim',
dependencies = {
'kyazdani42/nvim-web-devicons'
}
}
function M.setup()
function M.config()
local navic = require('nvim-navic')
require 'lualine'.setup {
options = {

View file

@ -1,5 +1,14 @@
local M = {}
function M.setup()
local M = {
'nvim-neo-tree/neo-tree.nvim',
branch = 'v2.x',
dependencies = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
},
}
function M.config()
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
require('neo-tree').setup({

View file

@ -1,6 +1,9 @@
local M = {}
local M = {
'jose-elias-alvarez/null-ls.nvim',
dependencies = { 'nvim-lua/plenary.nvim' }
}
function M.setup()
function M.config()
local nls = require 'null-ls'
nls.setup({

View file

@ -1,6 +1,16 @@
local M = {}
local M = {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-vsnip',
'onsails/lspkind.nvim',
},
}
function M.setup()
function M.config()
local cmp = require 'cmp'
cmp.setup({
@ -14,7 +24,7 @@ function M.setup()
-- { name = 'nvim_lsp_signature_help' },
},
formatting = {
format = require 'lspkind'.cmp_format({
format = require('lspkind').cmp_format({
-- mode = 'symbol',
}),
},

View file

@ -1,10 +1,23 @@
local M = {}
local M = {
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-lua/popup.nvim',
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-ui-select.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
}
},
keys = {
{'<Space>b', [[<Cmd>Telescope buffers<CR>]], { noremap = true, silent = true }},
{'<Space>f', [[<Cmd>Telescope fd<CR>]], { noremap = true, silent = true }},
{'<Space>T', [[<Cmd>Telescope<CR>]], { noremap = true, silent = true }},
}
}
function M.setup()
function M.config()
local telescope = require('telescope')
vim.api.nvim_set_keymap('n', '<Space>b', [[<Cmd>Telescope buffers<CR>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Space>f', [[<Cmd>Telescope fd<CR>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Space>T', [[<Cmd>Telescope<CR>]], { noremap = true, silent = true })
telescope.setup {
defaults = {

View file

@ -1,9 +1,16 @@
local M = {}
local M = {
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/playground',
'nvim-treesitter/nvim-treesitter-textobjects',
{ 'yioneko/nvim-yati', tag = 'legacy' }
}
}
function M.setup()
function M.config()
require 'nvim-treesitter.configs'.setup {
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
sync_install = true,
sync_install = false,
highlight = {
enable = true,
disable = { 'help' },

View file

@ -1,9 +0,0 @@
local M = {}
function M.setup()
require('trouble').setup({
mode = 'document_diagnostics'
})
end
return M

View file

@ -0,0 +1,7 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "NoSingleTable"
collapse_simple_statement = "Never"