First push of files to repository
This commit is contained in:
commit
e39011a95c
31
lazy-lock.json
Normal file
31
lazy-lock.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "cc3b68b08e6a0cb6e6bf9944932940091e49bb83" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"live-preview.nvim": { "branch": "main", "commit": "598672eaf91b38946626677f8e80426e6e7ceccc" },
|
||||
"lsp_lines.nvim": { "branch": "main", "commit": "a92c755f182b89ea91bd8a6a2227208026f27b4d" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0ea56f91b7f51a37b749c050a5e5dfdd56b302b3" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "2a406cdd8c373ae7fe378a9e062a5424472bd8d8" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "059e89495b3ec09395262f16b1ad441a38081d04" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "4ea9083b6d3dff4ddc6da17c51334c3255b7eba5" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "0e21ee8df6235511c02bab4a5b391d18e165a58d" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "698b5f805722254bca3c509591c1806d268b6c2f" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "57dfa947cc88cdf1baa2c7e13ed31edddd8fb1d1" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "992285058ce208825eb1b9ac82fa6be7d76ffcc1" },
|
||||
"spellwarn.nvim": { "branch": "main", "commit": "12734b47b008d912b4925c0bc2c1248eb534409d" },
|
||||
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }
|
||||
}
|
||||
25
lua/options.lua
Normal file
25
lua/options.lua
Normal file
@ -0,0 +1,25 @@
|
||||
--Vim Commands
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.scrolloff = 999
|
||||
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
|
||||
vim.opt.virtualedit = "block"
|
||||
|
||||
vim.opt.inccommand = "split"
|
||||
|
||||
vim.opt.ignorecase = true
|
||||
|
||||
vim.g.mapleader = " "
|
||||
2
lua/plugins.desktop.bak
Normal file
2
lua/plugins.desktop.bak
Normal file
@ -0,0 +1,2 @@
|
||||
return require('packer').startup(function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
36
lua/plugins.lua
Normal file
36
lua/plugins.lua
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
-- Lazy.nvim 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",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local status_ok, lazy = pcall(require, "lazy")
|
||||
if not status_ok then
|
||||
print("lazy just installed, please restart neovim")
|
||||
return
|
||||
end
|
||||
|
||||
lazy.setup({
|
||||
spec = {
|
||||
require("plugins.kanagawa"),
|
||||
require("plugins.lualine"),
|
||||
require("plugins.nvim-treesitter"),
|
||||
require("plugins.colorizer"),
|
||||
require("plugins.cmp"),
|
||||
require("plugins.luasnip"),
|
||||
require("plugins.mason"),
|
||||
require("plugins.lsp"),
|
||||
require("plugins.html-liveview")
|
||||
},
|
||||
})
|
||||
88
lua/plugins/cmp.lua
Normal file
88
lua/plugins/cmp.lua
Normal file
@ -0,0 +1,88 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"windwp/nvim-autopairs",
|
||||
"onsails/lspkind-nvim",
|
||||
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true }
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local lsp_kind = require("lspkind")
|
||||
local cmp_next = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
local cmp_prev = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
|
||||
lsp_kind.init()
|
||||
---@diagnostic disable-next-line
|
||||
cmp.setup({
|
||||
enabled = true,
|
||||
preselect = cmp.PreselectMode.None,
|
||||
window = {
|
||||
completion = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:Normal,FloatBorder:LspBorderBG,CursorLine:PmenuSel,Search:None",
|
||||
}),
|
||||
documentation = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:Normal,FloatBorder:LspBorderBG,CursorLine:PmenuSel,Search:None",
|
||||
}),
|
||||
},
|
||||
---@diagnostic disable-next-line
|
||||
view = {
|
||||
entries = "bordered",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<S-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<tab>"] = cmp_next,
|
||||
["<down>"] = cmp_next,
|
||||
["<C-p>"] = cmp_prev,
|
||||
["<up>"] = cmp_prev,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp_signature_help", group_index = 1 },
|
||||
{ name = "luasnip", max_item_count = 5, group_index = 1 },
|
||||
{ name = "nvim_lsp", max_item_count = 20, group_index = 1 },
|
||||
{ name = "nvim_lua", group_index = 1 },
|
||||
{ name = "vim-dadbod-completion", group_index = 1 },
|
||||
{ name = "path", group_index = 2 },
|
||||
{ name = "buffer", keyword_length = 2, max_item_count = 5, group_index = 2 },
|
||||
},
|
||||
})
|
||||
local presentAutopairs, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
if not presentAutopairs then
|
||||
return
|
||||
end
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
end,
|
||||
}
|
||||
14
lua/plugins/colorizer.lua
Normal file
14
lua/plugins/colorizer.lua
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
-- Nvim-Colorizer Plugin
|
||||
return {
|
||||
"catgoose/nvim-colorizer.lua",
|
||||
config = function()
|
||||
require("colorizer").setup({
|
||||
filetypes = {
|
||||
"*", -- Highlight all filetypes
|
||||
css = { rgb_fn = true }, -- Enable parsing of RGB functions in CSS
|
||||
html = { names = false }, -- Disable parsing of "names" like blue, red, green, etc in HTML
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
6
lua/plugins/html-liveview.lua
Normal file
6
lua/plugins/html-liveview.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
"brianhuster/live-preview.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim"
|
||||
},
|
||||
}
|
||||
7
lua/plugins/kanagawa.lua
Normal file
7
lua/plugins/kanagawa.lua
Normal file
@ -0,0 +1,7 @@
|
||||
-- Colorscheme
|
||||
return {
|
||||
"rebelot/kanagawa.nvim",
|
||||
config = function()
|
||||
vim.cmd.colorscheme("kanagawa-wave")
|
||||
end,
|
||||
}
|
||||
130
lua/plugins/lsp/init.lua
Normal file
130
lua/plugins/lsp/init.lua
Normal file
@ -0,0 +1,130 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"folke/neodev.nvim",
|
||||
"b0o/schemastore.nvim",
|
||||
"ravibrock/spellwarn.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||
},
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("neodev").setup({})
|
||||
require("lsp_lines").setup()
|
||||
require("spellwarn").setup()
|
||||
local lspconfig = require("lspconfig")
|
||||
-- local remaps = require("plugins.lsp.remaps")
|
||||
local icons = require("utils.icons")
|
||||
|
||||
local presentCmpNvimLsp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
local presentLspSignature, lsp_signature = pcall(require, "lsp_signature")
|
||||
|
||||
vim.lsp.set_log_level("error")
|
||||
|
||||
local function on_attach(client, bufnr)
|
||||
remaps.set_default_on_buffer(client, bufnr)
|
||||
if presentLspSignature then
|
||||
lsp_signature.on_attach({ floating_window = false, timer_interval = 500 })
|
||||
end
|
||||
end
|
||||
|
||||
local signs = {
|
||||
{ name = "DiagnosticSignError", text = icons.diagnostics.error },
|
||||
{ name = "DiagnosticSignWarn", text = icons.diagnostics.warning },
|
||||
{ name = "DiagnosticSignHint", text = icons.diagnostics.hint },
|
||||
{ name = "DiagnosticSignInfo", text = icons.diagnostics.information },
|
||||
}
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||
end
|
||||
|
||||
local config = {
|
||||
virtual_text = false, -- appears after the line
|
||||
virtual_lines = false, -- appears under the line
|
||||
signs = {
|
||||
active = signs,
|
||||
},
|
||||
flags = {
|
||||
debounce_text_changes = 200,
|
||||
},
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focus = false,
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
border = "shadow",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
}
|
||||
lspconfig.util.default_config = vim.tbl_deep_extend("force", lspconfig.util.default_config, config)
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
local border = {
|
||||
border = "shadow",
|
||||
}
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.hover, border)
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, border)
|
||||
|
||||
local capabilities
|
||||
if presentCmpNvimLsp then
|
||||
capabilities = cmp_lsp.default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
else
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
end
|
||||
|
||||
local servers = {
|
||||
bashls = require("plugins.lsp.servers.bashls")(on_attach),
|
||||
cssls = require("plugins.lsp.servers.cssls")(on_attach),
|
||||
dockerls = {},
|
||||
html = {},
|
||||
jsonls = {},
|
||||
lua_ls = require("plugins.lsp.servers.luals")(on_attach),
|
||||
intelephense = require("plugins.lsp.servers.phpls")(on_attach),
|
||||
pylsp = require("plugins.lsp.servers.pylsp")(on_attach),
|
||||
rust_analyzer = {},
|
||||
tailwindcss = require("plugins.lsp.servers.tailwindcss")(on_attach),
|
||||
terraformls = {},
|
||||
tflint = {},
|
||||
ts_ls = require("plugins.lsp.servers.ts_ls")(on_attach),
|
||||
yamlls = {},
|
||||
}
|
||||
|
||||
local default_lsp_config = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 200,
|
||||
allow_incremental_sync = true,
|
||||
},
|
||||
}
|
||||
|
||||
local server_names = {}
|
||||
local server_configs = {}
|
||||
for server_name, server_config in pairs(servers) do
|
||||
table.insert(server_names, server_name)
|
||||
server_configs[server_name] = server_config
|
||||
end
|
||||
|
||||
local present_mason, mason = pcall(require, "mason-lspconfig")
|
||||
if present_mason then
|
||||
mason.setup({ ensure_installed = server_names })
|
||||
mason.setup_handlers({
|
||||
function(server)
|
||||
local merged_config = vim.tbl_deep_extend("force", default_lsp_config, server_configs[server] or {})
|
||||
lspconfig[server].setup(merged_config)
|
||||
if server == "rust_analyzer" then
|
||||
local present_rust_tools, rust_tools = pcall(require, "rust-tools")
|
||||
if present_rust_tools then
|
||||
rust_tools.setup({ server = merged_config })
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
20
lua/plugins/lsp/servers/bashls.lua
Normal file
20
lua/plugins/lsp/servers/bashls.lua
Normal file
@ -0,0 +1,20 @@
|
||||
local util = require 'lspconfig.util'
|
||||
return function(on_attach)
|
||||
return {
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
cmd = { 'bash-language-server', 'start' },
|
||||
cmd_env = {
|
||||
GLOB_PATTERN = "*@(.sh|.inc|.bash|.command|.zsh)",
|
||||
},
|
||||
settings = {
|
||||
bashIde = {
|
||||
globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command|.zsh)',
|
||||
},
|
||||
},
|
||||
filetypes = { "sh", "zsh" },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
}
|
||||
end
|
||||
32
lua/plugins/lsp/servers/cssls.lua
Normal file
32
lua/plugins/lsp/servers/cssls.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local util = require 'lspconfig.util'
|
||||
return function(on_attach)
|
||||
return {
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
settings = {
|
||||
css = {
|
||||
validate = true,
|
||||
lint = {
|
||||
unknownAtRules = "ignore"
|
||||
}
|
||||
},
|
||||
scss = {
|
||||
validate = true,
|
||||
lint = {
|
||||
unknownAtRules = "ignore"
|
||||
}
|
||||
},
|
||||
less = {
|
||||
validate = true,
|
||||
lint = {
|
||||
unknownAtRules = "ignore"
|
||||
}
|
||||
},
|
||||
},
|
||||
cmd = { "vscode-css-language-server", "--stdio" },
|
||||
filetypes = { "css", "scss" },
|
||||
root_dir = util.find_git_ancestor,
|
||||
single_file_support = true,
|
||||
}
|
||||
end
|
||||
33
lua/plugins/lsp/servers/luals.lua
Normal file
33
lua/plugins/lsp/servers/luals.lua
Normal file
@ -0,0 +1,33 @@
|
||||
return function(on_attach)
|
||||
return {
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
hint = {
|
||||
enable = true
|
||||
},
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- make the server aware of Neovim runtime files
|
||||
-- library = {
|
||||
-- [vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||
-- [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true
|
||||
-- },
|
||||
checkThirdParty = false
|
||||
},
|
||||
-- do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
40
lua/plugins/lsp/servers/phpls.lua
Normal file
40
lua/plugins/lsp/servers/phpls.lua
Normal file
@ -0,0 +1,40 @@
|
||||
---@brief
|
||||
---
|
||||
--- https://intelephense.com/
|
||||
---
|
||||
--- `intelephense` can be installed via `npm`:
|
||||
--- ```sh
|
||||
--- npm install -g intelephense
|
||||
--- ```
|
||||
---
|
||||
--- ```lua
|
||||
--- -- See https://github.com/bmewburn/intelephense-docs/blob/master/installation.md#initialisation-options
|
||||
--- init_options = {
|
||||
--- storagePath = …, -- Optional absolute path to storage dir. Defaults to os.tmpdir().
|
||||
--- globalStoragePath = …, -- Optional absolute path to a global storage dir. Defaults to os.homedir().
|
||||
--- licenceKey = …, -- Optional licence key or absolute path to a text file containing the licence key.
|
||||
--- clearCache = …, -- Optional flag to clear server state. State can also be cleared by deleting {storagePath}/intelephense
|
||||
--- }
|
||||
--- -- See https://github.com/bmewburn/intelephense-docs
|
||||
--- settings = {
|
||||
--- intelephense = {
|
||||
--- files = {
|
||||
--- maxSize = 1000000;
|
||||
--- };
|
||||
--- };
|
||||
--- }
|
||||
--- ```
|
||||
|
||||
return {
|
||||
cmd = { 'intelephense', '--stdio' },
|
||||
filetypes = { 'php' },
|
||||
root_dir = function(bufnr, on_dir)
|
||||
local fname = vim.api.nvim_buf_get_name(bufnr)
|
||||
local cwd = assert(vim.uv.cwd())
|
||||
local root = vim.fs.root(fname, { 'composer.json', '.git' })
|
||||
|
||||
-- prefer cwd if root is a descendant
|
||||
on_dir(root and vim.fs.relpath(cwd, root) and cwd)
|
||||
end,
|
||||
}
|
||||
|
||||
40
lua/plugins/lsp/servers/pylsp.lua
Normal file
40
lua/plugins/lsp/servers/pylsp.lua
Normal file
@ -0,0 +1,40 @@
|
||||
---@brief
|
||||
---
|
||||
--- https://github.com/python-lsp/python-lsp-server
|
||||
---
|
||||
--- A Python 3.6+ implementation of the Language Server Protocol.
|
||||
---
|
||||
--- See the [project's README](https://github.com/python-lsp/python-lsp-server) for installation instructions.
|
||||
---
|
||||
--- Configuration options are documented [here](https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md).
|
||||
--- In order to configure an option, it must be translated to a nested Lua table and included in the `settings` argument to the `config('pylsp', {})` function.
|
||||
--- For example, in order to set the `pylsp.plugins.pycodestyle.ignore` option:
|
||||
--- ```lua
|
||||
--- vim.lsp.config('pylsp', {
|
||||
--- settings = {
|
||||
--- pylsp = {
|
||||
--- plugins = {
|
||||
--- pycodestyle = {
|
||||
--- ignore = {'W391'},
|
||||
--- maxLineLength = 100
|
||||
--- }
|
||||
--- }
|
||||
--- }
|
||||
--- }
|
||||
--- })
|
||||
--- ```
|
||||
---
|
||||
--- Note: This is a community fork of `pyls`.
|
||||
return {
|
||||
cmd = { 'pylsp' },
|
||||
filetypes = { 'python' },
|
||||
root_markers = {
|
||||
'pyproject.toml',
|
||||
'setup.py',
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
'.git',
|
||||
},
|
||||
}
|
||||
|
||||
3
lua/plugins/lsp/servers/yamlls.lua
Normal file
3
lua/plugins/lsp/servers/yamlls.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return function(capabilities)
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
end
|
||||
51
lua/plugins/lualine.lua
Normal file
51
lua/plugins/lualine.lua
Normal file
@ -0,0 +1,51 @@
|
||||
-- Lualine Plugin
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function ()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
always_show_tabline = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 100,
|
||||
tabline = 100,
|
||||
winbar = 100,
|
||||
},
|
||||
},
|
||||
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
})
|
||||
end,
|
||||
}
|
||||
35
lua/plugins/luasnip.lua
Normal file
35
lua/plugins/luasnip.lua
Normal file
@ -0,0 +1,35 @@
|
||||
return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
postinstall = "make install_jsregexp",
|
||||
config = function()
|
||||
local luasnip = require("luasnip")
|
||||
luasnip.config.setup({
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
enable_autosnippets = true,
|
||||
})
|
||||
-- add vscode exported completions
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
local r = require("utils.remaps")
|
||||
|
||||
r.map({ "i", "s" }, "<c-n>", function()
|
||||
if luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, "Expand current snippet or jump to next", { silent = true })
|
||||
|
||||
r.map({ "i", "s" }, "<c-p>", function()
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, "Go to previous snippet", { silent = true })
|
||||
|
||||
r.map("i", "<c-l>", function()
|
||||
if luasnip.choice_active() then
|
||||
luasnip.change_choice(1)
|
||||
end
|
||||
end, "Show list of options")
|
||||
|
||||
end,
|
||||
}
|
||||
53
lua/plugins/mason.lua
Normal file
53
lua/plugins/mason.lua
Normal file
@ -0,0 +1,53 @@
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
build = ":MasonInstallAll",
|
||||
config = function()
|
||||
local f = require("utils.functions")
|
||||
require("mason").setup({
|
||||
ui = {
|
||||
border = "shadow",
|
||||
icons = require("utils.icons").mason,
|
||||
zindex = 99,
|
||||
},
|
||||
})
|
||||
f.cmd("MasonInstallAll", function()
|
||||
vim.cmd('MasonUpdate')
|
||||
local ensure_installed = {
|
||||
"bash-language-server",
|
||||
"black",
|
||||
"clang-format",
|
||||
"clangd",
|
||||
"css-lsp",
|
||||
"dockerfile-language-server",
|
||||
"eslint-lsp",
|
||||
"html-lsp",
|
||||
"intelephense",
|
||||
"isort",
|
||||
"jq",
|
||||
"json-lsp",
|
||||
"jsonlint",
|
||||
"lua-language-server",
|
||||
"php-cs-fixer",
|
||||
"prettier",
|
||||
"prettierd",
|
||||
"python-lsp-server",
|
||||
"rust-analyzer",
|
||||
"shellcheck",
|
||||
"shellharden",
|
||||
"shfmt",
|
||||
"standardjs",
|
||||
"stylelint",
|
||||
"stylelint-lsp",
|
||||
"stylua",
|
||||
"tailwindcss-language-server",
|
||||
"terraform-ls",
|
||||
"tflint",
|
||||
"typescript-language-server",
|
||||
"yaml-language-server",
|
||||
"yamlfmt",
|
||||
"yamllint",
|
||||
}
|
||||
vim.cmd('MasonInstall ' .. table.concat(ensure_installed, ' '))
|
||||
end, { desc = "install all lsp tools" })
|
||||
end,
|
||||
}
|
||||
70
lua/plugins/nvim-treesitter.lua
Normal file
70
lua/plugins/nvim-treesitter.lua
Normal file
@ -0,0 +1,70 @@
|
||||
|
||||
-- Treesitter Plugin
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query" },
|
||||
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<Leader>ss",
|
||||
node_incremental = "<Leader>si",
|
||||
scope_incremental = "<Leader>sc",
|
||||
node_decremental = "<Leader>sd",
|
||||
},
|
||||
},
|
||||
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
|
||||
-- Automatically jump forward to textobj, similar to targets.vim
|
||||
lookahead = true,
|
||||
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
-- You can optionally set descriptions to the mappings (used in the desc parameter of
|
||||
-- nvim_buf_set_keymap) which plugins like which-key display
|
||||
["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
|
||||
-- You can also use captures from other query groups like `locals.scm`
|
||||
["as"] = { query = "@local.scope", query_group = "locals", desc = "Select language scope" },
|
||||
},
|
||||
-- You can choose the select mode (default is charwise 'v')
|
||||
--
|
||||
-- Can also be a function which gets passed a table with the keys
|
||||
-- * query_string: eg '@function.inner'
|
||||
-- * method: eg 'v' or 'o'
|
||||
-- and should return the mode ('v', 'V', or '<c-v>') or a table
|
||||
-- mapping query_strings to modes.
|
||||
selection_modes = {
|
||||
['@parameter.outer'] = 'v', -- charwise
|
||||
['@function.outer'] = 'V', -- linewise
|
||||
['@class.outer'] = '<c-v>', -- blockwise
|
||||
},
|
||||
-- If you set this to `true` (default is `false`) then any textobject is
|
||||
-- extended to include preceding or succeeding whitespace. Succeeding
|
||||
-- whitespace has priority in order to act similarly to eg the built-in
|
||||
-- `ap`.
|
||||
--
|
||||
-- Can also be a function which gets passed a table with the keys
|
||||
-- * query_string: eg '@function.inner'
|
||||
-- * selection_mode: eg 'v'
|
||||
-- and should return true or false
|
||||
include_surrounding_whitespace = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
73
lua/utils/duplicates.lua
Normal file
73
lua/utils/duplicates.lua
Normal file
@ -0,0 +1,73 @@
|
||||
local functions = require("utils.functions")
|
||||
|
||||
local X = {}
|
||||
|
||||
local duplicates_n = {}
|
||||
local duplicates_v = {}
|
||||
local duplicates_i = {}
|
||||
local duplicates_s = {}
|
||||
local duplicates_x = {}
|
||||
|
||||
local function check_and_set_duplicates(input, description, check, table)
|
||||
if check then
|
||||
local found = table[input]
|
||||
|
||||
if found ~= nil then
|
||||
if found ~= description then
|
||||
print(input .. " already mapped (" .. found .. " so we cannot re-map (" .. description .. ")")
|
||||
end
|
||||
end
|
||||
|
||||
table[input] = description
|
||||
end
|
||||
end
|
||||
|
||||
X.check_duplicates = function(type, input, description)
|
||||
local check_n = false
|
||||
local check_v = false
|
||||
local check_i = false
|
||||
local check_s = false
|
||||
local check_x = false
|
||||
|
||||
if functions.is_table(type) then
|
||||
if type["n"] then
|
||||
check_n = true
|
||||
end
|
||||
if type["v"] then
|
||||
check_v = true
|
||||
end
|
||||
if type["i"] then
|
||||
check_i = true
|
||||
end
|
||||
if type["s"] then
|
||||
check_s = true
|
||||
end
|
||||
if type["x"] then
|
||||
check_x = true
|
||||
end
|
||||
else
|
||||
if type == "n" then
|
||||
check_n = true
|
||||
end
|
||||
if type == "v" then
|
||||
check_v = true
|
||||
end
|
||||
if type == "i" then
|
||||
check_i = true
|
||||
end
|
||||
if type == "s" then
|
||||
check_s = true
|
||||
end
|
||||
if type == "x" then
|
||||
check_x = true
|
||||
end
|
||||
end
|
||||
|
||||
check_and_set_duplicates(input, description, check_n, duplicates_n)
|
||||
check_and_set_duplicates(input, description, check_v, duplicates_v)
|
||||
check_and_set_duplicates(input, description, check_i, duplicates_i)
|
||||
check_and_set_duplicates(input, description, check_s, duplicates_s)
|
||||
check_and_set_duplicates(input, description, check_x, duplicates_x)
|
||||
end
|
||||
|
||||
return X
|
||||
126
lua/utils/functions.lua
Normal file
126
lua/utils/functions.lua
Normal file
@ -0,0 +1,126 @@
|
||||
local vim = vim
|
||||
|
||||
local X = {}
|
||||
|
||||
---@param on_attach fun(client, buffer)
|
||||
function X.on_attach(on_attach)
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local buffer = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
on_attach(client, buffer)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function X.starts_with(str, start)
|
||||
return str:sub(1, #start) == start
|
||||
end
|
||||
|
||||
function X.is_table(to_check)
|
||||
return type(to_check) == "table"
|
||||
end
|
||||
|
||||
function X.has_key(t, key)
|
||||
for t_key, _ in pairs(t) do
|
||||
if t_key == key then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function X.has_value(t, val)
|
||||
for _, value in ipairs(t) do
|
||||
if value == val then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function X.tprint(table)
|
||||
print(vim.inspect(table))
|
||||
end
|
||||
|
||||
function X.tprint_keys(table)
|
||||
for k in pairs(table) do
|
||||
print(k)
|
||||
end
|
||||
end
|
||||
|
||||
X.reload = function()
|
||||
local presentReload, reload = pcall(require, "plenary.reload")
|
||||
if presentReload then
|
||||
local counter = 0
|
||||
|
||||
for moduleName in pairs(package.loaded) do
|
||||
if X.starts_with(moduleName, "lt.") then
|
||||
reload.reload_module(moduleName)
|
||||
counter = counter + 1
|
||||
end
|
||||
end
|
||||
-- clear nvim-mapper keys
|
||||
vim.g.mapper_records = nil
|
||||
vim.notify("Reloaded " .. counter .. " modules!")
|
||||
end
|
||||
end
|
||||
|
||||
function X.is_macunix()
|
||||
return vim.fn.has("macunix")
|
||||
end
|
||||
|
||||
function X.link_highlight(from, to, override)
|
||||
local hl_exists, _ = pcall(vim.api.nvim_get_hl_by_name, from, false)
|
||||
if override or not hl_exists then
|
||||
-- vim.cmd(("highlight link %s %s"):format(from, to))
|
||||
vim.api.nvim_set_hl(0, from, { link = to })
|
||||
end
|
||||
end
|
||||
|
||||
X.highlight = function(group, opts)
|
||||
vim.api.nvim_set_hl(0, group, opts)
|
||||
end
|
||||
|
||||
X.highlight_bg = function(group, col)
|
||||
vim.api.nvim_set_hl(0, group, { bg = col })
|
||||
end
|
||||
|
||||
-- Define fg color
|
||||
-- @param group Group
|
||||
-- @param color Color
|
||||
X.highlight_fg = function(group, col)
|
||||
vim.api.nvim_set_hl(0, group, { fg = col })
|
||||
end
|
||||
|
||||
-- Define bg and fg color
|
||||
-- @param group Group
|
||||
-- @param fgcol Fg Color
|
||||
-- @param bgcol Bg Color
|
||||
X.highlight_fg_bg = function(group, fgcol, bgcol)
|
||||
vim.api.nvim_set_hl(0, group, { bg = bgcol, fg = fgcol })
|
||||
end
|
||||
|
||||
X.from_highlight = function(hl)
|
||||
local result = {}
|
||||
local list = vim.api.nvim_get_hl_by_name(hl, true)
|
||||
for k, v in pairs(list) do
|
||||
local name = k == "background" and "bg" or "fg"
|
||||
result[name] = string.format("#%06x", v)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
X.get_color_from_terminal = function(num, default)
|
||||
local key = "terminal_color_" .. num
|
||||
return vim.g[key] and vim.g[key] or default
|
||||
end
|
||||
|
||||
X.cmd = function(name, command, desc)
|
||||
vim.api.nvim_create_user_command(name, command, desc)
|
||||
end
|
||||
|
||||
X.autocmd = function(evt, opts)
|
||||
vim.api.nvim_create_autocmd(evt, opts)
|
||||
end
|
||||
return X
|
||||
109
lua/utils/icons.lua
Normal file
109
lua/utils/icons.lua
Normal file
@ -0,0 +1,109 @@
|
||||
return {
|
||||
diagnostics = {
|
||||
error = " ",
|
||||
hint = " ",
|
||||
information = " ",
|
||||
other = " ",
|
||||
warning = " ",
|
||||
},
|
||||
git = {
|
||||
Added = " ",
|
||||
Modified = " ",
|
||||
Removed = " ",
|
||||
},
|
||||
dap = {
|
||||
breakpoint = " ",
|
||||
breakpoint_condition = " ",
|
||||
log_point = " ",
|
||||
stopped = " ",
|
||||
breakpoint_rejected = " ",
|
||||
pause = " ",
|
||||
play = " ",
|
||||
step_into = " ",
|
||||
step_over = " ",
|
||||
step_out = " ",
|
||||
step_back = " ",
|
||||
run_last = " ",
|
||||
terminate = " ",
|
||||
},
|
||||
lazy = {
|
||||
cmd = " ",
|
||||
config = "",
|
||||
event = "",
|
||||
ft = " ",
|
||||
init = " ",
|
||||
import = " ",
|
||||
keys = " ",
|
||||
lazy = " ",
|
||||
loaded = "",
|
||||
not_loaded = "",
|
||||
plugin = " ",
|
||||
runtime = " ",
|
||||
source = " ",
|
||||
start = "",
|
||||
task = "✔ ",
|
||||
list = {
|
||||
"",
|
||||
"➜",
|
||||
"★",
|
||||
"‒",
|
||||
},
|
||||
},
|
||||
mason = {
|
||||
package_installed = "",
|
||||
package_pending = "",
|
||||
package_uninstalled = "",
|
||||
},
|
||||
trouble = {
|
||||
indent = {
|
||||
top = "┊ ",
|
||||
middle = "├╴",
|
||||
last = "└╴",
|
||||
fold_open = " ",
|
||||
fold_closed = " ",
|
||||
ws = " ",
|
||||
},
|
||||
folder_closed = " ",
|
||||
folder_open = " ",
|
||||
kinds = {
|
||||
Array = " ",
|
||||
Boolean = " ",
|
||||
Class = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Enum = " ",
|
||||
EnumMember = " ",
|
||||
Event = " ",
|
||||
Field = " ",
|
||||
File = " ",
|
||||
Function = " ",
|
||||
Interface = " ",
|
||||
Key = " ",
|
||||
Method = " ",
|
||||
Module = " ",
|
||||
Namespace = " ",
|
||||
Null = " ",
|
||||
Number = " ",
|
||||
Object = " ",
|
||||
Operator = " ",
|
||||
Package = " ",
|
||||
Property = " ",
|
||||
String = " ",
|
||||
Struct = " ",
|
||||
TypeParameter = " ",
|
||||
Variable = " ",
|
||||
}
|
||||
},
|
||||
borders = {
|
||||
dashed = { "┄", "┊", "┄", "┊", "╭", "╮", "╯", "╰", },
|
||||
double = { "═", "║", "═", "║", "╔", "╗", "╝", "╚", },
|
||||
single = { "─", "│", "─", "│", "╭", "╮", "╯", "╰", },
|
||||
blocks = { "▀", "▐", "▄", "▌", "▛", "▜", "▟", "▙", },
|
||||
blocky = { "▀", "▐", "▄", "▌", "▄", "▄", "▓", "▀", },
|
||||
},
|
||||
telescope = {
|
||||
prompt = { "─", "│", "─", "│", "╭", "╮", "╯", "╰", },
|
||||
results = { "─", " ", "─", "│", "╭", "─", "─", "╰", },
|
||||
preview = { "─", "│", "─", "│", "─", "╮", "╯", "╰", },
|
||||
},
|
||||
}
|
||||
44
lua/utils/remaps.lua
Normal file
44
lua/utils/remaps.lua
Normal file
@ -0,0 +1,44 @@
|
||||
local keymap = vim.keymap
|
||||
local check_duplicates = require("utils.duplicates").check_duplicates
|
||||
local X = {}
|
||||
local wk_lazy = {}
|
||||
|
||||
local function lazy_register_wk(input)
|
||||
table.insert(wk_lazy, input)
|
||||
end
|
||||
|
||||
local function add_wk(input)
|
||||
local wk_ready, wk = pcall(require, "which-key")
|
||||
if wk_ready and wk.did_setup then
|
||||
if wk_lazy ~= {} then
|
||||
lazy_register_wk(input)
|
||||
wk.add(wk_lazy)
|
||||
wk_lazy = {}
|
||||
end
|
||||
else
|
||||
lazy_register_wk(input)
|
||||
end
|
||||
end
|
||||
|
||||
function X.map(type, input, output, description, additional_options)
|
||||
local options = { remap = true, desc = description }
|
||||
if additional_options then
|
||||
options = vim.tbl_deep_extend("force", options, additional_options)
|
||||
end
|
||||
keymap.set(type, input, output, options)
|
||||
check_duplicates(type, input, description)
|
||||
end
|
||||
|
||||
function X.noremap(type, input, output, description, additional_options)
|
||||
local options = { remap = false }
|
||||
if additional_options then
|
||||
options = vim.tbl_deep_extend("force", options, additional_options)
|
||||
end
|
||||
X.map(type, input, output, description, options)
|
||||
end
|
||||
|
||||
function X.map_virtual(input)
|
||||
add_wk(input)
|
||||
end
|
||||
|
||||
return X
|
||||
Loading…
x
Reference in New Issue
Block a user