Cleanup formatting layout randoms
This commit is contained in:
@@ -1,54 +1,54 @@
|
|||||||
local term_buf = nil
|
local term_buf = nil
|
||||||
|
|
||||||
local function open_term_split()
|
local function open_term_split()
|
||||||
vim.cmd('botright vsplit')
|
vim.cmd('botright vsplit')
|
||||||
local win = vim.api.nvim_get_current_win()
|
local win = vim.api.nvim_get_current_win()
|
||||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||||
vim.api.nvim_win_set_buf(win, term_buf)
|
vim.api.nvim_win_set_buf(win, term_buf)
|
||||||
else
|
else
|
||||||
vim.cmd('terminal')
|
vim.cmd('terminal')
|
||||||
term_buf = vim.api.nvim_get_current_buf()
|
term_buf = vim.api.nvim_get_current_buf()
|
||||||
end
|
end
|
||||||
vim.api.nvim_win_set_width(win, math.floor(vim.o.columns * 0.37))
|
vim.api.nvim_win_set_width(win, math.floor(vim.o.columns * 0.37))
|
||||||
vim.cmd('startinsert')
|
vim.cmd('startinsert')
|
||||||
end
|
end
|
||||||
|
|
||||||
local function toggle_term()
|
local function toggle_term()
|
||||||
-- Check if terminal is already visible in a window
|
-- Check if terminal is already visible in a window
|
||||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||||
if vim.api.nvim_win_get_buf(win) == term_buf then
|
if vim.api.nvim_win_get_buf(win) == term_buf then
|
||||||
vim.api.nvim_win_close(win, false)
|
vim.api.nvim_win_close(win, false)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
open_term_split()
|
open_term_split()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function open_term_fullscreen()
|
local function open_term_fullscreen()
|
||||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||||
vim.api.nvim_set_current_buf(term_buf)
|
vim.api.nvim_set_current_buf(term_buf)
|
||||||
else
|
else
|
||||||
vim.cmd('terminal')
|
vim.cmd('terminal')
|
||||||
term_buf = vim.api.nvim_get_current_buf()
|
term_buf = vim.api.nvim_get_current_buf()
|
||||||
end
|
end
|
||||||
vim.cmd('startinsert')
|
vim.cmd('startinsert')
|
||||||
end
|
end
|
||||||
|
|
||||||
local function prev_non_term_buf()
|
local function prev_non_term_buf()
|
||||||
local cur = vim.api.nvim_get_current_buf()
|
local cur = vim.api.nvim_get_current_buf()
|
||||||
local bufs = vim.fn.getbufinfo({ buflisted = 1 })
|
local bufs = vim.fn.getbufinfo({ buflisted = 1 })
|
||||||
local candidates = {}
|
local candidates = {}
|
||||||
for _, info in ipairs(bufs) do
|
for _, info in ipairs(bufs) do
|
||||||
if info.bufnr ~= cur and vim.bo[info.bufnr].buftype ~= 'terminal' then
|
if info.bufnr ~= cur and vim.bo[info.bufnr].buftype ~= 'terminal' then
|
||||||
table.insert(candidates, info)
|
table.insert(candidates, info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if #candidates == 0 then
|
if #candidates == 0 then
|
||||||
print('No previous non-terminal buffer')
|
print('No previous non-terminal buffer')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
table.sort(candidates, function(a, b) return a.lastused > b.lastused end)
|
table.sort(candidates, function(a, b) return a.lastused > b.lastused end)
|
||||||
vim.api.nvim_set_current_buf(candidates[1].bufnr)
|
vim.api.nvim_set_current_buf(candidates[1].bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
map('n', '<C-j>', toggle_term, { desc = 'Toggle terminal split' })
|
map('n', '<C-j>', toggle_term, { desc = 'Toggle terminal split' })
|
||||||
|
|||||||
+3
-3
@@ -86,12 +86,12 @@ if [ "$DO_LINKS" = true ]; then
|
|||||||
link_file "$DOTFILES_DIR/config/kanata" "$HOME/.config/kanata"
|
link_file "$DOTFILES_DIR/config/kanata" "$HOME/.config/kanata"
|
||||||
link_file "$DOTFILES_DIR/config/fish" "$HOME/.config/fish"
|
link_file "$DOTFILES_DIR/config/fish" "$HOME/.config/fish"
|
||||||
link_file "$DOTFILES_DIR/config/alacritty" "$HOME/.config/alacritty"
|
link_file "$DOTFILES_DIR/config/alacritty" "$HOME/.config/alacritty"
|
||||||
link_file "$DOTFILES_DIR/config/nvim" "$HOME/.config/nvim"
|
|
||||||
link_file "$DOTFILES_DIR/config/zed/keymap.json" "$HOME/.config/zed/keymap.json"
|
|
||||||
link_file "$DOTFILES_DIR/config/zed/settings.json" "$HOME/.config/zed/settings.json"
|
|
||||||
link_file "$DOTFILES_DIR/config/lf" "$HOME/.config/lf"
|
link_file "$DOTFILES_DIR/config/lf" "$HOME/.config/lf"
|
||||||
|
link_file "$DOTFILES_DIR/config/picom" "$HOME/.config/picom"
|
||||||
link_file "$DOTFILES_DIR/config/polybar" "$HOME/.config/polybar"
|
link_file "$DOTFILES_DIR/config/polybar" "$HOME/.config/polybar"
|
||||||
link_file "$DOTFILES_DIR/config/rofi" "$HOME/.config/rofi"
|
link_file "$DOTFILES_DIR/config/rofi" "$HOME/.config/rofi"
|
||||||
|
link_file "$DOTFILES_DIR/config/nvim" "$HOME/.config/nvim"
|
||||||
|
link_file "$DOTFILES_DIR/scripts/bin" "$HOME/.local/bin"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "🧾 Summary: $CREATED symlink(s) created or fixed, $SKIPPED skipped."
|
echo "🧾 Summary: $CREATED symlink(s) created or fixed, $SKIPPED skipped."
|
||||||
|
|||||||
Reference in New Issue
Block a user