migrated even more stuff from after to plugins

This commit is contained in:
2024-04-10 10:58:10 +02:00
parent ce68ad5dfc
commit 1864867434
19 changed files with 290 additions and 250 deletions

View File

@@ -1 +0,0 @@
require("barbecue").setup()

View File

@@ -1,62 +0,0 @@
local cmp = require("cmp")
local lspkind = require("lspkind")
local border = require('409.ui').border
local cmp_select = { behavior = cmp.SelectBehavior.Select }
local winhighlight = "Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None"
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "nvim_lsp_signature_help" },
{ name = "nvim_lua" },
{ name = "luasnip", keyword_length = 2 },
{ name = "buffer", keyword_length = 3 },
},
view = {
entries = "custom",
},
completion = {
completeopt = "menuone,noselect,preview",
docs_initially_visible = true,
},
window = {
documentation = {
border = border,
winhighlight = winhighlight,
},
completion = {
border = border,
winhighlight = winhighlight,
},
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind = lspkind.cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. (strings[1] or "") .. " "
kind.menu = " (" .. (strings[2] or "") .. ")"
return kind
end,
},
mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<C-k>"] = cmp.mapping.scroll_docs(-4),
["<C-j>"] = cmp.mapping.scroll_docs(4),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-g>"] = cmp.mapping.complete(),
["<Tab>"] = nil,
["<S-Tab>"] = nil,
}),
})

View File

@@ -1,25 +1,3 @@
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
c = { "clang_format" },
cs = { "csharpier" },
javascript = { { "prettierd", "prettier" } },
rust = { "rustfmt" },
dart = { "dart_format" }
},
})
conform.setup()
conform.formatters.clang_format = {
args = { "--style", "{IndentWidth: 4, UseTab: Always, TabWidth: 4}" },
}
conform.formatters.rustfmt = {
args = { "--edition", "2021" },
}
vim.keymap.set("n", "<leader>f", function()
if not conform.format({ bufnr = vim.lsp.bufnr }) then
vim.lsp.buf.format()
end
end)

View File

@@ -1 +0,0 @@
require("flutter-tools").setup({})

3
after/plugin/lsp.lua Executable file → Normal file
View File

@@ -6,7 +6,7 @@ local lsp_default_capabilities = vim.lsp.protocol.make_client_capabilities()
local capabilities = vim.tbl_deep_extend("force", {}, lsp_default_capabilities, default_capabilities)
require("mason").setup({})
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "tsserver", "rust_analyzer" },
handlers = {
@@ -16,7 +16,6 @@ require("mason-lspconfig").setup({
})
end,
["lua_ls"] = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({
settings = {
Lua = {

View File

@@ -1,86 +1,3 @@
local theme = function()
local colors = {
darkgray = "#181825",
gray = "#cdd6f4",
innerbg = nil,
outerbg = "#313244",
normal = "#89b4fa",
insert = "#a6e3a1",
visual = "#cdd6f4",
replace = "#f38ba8",
command = "#fab387",
}
return {
inactive = {
a = { fg = colors.gray, bg = colors.outerbg, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
visual = {
a = { fg = colors.darkgray, bg = colors.visual, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
replace = {
a = { fg = colors.darkgray, bg = colors.replace, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
normal = {
a = { fg = colors.darkgray, bg = colors.normal, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
insert = {
a = { fg = colors.darkgray, bg = colors.insert, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
command = {
a = { fg = colors.darkgray, bg = colors.command, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
}
end
require('lualine').setup {
options = {
icons_enabled = true,
theme = theme(),
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = { 'packer' },
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
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 = {}
}

View File

@@ -1,2 +0,0 @@
-- local todo = require('todo-comments')
-- todo.setup()

45
after/plugin/treesitter.lua Executable file → Normal file
View File

@@ -1,47 +1,2 @@
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = {
"javascript",
"typescript",
"c",
"lua",
"vim",
"vimdoc",
"query",
"c_sharp",
"css",
"gitcommit",
"html",
"svelte",
"yaml",
"astro",
"toml",
"jsdoc",
"json",
},
tree_docs = {
enable = true,
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
disable = { "yaml" },
},
})

View File

@@ -1,6 +0,0 @@
local trouble = require('trouble')
vim.keymap.set('n', '<leader>tt', ':TodoTrouble<CR>')
vim.keymap.set('n', '<leader>tv', function ()
trouble.open()
end)

View File

@@ -1 +0,0 @@
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)

View File

@@ -59,5 +59,8 @@ return {
"folke/todo-comments.nvim",
event = "VeryLazy",
dependencies = { "nvim-lua/plenary.nvim" },
config = function ()
require("todo-comments").setup()
end
},
}

View File

@@ -1,10 +1,76 @@
return {
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
{
"hrsh7th/nvim-cmp",
dependencies = { "onsails/lspkind.nvim" },
opts = function()
local cmp = require("cmp")
local lspkind = require("lspkind")
local border = require('409.ui').border
local cmp_select = { behavior = cmp.SelectBehavior.Select }
local winhighlight = "Normal:CmpPmenu,FloatBorder:CmpPmenuBorder,CursorLine:PmenuSel,Search:None"
return {
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "path" },
{ name = "nvim_lsp_signature_help" },
{ name = "nvim_lua" },
{ name = "luasnip", keyword_length = 2 },
{ name = "buffer", keyword_length = 3 },
},
view = {
entries = "custom",
},
completion = {
completeopt = "menuone,noselect,preview",
docs_initially_visible = true,
},
window = {
documentation = {
border = border,
winhighlight = winhighlight,
},
completion = {
border = border,
winhighlight = winhighlight,
},
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind = lspkind.cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. (strings[1] or "") .. " "
kind.menu = " (" .. (strings[2] or "") .. ")"
return kind
end,
},
mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<C-k>"] = cmp.mapping.scroll_docs(-4),
["<C-j>"] = cmp.mapping.scroll_docs(4),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-g>"] = cmp.mapping.complete(),
["<Tab>"] = nil,
["<S-Tab>"] = nil,
}),
}
end
},
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip",
}

View File

@@ -2,5 +2,17 @@ return {
{
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
keys = {
{
"<leader>tt",
":TodoTrouble<CR>",
desc = "Trouble (TODOs)",
},
{
"<leader>tv",
":Trouble<CR>",
desc = "Trouble",
},
},
},
}

View File

@@ -1,9 +1,13 @@
return {
{
"akinsho/flutter-tools.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim", -- optional for vim.ui.select
},
},
{
"akinsho/flutter-tools.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim", -- optional for vim.ui.select
},
event = "VeryLazy",
config = function()
require("flutter-tools").setup({})
end,
},
}

View File

@@ -1,5 +1,35 @@
return {
{
"stevearc/conform.nvim",
opts = function()
return {
formatters_by_ft = {
lua = { "stylua" },
c = { "clang_format" },
cs = { "csharpier" },
javascript = { { "prettierd", "prettier" } },
rust = { "rustfmt" },
dart = { "dart_format" },
},
}
end,
config = function(plugin, opts)
local conform = require("conform")
conform.setup(opts)
conform.formatters.clang_format = {
args = { "--style", "{IndentWidth: 4, UseTab: Always, TabWidth: 4}" },
}
conform.formatters.rustfmt = {
args = { "--edition", "2021" },
}
vim.keymap.set("n", "<leader>f", function()
if not conform.format({ bufnr = vim.lsp.bufnr }) then
vim.lsp.buf.format()
end
end)
end,
},
}

View File

@@ -1,6 +1,6 @@
return {
"onsails/lspkind.nvim",
{ "williamboman/mason.nvim" },
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
}

View File

@@ -1,7 +1,96 @@
local lualine_theme = function()
local colors = {
darkgray = "#181825",
gray = "#cdd6f4",
innerbg = nil,
outerbg = "#313244",
normal = "#89b4fa",
insert = "#a6e3a1",
visual = "#cdd6f4",
replace = "#f38ba8",
command = "#fab387",
}
return {
inactive = {
a = { fg = colors.gray, bg = colors.outerbg, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
visual = {
a = { fg = colors.darkgray, bg = colors.visual, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
replace = {
a = { fg = colors.darkgray, bg = colors.replace, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
normal = {
a = { fg = colors.darkgray, bg = colors.normal, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
insert = {
a = { fg = colors.darkgray, bg = colors.insert, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
command = {
a = { fg = colors.darkgray, bg = colors.command, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
}
end
return {
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
options = {
icons_enabled = true,
theme = lualine_theme(),
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = { "packer" },
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
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 = {},
},
config = function(plugin, opts)
require("lualine").setup(opts)
end,
},
{
"utilyre/barbecue.nvim",
@@ -10,5 +99,8 @@ return {
"SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons", -- optional dependency
},
config = function()
require("barbecue").setup()
end,
},
}

View File

@@ -1,9 +1,58 @@
return {
{
"nvim-treesitter/nvim-treesitter",
dependencies = {
"nvim-treesitter/nvim-tree-docs",
"JoosepAlviste/nvim-ts-context-commentstring",
}
},
{
"nvim-treesitter/nvim-treesitter",
dependencies = {
"nvim-treesitter/nvim-tree-docs",
"JoosepAlviste/nvim-ts-context-commentstring",
},
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = {
"javascript",
"typescript",
"c",
"lua",
"vim",
"vimdoc",
"query",
"c_sharp",
"css",
"gitcommit",
"html",
"svelte",
"yaml",
"astro",
"toml",
"jsdoc",
"json",
},
tree_docs = {
enable = true,
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
disable = { "yaml" },
},
})
end,
},
}

View File

@@ -7,7 +7,15 @@ return {
"christoomey/vim-tmux-navigator",
lazy = false,
},
"mbbill/undotree",
{
"mbbill/undotree",
keys = {
{
"<leader>u",
":UndotreeToggle<CR>",
}
}
},
"nvim-tree/nvim-web-devicons",
{
"RRethy/vim-illuminate",