From 8fd349f5062709409de062c0769e14e119c41ea9 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Mon, 3 Jun 2024 00:27:56 +0200 Subject: [PATCH] nvim: leader use space, fix keybing show hl todo, note ... --- .config/nvim/init.lua | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 104d03a..fc514ea 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,15 +1,15 @@ +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + vim.cmd([[ set runtimepath^=~/.vim runtimepath+=~/.vim/after let &packpath = &runtimepath source ~/.vimrc ]]) --- Set as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) --- vim.g.mapleader = ' ' ---vim.g.maplocalleader = ' ' - -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = true @@ -25,6 +25,17 @@ vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagn vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.highlight.on_yank()` +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying) text", + group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) + local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then vim.fn.system({ @@ -48,6 +59,10 @@ require("lazy").setup({ { -- Useful plugin to show you pending keybinds. "folke/which-key.nvim", event = "VimEnter", -- Sets the loading event to 'VimEnter' + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, config = function() -- This is the function that runs, AFTER loading require("which-key").setup() @@ -84,6 +99,13 @@ require("lazy").setup({ "rhysd/vim-grammarous", "liuchengxu/vista.vim", "https://git.mathux.org/mathieu/taglist.git", + -- Highlight todo, notes, etc in comments + { + "folke/todo-comments.nvim", + event = "VimEnter", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { signs = false }, + }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate",