aboutsummaryrefslogtreecommitdiff
path: root/neovim/.config/nvim/lua/autocmd.lua
blob: 603e6b4936821984f6f909ddd2355b13cd74c821 (plain)
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
-- Custom filetypes
vim.filetype.add({
  extension = {
    conf = "conf",
    nd = "markdown",
  },
  pattern = {
    [".*%.env.*"] = "sh",
    ["ignore$"] = "conf",
  },
})

local cmd = vim.api.nvim_create_autocmd

-- Go to last location when opening buffer
cmd("BufReadPost", { 
  command = [[ if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g`\"" | endif ]]
})

-- Highlight the region on yank
cmd("TextYankPost", {
  group = vim.api.nvim_create_augroup("TextYankGroup", { clear = true }),
  callback = function() vim.highlight.on_yank({ higroup = "Visual" }) end,
})