diff options
| author | Soispha Peetz <soispha@b-peetz.de> | 2026-11-29 23:18:09 +0100 |
|---|---|---|
| committer | Soispha Peetz <soispha@b-peetz.de> | 2026-11-29 23:18:36 +0100 |
| commit | 13a09ec7468a220a5b7570e5325ea9800ac57b90 (patch) | |
| tree | d41b0f0f1d0ad421a33335152a4e390edd02de0a /modules/by-name/nv/nvim/mappings/default.nix | |
| parent | modules/taskwarrior: Update news.version (diff) | |
| download | nixos-config-13a09ec7468a220a5b7570e5325ea9800ac57b90.zip | |
Otherwise, the lua code is invalid.
Diffstat (limited to 'modules/by-name/nv/nvim/mappings/default.nix')
| -rw-r--r-- | modules/by-name/nv/nvim/mappings/default.nix | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/modules/by-name/nv/nvim/mappings/default.nix b/modules/by-name/nv/nvim/mappings/default.nix index 2a1bacb0..6a9175f6 100644 --- a/modules/by-name/nv/nvim/mappings/default.nix +++ b/modules/by-name/nv/nvim/mappings/default.nix @@ -254,22 +254,24 @@ mode = ["n"]; key = "<leader>X"; action.__raw = '' - local cur_line = tostring(vim.api.nvim_get_current_line()); - vim.api.nvim_del_current_line(); + function() + local cur_line = tostring(vim.api.nvim_get_current_line()); + vim.api.nvim_del_current_line(); - local output = vim.system( - { vim.env.SHELL; "-c"; cur_line; }, - { - text = true; - cwd = vim.fs.dirname(vim.api.nvim_buf_get_name(0)); - } - ):wait() + local output = vim.system( + { vim.env.SHELL; "-c"; cur_line; }, + { + text = true; + cwd = vim.fs.dirname(vim.api.nvim_buf_get_name(0)); + } + ):wait() - if output.stdout ~= "" then - vim.api.nvim_put(vim.split(output.stdout, "\n"), "", false, false) - end - if output.stderr ~= "" then - vim.api.nvim_put(vim.split(output.stderr, "\n"), "", false, false) + if output.stdout ~= "" then + vim.api.nvim_put(vim.split(output.stdout, "\n"), "", false, false) + end + if output.stderr ~= "" then + vim.api.nvim_put(vim.split(output.stderr, "\n"), "", false, false) + end end ''; options.desc = "Read the current line and execute that line in your $SHELL. The resulting output will replace the curent line that was being executed."; |
