~sanchayanmaity/dotfiles

918df6307351be6d7b6f40a9de4b415cf6b19f00 — Sanchayan Maity a month ago 8fd4ae0
nvim: Fix group argument to nvim_create_autocmd
2 files changed, 12 insertions(+), 12 deletions(-)

M nvim/.config/nvim/lua/autocmd.lua
M nvim/.config/nvim/lua/lsp.lua
M nvim/.config/nvim/lua/autocmd.lua => nvim/.config/nvim/lua/autocmd.lua +7 -7
@@ 1,35 1,35 @@
vim.api.nvim_create_augroup("custom_group", {clear = true})
local custom_augroup_id = vim.api.nvim_create_augroup("custom_group", {clear = true})

local aucmd_dict = {
  TermOpen = {
    {
      group   = "custom_group",
      group   = custom_augroup_id,
      pattern = "*",
      command = "startinsert"
    },
    {
      group   = "custom_group",
      group   = custom_augroup_id,
      pattern = "*",
      command = "setlocal listchars= nonumber norelativenumber"
    },
  },
  VimResized = {
    {
      group   = "custom_group",
      group   = custom_augroup_id,
      pattern = "*",
      command = ":wincmd ="
    }
  },
  InsertEnter = {
    {
      group   = "custom_group",
      group   = custom_augroup_id,
      pattern = "*",
      command = "setlocal nohlsearch"
    }
  },
  TextYankPost = {
    {
      group   = "custom_group",
      group   = custom_augroup_id,
      pattern = "*",
      callback = function ()
        require("vim.highlight").on_yank({timeout = 1000})


@@ 38,7 38,7 @@ local aucmd_dict = {
  },
  VimLeave = {
    {
      group   = "custom_group",
      group   = custom_augroup_id,
      pattern = "*",
      command = "set guicursor=a:hor1-blinkon0"
    }

M nvim/.config/nvim/lua/lsp.lua => nvim/.config/nvim/lua/lsp.lua +5 -5
@@ 110,19 110,19 @@ local on_attach = function(client, bufnr)
  end

  if client.server_capabilities.codeLensProvider or client.server_capabilities.documentHighlightProvider then
    vim.api.nvim_create_augroup("LSP", {clear = true})
    local lsp_augroup_id = vim.api.nvim_create_augroup("LSP", {clear = true})

    if client.server_capabilities.codeLensProvider then
      vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>l", "<cmd>lua vim.lsp.codelens.run()<CR>", opts)
      vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
        group   = "LSP",
        group   = lsp_augroup_id,
        buffer  = bufnr,
        callback = function ()
          vim.lsp.codelens.refresh()
        end,
      })
      vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {
        group   = "LSP",
        group   = lsp_augroup_id,
        buffer  = bufnr,
        callback = function ()
          lightbulb.update_lightbulb()


@@ 132,14 132,14 @@ local on_attach = function(client, bufnr)

    if client.server_capabilities.documentHighlightProvider then
      vim.api.nvim_create_autocmd("CursorHold", {
        group   = "LSP",
        group   = lsp_augroup_id,
        buffer  = bufnr,
        callback = function ()
          vim.lsp.buf.document_highlight()
        end,
      })
      vim.api.nvim_create_autocmd("CursorMoved", {
        group   = "LSP",
        group   = lsp_augroup_id,
        buffer  = bufnr,
        callback = function ()
          vim.lsp.buf.clear_references()