Skip to content

Commit 6b14fbc

Browse files
committed
deprecate mode 'buffer'
1 parent 825a0d5 commit 6b14fbc

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ Don't use setup if filetype or a json path
6969
- Toggle runner
7070
- Reload runner
7171
- Run in a Float window
72-
- Run in a buffer
7372
- Run in a tab
7473
- Run in a split
7574
- Run in toggleTerm
@@ -86,8 +85,8 @@ All run commands allow restart. So, for example, if you use a command that does
8685

8786
- `:RunCode` - Runs based on file type, first checking if belongs to project, then if filetype mapping exists
8887
- `:RunCode <A_key_here>` - Execute command from its key in current directory.
89-
- `:RunFile <mode>` - Run the current file(optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm", "buf"}, default: "term").
90-
- `:RunProject <mode>` - 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").
88+
- `:RunFile <mode>` - Run the current file(optionally you can select an opening mode: {"toggle", "float", "tab", "toggleterm"}, default: "term").
89+
- `:RunProject <mode>` - 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").
9190
- `:RunClose` - Close runner
9291
- `:CRFiletype` - Open json with supported files(Use only if you configured with json files).
9392
- `:CRProjects` - Open json with list of projects(Use only if you configured with json files).
@@ -108,7 +107,7 @@ vim.keymap.set('n', '<leader>crp', ':CRProjects<CR>', { noremap = true, silent =
108107

109108
### Options
110109

111-
- `mode`: Mode in which you want to run(default: term, valid options: {"toggle", "float", "tab", "toggleterm", "buf"}),
110+
- `mode`: Mode in which you want to run(default: term, valid options: {"toggle", "float", "tab", "toggleterm"}),
112111
- `focus`: Focus on runner window(only works on toggle, term and tab mode, default: true)
113112
- `startinsert`: init in insert mode(default: false)
114113
- `term`: Configurations for the integrated terminal
@@ -162,7 +161,7 @@ Note: A common mistake code runners make is using relative paths and not absolut
162161

163162
```lua
164163
require('code_runner').setup {
165-
-- choose default mode (valid term, tab, float, toggle, buf)
164+
-- choose default mode (valid term, tab, float, toggle)
166165
mode = 'term',
167166
-- Focus on runner window(only works on toggle, term and tab mode)
168167
focus = true,

lua/code_runner/commands.lua

+2-7
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ local function execute(command, bufname, prefix)
114114
local set_bufname = "file " .. bufname
115115
local current_wind_id = vim.api.nvim_get_current_win()
116116
close_runner(bufname)
117-
if prefix ~= "bufdo" then
118-
prefix = prefix .. " |"
119-
end
120-
vim.cmd(prefix .. " term " .. command)
117+
vim.cmd(prefix)
118+
vim.fn.termopen(command)
121119
vim.cmd("norm G")
122120
vim.opt_local.relativenumber = false
123121
vim.opt_local.number = false
@@ -170,9 +168,6 @@ M.modes = {
170168
tab = function(command, bufname)
171169
execute(command, bufname, "tabnew")
172170
end,
173-
buf = function(command, bufname)
174-
execute(command, bufname, "bufdo")
175-
end,
176171
toggleterm = function(command, ...)
177172
local tcmd = string.format('TermExec cmd="%s"', command)
178173
vim.cmd(tcmd)

0 commit comments

Comments
 (0)