You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
994 B
30 lines
994 B
9 months ago
|
--------------------------------------------
|
||
|
--- Commands ---
|
||
|
|
||
|
-- Prevent typo
|
||
|
vim.cmd [[
|
||
|
cnoreabbrev <expr> W (getcmdtype() is# ":" && getcmdline() is# "W") ? ("w") : ("W")
|
||
|
cnoreabbrev <expr> Q (getcmdtype() is# ":" && getcmdline() is# "Q") ? ("q") : ("Q")
|
||
|
cnoreabbrev <expr> WQ (getcmdtype() is# ":" && getcmdline() is# "WQ") ? ("wq") : ("WQ")
|
||
|
cnoreabbrev <expr> Wq (getcmdtype() is# ":" && getcmdline() is# "Wq") ? ("wq") : ("Wq")
|
||
|
]]
|
||
|
|
||
|
--------------------------------------------
|
||
|
--- Autocommands ---
|
||
|
|
||
|
-- Cut off trailing whitespace and trailing blank lines
|
||
|
local core = require("core.functions")
|
||
|
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||
|
pattern = "*",
|
||
|
callback = core.trim_buffer,
|
||
|
})
|
||
|
|
||
|
-- Highlight on yank
|
||
|
-- See `:help vim.highlight.on_yank()`
|
||
|
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
||
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||
|
pattern = "*",
|
||
|
group = highlight_group,
|
||
|
callback = function() vim.highlight.on_yank() end,
|
||
|
})
|