Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

gitcommit ft and builtins.code_actions.gitsigns #851

Answered by fitrh
konart asked this question in Q&A
Discussion options

You must be logged in to vote

That is because you create autocmd for all buffers

For LSP thing, you have to specify which buffer (which is why we have access to bufnr in on_attach) you want to add LSP-specific features (keymap, autocmd, user-command, etc.)

You can try to convert your on_attach like this

local on_attach = function(client, bufnr)
    local support = client.supports_method
    local augroup = vim.api.nvim_create_augroup
    local autocmd = vim.api.nvim_create_autocmd

    if support("textDocument/documentHighlight") then
        -- It is always recommended to put autocmd in a augroup
        local highlight_on_cursor = augroup("HighlightOnCursor", { clear = false })

        autocmd({ "CursorHold", "Curs…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@konart
Comment options

@jose-elias-alvarez
Comment options

Comment options

You must be logged in to vote
1 reply
@konart
Comment options

Answer selected by konart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants