diff options
| author | Kyren223 <contact@kyren.codes> | 2026-08-05 03:19:50 +0300 |
|---|---|---|
| committer | Kyren223 <contact@kyren.codes> | 2026-08-05 03:19:50 +0300 |
| commit | e67815062126265a64b48eaf1145695292ab5ee7 (patch) | |
| tree | 00db5fc099d37927c857dfbfcbfbe204cadfbbf6 | |
| parent | 615433f5772748d8beaa4eef61082ac39c7c5c3b (diff) | |
Fix error on commit when .scratch.md doesn't exist yet
| -rw-r--r-- | .config/nvim/lua/extra.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/.config/nvim/lua/extra.lua b/.config/nvim/lua/extra.lua index b6c2844..e4ffaa3 100644 --- a/.config/nvim/lua/extra.lua +++ b/.config/nvim/lua/extra.lua @@ -1002,7 +1002,10 @@ vim.api.nvim_create_autocmd('FileType', { end local path = vim.fn.fnamemodify(workspace_scratch_path, ':p') - local lines = vim.fn.readfile(path) + local ok, lines = pcall(vim.fn.readfile, path) + if not ok then + return + end local scratch_bufnr = vim.fn.bufnr(path) if scratch_bufnr ~= -1 and vim.api.nvim_buf_is_loaded(scratch_bufnr) then lines = vim.api.nvim_buf_get_lines(scratch_bufnr, 0, -1, false) |
