From b9513f21ae630ffcb93d68c21eeb70b5eebe74ae Mon Sep 17 00:00:00 2001 From: "jakob.stendahl" Date: Sat, 13 Jan 2024 13:21:31 +0100 Subject: Simplify nvim xp --- Common/nvim/lua/helper_functions.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Common/nvim/lua/helper_functions.lua') 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', 'wt', [[:%s/\s\+$//e]]) -- 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', 'jq', FormatJson, { noremap = true, silent = true }) -vim.keymap.set('v', 'jq', ':FormatJson', { noremap = true, silent = true }) +vim.keymap.set('n', 'jq', JsonFormat, { noremap = true, silent = true }) +vim.keymap.set('v', 'jq', ':JsonFormat', { noremap = true, silent = true }) function English() vim.opt.spell = true -- cgit v1.2.3