blob: bff808a612f60d0892c6131ec110e27ec6161682 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
-- Wrap and check for spell in text filetypes.
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('wrap_spell', { clear = true }),
pattern = { 'gitcommit', 'markdown' },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Go to last loc when opening a buffer.
vim.api.nvim_create_autocmd('BufReadPost', {
group = vim.api.nvim_create_augroup('last_loc', { clear = true }),
callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then
-- Protected call to catch errors.
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})
|