-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathautocmds.lua
More file actions
76 lines (69 loc) · 1.54 KB
/
autocmds.lua
File metadata and controls
76 lines (69 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
callback = function()
vim.cmd "set formatoptions-=cro"
end,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
"netrw",
"Jaq",
"qf",
"git",
"help",
"man",
"lspinfo",
"oil",
"spectre_panel",
"lir",
"DressingSelect",
"tsplayground",
"",
},
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
set nobuflisted
]]
end,
})
vim.api.nvim_create_autocmd({ "CmdWinEnter" }, {
callback = function()
vim.cmd "quit"
end,
})
vim.api.nvim_create_autocmd({ "VimResized" }, {
callback = function()
vim.cmd "tabdo wincmd ="
end,
})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
pattern = { "*" },
callback = function()
vim.cmd "checktime"
end,
})
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
callback = function()
vim.highlight.on_yank { higroup = "Visual", timeout = 40 }
end,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "gitcommit", "markdown", "NeogitCommitMessage" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
vim.api.nvim_create_autocmd({ "CursorHold" }, {
callback = function()
local status_ok, luasnip = pcall(require, "luasnip")
if not status_ok then
return
end
if luasnip.expand_or_jumpable() then
-- ask maintainer for option to make this silent
-- luasnip.unlink_current()
vim.cmd [[silent! lua require("luasnip").unlink_current()]]
end
end,
})