feat(kauffinger/lazyvim): new config with my own from kauffinger/lazyvim

This commit is contained in:
2024-02-25 17:37:23 +03:00
commit 33c2bc8397
35 changed files with 1542 additions and 0 deletions

55
lua/plugins/conform.lua Normal file
View File

@@ -0,0 +1,55 @@
local util = require("conform.util")
return {
"stevearc/conform.nvim",
opts = function()
---@class ConformOpts
local opts = {
-- LazyVim will use these options when formatting with the conform.nvim formatter
format = {
timeout_ms = 3000,
async = false, -- not recommended to change
quiet = false, -- not recommended to change
},
---@type table<string, conform.FormatterUnit[]>
formatters_by_ft = {
lua = { "stylua" },
fish = { "fish_indent" },
sh = { "shfmt" },
php = { "pint" },
blade = { "blade-formatter", "rustywind" },
-- python = { "black" },
javascript = { "prettierd" },
},
-- LazyVim will merge the options you set here with builtin formatters.
-- You can also define any custom formatters here.
---@type table<string, conform.FormatterConfigOverride|fun(bufnr: integer): nil|conform.FormatterConfigOverride>
formatters = {
injected = { options = { ignore_errors = true } },
-- # Example of using dprint only when a dprint.json file is present
-- dprint = {
-- condition = function(ctx)
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
-- end,
-- },
--
-- # Example of using shfmt with extra args
-- shfmt = {
-- extra_args = { "-i", "2", "-ci" },
-- },
pint = {
meta = {
url = "https://github.com/laravel/pint",
description = "Laravel Pint is an opinionated PHP code style fixer for minimalists. Pint is built on top of PHP-CS-Fixer and makes it simple to ensure that your code style stays clean and consistent.",
},
command = util.find_executable({
vim.fn.stdpath("data") .. "/mason/bin/pint",
"vendor/bin/pint",
}, "pint"),
args = { "$FILENAME" },
stdin = false,
},
},
}
return opts
end,
}

26
lua/plugins/database.lua Normal file
View File

@@ -0,0 +1,26 @@
return {
"kristijanhusak/vim-dadbod-ui",
dependencies = {
"tpope/vim-dadbod",
"kristijanhusak/vim-dadbod-completion",
"tpope/vim-dotenv",
},
keys = { { "<leader><leader>db", ":tab DBUI<cr>", desc = "Open Database client" } },
init = function()
vim.g.db_ui_use_nerd_fonts = 1
vim.g.db_ui_show_database_icon = 1
vim.g.db_ui_force_echo_notifications = 1
vim.g.db_ui_win_position = "left"
vim.g.db_ui_winwidth = 100
vim.g.db_ui_table_helpers = {
mysql = {
Count = "select count(1) from {optional_schema}{table}",
Explain = "EXPLAIN {last_query}",
},
sqlite = {
Describe = "PRAGMA table_info({table})",
},
}
end,
}

28
lua/plugins/emmet_ls.lua Normal file
View File

@@ -0,0 +1,28 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
-- @type lspconfig.options
servers = {
emmet_ls = {
filetypes = {
"astro",
"blade",
"css",
"eruby",
"html",
"htmldjango",
"javascriptreact",
"less",
"pug",
"sass",
"scss",
"svelte",
"typescriptreact",
"vue",
},
},
},
},
},
}

267
lua/plugins/example.lua Normal file
View File

@@ -0,0 +1,267 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
-- if true then return {} end
-- every spec file under config.plugins will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
-- { "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load everforest
{
"LazyVim/LazyVim",
opts = {
colorscheme = "everforest",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- add symbols-outline
-- {
-- "simrat39/symbols-outline.nvim",
-- cmd = "SymbolsOutline",
-- keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
-- config = true,
-- },
-- override nvim-cmp and add cmp-emoji
-- {
-- "hrsh7th/nvim-cmp",
-- dependencies = { "hrsh7th/cmp-emoji" },
-- ---@param opts cmp.ConfigSchema
-- opts = function(_, opts)
-- local cmp = require("cmp")
-- opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
-- end,
-- },
-- change some telescope options and a keymap to browse plugin files
-- {
-- "nvim-telescope/telescope.nvim",
-- keys = {
-- -- add a keymap to browse plugin files
-- -- stylua: ignore
-- {
-- "<leader>fp",
-- function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
-- desc = "Find Plugin File",
-- },
-- },
-- change some options
-- opts = {
-- defaults = {
-- layout_strategy = "horizontal",
-- layout_config = { prompt_position = "top" },
-- sorting_strategy = "ascending",
-- winblend = 0,
-- },
-- },
-- },
-- add telescope-fzf-native
-- {
-- "telescope.nvim",
-- dependencies = {
-- "nvim-telescope/telescope-fzf-native.nvim",
-- build = "make",
-- config = function()
-- require("telescope").load_extension("fzf")
-- end,
-- },
-- },
-- add pyright to lspconfig
-- {
-- "neovim/nvim-lspconfig",
-- ---@class PluginLspOpts
-- opts = {
-- ---@type lspconfig.options
-- servers = {
-- -- pyright will be automatically installed with mason and loaded with lspconfig
-- pyright = {},
-- },
-- },
-- },
-- add tsserver and setup with typescript.nvim instead of lspconfig
-- {
-- "neovim/nvim-lspconfig",
-- dependencies = {
-- "jose-elias-alvarez/typescript.nvim",
-- init = function()
-- require("lazyvim.util").on_attach(function(_, buffer)
-- -- stylua: ignore
-- vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
-- vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
-- end)
-- end,
-- },
-- ---@class PluginLspOpts
-- opts = {
-- ---@type lspconfig.options
-- servers = {
-- -- tsserver will be automatically installed with mason and loaded with lspconfig
-- tsserver = {},
-- },
-- -- you can do any additional lsp server setup here
-- -- return true if you don't want this server to be setup with lspconfig
-- ---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
-- setup = {
-- -- example to setup with typescript.nvim
-- tsserver = function(_, opts)
-- require("typescript").setup({ server = opts })
-- return true
-- end,
-- -- Specify * to use this function as a fallback for any server
-- -- ["*"] = function(server, opts) end,
-- },
-- },
-- },
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
-- { import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
-- {
-- "nvim-treesitter/nvim-treesitter",
-- opts = {
-- ensure_installed = {
-- "bash",
-- "help",
-- "html",
-- "javascript",
-- "json",
-- "lua",
-- "markdown",
-- "markdown_inline",
-- "python",
-- "query",
-- "regex",
-- "tsx",
-- "typescript",
-- "vim",
-- "yaml",
-- },
-- },
-- },
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
-- {
-- "nvim-treesitter/nvim-treesitter",
-- opts = function(_, opts)
-- -- add tsx and treesitter
-- vim.list_extend(opts.ensure_installed, {
-- "tsx",
-- "typescript",
-- })
-- end,
-- },
-- the opts function can also be used to change the default opts:
-- {
-- "nvim-lualine/lualine.nvim",
-- event = "VeryLazy",
-- opts = function(_, opts)
-- table.insert(opts.sections.lualine_x, "😄")
-- end,
-- },
-- or you can return new options to override all the defaults
-- {
-- "nvim-lualine/lualine.nvim",
-- event = "VeryLazy",
-- opts = function()
-- return {
-- --[[add your custom lualine config here]]
-- }
-- end,
-- },
-- use mini.starter instead of alpha
-- { import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc
-- { import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
-- {
-- "williamboman/mason.nvim",
-- opts = {
-- ensure_installed = {
-- "stylua",
-- "shellcheck",
-- "shfmt",
-- "flake8",
-- },
-- },
-- },
-- Use <tab> for completion and snippets (supertab)
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
{
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
},
-- then: setup supertab in cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
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 luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
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" }),
})
end,
},
}

View File

@@ -0,0 +1,5 @@
return {
{
"jwalton512/vim-blade",
},
}

10
lua/plugins/git.lua Normal file
View File

@@ -0,0 +1,10 @@
return {
"tpope/vim-fugitive",
keys = {
{ "<leader>ga", ":Git fetch --all -p<cr>", desc = "Git fetch" },
{ "<leader>gl", ":Git pull<cr>", desc = "Git pull" },
{ "<leader>gdh", ":diffget //2<cr>", desc = "Git diff grab from left" },
{ "<leader>gdl", ":diffget //3<cr>", desc = "Git diff grab from right" },
},
cmd = { "G", "Git" },
}

View File

@@ -0,0 +1,28 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
-- @type lspconfig.options
servers = {
intelephense = {
filetypes = { "php", "blade" },
settings = {
intelephense = {
filetypes = { "php", "blade" },
files = {
associations = { "*.php", "*.blade.php" }, -- Associating .blade.php files as well
maxSize = 5000000,
},
},
},
cmd = {
"node",
"--max-old-space-size=4096",
"/home/alex/.local/share/nvim/mason/bin/intelephense",
"--stdio",
},
},
},
},
},
}

45
lua/plugins/laravel.lua Normal file
View File

@@ -0,0 +1,45 @@
return {
"adalessa/laravel.nvim",
dependencies = {
"rcarriga/nvim-notify",
"nvim-telescope/telescope.nvim",
"MunifTanjim/nui.nvim",
},
cmd = { "Sail", "Artisan", "Composer", "Npm", "Laravel", "LaravelInfo", "DockerCompose" },
keys = {
{ "<leader>la", ":Laravel artisan<cr>", desc = "Laravel Application Commands" },
{ "<leader>lr", ":Laravel routes<cr>", desc = "Laravel Application Routes" },
{
"<leader>lt",
function()
require("laravel.tinker").send_to_tinker()
end,
mode = "v",
desc = "Laravel Application Routes",
},
},
init = function()
vim.g.laravel_log_level = "debug"
end,
config = function()
local uid = vim.system({ "id", "-u" }, { text = true }):wait().stdout or "1000"
local gid = vim.system({ "id", "-g" }, { text = true }):wait().stdout or "1000"
local user_arg = string.format("%s:%s", vim.trim(uid), vim.trim(gid))
require("laravel").setup({
route_info = {
position = "top",
},
environment = {
environments = {
["ao"] = require("laravel.environment.docker_compose").setup({
container_name = "panel-webserver",
cmd = { "docker", "compose", "exec", "-u", user_arg, "-it", "panel-webserver" },
}),
},
},
})
require("telescope").load_extension("laravel")
end,
}

View File

@@ -0,0 +1,47 @@
return {
"jay-babu/mason-nvim-dap.nvim",
dependencies = "mason.nvim",
cmd = { "DapInstall", "DapUninstall" },
opts = {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_setup = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {
function(config)
-- all sources with no handler get passed here
-- Keep original functionality
require("mason-nvim-dap").default_setup(config)
end,
php = function(config)
config.configurations = {
{
type = "php",
request = "launch",
name = "Listen for Xdebug",
port = 9003,
pathMappings = {
-- For some reason xdebug sometimes fails for me, depending on me
-- using herd or docker. To get it to work, change the order of the mappings.
-- The first mapping should be the one that you are actively using.
-- This only started recently, so I don't know what changed.
["${workspaceFolder}"] = "${workspaceFolder}",
["/var/www/html"] = "${workspaceFolder}",
},
},
}
require("mason-nvim-dap").default_setup(config) -- don't forget this!
end,
},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
"php",
"bash",
-- "python",
},
},
}

34
lua/plugins/mason.lua Normal file
View File

@@ -0,0 +1,34 @@
return {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"actionlint",
"ansible-language-server",
"ansible-lint",
"antlers-language-server",
"black",
"bash-language-server",
"blade-formatter",
"docker-compose-language-service",
"dockerfile-language-server",
"dot-language-server",
"emmet-ls",
"eslint_d",
"flake8",
"hadolint",
"html-lsp",
"intelephense",
"nginx-language-server",
"php-debug-adapter",
"phpstan",
"pint",
"prettierd",
"pyright",
"rustywind",
"shellcheck",
"shfmt",
"stylua",
"tailwindcss-language-server",
},
},
}

24
lua/plugins/null-ls.lua Normal file
View File

@@ -0,0 +1,24 @@
return {
{
"nvimtools/none-ls.nvim",
opts = function()
local nls = require("null-ls")
return {
sources = {
nls.builtins.diagnostics.phpstan.with({
extra_args = {
"--memory-limit=2G",
},
}),
},
}
end,
},
{
-- add longer timeout, since formatting blade files gets a little slow
-- "neovim/nvim-lspconfig",
-- opts = {
-- format = { timeout_ms = 2000 },
-- },
},
}

10
lua/plugins/nvim-cmp.lua Normal file
View File

@@ -0,0 +1,10 @@
return {
"nvim-cmp",
opts = function(_, opts)
table.insert(opts.sources, 1, {
name = "copilot",
group_index = 2,
priority = 100,
})
end,
}

30
lua/plugins/nvim-lint.lua Normal file
View File

@@ -0,0 +1,30 @@
return {
"mfussenegger/nvim-lint",
event = "LazyFile",
opts = {
-- Event to trigger linters
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
linters_by_ft = {
fish = { "fish" },
dockerfile = { "hadolint" },
-- python = { "pylint" },
-- Use the "*" filetype to run linters on all filetypes.
-- ['*'] = { 'global linter' },
-- Use the "_" filetype to run linters on filetypes that don't have other linters configured.
-- ['_'] = { 'fallback linter' },
},
-- LazyVim extension to easily override linter options
-- or add custom linters.
---@type table<string,table>
linters = {
-- -- Example of using selene only when a selene.toml file is present
-- selene = {
-- -- `condition` is another LazyVim extension that allows you to
-- -- dynamically enable/disable linters based on the context.
-- condition = function(ctx)
-- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1]
-- end,
-- },
},
},
}

97
lua/plugins/php.lua Normal file
View File

@@ -0,0 +1,97 @@
return { -- lazy
{
"ccaglak/namespace.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
{
"adalessa/composer.nvim",
lazy = true,
},
},
-- {
-- "ludovicchabant/vim-gutentags",
-- config = function()
-- vim.g.gutentags_ctags_exclude = {
-- "*.git",
-- "*.svg",
-- "*.hg",
-- "*/tests/*",
-- "build",
-- "dist",
-- "*sites/*/files/*",
-- "bin",
-- "node_modules",
-- "bower_components",
-- "cache",
-- "compiled",
-- "docs",
-- "example",
-- "bundle",
-- "vendor",
-- "*.md",
-- "*-lock.json",
-- "*.lock",
-- "*bundle*.js",
-- "*build*.js",
-- ".*rc*",
-- "*.json",
-- "*.min.*",
-- "*.map",
-- "*.bak",
-- "*.zip",
-- "*.pyc",
-- "*.class",
-- "*.sln",
-- "*.Master",
-- "*.csproj",
-- "*.tmp",
-- "*.csproj.user",
-- "*.cache",
-- "*.pdb",
-- "tags*",
-- "cscope.*",
-- -- '*.css',
-- -- '*.less',
-- -- '*.scss',
-- "*.exe",
-- "*.dll",
-- "*.mp3",
-- "*.ogg",
-- "*.flac",
-- "*.swp",
-- "*.swo",
-- "*.bmp",
-- "*.gif",
-- "*.ico",
-- "*.jpg",
-- "*.png",
-- "*.rar",
-- "*.zip",
-- "*.tar",
-- "*.tar.gz",
-- "*.tar.xz",
-- "*.tar.bz2",
-- "*.pdf",
-- "*.doc",
-- "*.docx",
-- "*.ppt",
-- "*.pptx",
-- }
--
-- vim.g.gutentags_add_default_project_roots = false
-- vim.g.gutentags_project_root = { "package.json", ".git" }
-- vim.g.gutentags_cache_dir = vim.fn.stdpath("data") .. "/ctags"
-- vim.g.gutentags_generate_on_new = true
-- vim.g.gutentags_generate_on_missing = true
-- vim.g.gutentags_generate_on_write = true
-- vim.g.gutentags_generate_on_empty_buffer = true
-- vim.g.gutentags_modules = true
-- vim.cmd([[command! -nargs=0 GutentagsClearCache call system('rm ' . g:gutentags_cache_dir . '/*')]])
-- vim.g.gutentags_ctags_extra_args = { "--tag-relative=yes", "--fields=+ailmnS" }
--
-- -- custom
-- vim.g.gutentags_modules = { "ctags" }
-- end,
-- },
}

43
lua/plugins/tailwind.lua Normal file
View File

@@ -0,0 +1,43 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
tailwindcss = {
settings = {
tailwindCSS = {
experimental = {
classRegex = {
"@?class\\(([^]*)\\)",
"'([^']*)'",
},
},
},
},
},
},
},
},
{
"NvChad/nvim-colorizer.lua",
opts = {
user_default_options = {
tailwind = true,
},
},
},
{
"hrsh7th/nvim-cmp",
dependencies = {
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
},
opts = function(_, opts)
-- original LazyVim kind icon formatter
local format_kinds = opts.formatting.format
opts.formatting.format = function(entry, item)
format_kinds(entry, item) -- add icons
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
end
end,
},
}

24
lua/plugins/theme.lua Normal file
View File

@@ -0,0 +1,24 @@
return {
-- -- Configure LazyVim to load gruvbox
-- {
-- "LazyVim/LazyVim",
-- opts = {
-- colorscheme = "catppuccin-mocha",
-- },
-- },
"neanias/everforest-nvim",
lazy = false,
priority = 1000,
config = function()
require("everforest").setup({
background = "hard",
transparent_background_level = 0,
italics = true,
disable_italic_comments = false,
ui_contrast = "low",
})
vim.cmd("let g:everforest_better_performance = 1")
vim.cmd("let g:airline_theme = 'everforest'")
vim.cmd("colorscheme everforest")
end,
}

View File

@@ -0,0 +1,50 @@
-- add more treesitter parsers
return {
"nvim-treesitter/nvim-treesitter",
build = function()
require("nvim-treesitter.install").update({ with_sync = true })
end,
dependencies = {
{
"JoosepAlviste/nvim-ts-context-commentstring",
opts = {
custom_calculation = function(_, language_tree)
if vim.bo.filetype == "blade" and language_tree._lang ~= "javascript" and language_tree._lang ~= "php" then
return "{{-- %s --}}"
end
end,
},
},
"nvim-treesitter/nvim-treesitter-textobjects",
},
opts = {
ensure_installed = "all",
-- auto_install = true,
highlight = {
enable = true,
},
-- Needed because treesitter highlight turns off autoindent for php files
indent = {
enable = true,
},
},
config = function(_, opts)
---@class ParserInfo[]
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
files = {
"src/parser.c",
-- "src/scanner.cc",
},
branch = "main",
-- generate_requires_npm = true,
-- requires_generate_from_grammar = true,
},
filetype = "blade",
}
require("nvim-treesitter.configs").setup(opts)
end,
}