aboutsummaryrefslogtreecommitdiff
path: root/neovim/.config/nvim/lua/autocmd.lua
diff options
context:
space:
mode:
Diffstat (limited to 'neovim/.config/nvim/lua/autocmd.lua')
-rw-r--r--neovim/.config/nvim/lua/autocmd.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/neovim/.config/nvim/lua/autocmd.lua b/neovim/.config/nvim/lua/autocmd.lua
new file mode 100644
index 0000000..603e6b4
--- /dev/null
+++ b/neovim/.config/nvim/lua/autocmd.lua
@@ -0,0 +1,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,
+})
+