diff .chezmoitemplates/init.lua @ 691:989cedcc0a38

chore: remove config.vim
author zegervdv <zegervdv@me.com>
date Wed, 05 Oct 2022 09:52:29 +0200
parents 424764c7f51a
children 22efd3b888f8
line wrap: on
line diff
--- a/.chezmoitemplates/init.lua	Wed Oct 05 09:19:12 2022 +0200
+++ b/.chezmoitemplates/init.lua	Wed Oct 05 09:52:29 2022 +0200
@@ -984,6 +984,16 @@
   if vim.o.diff then vim.cmd.diffupdate() end
 end
 
+-- Open file at last position
+au.BufReadPost = function()
+  if vim.bo.filetype ~= 'gitcommit' and vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then
+    vim.cmd.normal { 'g`"', bang = true }
+  end
+end
+
+-- Remove netrw buffers
+au.FileType = { 'netrw', 'setlocal bufhidden=delete' }
+
 -- Terminal
 au.group('enter_term', {
   { 'TermOpen', '*', 'startinsert!' },
@@ -1003,6 +1013,22 @@
   },
 })
 
+-- Color number categories in reports and logs
+au({ 'BufNewFile', 'BufRead', 'BufEnter' }, {
+  '*.rpt,*.log',
+  function()
+    vim.cmd.syntax { 'match', 'String', [["\v<\d{1,3}>"]] }
+    vim.cmd.syntax { 'match', 'Statement', [["\v<\d{4,6}>"]] }
+    vim.cmd.syntax { 'match', 'Function', [["\v<\d{7,9}>"]] }
+
+    vim.cmd.syntax { 'match', 'Number', [["\v<0+>"]] }
+
+    vim.cmd.syntax { 'match', 'Error', [["\v\c^error:"]] }
+
+    vim.wo.wrap = false
+  end,
+})
+
 -- Apply changes in chezmoi managed files
 au.group('chezmoi', {
   { 'BufWritePost', os.getenv 'HOME' .. '/.local/share/chezmoi/*', 'silent !chezmoi apply --source-path %' },