Add 'dots/' from commit 'f64b634dd8fbb2c8a2898c3b9d0acc9452e4d966'
git-subtree-dir: dots git-subtree-mainline:2ad98cde17git-subtree-split:f64b634dd8
This commit is contained in:
19
dots/.config/nvim/ftplugin/json.lua
Normal file
19
dots/.config/nvim/ftplugin/json.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local json_newline = function()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
if line == "" then
|
||||
print("line is empty")
|
||||
return "o"
|
||||
elseif string.byte(line, -1) == string.byte(",") then
|
||||
return "o"
|
||||
elseif string.byte(line, -1) == string.byte("{") then
|
||||
print("line ends with '{'")
|
||||
return "o"
|
||||
elseif string.byte(line, -1) == string.byte("}") then
|
||||
print("line ends with '}'")
|
||||
return "o"
|
||||
else
|
||||
return "A,<CR>"
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "o", json_newline, { buffer = true, expr = true })
|
||||
Reference in New Issue
Block a user