nvim config stolen from @Lukacms

This commit is contained in:
2023-11-03 11:24:41 +01:00
parent e881d7c7f5
commit 50c4761b4b
42 changed files with 1809 additions and 0 deletions

202
nvim/lua/plugins/coding.lua Normal file
View File

@@ -0,0 +1,202 @@
return {
-- {%@@ if profile != "lukac" @@%}
{ "b0o/schemastore.nvim" },
{
"neovim/nvim-lspconfig",
event = "BufReadPre",
dependencies = {
{ "weilbith/nvim-code-action-menu", cmd = "CodeActionMenu" },
"jose-elias-alvarez/null-ls.nvim",
"jose-elias-alvarez/typescript.nvim",
"simrat39/rust-tools.nvim",
"hrsh7th/cmp-nvim-lsp",
},
},
{
"j-hui/fidget.nvim",
tag = "legacy",
event = "BufReadPre",
opts = {}
},
--[[ {
"L3MON4D3/LuaSnip",
version = "<CurrentMajor>.*",
config = function()
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "~/.config/nvim/snippets/" } })
end,
keys = {
{
"<C-l>",
function()
require("luasnip").jump(1)
end,
mode = "i",
},
{
"<C-h>",
function()
require("luasnip").jump(-1)
end,
mode = "i",
},
},
}, ]]
{
"hrsh7th/vim-vsnip",
config = function()
vim.g.vsnip_snippet_dir = "~/.config/nvim/snippets"
local map = require("utils").map
local options = { expr = true, noremap = true }
map("i", "<C-l>", 'vsnip#jumpable(1) ? "<Plug>(vsnip-jump-next)" : "<C-l>"', options)
map("s", "<C-l>", 'vsnip#jumpable(1) ? "<Plug>(vsnip-jump-next)" : "<C-l>"', options)
map("s", "<C-k>", 'vsnip#jumpable(-1) ? "<Plug>(vsnip-jump-prev)" : "<C-h>"', options)
map("i", "<C-k>", 'vsnip#jumpable(-1) ? "<Plug>(vsnip-jump-prev)" : "<C-h>"', options)
end,
},
-- Autocompletion
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-path",
"hrsh7th/cmp-vsnip",
-- "L3MON4D3/LuaSnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-nvim-lsp",
"onsails/lspkind-nvim",
},
init = function(_)
local highlight = require("utils").highlight
local colors = require("highlights").colors
local cmp = require("cmp")
local lspkind = require("lspkind")
highlight("CmpItemAbbrDeprecated", { style = "strikethrough", fg = colors.grey })
highlight("CmpItemAbbrMatch", { bg = "NONE", fg = colors.picton_blue })
highlight("CmpItemAbbrMatchFuzzy", { bg = "NONE", fg = colors.picton_blue })
highlight("CmpItemKindVariable", { bg = "NONE", fg = colors.columbia_blue })
highlight("CmpItemKindInterface", { bg = "NONE", fg = colors.columbia_blue })
highlight("CmpItemKindText", { bg = "NONE", fg = colors.columbia_blue })
highlight("CmpItemKindFunction", { bg = "NONE", fg = colors.lilac })
highlight("CmpItemKindMethod", { bg = "NONE", fg = colors.lilac })
highlight("CmpItemKindKeyword", { bg = "NONE", fg = colors.light_grey })
highlight("CmpItemKindProperty", { bg = "NONE", fg = colors.light_grey })
highlight("CmpItemKindUnit", { bg = "NONE", fg = colors.light_grey })
vim.opt.completeopt = { "menuone", "noselect" }
-- Remove cmp status display
vim.opt.shortmess:append("c")
end,
opts = function()
local cmp = require("cmp")
local lspkind = require("lspkind")
-- local luasnip = require("luasnip")
return {
snippet = {
expand = function(args)
-- luasnip.lsp_expand(args.body)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
["<C-Space>"] = cmp.mapping.complete({
config = {
sources = {
{ name = "nvim_lsp" },
-- { name = "LuaSnip" },
{ name = "vsnip" },
{ name = "path" },
{ name = "buffer" },
},
},
}),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item(),
},
sources = {
{ name = "nvim_lsp" },
-- { name = "LuaSnip" },
{ name = "vsnip" },
{ name = "path" },
{ name = "buffer" },
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
maxwidth = "50",
symbol_map = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "[]",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
}),
},
}
end,
},
-- Symbol tree
{ "simrat39/symbols-outline.nvim", keys = { { "<Leader>s", "<cmd>SymbolsOutlineOpen<CR>" } }, opts = {} },
{ "JoosepAlviste/nvim-ts-context-commentstring", lazy = true },
{
"numToStr/Comment.nvim",
opts = {
ignore = "^$",
toggler = {
line = "<Space>/",
},
},
},
{
"MunifTanjim/prettier.nvim",
opts = {
single_quote = true,
print_width = 100,
jsx_single_quote = true,
bracket_same_line = true,
}
}
}

View File

@@ -0,0 +1,45 @@
return {
{
"Mofiqul/vscode.nvim",
priority = 1000,
opts = {
transparent = true,
italic_comments = true,
color_overrides = {
vscLineNumber = "#D7BA7D",
vscFoldBackground = "#202d39",
-- Syntax colors
vscGray = "#808080",
vscViolet = "#646695",
vscBlue = "#569CD6",
vscAccentBlue = "#4FC1FE",
vscDarkBlue = "#223E55",
vscMediumBlue = "#18a2fe",
vscLightBlue = "#9CDCFE",
vscGreen = "#808080",
vscBlueGreen = "#4EC9B0",
vscLightGreen = "#B5CEA8",
vscRed = "#F44747",
vscOrange = "#CE9178",
vscLightRed = "#D16969",
vscYellowOrange = "#D7BA7D",
vscYellow = "#DCDCAA",
vscDarkYellow = "#FFA602",
vscPink = "#C586C0",
},
group_overrides = {
-- this supports the same val table as vim.api.nvim_set_hl
-- use colors from this colorscheme by requiring vscode.colors!
Cursor = {
fg = "#646695",
bg = "#B5CEA8",
bold = false,
},
},
},
config = function(plugin, opts)
require("vscode").setup(opts)
require("vscode").load()
end,
},
}

View File

@@ -0,0 +1,9 @@
return {
{
"danymat/neogen",
dependencies = "nvim-treesitter/nvim-treesitter",
config = true,
-- Uncomment next line if you want to follow only stable versions
-- version = "*"
}
}

284
nvim/lua/plugins/editor.lua Normal file
View File

@@ -0,0 +1,284 @@
local utils = require("utils")
return {
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v2.x",
cmd = "Neotree",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-tree/nvim-web-devicons" },
{ "MunifTanjim/nui.nvim" },
{
"s1n7ax/nvim-window-picker",
tag = "v1.5",
opts = function()
local colors = require("highlights").colors
return {
autoselect_one = true,
include_current = true,
filter_rules = {
bo = {
filetype = { "neo-tree", "neo-tree-popup", "notify", "Trouble" },
buftype = { "terminal", "quickfix" },
},
},
fg_color = colors.picton_blue,
other_win_hl_color = colors.bordeaux,
}
end,
},
},
keys = {
{ "<C-b>", "<cmd>Neotree toggle<CR>" },
},
opts = {
close_if_last_window = false,
popup_border_style = "rounded",
enable_git_status = true,
enable_diagnostics = true,
window = {
mappings = {
["o"] = "open_with_window_picker",
},
},
default_component_configs = {
indent = {
with_markers = false,
},
name = {
use_git_status_colors = false,
},
git_status = {
symbols = {
deleted = "",
untracked = "*",
},
},
},
filesystem = {
hide_gitignored = true,
follow_current_file = true,
use_libuv_file_watcher = true,
always_show = {
".clang_format",
".clang-tidy",
},
},
},
},
-- {%@@ if profile != "lukac" @@%}
{
"nvim-telescope/telescope.nvim",
dependencies = {
{ "nvim-lua/popup.nvim" },
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
keys = {
{ "<C-p>", "<cmd>Telescope find_files<CR>" },
{ "§", "<cmd>Telescope live_grep<CR>" },
{ "<C-s>", "<cmd>Telescope lsp_document_symbols<CR>" },
{ "<C-f>", "<cmd>Telescope current_buffer_fuzzy_find<CR>" },
},
init = function()
local telescope = require("telescope")
telescope.load_extension("fzf")
end,
opts = function()
local actions = require("telescope.actions")
return {
defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.80,
height = 0.85,
preview_cutoff = 120,
},
mappings = {
i = {
["<C-k>"] = actions.move_selection_previous,
["<C-j>"] = actions.move_selection_next,
["<esc>"] = actions.close,
},
},
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
},
},
file_ignore_patterns = {
"nodes_modules/.*",
".git/.*",
"target/.*",
".yarn",
},
}
end,
},
{ "tpope/vim-fugitive" },
{
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function(_, opts)
local highlight = require("utils").highlight
local colors = require("highlights").colors
highlight("GitSignsAddNr", { bg = colors.clover, fg = "NONE" })
highlight("GitSignsChangeNr", { bg = colors.raw_umber, fg = "NONE" })
highlight("GitSignsDeleteNr", { bg = colors.bordeaux, fg = "NONE" })
require("gitsigns").setup(opts)
end,
opts = {
signs = {
add = { numhl = "GitSignsAddNr" },
change = { numhl = "GitSignsChangeNr" },
delete = { numhl = "GitSignsDeleteNr" },
topdelete = { numhl = "GitSignsDeleteNr" },
changedelete = { numhl = "GitSignsChangeNr" },
},
signcolumn = false,
numhl = true,
linehl = false,
word_diff = false,
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = true,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local buf_map = require("utils").buf_map
buf_map(bufnr, "n", "<leader>g", function()
gs.blame_line({ full = true })
end)
end,
},
},
{
"iamcco/markdown-preview.nvim",
config = function()
vim.fn["mkdp#util#install"]()
end,
},
-- { "iamcco/markdown-preview.nvim" },
{ "ellisonleao/glow.nvim", config = true, cmd = "Glow" },
{
"folke/todo-comments.nvim",
dependencies = "nvim-lua/plenary.nvim",
opts = {
signs = true,
sign_priority = 8,
keywords = {
FIX = {
icon = "",
color = "error",
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" },
},
TODO = { icon = "", color = "info" },
HACK = { icon = "", color = "warning" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "", color = "hint", alt = { "INFO" } },
},
merge_keywords = true,
highlight = {
before = "",
keyword = "wide",
after = "fg",
pattern = [[.*<(KEYWORDS)\s*]],
comments_only = true,
max_line_len = 400,
},
colors = {
error = { "LspDiagnosticsDefaultError", "ErrorMsg", "#DC2626" },
warning = { "LspDiagnosticsDefaultWarning", "WarningMsg", "#FBBF24" },
info = { "LspDiagnosticsDefaultInformation", "#2563EB" },
hint = { "LspDiagnosticsDefaultHint", "#10B981" },
default = { "Identifier", "#7C3AED" },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
pattern = [[\b(KEYWORDS)]], -- ripgrep regex
},
},
},
{
"folke/trouble.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
opts = {
use_diagnostic_signs = true,
},
},
{
"kevinhwang91/nvim-ufo",
dependencies = { "kevinhwang91/promise-async" },
init = function()
local bufnr = vim.api.nvim_get_current_buf()
require("ufo").setFoldVirtTextHandler(bufnr, utils.fold_handler)
end,
opts = {
open_fold_hl_timeout = 100,
provider_selector = function(bufnr, filetype, buftype)
return { "treesitter", "indent" }
end,
fold_virt_text_handler = utils.fold_handler,
},
},
{ "junegunn/vim-easy-align" },
{ "wesQ3/vim-windowswap" },
-- {%@@ endif @@%}
{
"ntpeters/vim-better-whitespace",
event = "BufReadPre",
keys = {
{ "<leader><Space>", "<cmd>StripWhitespace<CR>" },
},
},
}

View File

@@ -0,0 +1 @@
return {}

35
nvim/lua/plugins/misc.lua Normal file
View File

@@ -0,0 +1,35 @@
--[[ local utils = require("utils")
return {
{
"andweeb/presence.nvim",
config = function(plugin, opts)
-- The setup config table shows all available config options with their default values:
require("presence").setup({
-- General options
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
neovim_image_text = "The One True Text Editor", -- Text displayed when hovered over the Neovim image
main_image = "neovim", -- Main image display (either "neovim" or "file")
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended)
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
enable_line_number = false, -- Displays the current line number instead of the current project
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
show_time = true, -- Show the timer
-- Rich Presence text options
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
})
end,
},
} ]]
return {}

View File

@@ -0,0 +1,64 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufReadPost",
opts = {
ensure_installed = {
"bash",
"bibtex",
"c",
"cmake",
"cpp",
"css",
"dockerfile",
"elixir",
"fish",
"html",
"haskell",
"javascript",
"json",
"json5",
"latex",
"lua",
"make",
"markdown",
"mermaid",
"python",
"rust",
"typescript",
"yaml",
},
sync_install = true,
context_commentstring = {
enable = true,
},
highlight = {
enable = false,
},
playground = {
enable = true,
disable = {},
updatetime = 25,
persist_queries = false,
keybindings = {
toggle_query_editor = "o",
toggle_hl_groups = "i",
toggle_injected_languages = "t",
toggle_anonymous_nodes = "a",
toggle_language_display = "I",
focus_language = "f",
unfocus_language = "F",
update = "R",
goto_node = "<cr>",
show_help = "?",
},
},
},
config = function(plugin, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
{ "nvim-treesitter/playground" },
}

84
nvim/lua/plugins/ui.lua Normal file
View File

@@ -0,0 +1,84 @@
return {
{
"hoob3rt/lualine.nvim",
opts = function()
local colors = require("highlights").colors
local mode_highlight = function(highlight)
return {
a = { bg = highlight, fg = colors.eclipse, gui = "bold" },
b = { bg = colors.eclipse, fg = highlight },
c = { bg = colors.nero, fg = colors.light_grey },
}
end
local theme = {
normal = mode_highlight(colors.picton_blue),
insert = mode_highlight(colors.straw),
visual = mode_highlight(colors.glabe_green),
}
local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
color_error = colors.sunset_orange,
color_warn = colors.equator,
color_info = colors.mountain_meadow,
color_hint = colors.light_grey,
symbols = { error = "", warn = "", info = "", hint = "" },
}
local winbar_filename = {
"filename",
path = 1,
shorting_target = 20,
}
require("lualine").setup({
tabline = {
lualine_x = { require("tabline").tabline_tabs },
},
winbar = { lualine_c = { winbar_filename } },
inactive_winbar = { lualine_c = { winbar_filename } },
status_line = {
lualine_a = { "mode" },
lualine_b = { "branch", diagnostics },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat" },
lualine_y = { "filetype" },
lualine_z = { "location", "progress" },
},
options = {
theme = theme,
disabled_filetypes = { "packer", "neo-tree" },
ignore_focus = { "neo-tree" },
globalstatus = true,
},
extensions = {},
})
end,
dependencies = { { "nvim-tree/nvim-web-devicons" } },
},
{
"keklleo/tabline.nvim",
opts = { enable = false },
dependencies = {
{ "hoob3rt/lualine.nvim" },
{ "nvim-tree/nvim-web-devicons" },
},
},
{ "nvim-tree/nvim-web-devicons", lazy = true },
{ "norcalli/nvim-colorizer.lua", opts = { "*" } },
{ "luukvbaal/stabilize.nvim" },
{
"windwp/nvim-autopairs",
config = function(plugin, opts)
require("nvim-autopairs").setup()
end,
},
}