.dotfiles/.config/nvim/ftplugin/json.lua

14 lines
346 B
Lua
Raw Normal View History

2022-05-12 19:42:09 +02:00
vim.cmd [[autocmd BufRead,BufNewFile tsconfig.json set filetype=jsonc]]
2023-04-20 15:28:34 +02:00
-- ftplugin/json.lua
vim.keymap.set('n', 'o', function()
local line = vim.api.nvim_get_current_line()
local should_add_comma = string.find(line, '[^,{[]$')
if should_add_comma then
return 'A,<cr>'
else
return 'o'
end
end, { buffer = true, expr = true })