From 89b4343ca19395173def6f2ab27793f0a14f64c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Kmie=C4=87?= Date: Thu, 17 Aug 2023 23:43:39 +0200 Subject: [PATCH] Nvim: add missing files for various plugins --- .config/nvim/lua/plugins/block.lua | 6 + .../nvim/lua/plugins/edit-markdown-table.lua | 6 + .config/nvim/lua/plugins/lspconfig.lua | 161 +++++++++--------- .config/nvim/lua/plugins/markdown.lua | 5 + .config/nvim/lua/plugins/mini.lua | 19 +++ .config/nvim/lua/plugins/nvim-tree.lua | 25 ++- .config/nvim/lua/plugins/peek.lua | 1 + .config/nvim/lua/plugins/perfanno.lua | 91 ++++++++++ .config/nvim/lua/plugins/screenshot.lua | 30 ++++ .config/nvim/lua/plugins/transparent.lua | 16 ++ 10 files changed, 274 insertions(+), 86 deletions(-) create mode 100644 .config/nvim/lua/plugins/block.lua create mode 100644 .config/nvim/lua/plugins/edit-markdown-table.lua create mode 100644 .config/nvim/lua/plugins/markdown.lua create mode 100644 .config/nvim/lua/plugins/mini.lua create mode 100644 .config/nvim/lua/plugins/perfanno.lua create mode 100644 .config/nvim/lua/plugins/screenshot.lua create mode 100644 .config/nvim/lua/plugins/transparent.lua diff --git a/.config/nvim/lua/plugins/block.lua b/.config/nvim/lua/plugins/block.lua new file mode 100644 index 0000000..0d61676 --- /dev/null +++ b/.config/nvim/lua/plugins/block.lua @@ -0,0 +1,6 @@ +return { + "HampusHauffman/block.nvim", + config = function() + require("block").setup({}) + end +} diff --git a/.config/nvim/lua/plugins/edit-markdown-table.lua b/.config/nvim/lua/plugins/edit-markdown-table.lua new file mode 100644 index 0000000..bed3dbe --- /dev/null +++ b/.config/nvim/lua/plugins/edit-markdown-table.lua @@ -0,0 +1,6 @@ +return { + 'kiran94/edit-markdown-table.nvim', + config = true, + dependencies = { "nvim-treesitter/nvim-treesitter" }, + cmd = "EditMarkdownTable", +} diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua index 04da9b1..0174826 100644 --- a/.config/nvim/lua/plugins/lspconfig.lua +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -8,7 +8,87 @@ return { }, config = function() local nvim_lsp = require('lspconfig') - local clangd_extensions = require('clangd_extensions') + local clangd_extensions = require('clangd_extensions').setup({ + inlay_hints = { + inline = false, + -- Options other than `highlight' and `priority' only work + -- if `inline' is disabled + -- Only show inlay hints for the current line + only_current_line = true, + -- Event which triggers a refresh of the inlay hints. + -- You can make this { "CursorMoved" } or { "CursorMoved,CursorMovedI" } but + -- not that this may cause higher CPU usage. + -- This option is only respected when only_current_line and + -- autoSetHints both are true. + only_current_line_autocmd = { "CursorHold" }, + -- whether to show parameter hints with the inlay hints or not + show_parameter_hints = true, + -- prefix for parameter hints + parameter_hints_prefix = "←", + -- prefix for all the other hints (type, chaining) + other_hints_prefix = "→", + -- whether to align to the length of the longest line in the file + max_len_align = false, + -- padding from the left if max_len_align is true + max_len_align_padding = 1, + -- whether to align to the extreme right or not + right_align = false, + -- padding from the right if right_align is true + right_align_padding = 7, + -- The color of the hints + highlight = "Comment", + -- The highlight group priority for extmark + priority = 100, + }, + ast = { + -- These are unicode, should be available in any font + role_icons = { + type = "🄣", + declaration = "🄓", + expression = "🄔", + statement = ";", + specifier = "🄱", + ["template argument"] = "🆃", + }, + kind_icons = { + Compound = "đŸ„Č", + Recovery = "🅁", + TranslationUnit = "🅄", + PackExpansion = "🄿", + TemplateTypeParm = "🅃", + TemplateTemplateParm = "🅃", + TemplateParamObject = "🅃", + }, + --[[ These require codicons (https://github.com/microsoft/vscode-codicons) + role_icons = { + type = "î­Ł", + declaration = "îȘŒ", + expression = "", + specifier = "", + statement = "îȘ†", + ["template argument"] = "îȘ’", + }, + + kind_icons = { + Compound = "îȘ‹", + Recovery = "îȘ‡", + TranslationUnit = "î«©", + PackExpansion = "", + TemplateTypeParm = "îȘ’", + TemplateTemplateParm = "îȘ’", + TemplateParamObject = "îȘ’", + }, ]] + highlights = { + detail = "Comment", + }, + memory_usage = { + border = "none", + }, + symbol_info = { + border = "none", + } + } + }) local lsp_signature = require('lsp_signature') -- Mappings. @@ -114,85 +194,6 @@ return { nvim_lsp.clangd.setup({ settings = { - inlay_hints = { - inline = vim.fn.has("nvim-0.10") == 1, - -- Options other than `highlight' and `priority' only work - -- if `inline' is disabled - -- Only show inlay hints for the current line - only_current_line = false, - -- Event which triggers a refresh of the inlay hints. - -- You can make this { "CursorMoved" } or { "CursorMoved,CursorMovedI" } but - -- not that this may cause higher CPU usage. - -- This option is only respected when only_current_line and - -- autoSetHints both are true. - only_current_line_autocmd = { "CursorHold" }, - -- whether to show parameter hints with the inlay hints or not - show_parameter_hints = true, - -- prefix for parameter hints - parameter_hints_prefix = "<- ", - -- prefix for all the other hints (type, chaining) - other_hints_prefix = "=> ", - -- whether to align to the length of the longest line in the file - max_len_align = false, - -- padding from the left if max_len_align is true - max_len_align_padding = 1, - -- whether to align to the extreme right or not - right_align = false, - -- padding from the right if right_align is true - right_align_padding = 7, - -- The color of the hints - highlight = "Comment", - -- The highlight group priority for extmark - priority = 100, - }, - ast = { - -- These are unicode, should be available in any font - role_icons = { - type = "🄣", - declaration = "🄓", - expression = "🄔", - statement = ";", - specifier = "🄱", - ["template argument"] = "🆃", - }, - kind_icons = { - Compound = "đŸ„Č", - Recovery = "🅁", - TranslationUnit = "🅄", - PackExpansion = "🄿", - TemplateTypeParm = "🅃", - TemplateTemplateParm = "🅃", - TemplateParamObject = "🅃", - }, - --[[ These require codicons (https://github.com/microsoft/vscode-codicons) - role_icons = { - type = "î­Ł", - declaration = "îȘŒ", - expression = "", - specifier = "", - statement = "îȘ†", - ["template argument"] = "îȘ’", - }, - - kind_icons = { - Compound = "îȘ‹", - Recovery = "îȘ‡", - TranslationUnit = "î«©", - PackExpansion = "", - TemplateTypeParm = "îȘ’", - TemplateTemplateParm = "îȘ’", - TemplateParamObject = "îȘ’", - }, ]] - highlights = { - detail = "Comment", - }, - memory_usage = { - border = "none", - }, - symbol_info = { - border = "none", - } - } }, on_attach = on_attach, --on_publish_diagnostics = diagnostic_handler, diff --git a/.config/nvim/lua/plugins/markdown.lua b/.config/nvim/lua/plugins/markdown.lua new file mode 100644 index 0000000..a1c2124 --- /dev/null +++ b/.config/nvim/lua/plugins/markdown.lua @@ -0,0 +1,5 @@ +return { + 'richardbizik/nvim-toc', + ft = { "md", "markdown" }, + config = true, +} diff --git a/.config/nvim/lua/plugins/mini.lua b/.config/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..322d231 --- /dev/null +++ b/.config/nvim/lua/plugins/mini.lua @@ -0,0 +1,19 @@ +return { + "echasnovski/mini.nvim", + version = false, + config = function() + local hipatterns = require('mini.hipatterns') + hipatterns.setup({ + highlighters = { + -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' + fixme = { pattern = '%f[%w]()EFMC 0()%f[%W]', group = 'MiniHipatternsFixme' }, + hack = { pattern = '%f[%w]()Vehicle 0()%f[%W]', group = 'MiniHipatternsHack' }, + todo = { pattern = '%f[%w]()CoCo 0()%f[%W]', group = 'MiniHipatternsTodo' }, + note = { pattern = '%f[%w]()EneM 0()%f[%W]', group = 'MiniHipatternsNote' }, + + -- Highlight hex color strings (`#rrggbb`) using that color + hex_color = hipatterns.gen_highlighter.hex_color(), + }, + }) + end +} diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua index e1f0c07..0ae029a 100644 --- a/.config/nvim/lua/plugins/nvim-tree.lua +++ b/.config/nvim/lua/plugins/nvim-tree.lua @@ -51,15 +51,28 @@ return { timeout = 500, }, view = { + centralize_selection = false, + cursorline = true, + debounce_delay = 15, width = 35, - side = 'left', - mappings = { - custom_only = false, - list = {} - }, + hide_root_folder = false, + side = "left", + preserve_window_proportions = false, number = false, relativenumber = false, - signcolumn = "no" + signcolumn = "no", + float = { + enable = false, + quit_on_focus_loss = true, + open_win_config = { + relative = "editor", + border = "rounded", + width = 30, + height = 30, + row = 1, + col = 1, + }, + }, }, trash = { cmd = "trash", diff --git a/.config/nvim/lua/plugins/peek.lua b/.config/nvim/lua/plugins/peek.lua index 638b4f5..621c148 100644 --- a/.config/nvim/lua/plugins/peek.lua +++ b/.config/nvim/lua/plugins/peek.lua @@ -1,6 +1,7 @@ return { 'toppair/peek.nvim', build = 'deno task --quiet build:fast', + ft = { "markdown", "md" }, config = function() -- default config: require('peek').setup({ diff --git a/.config/nvim/lua/plugins/perfanno.lua b/.config/nvim/lua/plugins/perfanno.lua new file mode 100644 index 0000000..aabd6f3 --- /dev/null +++ b/.config/nvim/lua/plugins/perfanno.lua @@ -0,0 +1,91 @@ +return { + "t-troebst/perfanno.nvim", + ft = { "cpp", "c" }, + config = function() + require("perfanno").setup { + -- List of highlights that will be used to highlight hot lines (or nil to disable highlighting) + line_highlights = nil, + -- Highlight used for virtual text annotations (or nil to disable virtual text) + vt_highlight = nil, + + -- Annotation formats that can be cycled between via :PerfCycleFormat + -- "percent" controls whether percentages or absolute counts should be displayed + -- "format" is the format string that will be used to display counts / percentages + -- "minimum" is the minimum value below which lines will not be annotated + -- Note: this also controls what shows up in the telescope finders + formats = { + {percent = true, format = "%.2f%%", minimum = 0.5}, + {percent = false, format = "%d", minimum = 1} + }, + + -- Automatically annotate files after :PerfLoadFlat and :PerfLoadCallGraph + annotate_after_load = true, + -- Automatically annotate newly opened buffers if information is available + annotate_on_open = true, + + -- Options for telescope-based hottest line finders + telescope = { + -- Enable if possible, otherwise the plugin will fall back to vim.ui.select + enabled = pcall(require, "telescope"), + -- Annotate inside of the preview window + annotate = true, + }, + + -- Node type patterns used to find the function that surrounds the cursor + ts_function_patterns = { + -- These should work for most languages (at least those used with perf) + default = { + "function", + "method", + }, + -- Otherwise you can add patterns for specific languages like: + -- weirdlang = { + -- "weirdfunc", + -- } + } + } + + local telescope = require("telescope") + local actions = telescope.extensions.perfanno.actions + telescope.setup { + extensions = { + perfanno = { + -- Special mappings in the telescope finders + mappings = { + ["i"] = { + -- Find hottest callers of selected entry + [""] = actions.hottest_callers, + -- Find hottest callees of selected entry + [""] = actions.hottest_callees, + }, + + ["n"] = { + ["gu"] = actions.hottest_callers, + ["gd"] = actions.hottest_callees, + } + } + } + } + + } + local keymap = vim.api.nvim_set_keymap + local opts = {noremap = true, silent = true} + + keymap("n", "plf", ":PerfLoadFlat", opts) + keymap("n", "plg", ":PerfLoadCallGraph", opts) + keymap("n", "plo", ":PerfLoadFlameGraph", opts) + + keymap("n", "pe", ":PerfPickEvent", opts) + + keymap("n", "pa", ":PerfAnnotate", opts) + keymap("n", "pf", ":PerfAnnotateFunction", opts) + keymap("v", "pa", ":PerfAnnotateSelection", opts) + + keymap("n", "pt", ":PerfToggleAnnotations", opts) + + keymap("n", "ph", ":PerfHottestLines", opts) + keymap("n", "ps", ":PerfHottestSymbols", opts) + keymap("n", "pc", ":PerfHottestCallersFunction", opts) + keymap("v", "pc", ":PerfHottestCallersSelection", opts) + end +} diff --git a/.config/nvim/lua/plugins/screenshot.lua b/.config/nvim/lua/plugins/screenshot.lua new file mode 100644 index 0000000..cf34e2c --- /dev/null +++ b/.config/nvim/lua/plugins/screenshot.lua @@ -0,0 +1,30 @@ +return { + "TobinPalmer/rayso.nvim", + cmd = { 'Rayso' }, + config = function() + require('rayso').setup{ + base_url = 'https://ray.so/', -- Default URL + open_cmd = 'firefox', -- On MacOS, will open with open -a firefox.app. Other OS's are untested. + options = { + background = true, -- If the screenshot should have a background. + dark_mode = true, -- If the screenshot should be in dark mode. + logging_path = '', -- Path to create a log file in. + logging_file = 'rayso', -- Name of log file, will be a markdown file, ex rayso.md. + logging_enabled = false, -- If you enable the logging file. + padding = 32, -- The default padding that the screenshot will have. + theme = 'crimson', -- Theme + title = 'Untitled', -- Default title + } + } + end +} + +--"narutoxy/silicon.lua", +-- {'krivahtoo/silicon.nvim', build = './install.sh', +-- config = function() +-- require('silicon').setup({ +-- font = 'DaddyTimeMono Nerd Font=16', +-- theme = 'Monokai Extended', +-- }) +-- end +-- }, diff --git a/.config/nvim/lua/plugins/transparent.lua b/.config/nvim/lua/plugins/transparent.lua new file mode 100644 index 0000000..58ceccc --- /dev/null +++ b/.config/nvim/lua/plugins/transparent.lua @@ -0,0 +1,16 @@ +return { + "xiyaowong/transparent.nvim", + config = function() + require("transparent").setup({ + groups = { -- table: default groups + 'Normal', 'NormalNC', 'Comment', 'Constant', 'Special', 'Identifier', + 'Statement', 'PreProc', 'Type', 'Underlined', 'Todo', 'String', 'Function', + 'Conditional', 'Repeat', 'Operator', 'Structure', 'LineNr', 'NonText', + 'SignColumn', 'CursorLineNr', 'EndOfBuffer', + }, + extra_groups = {}, -- table: additional groups that should be cleared + exclude_groups = {}, -- table: groups you don't want to clear + }) + end, + cmd = {"TransparentEnable", "TransparentDisable", "TransparentToggle" }, +}