diff options
Diffstat (limited to 'Common/nvim/lua/helper_functions.lua')
-rwxr-xr-x | Common/nvim/lua/helper_functions.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Common/nvim/lua/helper_functions.lua b/Common/nvim/lua/helper_functions.lua index 1b9ac50..1f57a09 100755 --- a/Common/nvim/lua/helper_functions.lua +++ b/Common/nvim/lua/helper_functions.lua @@ -46,7 +46,7 @@ vim.api.nvim_create_user_command('JoinLinesBT', JoinLinesBT, {bang=false, desc=' vim.keymap.set('n', '<Leader>wt', [[:%s/\s\+$//e<cr>]]) -- Quick json formatting using jq -function FormatJson(start_line, end_line) +function JsonFormat(start_line, end_line) if start_line == nil or end_line == nil then if vim.fn.mode() == 'v' then start_line, _, end_line, _ = unpack(vim.fn.getpos("'<"), 2, 5) @@ -61,11 +61,11 @@ function FormatJson(start_line, end_line) handle:close() vim.api.nvim_buf_set_lines(0, start_line - 1, end_line, false, vim.fn.split(result, "\n")) end -vim.api.nvim_create_user_command('FormatJson', function(opts) - FormatJson(opts.line1, opts.line2) +vim.api.nvim_create_user_command('JsonFormat', function(opts) + JsonFormat(opts.line1, opts.line2) end, {range = true, desc = 'Format JSON'}) -vim.keymap.set('n', '<leader>jq', FormatJson, { noremap = true, silent = true }) -vim.keymap.set('v', '<leader>jq', ':FormatJson<CR>', { noremap = true, silent = true }) +vim.keymap.set('n', '<leader>jq', JsonFormat, { noremap = true, silent = true }) +vim.keymap.set('v', '<leader>jq', ':JsonFormat<CR>', { noremap = true, silent = true }) function English() vim.opt.spell = true |