From 6b14fbcc56258fe417ab32fd8ab395153753e44f Mon Sep 17 00:00:00 2001 From: Luca Saccarola Date: Thu, 27 Apr 2023 19:23:45 +0200 Subject: [PATCH] deprecate mode 'buffer' --- README.md | 9 ++++----- lua/code_runner/commands.lua | 9 ++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 992139e..45c40d7 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,6 @@ Don't use setup if filetype or a json path - Toggle runner - Reload runner - Run in a Float window -- Run in a buffer - Run in a tab - Run in a split - Run in toggleTerm @@ -86,8 +85,8 @@ All run commands allow restart. So, for example, if you use a command that does - `:RunCode` - Runs based on file type, first checking if belongs to project, then if filetype mapping exists - `:RunCode ` - Execute command from its key in current directory. -- `:RunFile ` - Run the current file(optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm", "buf"}, default: "term"). -- `:RunProject ` - Run the current project(If you are in a project otherwise you will not do anything, (optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm", "buf"}, default: "term"). +- `:RunFile ` - Run the current file(optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm"}, default: "term"). +- `:RunProject ` - Run the current project(If you are in a project otherwise you will not do anything, (optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm"}, default: "term"). - `:RunClose` - Close runner - `:CRFiletype` - Open json with supported files(Use only if you configured with json files). - `:CRProjects` - Open json with list of projects(Use only if you configured with json files). @@ -108,7 +107,7 @@ vim.keymap.set('n', 'crp', ':CRProjects', { noremap = true, silent = ### Options -- `mode`: Mode in which you want to run(default: term, valid options: {"toggle", "float", "tab", "toggleterm", "buf"}), +- `mode`: Mode in which you want to run(default: term, valid options: {"toggle", "float", "tab", "toggleterm"}), - `focus`: Focus on runner window(only works on toggle, term and tab mode, default: true) - `startinsert`: init in insert mode(default: false) - `term`: Configurations for the integrated terminal @@ -162,7 +161,7 @@ Note: A common mistake code runners make is using relative paths and not absolut ```lua require('code_runner').setup { - -- choose default mode (valid term, tab, float, toggle, buf) + -- choose default mode (valid term, tab, float, toggle) mode = 'term', -- Focus on runner window(only works on toggle, term and tab mode) focus = true, diff --git a/lua/code_runner/commands.lua b/lua/code_runner/commands.lua index b0b1575..4c1accc 100644 --- a/lua/code_runner/commands.lua +++ b/lua/code_runner/commands.lua @@ -114,10 +114,8 @@ local function execute(command, bufname, prefix) local set_bufname = "file " .. bufname local current_wind_id = vim.api.nvim_get_current_win() close_runner(bufname) - if prefix ~= "bufdo" then - prefix = prefix .. " |" - end - vim.cmd(prefix .. " term " .. command) + vim.cmd(prefix) + vim.fn.termopen(command) vim.cmd("norm G") vim.opt_local.relativenumber = false vim.opt_local.number = false @@ -170,9 +168,6 @@ M.modes = { tab = function(command, bufname) execute(command, bufname, "tabnew") end, - buf = function(command, bufname) - execute(command, bufname, "bufdo") - end, toggleterm = function(command, ...) local tcmd = string.format('TermExec cmd="%s"', command) vim.cmd(tcmd)