mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 03:14:55 +02:00
new nvim config
This commit is contained in:
parent
f087422bbf
commit
7d14948480
66 changed files with 1771 additions and 1719 deletions
163
nvim/lua/user/plugins/core/colorscheme.lua
Normal file
163
nvim/lua/user/plugins/core/colorscheme.lua
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
local options = {
|
||||
flavour = "mocha",
|
||||
transparent_background = true,
|
||||
color_overrides = {
|
||||
mocha = {
|
||||
base = "#0E1019",
|
||||
mantle = "#0D0F17",
|
||||
crust = "#0C0D14",
|
||||
surface0 = "#1a1c2d",
|
||||
surface1 = "#343959",
|
||||
surface2 = "#41476F",
|
||||
overlay0 = "#3F4256",
|
||||
overlay1 = "#5B5F7C",
|
||||
overlay2 = "#767BA0",
|
||||
text = "#eceef4",
|
||||
},
|
||||
},
|
||||
no_italic = true,
|
||||
no_bold = true,
|
||||
highlight_overrides = {
|
||||
mocha = function(colors)
|
||||
return {
|
||||
Visual = { bg = colors.overlay1 },
|
||||
|
||||
-- Floating windows
|
||||
NormalFloat = { fg = colors.text, bg = colors.crust },
|
||||
FloatTitle = { fg = colors.base, bg = colors.blue },
|
||||
FloatBorder = { fg = colors.surface1, bg = colors.crust },
|
||||
|
||||
-- Window separator
|
||||
WinSeparator = { fg = colors.surface0 },
|
||||
|
||||
-- Menus
|
||||
Pmenu = { link = "NormalFloat" },
|
||||
PmenuSel = { bg = colors.surface1 },
|
||||
PmenuSbar = { link = "Pmenu" },
|
||||
PmenuThumb = { link = "PmenuSel" },
|
||||
|
||||
-- NoiceMini = { link = "NormalFloat" },
|
||||
WhichKeyFloat = { link = "Pmenu" },
|
||||
|
||||
-- indent lines
|
||||
IblScope = { fg = colors.surface0 },
|
||||
|
||||
-- Search matches
|
||||
IncSearch = { bg = colors.yellow },
|
||||
|
||||
-- Autocomplete window
|
||||
CmpItemAbbr = { fg = colors.overlay2 },
|
||||
CmpItemKindText = { fg = colors.text },
|
||||
|
||||
-- telescope
|
||||
TelescopeNormal = { link = "NormalFloat" },
|
||||
TelescopeBorder = { link = "FloatBorder" },
|
||||
TelescopeTitle = { link = "FloatTitle" },
|
||||
TelescopePromptNormal = { bg = colors.mantle },
|
||||
TelescopePromptPrefix = { fg = colors.mauve },
|
||||
TelescopePromptBorder = { fg = colors.mantle, bg = colors.mantle },
|
||||
TelescopePreviewTitle = { fg = colors.crust, bg = colors.mauve },
|
||||
TelescopeResultsNormal = { fg = colors.overlay2, bg = colors.crust },
|
||||
TelescopeMatching = { link = "CmpItemAbbrMatch" },
|
||||
TelescopeSelection = { link = "PmenuSel" },
|
||||
TelescopeIndicatorModified = { fg = colors.yellow },
|
||||
TelescopeIndicatorReadonly = { fg = colors.red },
|
||||
TelescopeIndicatorHidden = { link = "TelescopeResultsComment" },
|
||||
|
||||
-- Statusline
|
||||
StatusLine = { fg = colors.text, bg = colors.crust },
|
||||
StatusLineNormal = { link = "StatusLine" },
|
||||
StatusLineSeparator = { fg = colors.rosewater, bg = colors.crust },
|
||||
StatusLineInsert = { fg = colors.base, bg = colors.blue },
|
||||
StatusLineVisual = { fg = colors.base, bg = colors.mauve },
|
||||
StatusLineCommand = { fg = colors.base, bg = colors.yellow },
|
||||
StatusLineReplace = { fg = colors.base, bg = colors.maroon },
|
||||
|
||||
-- Neotree
|
||||
NeoTreeTabActive = { bg = colors.surface2, fg = colors.lavender },
|
||||
NeoTreeTabInactive = { bg = colors.crust, fg = colors.surface2 },
|
||||
NeoTreeTabSeparatorActive = { fg = colors.base, bg = colors.surface2 },
|
||||
NeoTreeTabSeparatorInactive = { fg = colors.base, bg = colors.crust },
|
||||
NeoTreeFileIcon = { link = "Normal" },
|
||||
NeoTreeModified = { fg = colors.yellow },
|
||||
NeoTreeWinSeparator = { link = "WinSeparator" },
|
||||
|
||||
-- Syntax
|
||||
PreProc = { link = "Include" },
|
||||
Operator = { fg = colors.rosewater },
|
||||
Function = { link = "@text" },
|
||||
Delimiter = { link = "@text" },
|
||||
Include = { fg = colors.mauve },
|
||||
Keyword = { fg = colors.yellow },
|
||||
Repeat = { link = "Keyword" },
|
||||
Conditional = { link = "Keyword" },
|
||||
Type = { fg = colors.blue },
|
||||
String = { fg = colors.lavender },
|
||||
Exception = { link = "Keyword" },
|
||||
|
||||
-- Treesitter tokens
|
||||
["@constructor"] = { link = "Function" },
|
||||
["@variable"] = { fg = colors.green },
|
||||
["@variable.builtin"] = { link = "@variable" },
|
||||
["@variable.parameter"] = { link = "@parameter" },
|
||||
["@variable.member"] = { link = "@variable" },
|
||||
["@parameter"] = { link = "@variable" },
|
||||
["@keyword.function"] = { link = "Keyword" },
|
||||
["@keyword.return"] = { link = "Keyword" },
|
||||
["@keyword.operator"] = { link = "Keyword" },
|
||||
["@property"] = { link = "@variable" },
|
||||
["@tag"] = { link = "Keyword" },
|
||||
["@tag.delimiter"] = { link = "@text" },
|
||||
["@punctuation"] = { link = "@text" },
|
||||
["@module"] = { link = "@text" },
|
||||
["@punctuation.bracket"] = { link = "@punctuation" },
|
||||
|
||||
-- LSP
|
||||
["@lsp.type.property"] = { link = "@variable" },
|
||||
|
||||
-- Bash
|
||||
["@variable.parameter.bash"] = { fg=colors.rosewater },
|
||||
|
||||
-- Makefile
|
||||
["@function.make"] = { link = "Keyword" },
|
||||
["@string.special.symbol.make"] = { link = "@variable" },
|
||||
|
||||
-- Markup
|
||||
["@markup.raw"] = { link = "@text" },
|
||||
["@markup.strong"] = { fg = colors.blue },
|
||||
["@markup.italic"] = { fg = colors.green },
|
||||
|
||||
-- PHP
|
||||
["@keyword.import.php"] = { link = "@keyword" },
|
||||
["@class_name.php"] = { link = "@text" },
|
||||
["@extend_name.php"] = { link = "@text" },
|
||||
["@implement_name.php"] = { link = "@text" },
|
||||
["@namespace_name.php"] = { link = "@text" },
|
||||
["@namespace_alias.php"] = { link = "@text" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
integrations = {
|
||||
cmp = true,
|
||||
treesitter = true,
|
||||
neotree = true,
|
||||
-- barbar = true,
|
||||
-- noice = true,
|
||||
telescope = {
|
||||
enabled = true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = options,
|
||||
config = function(_, opts)
|
||||
require("catppuccin").setup(opts)
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end,
|
||||
}
|
||||
65
nvim/lua/user/plugins/editor.lua
Normal file
65
nvim/lua/user/plugins/editor.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
return {
|
||||
"echasnovski/mini.bufremove",
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {
|
||||
debounce = 10,
|
||||
indent = {
|
||||
char = "▏",
|
||||
},
|
||||
scope = {
|
||||
enabled = false,
|
||||
},
|
||||
exclude = {
|
||||
filetypes = {
|
||||
"help",
|
||||
"dashboard",
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("ibl").setup(opts)
|
||||
|
||||
local hooks = require("ibl.hooks")
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_tab_indent_level)
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level)
|
||||
end,
|
||||
},
|
||||
-- Snippets
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
{
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
opts = {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })
|
||||
require("luasnip").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
93
nvim/lua/user/plugins/editor/autocomplete.lua
Normal file
93
nvim/lua/user/plugins/editor/autocomplete.lua
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
version = false,
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- autocomplete from buffer
|
||||
"hrsh7th/cmp-path", -- autocomplete from filesystem
|
||||
"f3fora/cmp-spell",
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
local utils = require("user.utils.cmp")
|
||||
local format = require("user.utils.cmp_format")
|
||||
-- local lspkind = require("user.utils.lspkind")
|
||||
local icons = require("user.icons")
|
||||
|
||||
local selectPrev = utils.selectPrev({ behavior = cmp.SelectBehavior.Insert })
|
||||
local selectNext = utils.selectNext({ behavior = cmp.SelectBehavior.Insert })
|
||||
|
||||
return {
|
||||
preselect = false,
|
||||
completion = {
|
||||
completeopt = "menu,menuone,longest,popup",
|
||||
},
|
||||
view = {
|
||||
entries = { name = "custom", selection_order = "near_cursor" },
|
||||
},
|
||||
window = {
|
||||
documentation = {
|
||||
border = { "", "", "", "", "", "", "", " " },
|
||||
},
|
||||
completion = {
|
||||
scrolloff = 4,
|
||||
},
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = selectPrev,
|
||||
["<S-Tab>"] = selectPrev,
|
||||
["<Down>"] = selectNext,
|
||||
["<Tab>"] = selectNext,
|
||||
["<C-c>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = utils.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
||||
},
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- require("luasnip").lsp_expand(args.body)
|
||||
-- end,
|
||||
-- },
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = format({
|
||||
symbol_map = icons.symbols,
|
||||
widths = {
|
||||
menu = 0,
|
||||
}
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{
|
||||
name = "spell",
|
||||
keyword_length = 3,
|
||||
option = {
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function()
|
||||
return true
|
||||
end,
|
||||
preselect_correct_word = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- experimental = {
|
||||
-- ghost_text = {
|
||||
-- hl_group = "NonText",
|
||||
-- },
|
||||
-- },
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
cmp.setup(opts)
|
||||
|
||||
-- insert () on function completion using autopairs
|
||||
local has_autopair, autopair = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
if has_autopair then
|
||||
cmp.event:on("confirm_done", autopair.on_confirm_done())
|
||||
end
|
||||
end,
|
||||
}
|
||||
90
nvim/lua/user/plugins/editor/fuzzyfinder.lua
Normal file
90
nvim/lua/user/plugins/editor/fuzzyfinder.lua
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
local icons = require("user.icons")
|
||||
local path_delim = require("user.utils.path").delimiter()
|
||||
|
||||
local border = {
|
||||
prompt = { " " },
|
||||
results = { " " },
|
||||
preview = { " " },
|
||||
}
|
||||
|
||||
local dropdown_opts = {
|
||||
previewer = false,
|
||||
prompt_title = false,
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
prompt_position = "top",
|
||||
},
|
||||
borderchars = border,
|
||||
}
|
||||
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
"sharkdp/fd",
|
||||
},
|
||||
opts = function()
|
||||
local utils = require("user.utils.telescope")
|
||||
local actions = require("telescope.actions")
|
||||
return {
|
||||
defaults = {
|
||||
path_display = { truncate = 1 },
|
||||
prompt_prefix = " ",
|
||||
selection_caret = icons.current .. " ",
|
||||
multi_icon = icons.selected .. " ",
|
||||
file_ignore_patterns = {
|
||||
".git" .. path_delim,
|
||||
"node_modules" .. path_delim,
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
},
|
||||
},
|
||||
borderchars = border,
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
buffers = vim.tbl_deep_extend("force", dropdown_opts, {
|
||||
theme = "dropdown",
|
||||
mappings = {
|
||||
i = {
|
||||
["<c-d>"] = actions.delete_buffer + actions.move_to_top,
|
||||
},
|
||||
},
|
||||
sort_mru = true, -- sort by most recent used.
|
||||
entry_maker = utils.buffer_view({
|
||||
indicators = {
|
||||
modified = {
|
||||
icon = icons.file_status.modified,
|
||||
},
|
||||
readonly = {
|
||||
icon = icons.file_status.readonly,
|
||||
},
|
||||
hidden = {
|
||||
icon = icons.file_status.hidden,
|
||||
}
|
||||
}
|
||||
})
|
||||
}),
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(dropdown_opts),
|
||||
},
|
||||
}
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.setup(opts)
|
||||
for name, _ in pairs(opts.extensions or {}) do
|
||||
telescope.load_extension(name)
|
||||
end
|
||||
end,
|
||||
}
|
||||
37
nvim/lua/user/plugins/editor/gitsigns.lua
Normal file
37
nvim/lua/user/plugins/editor/gitsigns.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
local icons = require('user.icons').diff_gutter
|
||||
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>g"] = { name = "+git" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = icons.add },
|
||||
delete = { text = icons.delete },
|
||||
change = { text = icons.change },
|
||||
untracked = { text = icons.untracked },
|
||||
topdelete = { text = icons.delete },
|
||||
changedelete = { text = icons.change },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = icons.add },
|
||||
delete = { text = icons.delete },
|
||||
change = { text = icons.change },
|
||||
topdelete = { text = icons.delete },
|
||||
changedelete = { text = icons.change },
|
||||
},
|
||||
diff_opts = {
|
||||
internal = true
|
||||
}
|
||||
},
|
||||
}
|
||||
89
nvim/lua/user/plugins/editor/treesitter.lua
Normal file
89
nvim/lua/user/plugins/editor/treesitter.lua
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = function()
|
||||
require("nvim-treesitter.install").update({ with_sync = true })
|
||||
end,
|
||||
dependencies = {
|
||||
-- "nvim-treesitter/nvim-treesitter-textobjects",
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
opts = {
|
||||
-- Filetypes to enable autotag for
|
||||
filetypes = {
|
||||
'html',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'javascriptreact',
|
||||
'typescriptreact',
|
||||
'svelte',
|
||||
'vue',
|
||||
'tsx',
|
||||
'jsx',
|
||||
'rescript',
|
||||
'xml',
|
||||
'php',
|
||||
'blade',
|
||||
'markdown',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
-- A list of parser names
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"ninja",
|
||||
"cmake",
|
||||
"dockerfile",
|
||||
"make",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"query",
|
||||
"javascript",
|
||||
-- "typescript",
|
||||
"css",
|
||||
"scss",
|
||||
-- "html",
|
||||
-- "vue",
|
||||
"json",
|
||||
"jsonc",
|
||||
"yaml",
|
||||
"toml",
|
||||
"xml",
|
||||
"glsl",
|
||||
"hlsl",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"kdl",
|
||||
},
|
||||
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
|
||||
parser_config.blade = {
|
||||
install_info = {
|
||||
url = "https://github.com/EmranMR/tree-sitter-blade",
|
||||
branch = "main",
|
||||
files = { "src/parser.c" },
|
||||
generate_requires_npm = true,
|
||||
requires_generate_from_grammar = true,
|
||||
},
|
||||
filetype = "blade",
|
||||
}
|
||||
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
}
|
||||
16
nvim/lua/user/plugins/lang/bash.lua
Normal file
16
nvim/lua/user/plugins/lang/bash.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "bash" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
bashls = {}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
8
nvim/lua/user/plugins/lang/blade.lua
Normal file
8
nvim/lua/user/plugins/lang/blade.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "blade" }
|
||||
}
|
||||
},
|
||||
}
|
||||
16
nvim/lua/user/plugins/lang/clangd.lua
Normal file
16
nvim/lua/user/plugins/lang/clangd.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "c", "cpp" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
clangd = {}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
16
nvim/lua/user/plugins/lang/css.lua
Normal file
16
nvim/lua/user/plugins/lang/css.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "css", "scss" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
tailwindcss = {},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
43
nvim/lua/user/plugins/lang/go.lua
Normal file
43
nvim/lua/user/plugins/lang/go.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
local lspservers = {
|
||||
gopls = {
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedvariable = true,
|
||||
unusedwrite = true,
|
||||
useany = true,
|
||||
},
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
on_save = function()
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = { only = { "source.organizeImports" } }
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000)
|
||||
for cid, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "go", "gomod", "gowork", "gosum" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = lspservers
|
||||
},
|
||||
}
|
||||
}
|
||||
8
nvim/lua/user/plugins/lang/html.lua
Normal file
8
nvim/lua/user/plugins/lang/html.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "html" }
|
||||
}
|
||||
}
|
||||
}
|
||||
33
nvim/lua/user/plugins/lang/lua.lua
Normal file
33
nvim/lua/user/plugins/lang/lua.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
local lspservers = {
|
||||
lua_ls = {
|
||||
cmd = { "/opt/luals/bin/lua-language-server", "--logpath=~/.local/luals/logs" },
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "lua" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = lspservers
|
||||
}
|
||||
}
|
||||
}
|
||||
25
nvim/lua/user/plugins/lang/php.lua
Normal file
25
nvim/lua/user/plugins/lang/php.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
local lspservers = {
|
||||
phpactor = {
|
||||
settings = {
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "php", "phpdoc" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = lspservers
|
||||
},
|
||||
}
|
||||
}
|
||||
37
nvim/lua/user/plugins/lang/rust.lua
Normal file
37
nvim/lua/user/plugins/lang/rust.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
local lspservers = {
|
||||
rust_analyzer = {
|
||||
-- settings = {
|
||||
-- ["rust-analyzer"] = {
|
||||
-- imports = {
|
||||
-- granularity = {
|
||||
-- group = "module",
|
||||
-- },
|
||||
-- prefix = "self",
|
||||
-- },
|
||||
-- cargo = {
|
||||
-- buildScripts = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
-- },
|
||||
-- procMacro = {
|
||||
-- enable = true
|
||||
-- },
|
||||
-- }
|
||||
-- }
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "rust", "toml" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = lspservers
|
||||
},
|
||||
}
|
||||
}
|
||||
24
nvim/lua/user/plugins/lang/typescript.lua
Normal file
24
nvim/lua/user/plugins/lang/typescript.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
local lspservers = {
|
||||
tsserver = {
|
||||
settings = {
|
||||
-- tsserver_plugins = {
|
||||
-- "@vue/typescript-plugin",
|
||||
-- },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "typescript" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = lspservers
|
||||
},
|
||||
}
|
||||
}
|
||||
36
nvim/lua/user/plugins/lang/vue.lua
Normal file
36
nvim/lua/user/plugins/lang/vue.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
local lspservers = {
|
||||
volar = {
|
||||
init_options = {
|
||||
vue = {
|
||||
hybridMode = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
tsserver = {
|
||||
settings = {
|
||||
tsserver_plugins = {
|
||||
"@vue/typescript-plugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
-- Vue needs typescript
|
||||
{ import = "user.plugins.lang.typescript" },
|
||||
-- And most likely css/scss aswell.
|
||||
{ import = "user.plugins.lang.css" },
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = { "vue" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = lspservers
|
||||
},
|
||||
}
|
||||
}
|
||||
53
nvim/lua/user/plugins/lsp.lua
Normal file
53
nvim/lua/user/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{
|
||||
-- Autocomplete source
|
||||
"hrsh7th/nvim-cmp",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help"
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
document_highlight = {
|
||||
enabled = true,
|
||||
},
|
||||
codelens = {
|
||||
enabled = false,
|
||||
},
|
||||
inlay_hints = {
|
||||
enabled = false,
|
||||
exclude = {},
|
||||
},
|
||||
servers = {},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local lspconfig = require("lspconfig")
|
||||
local augroup = vim.api.nvim_create_augroup("Lsp", {})
|
||||
|
||||
for name, server_opts in pairs(opts.servers) do
|
||||
|
||||
local on_attach = function(_, bufnr)
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
|
||||
-- Setup on save handler
|
||||
if server_opts.on_save then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = server_opts.on_save,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
server_opts = vim.tbl_deep_extend("force", {
|
||||
on_attach = on_attach
|
||||
}, server_opts or {})
|
||||
|
||||
lspconfig[name].setup(server_opts)
|
||||
end
|
||||
end,
|
||||
}
|
||||
104
nvim/lua/user/plugins/ui.lua
Normal file
104
nvim/lua/user/plugins/ui.lua
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
local icons = require("user.icons")
|
||||
|
||||
return {
|
||||
-- File explorer
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
opts = {
|
||||
-- hide_root_node = true,
|
||||
popup_border_style = 'solid',
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
with_markers = false,
|
||||
indent_marker = icons.tree.node,
|
||||
last_indent_marker = icons.tree.nodelast,
|
||||
indent_size = 2,
|
||||
},
|
||||
icon = {
|
||||
folder_closed = icons.folder.closed,
|
||||
folder_open = icons.folder.open,
|
||||
folder_empty = icons.folder.empty,
|
||||
folder_empty_open = icons.folder.empty_open,
|
||||
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||
-- then these will never be used.
|
||||
default = icons.files.default,
|
||||
},
|
||||
modified = {
|
||||
symbol = icons.modified,
|
||||
},
|
||||
name = {
|
||||
highlight_opened_files = true,
|
||||
},
|
||||
git_status = {
|
||||
symbols = icons.gitsigns,
|
||||
align = "right",
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
"filesystem",
|
||||
"buffers",
|
||||
"git_status",
|
||||
"document_symbols",
|
||||
},
|
||||
source_selector = {
|
||||
winbar = true, -- toggle to show selector on winbar
|
||||
show_scrolled_off_parent_node = false, -- boolean
|
||||
sources = { -- table
|
||||
{
|
||||
source = "filesystem", -- string
|
||||
display_name = " Files " -- string | nil
|
||||
},
|
||||
{
|
||||
source = "buffers", -- string
|
||||
display_name = " Buffers " -- string | nil
|
||||
},
|
||||
{
|
||||
source = "git_status", -- string
|
||||
display_name = " Git " -- string | nil
|
||||
},
|
||||
{
|
||||
source = "document_symbols", -- string
|
||||
display_name = " Docments " -- string | nil
|
||||
},
|
||||
},
|
||||
content_layout = "center",
|
||||
separator = { left = "", right= "", override = "active" },
|
||||
-- show_separator_on_edge = true,
|
||||
},
|
||||
window = {
|
||||
popup = {
|
||||
size = {
|
||||
height = "100%",
|
||||
width = "100%",
|
||||
},
|
||||
position = "50%",
|
||||
relative = "editor",
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
},
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
event_handlers = {
|
||||
{
|
||||
event = "neo_tree_buffer_enter",
|
||||
handler = function ()
|
||||
vim.opt_local.statuscolumn = ''
|
||||
end
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
}
|
||||
}
|
||||
133
nvim/lua/user/plugins/ui/statusline.lua
Normal file
133
nvim/lua/user/plugins/ui/statusline.lua
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
local icons = require("user.icons")
|
||||
|
||||
local function indent_settings()
|
||||
return (vim.bo.expandtab and "SPC" or "TAB")
|
||||
.. " "
|
||||
.. (vim.bo.shiftwidth == 0 and vim.bo.tabstop or vim.bo.shiftwidth)
|
||||
end
|
||||
|
||||
local function lsp_info()
|
||||
local num_clients = tostring(#vim.tbl_keys(vim.lsp.buf_get_clients()))
|
||||
return " " .. num_clients
|
||||
end
|
||||
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"arkav/lualine-lsp-progress",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
globalstatus = true,
|
||||
component_separators = "",
|
||||
-- section_separators = { "'" .. icons.separator .. "'", color = "StatusLineSeparator" },
|
||||
section_separators = "",
|
||||
disabled_filetypes = {
|
||||
statusline = {
|
||||
"dashboard",
|
||||
},
|
||||
winbar = {
|
||||
"neo-tree",
|
||||
}
|
||||
},
|
||||
theme = {
|
||||
normal = {
|
||||
a = "StatusLineNormal",
|
||||
b = "StatusLine",
|
||||
c = "StatusLine",
|
||||
x = "StatusLine",
|
||||
y = "StatusLine",
|
||||
z = "StatusLine",
|
||||
},
|
||||
command = {
|
||||
a = "StatusLineCommand",
|
||||
z = "StatusLine",
|
||||
},
|
||||
insert = {
|
||||
a = "StatusLineInsert",
|
||||
z = "StatusLine",
|
||||
},
|
||||
visual = {
|
||||
a = "StatusLineVisual",
|
||||
z = "StatusLine",
|
||||
},
|
||||
replace = {
|
||||
a = "StatusLineReplace",
|
||||
z = "StatusLine",
|
||||
},
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{
|
||||
"mode",
|
||||
separator = "|"
|
||||
},
|
||||
},
|
||||
lualine_b = {
|
||||
"branch",
|
||||
-- '" " .. tostring(#vim.tbl_keys(vim.lsp.buf_get_clients()))',
|
||||
lsp_info,
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = {
|
||||
error = icons.diagnostics.error .. " ",
|
||||
warn = icons.diagnostics.warn .. " ",
|
||||
info = icons.diagnostics.info .. " ",
|
||||
hint = icons.diagnostics.hint .. " ",
|
||||
},
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
added = icons.diff.added .. " ",
|
||||
modified = icons.diff.modified .. " ",
|
||||
removed = icons.diff.removed .. " ",
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
"filename",
|
||||
path = 1,
|
||||
symbols = vim.tbl_deep_extend("force", icons.file_status, {
|
||||
unnamed = "",
|
||||
})
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
"filetype",
|
||||
"fileformat",
|
||||
-- '(vim.bo.expandtab and "SPC" or "TAB") .. " " .. (vim.bo.shiftwidth == 0 and vim.bo.tabstop or vim.bo.shiftwidth)',
|
||||
indent_settings,
|
||||
},
|
||||
lualine_y = {
|
||||
"location",
|
||||
"progress",
|
||||
},
|
||||
lualine_z = {},
|
||||
},
|
||||
winbar = {
|
||||
lualine_c = {
|
||||
{ "filetype", icon_only = true },
|
||||
"filename",
|
||||
},
|
||||
},
|
||||
inactive_winbar = {
|
||||
lualine_c = {
|
||||
{ "filetype", icon_only = true },
|
||||
"filename",
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
"lazy",
|
||||
"neo-tree",
|
||||
},
|
||||
},
|
||||
init = function ()
|
||||
-- disable mode in the command line, as its already shown in lualine
|
||||
vim.o.showmode = false
|
||||
end
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue