mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
replace more viml with native lua code
This commit is contained in:
parent
a6f716558b
commit
26921309ec
@ -1,3 +1,5 @@
|
||||
local api = vim.api
|
||||
local keymap = vim.keymap
|
||||
local dashboard = require("dashboard")
|
||||
|
||||
dashboard.custom_header = {
|
||||
@ -56,10 +58,11 @@ dashboard.custom_center = {
|
||||
},
|
||||
}
|
||||
|
||||
vim.cmd([[
|
||||
augroup dashboard_enter
|
||||
au!
|
||||
autocmd FileType dashboard nnoremap <buffer> q :qa<CR>
|
||||
autocmd FileType dashboard nnoremap <buffer> e :enew<CR>
|
||||
augroup END
|
||||
]])
|
||||
api.nvim_create_autocmd("FileType", {
|
||||
pattern = "dashboard",
|
||||
group = api.nvim_create_augroup("dashboard_enter", { clear = true }),
|
||||
callback = function ()
|
||||
keymap.set("n", "q", ":qa<CR>", { buffer = true, silent = true })
|
||||
keymap.set("n", "e", ":enew<CR>", { buffer = true, silent = true })
|
||||
end
|
||||
})
|
||||
|
||||
@ -69,12 +69,24 @@ local custom_attach = function(client, bufnr)
|
||||
hi! link LspReferenceRead Visual
|
||||
hi! link LspReferenceText Visual
|
||||
hi! link LspReferenceWrite Visual
|
||||
augroup lsp_document_highlight
|
||||
autocmd! * <buffer>
|
||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||
augroup END
|
||||
]])
|
||||
|
||||
local gid = api.nvim_create_augroup("lsp_document_highlight", { clear = true })
|
||||
api.nvim_create_autocmd("CursorHold" , {
|
||||
group = gid,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
lsp.buf.document_highlight()
|
||||
end
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd("CursorMoved" , {
|
||||
group = gid,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
lsp.buf.clear_references()
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
if vim.g.logging_level == "debug" then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user