Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate mode 'buffer' #78

Merged
merged 2 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ vim.keymap.set('n', '<leader>crp', ':CRProjects<CR>', { 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
Expand Down Expand Up @@ -153,7 +153,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,
Expand Down
9 changes: 2 additions & 7 deletions lua/code_runner/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down