From aa6b9c677d83d76d448c3bb0973bf8d14bfdf922 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 8 Jun 2024 21:40:18 +0200 Subject: refactor: use `vim._with` where possible This mostly means replacing `nvim_buf_call` and `nvim_win_call` with `vim._with`. --- runtime/filetype.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/filetype.lua') diff --git a/runtime/filetype.lua b/runtime/filetype.lua index be76af787d..797033da06 100644 --- a/runtime/filetype.lua +++ b/runtime/filetype.lua @@ -21,7 +21,7 @@ vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'StdinReadPost' }, { -- Generic configuration file used as fallback ft = require('vim.filetype.detect').conf(args.file, args.buf) if ft then - vim.api.nvim_buf_call(args.buf, function() + vim._with({ buf = args.buf }, function() vim.api.nvim_cmd({ cmd = 'setf', args = { 'FALLBACK', ft } }, {}) end) end @@ -32,7 +32,7 @@ vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'StdinReadPost' }, { on_detect(args.buf) end - vim.api.nvim_buf_call(args.buf, function() + vim._with({ buf = args.buf }, function() vim.api.nvim_cmd({ cmd = 'setf', args = { ft } }, {}) end) end -- cgit