mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-31 07:09:54 +02:00
feat: initial commit
This commit is contained in:
commit
58e5dae036
18 changed files with 683 additions and 0 deletions
40
lua/user/autocommands.lua
Normal file
40
lua/user/autocommands.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
-- Check if we need to reload the file when it changed
|
||||
vim.api.nvim_create_autocmd("FocusGained", { command = "checktime" })
|
||||
|
||||
-- Highlight on yank
|
||||
vim.api.nvim_create_autocmd("TextYankPost", { callback = vim.highlight.on_yank })
|
||||
|
||||
-- go to last loc when opening a buffer
|
||||
vim.api.nvim_create_autocmd("BufReadPre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "<buffer>",
|
||||
once = true,
|
||||
callback = function()
|
||||
vim.cmd(
|
||||
[[if &ft !~# 'commit\|rebase' && line("'\"") > 1 && line("'\"") <= line("$") | exe 'normal! g`"' | endif]]
|
||||
)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- close some filetypes with <q>
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = {
|
||||
"qf",
|
||||
"help",
|
||||
"man",
|
||||
"notify",
|
||||
"lspinfo",
|
||||
"spectre_panel",
|
||||
"startuptime",
|
||||
"tsplayground",
|
||||
"PlenaryTestPopup",
|
||||
},
|
||||
callback = function(event)
|
||||
vim.bo[event.buf].buflisted = false
|
||||
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true })
|
||||
end,
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue