Skip to content

Commit c6826e5

Browse files
committed
vim(snippets): Simplify lua inspect-debugging snippet i
Use `utils.debug_utils` lib instead of putting all the code and logic in the snippet itself.
1 parent 2dcca74 commit c6826e5

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

vim/UltiSnips/lua.snippets

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,8 @@ endsnippet
3030
snippet p
3131
print(vim.inspect(${1}))
3232
endsnippet
33-
snippet i "vim.notify + vim.inspect"
34-
`!p
35-
has_def = any([l.strip().startswith('local _inspect = function') for l in snip.buffer[:-1]])
36-
if not has_def:
37-
snip.rv = "require 'notify'.setup { level = 'DEBUG' } -- XXX DEBUG"
38-
snip += "local _inspect = function(x, ...) return vim.notify(vim.inspect(x), vim.log.levels.DEBUG, { title = vim.split(debug.traceback(), '\\n')[3] }) end;"
39-
snip += ""
40-
`_inspect($1)
33+
snippet i "vim.notify + vim.inspect for debugging"
34+
require('utils.debug_utils').inspect({ ["$1"] = ${1:obj}$0 })
4135
endsnippet
4236
snippet inspect
4337
vim.inspect(${1})

0 commit comments

Comments
 (0)