From 77ea86bc30d9a030af2a385feda2bb9926151f1d Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Thu, 11 May 2023 17:31:02 +0300 Subject: [PATCH] add legendary.nvim descriptions to most common bindings --- after/plugin/lspsignature-theme.lua | 8 +++++ lua/config/baleia.lua | 4 +++ lua/config/based.lua | 6 ++++ lua/config/devicons.lua | 4 +-- lua/config/diffview.lua | 9 ++++++ lua/config/dressing.lua | 3 +- lua/config/fugitive.lua | 5 ++- lua/config/gitblame.lua | 17 +++++++--- lua/config/gitsigns.lua | 49 +++++++++++++++-------------- lua/config/leap.lua | 8 +++-- lua/config/legendary.lua | 7 ++--- lua/config/lspconfig.lua | 28 +++++++++++------ lua/config/lspsignature.lua | 13 ++++++-- lua/config/luapad.lua | 5 +++ lua/config/move.lua | 14 +++------ lua/config/nvim-tree.lua | 6 ++-- lua/config/quickscope.lua | 7 ++--- lua/config/refactoring.lua | 39 ----------------------- lua/config/reload.lua | 6 ---- lua/config/sneak.lua | 23 -------------- lua/config/telescope.lua | 41 ++++++++++++++---------- lua/config/tidy.lua | 4 +-- lua/config/todo-comments.lua | 4 +++ lua/config/toggleterm.lua | 4 ++- lua/config/trouble.lua | 10 +++--- lua/config/vimspector.lua | 2 -- lua/options.lua | 9 ++++++ lua/plugins.lua | 4 +-- 28 files changed, 174 insertions(+), 165 deletions(-) create mode 100644 after/plugin/lspsignature-theme.lua create mode 100644 lua/config/diffview.lua delete mode 100644 lua/config/refactoring.lua delete mode 100644 lua/config/reload.lua delete mode 100644 lua/config/sneak.lua delete mode 100644 lua/config/vimspector.lua diff --git a/after/plugin/lspsignature-theme.lua b/after/plugin/lspsignature-theme.lua new file mode 100644 index 0000000..0438b36 --- /dev/null +++ b/after/plugin/lspsignature-theme.lua @@ -0,0 +1,8 @@ +if vim.g.colors_name == "srcery" then + local hard_black = vim.api.nvim_get_hl_by_name("SrceryHardBlack", true).foreground + local bright_white = vim.api.nvim_get_hl_by_name("SrceryBrightWhite", true).foreground + + vim.api.nvim_set_hl(0, "FloatBorder", {bg=hard_black, fg=bright_white}) + vim.api.nvim_set_hl(0, "FloatNormal", {bg=hard_black, fg=bright_white}) + vim.api.nvim_set_hl(0, "Pmenu", {bg=hard_black, fg=bright_white}) +end diff --git a/lua/config/baleia.lua b/lua/config/baleia.lua index 6237409..bd70bff 100644 --- a/lua/config/baleia.lua +++ b/lua/config/baleia.lua @@ -6,5 +6,9 @@ return { vim.api.nvim_create_user_command("BaleiaColorize", function() baleia.once(vim.api.nvim_get_current_buf()) end, { }) + + require("legendary").command{ + ":BaleiaColorize", description = "Colorize ANSI codes" + } end } diff --git a/lua/config/based.lua b/lua/config/based.lua index 2bda153..5cffb22 100644 --- a/lua/config/based.lua +++ b/lua/config/based.lua @@ -5,5 +5,11 @@ return { based.setup{} vim.keymap.set({"n", "v"}, "", based.convert) + + require("legendary").keymap{ + "", + { n = based.convert, v = based.convert }, + description = "Convert number to other base" + } end } diff --git a/lua/config/devicons.lua b/lua/config/devicons.lua index 7e72d6a..aebc460 100644 --- a/lua/config/devicons.lua +++ b/lua/config/devicons.lua @@ -1,6 +1,4 @@ return { 'kyazdani42/nvim-web-devicons', - config = function() - require('nvim-web-devicons').setup() - end + config = function() require('nvim-web-devicons').setup() end } diff --git a/lua/config/diffview.lua b/lua/config/diffview.lua new file mode 100644 index 0000000..c1a0435 --- /dev/null +++ b/lua/config/diffview.lua @@ -0,0 +1,9 @@ +return { + "sindrets/diffview.nvim", + requires = 'nvim-lua/plenary.nvim', + config = function() + require("legendary").command{ + ":DiffviewOpen", description = "Open diff view" + } + end +} diff --git a/lua/config/dressing.lua b/lua/config/dressing.lua index 204af5a..2c88375 100644 --- a/lua/config/dressing.lua +++ b/lua/config/dressing.lua @@ -1,5 +1,6 @@ return { - 'stevearc/dressing.nvim', + "stevearc/dressing.nvim", + requires = "nvim-telescope/telescope.nvim", config = function() require('dressing').setup({ select = { diff --git a/lua/config/fugitive.lua b/lua/config/fugitive.lua index f671521..54e3136 100644 --- a/lua/config/fugitive.lua +++ b/lua/config/fugitive.lua @@ -1,6 +1,9 @@ return { 'tpope/vim-fugitive', config = function () - vim.keymap.set('n', 'gg', ':G', { silent = true }) + -- TODO: Add most commonly used fugitive bindings + require("legendary").keymaps{ + {"gg", ":G", description = "Open fugitive", opts = {silent = true}} + } end } diff --git a/lua/config/gitblame.lua b/lua/config/gitblame.lua index 4d4dc73..4fe7786 100644 --- a/lua/config/gitblame.lua +++ b/lua/config/gitblame.lua @@ -1,13 +1,22 @@ return { 'f-person/git-blame.nvim', config = function () - local map = require 'utils.map' local silent = {silent = true} - map('n', 'gm', ":GitBlameCopySHA", silent) - map('n', 'gj', ":GitBlameOpenCommitURL", silent) - map('n', 'gu', ":GitBlameToggle", silent) + require("legendary").keymaps{ + { + itemgroup = "gitblame", + description = "Git blame", + icon = "", + keymaps = { + {"gm", ":GitBlameCopySHA", description = "Copy commit hash", opts = silent}, + {"gj", ":GitBlameOpenCommit", description = "Open commit", opts = silent}, + {"gu", ":GitBlameToggle", description = "Toggle git blame", opts = silent}, + } + } + } vim.g["gitblame_enabled"] = 0 + vim.g["gitblame_date_format"] = "%r" end } diff --git a/lua/config/gitsigns.lua b/lua/config/gitsigns.lua index e28a922..7f84daf 100644 --- a/lua/config/gitsigns.lua +++ b/lua/config/gitsigns.lua @@ -6,33 +6,36 @@ return { gitsigns.setup{ on_attach = function(bufnr) - local function map(mode, lhs, rhs, opts) - opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {}) - vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) + local function keymap_n(key, command, description, opts) + opts = vim.tbl_extend('force', {noremap = true, silent = true, buffer=bufnr}, opts or {}) + return {key, command, description=description, opts=opts} + end + local function keymap_vn(key, command, description, opts) + opts = vim.tbl_extend('force', {noremap = true, silent = true, buffer=bufnr}, opts or {}) + return {key, command, mode={"v", "n"}, description=description, opts=opts} end - -- Navigation - map('n', ']c', "&diff ? ']c' : 'Gitsigns next_hunk'", {expr=true}) - map('n', '[c', "&diff ? '[c' : 'Gitsigns prev_hunk'", {expr=true}) + require("legendary").keymaps{ + { + itemgroup = "githunks", + description = "Git hunks", + icon = "", + keymaps = { + keymap_n(']c', "&diff ? ']c' : 'Gitsigns next_hunk'", "Jump to next hunk", {expr=true}), + keymap_n('[c', "&diff ? '[c' : 'Gitsigns prev_hunk'", "Jump to prev hunk", {expr=true}), - -- Actions - map('n', 'hs', ':Gitsigns stage_hunk') - map('v', 'hs', ':Gitsigns stage_hunk') - map('n', 'hr', ':Gitsigns reset_hunk') - map('v', 'hr', ':Gitsigns reset_hunk') - map('n', 'hS', 'Gitsigns stage_buffer') - map('n', 'hu', 'Gitsigns undo_stage_hunk') - map('n', 'hR', 'Gitsigns reset_buffer') - map('n', 'hp', 'Gitsigns preview_hunk') - map('n', 'hb', 'lua require"gitsigns".blame_line{full=true}') - map('n', 'tb', 'Gitsigns toggle_current_line_blame') - map('n', 'hd', 'Gitsigns diffthis') - map('n', 'hD', 'lua require"gitsigns".diffthis("~")') - map('n', 'td', 'Gitsigns toggle_deleted') + keymap_vn("hs", ":Gitsigns stage_hunk", "Stage hunk"), + keymap_vn("hr", ":Gitsigns reset_hunk", "Reset hunk"), + keymap_n("hS", "Gitsigns stage_buffer", "Stage buffer"), + keymap_n("hu", "Gitsigns undo_stage_hunk", "Undo stage hunk"), + keymap_n("hR", "Gitsigns reset_buffer", "Reset buffer"), + keymap_n("hp", "Gitsigns preview_hunk", "Preview hunk"), + keymap_n('td', 'Gitsigns toggle_deleted', "Toggle deleted"), - -- Text object - map('o', 'ih', ':Gitsigns select_hunk') - map('x', 'ih', ':Gitsigns select_hunk') + {'ih', {o=':Gitsigns select_hunk', x=':Gitsigns select_hunk'}, description="Select hunk" } + } + } + } end } end diff --git a/lua/config/leap.lua b/lua/config/leap.lua index 0040997..1e52c73 100644 --- a/lua/config/leap.lua +++ b/lua/config/leap.lua @@ -2,7 +2,11 @@ return { 'ggandor/leap.nvim', config = function() local silent = {silent=true} - vim.keymap.set("n", "s", "(leap-forward-to)", silent) - vim.keymap.set("n", "S", "(leap-backward-to)", silent) + + require("legendary").keymaps{ + {"s", "(leap-forward-to)", description="Leap forward", opts=silent}, + {"S", "(leap-backward-to)", description="Leap backward", opts=silent} + } + end } diff --git a/lua/config/legendary.lua b/lua/config/legendary.lua index 639c297..b9993d3 100644 --- a/lua/config/legendary.lua +++ b/lua/config/legendary.lua @@ -1,12 +1,11 @@ return { 'mrjones2014/legendary.nvim', + requires = 'stevearc/dressing.nvim', config = function() - vim.keymap.set("n", "l", ":Legendary", {silent = true}) - require("legendary").setup{ include_legendary_cmds = false, - commands = { - { ":TodoTelescope", description = "Show TODO's in telescope" } + keymaps = { + {"l", ":Legendary", description = "Open this help menu"} } } end diff --git a/lua/config/lspconfig.lua b/lua/config/lspconfig.lua index facd74a..15777bd 100644 --- a/lua/config/lspconfig.lua +++ b/lua/config/lspconfig.lua @@ -87,20 +87,31 @@ end ---@diagnostic disable-next-line: unused-local function M.on_attach(client, bufnr) -- Mappings. - local opts = { noremap = true, silent = true } + local opts = { noremap = true, silent = true, buffer = bufnr} - local function buf_set_keymap(mode, lhs, rhs) vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) end + -- local function keymap(mode, lhs, rhs) vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + require("legendary").keymaps{ + { + itemgroup = "lsp", + description = "LSP", + keymaps = { + {'gd', 'lua vim.lsp.buf.definition()', description = "Jump to definition", opts=opts}, + {'gD', 'lua vim.lsp.buf.declaration()', description = "Jump to declaration", opts=opts}, + {'gi', 'lua vim.lsp.buf.implementation()', description = "Jump to implementation", opts=opts}, + {'K', 'lua vim.lsp.buf.hover()', description = "Show info", opts=opts}, + {'rn', 'lua vim.lsp.buf.rename()', description = "Rename symbol"}, + {'ca', 'lua vim.lsp.buf.code_action()', description = "Show code actions"}, + {'d', 'lua vim.diagnostic.open_float()', description = "Open float"} + } + } + } + -- Enable completion triggered by buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- See `:help vim.lsp.*` for documentation on any of the below functions - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()') - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()') - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()') - buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()') - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()') -- Conflicts with movement between panes -- buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()') @@ -109,9 +120,6 @@ function M.on_attach(client, bufnr) -- buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()') -- buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))') -- buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()') - buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()') - buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()') - buf_set_keymap('n', 'd', 'lua vim.diagnostic.open_float()') -- buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()') -- buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()') -- buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()') diff --git a/lua/config/lspsignature.lua b/lua/config/lspsignature.lua index 6940cd4..14bd77c 100644 --- a/lua/config/lspsignature.lua +++ b/lua/config/lspsignature.lua @@ -1,9 +1,18 @@ return { "ray-x/lsp_signature.nvim", config = function() - require "lsp_signature".setup{ + local lsp_signature = require("lsp_signature") + + lsp_signature.setup{ hint_enable = false, - toggle_key = '' + toggle_key = nil, + handler_opts = { + border = { " ", " ", " ", " ", " ", " ", " ", " " } + } + } + + require("legendary").keymap{ + "", lsp_signature.toggle_float_win, description="Toggle signature float" } end } diff --git a/lua/config/luapad.lua b/lua/config/luapad.lua index 87d5fcd..3ef3994 100644 --- a/lua/config/luapad.lua +++ b/lua/config/luapad.lua @@ -8,3 +8,8 @@ vim.api.nvim_create_autocmd("FileType", { end end }) + +require("legendary").commands{ + { ":Luapad", description = "Open interactive lua" }, + { ":LuaRun", description = "Run lua from current buffer" } +} diff --git a/lua/config/move.lua b/lua/config/move.lua index b20fadb..49aeadf 100644 --- a/lua/config/move.lua +++ b/lua/config/move.lua @@ -2,16 +2,10 @@ return { 'fedepujol/move.nvim', config = function() local opts = { noremap = true, silent = true } - -- Normal-mode commands - -- vim.keymap.set('n', '', ':MoveLine(1)', opts) - -- vim.keymap.set('n', '', ':MoveLine(-1)', opts) - -- vim.keymap.set('n', '', ':MoveHChar(-1)', opts) - -- vim.keymap.set('n', '', ':MoveHChar(1)', opts) - -- Visual-mode commands - vim.keymap.set('v', '', ':MoveBlock(1)', opts) - vim.keymap.set('v', '', ':MoveBlock(-1)', opts) - vim.keymap.set('v', '', ':MoveHBlock(-1)', opts) - vim.keymap.set('v', '', ':MoveHBlock(1)', opts) + require("legendary").keymaps{ + {mode='v', '', ':MoveBlock(1)', description = "Move block up", opts=opts}, + {mode='v', '', ':MoveBlock(-1)', description = "Move block down", opts=opts}, + } end } diff --git a/lua/config/nvim-tree.lua b/lua/config/nvim-tree.lua index 0954009..5271c87 100644 --- a/lua/config/nvim-tree.lua +++ b/lua/config/nvim-tree.lua @@ -11,7 +11,9 @@ return { }, } - vim.keymap.set("n", "e", ":NvimTreeToggle", {silent = true}) - vim.keymap.set("n", "f", ":NvimTreeFindFileToggle", {silent = true}) + require("legendary").keymaps{ + {"e", ":NvimTreeToggle", description = "Toggle file tree", {silent = true}}, + {"f", ":NvimTreeFindFileToggle", description = "Show file in tree", {silent = true}} + } end } diff --git a/lua/config/quickscope.lua b/lua/config/quickscope.lua index 5d29545..a78d999 100644 --- a/lua/config/quickscope.lua +++ b/lua/config/quickscope.lua @@ -1,12 +1,9 @@ return { 'unblevable/quick-scope', config = function () - local g = vim.g - local cmd = vim.cmd - -- Trigger a highlight in the appropriate direction when pressing these keys: - g['qs_highlight_on_keys'] = {'f', 'F', 't', 'T'} + vim.g['qs_highlight_on_keys'] = {'f', 'F', 't', 'T'} - g['qs_max_chars'] = 150 + vim.g['qs_max_chars'] = 150 end } diff --git a/lua/config/refactoring.lua b/lua/config/refactoring.lua deleted file mode 100644 index 617fc92..0000000 --- a/lua/config/refactoring.lua +++ /dev/null @@ -1,39 +0,0 @@ -local refactoring = require("refactoring") -refactoring.setup() - --- telescope refactoring helper -local function refactor(prompt_bufnr) - local content = require("telescope.actions.state").get_selected_entry( - prompt_bufnr - ) - require("telescope.actions").close(prompt_bufnr) - require("refactoring").refactor(content.value) -end - --- NOTE: M is a global object --- for the sake of simplicity in this example --- you can extract this function and the helper above --- and then require the file and call the extracted function --- in the mappings below -M = {} -M.refactors = function() - local opts = require("telescope.themes").get_cursor() -- set personal telescope options - require("telescope.pickers").new(opts, { - prompt_title = "refactors", - finder = require("telescope.finders").new_table({ - results = require("refactoring").get_refactors(), - }), - sorter = require("telescope.config").values.generic_sorter(opts), - attach_mappings = function(_, map) - map("i", "", refactor) - map("n", "", refactor) - return true - end - }):find() -end - -vim.api.nvim_set_keymap("v", "re", [[ lua require('refactoring').refactor('Extract Function')]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("v", "rf", [[ lua require('refactoring').refactor('Extract Function To File')]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("v", "rt", [[ lua M.refactors()]], {noremap = true, silent = true, expr = false}) - -return M diff --git a/lua/config/reload.lua b/lua/config/reload.lua deleted file mode 100644 index 943d5e9..0000000 --- a/lua/config/reload.lua +++ /dev/null @@ -1,6 +0,0 @@ -local map = require 'utils.map' - -map('n', 'rc', ':Restart', {silent = true}) - -vim.cmd [[command! PackerRestart exe 'Restart' | exe 'PackerCompile' | exe 'PackerSync']] - diff --git a/lua/config/sneak.lua b/lua/config/sneak.lua deleted file mode 100644 index 314f8aa..0000000 --- a/lua/config/sneak.lua +++ /dev/null @@ -1,23 +0,0 @@ -local map = require 'utils.map' -local g = vim.g - -g['sneak#label'] = 1 - --- case insensitive sneak -g['sneak#use_ic_scs'] = 1 - --- immediately move to the next instance of search, if you move the cursor sneak is back to default behavior -g['sneak#s_next'] = 1 - --- remap so I can use , and ; with f and t -map({'n', 'v'}, 'gS', 'Sneak_;') -map({'n', 'v'}, 'gs', 'Sneak_;') --- map gS Sneak_, --- map gs Sneak_; - --- highlight Sneak guifg=black guibg=#00C7DF ctermfg=black ctermbg=cyan --- highlight SneakScope guifg=red guibg=yellow ctermfg=red ctermbg=yellow - --- Emoji prompt -g['sneak#prompt'] = '🔎' - diff --git a/lua/config/telescope.lua b/lua/config/telescope.lua index b02c023..df715f3 100644 --- a/lua/config/telescope.lua +++ b/lua/config/telescope.lua @@ -87,22 +87,29 @@ if fzfPlugin and fzfPlugin.loaded then end +local keymaps = { + -- Search project files + { "", project_files, description = "Open git files" }, + + -- Search files from current working directory + { "p", function() builtin.find_files() end, description = "Open files" }, + + -- Edit neovim config + {"ce", edit_config, description = "Edit neovim config" }, + + -- Grep string + { "fw", function() builtin.live_grep() end, description = "Grep" }, + + -- Change colorscheme + { "cs", function() builtin.colorscheme() end, description = "Change colorscheme" }, + + -- See help tags + { "fh", function() builtin.help_tags() end, description = "Search help tags" } +} + local silent = {silent = true} +for _, keymap in ipairs(keymaps) do + keymap.opts = silent +end --- Search project files -vim.keymap.set("n", "", project_files, silent) - --- Search files from current working directory -vim.keymap.set("n", "p", function() builtin.find_files() end, silent) - --- Edit neovim config -vim.keymap.set("n", "ce", edit_config, silent) - --- Find string -vim.keymap.set("n", "fw", function() builtin.live_grep() end, silent) - --- Change colorscheme -vim.keymap.set("n", "cs", function() builtin.colorscheme() end, silent) - --- See help tags -vim.keymap.set("n", "fh", function() builtin.help_tags() end, silent) +require("legendary").keymaps(keymaps) diff --git a/lua/config/tidy.lua b/lua/config/tidy.lua index f324797..f44885e 100644 --- a/lua/config/tidy.lua +++ b/lua/config/tidy.lua @@ -1,6 +1,4 @@ return { "mcauley-penney/tidy.nvim", - config = function() - require("tidy").setup() - end + config = function() require("tidy").setup() end } diff --git a/lua/config/todo-comments.lua b/lua/config/todo-comments.lua index 79f8614..2081f9d 100644 --- a/lua/config/todo-comments.lua +++ b/lua/config/todo-comments.lua @@ -3,5 +3,9 @@ return { requires = "nvim-lua/plenary.nvim", config = function() require("todo-comments").setup { signs = false } + + require("legendary").command{ + ":TodoTelescope", description = "Show TODO's in telescope" + } end } diff --git a/lua/config/toggleterm.lua b/lua/config/toggleterm.lua index f84d054..8da2232 100644 --- a/lua/config/toggleterm.lua +++ b/lua/config/toggleterm.lua @@ -4,6 +4,8 @@ return { config = function() require('toggleterm').setup() - vim.keymap.set("n", "t", ":ToggleTerm") + require("legendary").keymap{ + "t", ":ToggleTerm", description = "Toggle terminal", opts = { silent = true } + } end } diff --git a/lua/config/trouble.lua b/lua/config/trouble.lua index 24e4f65..324ce86 100644 --- a/lua/config/trouble.lua +++ b/lua/config/trouble.lua @@ -2,14 +2,14 @@ return { 'folke/trouble.nvim', requires = 'kyazdani42/nvim-web-devicons', config = function () - local map = require 'utils.map' - require('trouble').setup() local silent = {silent = true} - map('n', 'qq', ':TroubleToggle document_diagnostics', silent) - map('n', 'qf', ':TroubleToggle workspace_diagnostics', silent) - map('n', 'rf', ':TroubleToggle lsp_references', silent) + require("legendary").keymaps{ + {'qq', ':TroubleToggle document_diagnostics', description="Toggle file diagnostics", opts=silent}, + {'qf', ':TroubleToggle workspace_diagnostics', description="Toggle workspace diagnostics", opts=silent}, + {'gr', ':TroubleToggle lsp_references', description="Show references in trouble", opts=silent}, + } end } diff --git a/lua/config/vimspector.lua b/lua/config/vimspector.lua deleted file mode 100644 index 17438ef..0000000 --- a/lua/config/vimspector.lua +++ /dev/null @@ -1,2 +0,0 @@ -local g = vim.g -g['vimspector_enable_mappings']="HUMAN" diff --git a/lua/options.lua b/lua/options.lua index c35348a..41457e1 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -119,3 +119,12 @@ if vim.g.neovide then vim.g.neovide_scale_factor = 0.75 vim.g.neovide_hide_mouse_when_typing = true end + +-- Change c file comment string +vim.api.nvim_create_autocmd("FileType", { + group = vim.api.nvim_create_augroup("set-c-commentstring", { clear = true }), + pattern = {"c", "cc", "cpp", "h", "hpp"}, + callback = function(data) + vim.api.nvim_buf_set_option(data.buf, "commentstring", "// %s") + end +}) diff --git a/lua/plugins.lua b/lua/plugins.lua index f41a70b..492c63e 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -9,8 +9,8 @@ return function(use) use_config "toggleterm" use_config "baleia" use_config "todo-comments" - use_config "legendary" use_config "dressing" + use_config "legendary" use_config "move" use_config "gitblame" use_config "based" @@ -30,6 +30,7 @@ return function(use) use_config "devicons" use_config "treesitter" use_config "ts-playground" + use_config "diffview" use { "nvim-telescope/telescope.nvim", @@ -70,7 +71,6 @@ return function(use) use "eandrju/cellular-automaton.nvim" use "tweekmonster/startuptime.vim" use "tpope/vim-unimpaired" - use { "sindrets/diffview.nvim", requires = 'nvim-lua/plenary.nvim' } use "wellle/targets.vim" use "michaeljsmith/vim-indent-object" use "psliwka/vim-smoothie"