Compare commits

..

No commits in common. "0b659b0459a7db478fa9aec1b50f3726ea400f8b" and "dba8c3f6e80bd987188eda9dc33fe8d35340915b" have entirely different histories.

2 changed files with 0 additions and 57 deletions

View file

@ -46,29 +46,4 @@ return function(_, bufnr)
vim.lsp.buf.rename()
end
end, {nargs = "?"})
vim.api.nvim_buf_create_user_command(bufnr, "LspDocumentHighlight", function(args)
local disable = vim.b.document_highlight
arg = args.fargs[1]
if arg then
if string.lower(arg) == "on" then
disable = false
elseif string.lower(arg) == "off" then
disable = true
else
error "Argument must be either 'on' or 'off' or absent"
end
end
if disable then
require("lsp.document_highlight").stop(bufnr)
vim.b.document_highlight = false
else
require("lsp.document_highlight").start(bufnr)
vim.b.document_highlight = true
end
end, {nargs = "?", complete = function(lead)
return vim.fn.filter({ "on", "off" }, function(_, val)
return val:find("^" .. lead)
end)
end})
end

View file

@ -1,32 +0,0 @@
local document_highlight = {}
vim.api.nvim_create_augroup('lsp_document_highlight', {
clear = false
})
function document_highlight.start(bufnr)
vim.api.nvim_clear_autocmds({
buffer = bufnr,
group = 'lsp_document_highlight',
})
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = 'lsp_document_highlight',
buffer = bufnr,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
group = 'lsp_document_highlight',
buffer = bufnr,
callback = vim.lsp.buf.clear_references,
})
end
function document_highlight.stop(bufnr)
vim.api.nvim_clear_autocmds({
buffer = bufnr,
group = 'lsp_document_highlight',
})
vim.lsp.buf.clear_references()
end
return document_highlight