diff --git a/.gitignore b/.gitignore index 225fd51..18252ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ lazy-lock.json -.idea/ \ No newline at end of file +.idea/ +dap/ diff --git a/lua/editor/dashboard.lua b/lua/editor/dashboard.lua index 215160a..524405d 100644 --- a/lua/editor/dashboard.lua +++ b/lua/editor/dashboard.lua @@ -9,24 +9,97 @@ return { local dashboard = require('alpha.themes.startify') -- Header -- - dashboard.section.header.val = { - [[ ]], - [[ ]], - [[ ]], - [[ ]], - [[  ]], - [[ ████ ██████ █████ ██ ]], - [[ ███████████ █████  ]], - [[ █████████ ███████████████████ ███ ███████████ ]], - [[ █████████ ███ █████████████ █████ ██████████████ ]], - [[ █████████ ██████████ █████████ █████ █████ ████ █████ ]], - [[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]], - [[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]], - [[ ]], - [[ ]], - [[ ]], - } + local function getCharLen(s, pos) + local byte = string.byte(s, pos) + if not byte then + return nil + end + return (byte < 0x80 and 1) + or (byte < 0xE0 and 2) + or (byte < 0xF0 and 3) + or (byte < 0xF8 and 4) + or 1 + end - alpha.setup(dashboard.opts) + local function applyColors(logo, colors, logoColors) + dashboard.section.header.val = logo + + for key, color in pairs(colors) do + local name = 'Alpha' .. key + vim.api.nvim_set_hl(0, name, color) + colors[key] = name + end + + dashboard.section.header.opts.hl = {} + for i, line in ipairs(logoColors) do + local highlights = {} + local pos = 0 + + for j = 1, #line do + local opos = pos + pos = pos + getCharLen(logo[i], opos + 1) + + local color_name = colors[line:sub(j, j)] + if color_name then + table.insert(highlights, { color_name, opos, pos }) + end + end + + table.insert(dashboard.section.header.opts.hl, highlights) + end + return dashboard.opts + end + + alpha.setup(applyColors({ + [[ ███ ███ ]], + [[ ████ ████ ]], + [[  ████ █████ ]], + [[ █ ████ █████ ]], + [[ ██ ████ █████ ]], + [[ ███ ████ █████ ]], + [[ ████ ████ ████ ]], + [[ █████ ████████ ]], + [[ █████ ███████ ]], + [[ █████ ██████ ]], + [[ █████ █████ ]], + [[ ████ ████ ]], + [[ ███ ███ ]], + [[ ]], + [[ N E O V I M ]], + }, { + ['b'] = { fg = '#3399ff', ctermfg = 33 }, + ['a'] = { fg = '#53C670', ctermfg = 35 }, + ['g'] = { fg = '#39ac56', ctermfg = 29 }, + ['h'] = { fg = '#33994d', ctermfg = 23 }, + ['i'] = { + fg = '#33994d', + bg = '#39ac56', + ctermfg = 23, + ctermbg = 29, + }, + ['j'] = { + fg = '#53C670', + bg = '#33994d', + ctermfg = 35, + ctermbg = 23, + }, + ['k'] = { fg = '#30A572', ctermfg = 36 }, + }, { + [[ kkkka gggg ]], + [[ kkkkaa ggggg ]], + [[ b kkkaaa ggggg ]], + [[ bb kkaaaa ggggg ]], + [[ bbb kaaaaa ggggg ]], + [[ bbbb aaaaaa ggggg ]], + [[ bbbbb aaaaaa igggg ]], + [[ bbbbb aaaaaahiggg ]], + [[ bbbbb aaaaajhigg ]], + [[ bbbbb aaaaajhig ]], + [[ bbbbb aaaaajhi ]], + [[ bbbbb aaaaajh ]], + [[ bbbb aaaaa ]], + [[ ]], + [[ a a a b b b ]], + })) end, } diff --git a/lua/editor/file_tree.lua b/lua/editor/file_tree.lua index 25299ab..4e66116 100644 --- a/lua/editor/file_tree.lua +++ b/lua/editor/file_tree.lua @@ -46,7 +46,7 @@ return { }, }) - -- Dignostic Icons -- + -- Diagnostic Icons -- vim.fn.sign_define('DiagnosticSignError', { text = ' ', texthl = 'DiagnosticSignError', diff --git a/lua/editor/language_server.lua b/lua/editor/language_server.lua index 40f732c..1ac0221 100644 --- a/lua/editor/language_server.lua +++ b/lua/editor/language_server.lua @@ -86,7 +86,14 @@ return { 'nvim-tree/nvim-web-devicons', }, config = function() - require('lspsaga').setup({}) + require('lspsaga').setup({ + symbol_in_winbar = { + enable = false, + }, + lightbulb = { + enable = false + } + }) -- Keybinding -- vim.keymap.set( diff --git a/lua/editor/snippets.lua b/lua/editor/snippets.lua index fdee73b..f88133b 100644 --- a/lua/editor/snippets.lua +++ b/lua/editor/snippets.lua @@ -30,6 +30,12 @@ return { load_ft_func = require('luasnip_snippets.common.snip_utils').load_ft_func, ft_func = require('luasnip_snippets.common.snip_utils').ft_func, enable_autosnippets = true, + sources = { + { + name = "lazydev", + group_index = 0 + } + } }) -- Keybinding -- diff --git a/lua/toolchain/config.lua b/lua/toolchain/config.lua index 38d3605..9cfe369 100644 --- a/lua/toolchain/config.lua +++ b/lua/toolchain/config.lua @@ -2,7 +2,7 @@ local T = require('toolchain') local M = {} function M.setup() - T.add_highlighter_autoinstalls( 'json', 'xml', 'yaml', 'toml' ) + T.add_highlighter_autoinstalls('json', 'xml', 'yaml', 'toml') T.add_null_ls_module(function(null_ls) return { @@ -20,22 +20,21 @@ function M.setup() lspconfig.taplo.setup(config) end) - T.add_plugins( - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = {}, - }, + T.add_plugins({ + 'folke/neoconf.nvim', + priority = 10000, + config = function() require('neoconf').setup() end, + }, { + 'folke/lazydev.nvim', + dependencies = { + 'folke/neoconf.nvim', }, - { - "folke/neoconf.nvim", - priority = 100, - config = function() - require('neoconf').setup() - end - } - ) + ft = 'lua', + event = 'BufEnter *.lua', + config = function() + require('lazydev').setup(require('neoconf').get('lazydev')) + end, + }) end return M diff --git a/lua/toolchain/init.lua b/lua/toolchain/init.lua index 2427e8e..309cc20 100644 --- a/lua/toolchain/init.lua +++ b/lua/toolchain/init.lua @@ -110,4 +110,4 @@ return TOOLCHAINS -- Type Definitions - --------------------- ---@alias SetupLSPs fun(lspconfig:any, capabilities: any) ----@alias SetupNullLsModule fun(null_ls: any):table \ No newline at end of file +---@alias SetupNullLsModule fun(null_ls: any):table diff --git a/lua/toolchain/lua.lua b/lua/toolchain/lua.lua index 49a3c01..1abb81b 100644 --- a/lua/toolchain/lua.lua +++ b/lua/toolchain/lua.lua @@ -2,12 +2,10 @@ local T = require('toolchain') local M = {} function M.setup() - T.add_highlighter_autoinstalls('lua','luadoc') + T.add_highlighter_autoinstalls('lua', 'luadoc') T.add_null_ls_module(function(null_ls) return { - -- Diagnostics - null_ls.builtins.diagnostics.selene, -- Formatter null_ls.builtins.formatting.stylua, } @@ -15,16 +13,7 @@ function M.setup() T.add_lsp_autoinstalls('lua_ls') T.add_lsps(function(lspconfig, capabilities) - lspconfig.lua_ls.setup({ - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { 'vim' }, - }, - }, - }, - }) + lspconfig.lua_ls.setup({ capabilities = capabilities }) end) end diff --git a/lua/toolchain/php.lua b/lua/toolchain/php.lua index eab3cd6..49f18f2 100644 --- a/lua/toolchain/php.lua +++ b/lua/toolchain/php.lua @@ -24,6 +24,8 @@ function M.setup() lspconfig.phpactor.setup(config) lspconfig.stimulus_ls.setup(config) end) + + --TODO: move Dap config here end return M diff --git a/lua/toolchain/text.lua b/lua/toolchain/text.lua index 1f3b3df..84c0a7c 100644 --- a/lua/toolchain/text.lua +++ b/lua/toolchain/text.lua @@ -10,7 +10,6 @@ function M.setup() -- Actions null_ls.builtins.code_actions.proselint, -- Diagnostics - null_ls.builtins.diagnostics.alex, null_ls.builtins.diagnostics.codespell, null_ls.builtins.diagnostics.trail_space, -- Formatter diff --git a/lua/toolchain/web.lua b/lua/toolchain/web.lua index a3e71b3..c3f938c 100644 --- a/lua/toolchain/web.lua +++ b/lua/toolchain/web.lua @@ -15,7 +15,7 @@ function M.setup() } end) - T.add_lsp_autoinstalls('html', 'emmet_ls', 'cssls', 'tailwindcss', 'eslint', 'tsserver') + T.add_lsp_autoinstalls('html', 'emmet_ls', 'cssls', 'tailwindcss', 'eslint', 'ts_ls') T.add_lsps(function(lspconfig, capabilities) local config = { capabilities = capabilities } @@ -23,7 +23,7 @@ function M.setup() lspconfig.emmet_ls.setup(config) lspconfig.cssls.setup(config) lspconfig.tailwindcss.setup(config) - lspconfig.tsserver.setup(config) + lspconfig.ts_ls.setup(config) lspconfig.eslint.setup(config) end) end diff --git a/lua/util/config.lua b/lua/util/config.lua index 293d72a..ebbbee3 100644 --- a/lua/util/config.lua +++ b/lua/util/config.lua @@ -13,11 +13,11 @@ function CONFIG.get(module, name) end local config_file = vim.fn.readfile(config_file_path, "") - local succes, data = pcall(function() + local success, data = pcall(function() return vim.json.decode(table.concat(config_file, "")) end) - if not succes or data then + if not success or data then return nil end @@ -27,4 +27,4 @@ function CONFIG.get(module, name) ) end -return CONFIG \ No newline at end of file +return CONFIG diff --git a/neoconf.json b/neoconf.json index 1e2610a..5fdc870 100644 --- a/neoconf.json +++ b/neoconf.json @@ -1,7 +1,15 @@ { "lazydev": { "library": [ - "LazyVim" + "LazyVim", + "lazy.nvim" ] + }, + "lspconfig": { + "lua_ls": { + "Lua.diagnostics.globals": [ + "vim" + ] + } } -} \ No newline at end of file +}