Skip to content
Open
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
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,19 @@ require('jaq-nvim').setup{

behavior = {
-- Default type
default = "float",
default = "float",

-- Start in insert mode
startinsert = false,
startinsert = false,

-- Use `wincmd p` on startup
wincmd = false,
wincmd = false,

-- Auto-save files
autosave = false
autosave = false,

-- Close existing Jaq buffers
closeexisting = false
},

ui = {
Expand Down
18 changes: 14 additions & 4 deletions lua/jaq-nvim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ local config = {
},

behavior = {
default = "float",
startinsert = false,
wincmd = false,
autosave = false
default = "float",
startinsert = false,
wincmd = false,
autosave = false,
closeexisting = false
},

ui = {
Expand Down Expand Up @@ -112,6 +113,15 @@ local function float(cmd)
end

local function term(cmd)
if config.behavior.closeexisting then
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")
if filetype == "Jaq" then
vim.api.nvim_buf_delete(bufnr, { force = true })
end
end
end

vim.cmd(config.ui.terminal.position .. " " .. config.ui.terminal.size .. "new | term " .. cmd)

M.buf = vim.api.nvim_get_current_buf()
Expand Down