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

changeset 1086
82f517e1ae76
parent 1082
098f661195c1
child 1087
bfcf9813c223
equal deleted inserted replaced
1085:c2d11f022cf0 1086:82f517e1ae76
32 }) 32 })
33 33
34 -- >> auto session ? 34 -- >> auto session ?
35 35
36 -- >> jump to last position on open 36 -- >> jump to last position on open
37 local nojump = vim.regex([[mail\|commit\|rebase]])
38 assert(nojump, "Couldn't compile nojump regexp?")
39
37 autocmd(g, "BufReadPost", "*", function() 40 autocmd(g, "BufReadPost", "*", function()
38 local ft = vim.bo.filetype 41 if nojump:match_str(vim.bo.filetype or "") then
39 if ft == "mail" or string.match(ft, "^git") or string.match(ft, "^hg") then 42 return
40 return ""
41 end 43 end
42 44
43 local lastpos = fn.line([['"]]) 45 local lastpos = fn.line([['"]])
44 if lastpos >= 1 and lastpos <= fn.line("$") then 46 if lastpos >= 1 and lastpos <= fn.line("$") then
45 vim.cmd([[normal! g`"]]) 47 vim.cmd([[normal! g`"]])

mercurial