cleanup
This commit is contained in:
parent
2f05a92a22
commit
c8a407b681
2 changed files with 2 additions and 5 deletions
|
@ -109,17 +109,14 @@ function M.toggle_term_cmd(opts)
|
|||
vim.g.user_terminals = {}
|
||||
end
|
||||
local terms = vim.g.user_terminals
|
||||
-- if a command string is provided, create a basic table for Terminal:new() options
|
||||
if type(opts) == "string" then opts = { cmd = opts, hidden = true } end
|
||||
local num = vim.v.count > 0 and vim.v.count or 1
|
||||
-- if terminal doesn't exist yet, create it
|
||||
if not terms[opts.cmd] then terms[opts.cmd] = {} end
|
||||
if not terms[opts.cmd][num] then
|
||||
if not opts.count then opts.count = vim.tbl_count(terms) * 100 + num end
|
||||
if not opts.on_exit then opts.on_exit = function() terms[opts.cmd][num] = nil end end
|
||||
terms[opts.cmd][num] = require("toggleterm.terminal").Terminal:new(opts)
|
||||
end
|
||||
-- toggle the terminal
|
||||
terms[opts.cmd][num]:toggle()
|
||||
end
|
||||
|
||||
|
@ -138,6 +135,7 @@ function M.file_worktree(file, worktrees)
|
|||
"ls-files",
|
||||
"--error-unmatch",
|
||||
file
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
}):wait()
|
||||
if r.code == 0 then
|
||||
return worktree
|
||||
|
@ -211,8 +209,6 @@ local function has_capability(capability, filter)
|
|||
end
|
||||
|
||||
-- NOTE: LSP Keymaps here
|
||||
-- TODO: Optimize these lookups with a fucking table jesus
|
||||
-- https://stackoverflow.com/a/37493047
|
||||
function M.lsp_on_attach(client, bufnr)
|
||||
local lsp_mappings = M.empty_map_table()
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---@diagnostic disable: undefined-global
|
||||
return {
|
||||
s({ trig = "sst", name = "Standard Template" }, fmt([[
|
||||
#include <stdlib.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue