.config/nvim/lua/config/autocmds.lua

changeset 1086
82f517e1ae76
parent 1082
098f661195c1
child 1087
bfcf9813c223
--- a/.config/nvim/lua/config/autocmds.lua
+++ b/.config/nvim/lua/config/autocmds.lua
@@ -34,10 +34,12 @@ autocmd(g, "BufWritePre", "*", {
 -- >> auto session ?
 
 -- >> jump to last position on open
+local nojump = vim.regex([[mail\|commit\|rebase]])
+assert(nojump, "Couldn't compile nojump regexp?")
+
 autocmd(g, "BufReadPost", "*", function()
-  local ft = vim.bo.filetype
-  if ft == "mail" or string.match(ft, "^git") or string.match(ft, "^hg") then
-    return ""
+  if nojump:match_str(vim.bo.filetype or "") then
+    return
   end
 
   local lastpos = fn.line([['"]])

mercurial