float term working better now
This commit is contained in:
parent
9a22c87b89
commit
35dda4a37f
@ -32,6 +32,7 @@ return {
|
||||
config = function(_, opts)
|
||||
local whichkey = require("which-key")
|
||||
local utils = require("lazyvim.utils")
|
||||
local term = require("lazyvim.utils.term")
|
||||
|
||||
whichkey.setup(opts)
|
||||
|
||||
@ -318,7 +319,7 @@ return {
|
||||
{
|
||||
"<leader>gg",
|
||||
function()
|
||||
utils.float_term({ "lazygit" })
|
||||
term.float_term({ "lazygit" })
|
||||
end
|
||||
,
|
||||
desc = "Lazygit (cwd)"
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
local state = {
|
||||
local M = {}
|
||||
|
||||
State = {
|
||||
floating = {
|
||||
buf = -1,
|
||||
win = -1
|
||||
}
|
||||
}
|
||||
|
||||
function create_floating_window(opts)
|
||||
function M.create_floating_window(opts)
|
||||
-- Set default options if not provided
|
||||
opts = opts or {}
|
||||
opts.width = opts.width or math.floor(vim.o.columns * 0.8) -- Default 80% of screen width
|
||||
@ -42,12 +44,25 @@ end
|
||||
|
||||
-- Emable usage:
|
||||
vim.api.nvim_create_user_command("FloatTerminal", function()
|
||||
if not vim.api.nvim_win_is_valid(state.floating.win) then
|
||||
state.floating = create_floating_window({ buf = state.floating.buf })
|
||||
if vim.bo[state.floating.buf].buftype ~= "terminal" then
|
||||
if not vim.api.nvim_win_is_valid(State.floating.win) then
|
||||
State.floating = M.create_floating_window({ buf = State.floating.buf })
|
||||
if vim.bo[State.floating.buf].buftype ~= "terminal" then
|
||||
vim.cmd.term()
|
||||
end
|
||||
else
|
||||
vim.api.nvim_win_hide(state.floating.win)
|
||||
vim.api.nvim_win_hide(State.floating.win)
|
||||
end
|
||||
end, {})
|
||||
|
||||
function M.float_term(opts)
|
||||
if not vim.api.nvim_win_is_valid(State.floating.win) then
|
||||
State.floating = M.create_floating_window({ buf = State.floating.buf })
|
||||
if vim.bo[State.floating.buf].buftype ~= "terminal" then
|
||||
vim.cmd.term(opts)
|
||||
end
|
||||
else
|
||||
vim.api.nvim_win_hide(State.floating.win)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -70,7 +70,7 @@ export ZK_NOTEBOOK_DIR="$HOME/notes"
|
||||
export REPOS="$HOME/repos"
|
||||
export GITUSER="inkletblot"
|
||||
export NOTE_DIR="$HOME/notes/"
|
||||
export DWM_DIR="$REPOS/gitlab.inkletblot.com/inkletblot/dwm-inkletblot/"
|
||||
export DWM_DIR="$REPOS/git.inkletblot.com/inkletblot/dwm-inkletblot/"
|
||||
|
||||
# This is something luke smith has in his profile (which I have stolen, it's nice but
|
||||
# doesn't work very nicely with my login manager, lightdm, and I prefer to just run
|
||||
|
||||
Loading…
Reference in New Issue
Block a user