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 = {}
|
vim.g.user_terminals = {}
|
||||||
end
|
end
|
||||||
local terms = vim.g.user_terminals
|
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
|
if type(opts) == "string" then opts = { cmd = opts, hidden = true } end
|
||||||
local num = vim.v.count > 0 and vim.v.count or 1
|
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] then terms[opts.cmd] = {} end
|
||||||
if not terms[opts.cmd][num] then
|
if not terms[opts.cmd][num] then
|
||||||
if not opts.count then opts.count = vim.tbl_count(terms) * 100 + num end
|
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
|
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)
|
terms[opts.cmd][num] = require("toggleterm.terminal").Terminal:new(opts)
|
||||||
end
|
end
|
||||||
-- toggle the terminal
|
|
||||||
terms[opts.cmd][num]:toggle()
|
terms[opts.cmd][num]:toggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -138,6 +135,7 @@ function M.file_worktree(file, worktrees)
|
||||||
"ls-files",
|
"ls-files",
|
||||||
"--error-unmatch",
|
"--error-unmatch",
|
||||||
file
|
file
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
}):wait()
|
}):wait()
|
||||||
if r.code == 0 then
|
if r.code == 0 then
|
||||||
return worktree
|
return worktree
|
||||||
|
@ -211,8 +209,6 @@ local function has_capability(capability, filter)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- NOTE: LSP Keymaps here
|
-- 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)
|
function M.lsp_on_attach(client, bufnr)
|
||||||
local lsp_mappings = M.empty_map_table()
|
local lsp_mappings = M.empty_map_table()
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
---@diagnostic disable: undefined-global
|
||||||
return {
|
return {
|
||||||
s({ trig = "sst", name = "Standard Template" }, fmt([[
|
s({ trig = "sst", name = "Standard Template" }, fmt([[
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
Loading…
Add table
Reference in a new issue