What am I doing with my life...
This commit is contained in:
@@ -17,7 +17,7 @@ style.blinking = "Always"
|
|||||||
|
|
||||||
# THEME
|
# THEME
|
||||||
[colors.primary]
|
[colors.primary]
|
||||||
background = "#1b1b1b"
|
background = "#181818"
|
||||||
foreground = "#E4E4E4"
|
foreground = "#E4E4E4"
|
||||||
|
|
||||||
[colors.cursor]
|
[colors.cursor]
|
||||||
|
|||||||
+26
-26
@@ -153,29 +153,29 @@ set -g __fish_git_prompt_char_stagedstate '●'
|
|||||||
set -g __fish_git_prompt_char_untrackedfiles ''
|
set -g __fish_git_prompt_char_untrackedfiles ''
|
||||||
|
|
||||||
# Auto-attach to tmux on interactive shell start
|
# Auto-attach to tmux on interactive shell start
|
||||||
if status is-interactive && not set -q TMUX
|
# if status is-interactive && not set -q TMUX
|
||||||
# Get all session names matching shell, shell-2, shell-3 etc
|
# # Get all session names matching shell, shell-2, shell-3 etc
|
||||||
set sessions (tmux list-sessions -F '#S' 2>/dev/null)
|
# set sessions (tmux list-sessions -F '#S' 2>/dev/null)
|
||||||
|
#
|
||||||
if test (count $sessions) -eq 0
|
# if test (count $sessions) -eq 0
|
||||||
tmux new-session -s shell
|
# tmux new-session -s shell
|
||||||
else
|
# else
|
||||||
# Check if any shell session is unattached and attach it
|
# # Check if any shell session is unattached and attach it
|
||||||
set target (tmux list-sessions -F '#{session_name} #{session_attached}' 2>/dev/null \
|
# set target (tmux list-sessions -F '#{session_name} #{session_attached}' 2>/dev/null \
|
||||||
| grep '^shell' | grep ' 0$' | head -1 | awk '{print $1}')
|
# | grep '^shell' | grep ' 0$' | head -1 | awk '{print $1}')
|
||||||
|
#
|
||||||
if test -n "$target"
|
# if test -n "$target"
|
||||||
tmux attach -t $target
|
# tmux attach -t $target
|
||||||
else
|
# else
|
||||||
# All shell sessions attached — find next number
|
# # All shell sessions attached — find next number
|
||||||
set nums 1
|
# set nums 1
|
||||||
for s in $sessions
|
# for s in $sessions
|
||||||
if string match -rq '^shell-(\d+)$' $s
|
# if string match -rq '^shell-(\d+)$' $s
|
||||||
set nums $nums (string replace 'shell-' '' $s)
|
# set nums $nums (string replace 'shell-' '' $s)
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
set next (math (string join \n $nums | sort -n | tail -1) + 1)
|
# set next (math (string join \n $nums | sort -n | tail -1) + 1)
|
||||||
tmux new-session -s shell-$next
|
# tmux new-session -s shell-$next
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ map = vim.keymap.set
|
|||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.g.termguicolors = true
|
vim.g.termguicolors = true
|
||||||
-- mini.basics sets defaults see plugin folder for more
|
-- mini.basics sets defaults see plugin folder for more
|
||||||
|
vim.o.swapfile = false
|
||||||
vim.o.winborder = "single"
|
vim.o.winborder = "single"
|
||||||
vim.o.winblend = 0
|
vim.o.winblend = 0
|
||||||
vim.o.pumblend = 0
|
vim.o.pumblend = 0
|
||||||
@@ -30,9 +31,10 @@ map("v", "J", ":m '>+1<CR>gv=gv")
|
|||||||
map("v", "K", ":m '<-2<CR>gv=gv")
|
map("v", "K", ":m '<-2<CR>gv=gv")
|
||||||
map("v", "<S-Tab>", "<gv")
|
map("v", "<S-Tab>", "<gv")
|
||||||
map("v", "<Tab>" , ">gv")
|
map("v", "<Tab>" , ">gv")
|
||||||
map("n", "<leader>p", ":b#<CR>")
|
map("n", "<leader>l", ":b#<CR>")
|
||||||
map("n", "<leader>e", ":Ex<CR>")
|
map("n", "<leader>e", ":Ex<CR>")
|
||||||
map("n", "<leader>x", ":bd<CR>")
|
map("n", "<leader>x", ":bd<CR>")
|
||||||
|
|
||||||
require("autocmds")
|
require("autocmds")
|
||||||
|
require("terminal")
|
||||||
require("plugins")
|
require("plugins")
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
-- Terminals should open with insert mode
|
-- Terminals should open with insert mode
|
||||||
vim.api.nvim_create_autocmd("BufEnter", { pattern = "term://*", callback = function() vim.cmd("startinsert") end })
|
vim.api.nvim_create_autocmd({ "BufEnter", "TermEnter", "WinEnter" }, {
|
||||||
|
pattern = "term://*",
|
||||||
|
callback = function()
|
||||||
|
if vim.bo.buftype == "terminal" then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.cmd("startinsert")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- Start treesitter
|
-- Start treesitter
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
|||||||
@@ -13,19 +13,53 @@ require('nvim-highlight-colors').setup()
|
|||||||
require("mini.extra").setup()
|
require("mini.extra").setup()
|
||||||
require("mini.pairs").setup()
|
require("mini.pairs").setup()
|
||||||
require('mini.surround').setup()
|
require('mini.surround').setup()
|
||||||
|
require('mini.sessions').setup()
|
||||||
require("mini.statusline").setup()
|
require("mini.statusline").setup()
|
||||||
require('mini.basics').setup({options = { extra_ui = true }})
|
require('mini.basics').setup({options = { extra_ui = true }})
|
||||||
require('mini.completion').setup({lsp_completion = { auto_setup = true }})
|
require('mini.completion').setup({lsp_completion = { auto_setup = true }})
|
||||||
require("mini.pick").setup({
|
require("mini.pick").setup({
|
||||||
window = { config = function()
|
window = {
|
||||||
local height = math.floor(0.50 * vim.o.lines)
|
config = function()
|
||||||
local width = math.floor(0.50 * vim.o.columns)
|
local height = math.floor(0.50 * vim.o.lines)
|
||||||
return {
|
local width = math.floor(0.50 * vim.o.columns)
|
||||||
anchor = 'NW', height = height, width = width,
|
return {
|
||||||
row = math.floor(0.5 * (vim.o.lines - height)),
|
anchor = 'NW', height = height, width = width,
|
||||||
col = math.floor(0.5 * (vim.o.columns - width)),
|
row = math.floor(0.5 * (vim.o.lines - height)),
|
||||||
|
col = math.floor(0.5 * (vim.o.columns - width)),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Add global mappings here
|
||||||
|
mappings = {
|
||||||
|
delete_buffer = {
|
||||||
|
char = '<C-d>',
|
||||||
|
func = function()
|
||||||
|
local pick = require('mini.pick')
|
||||||
|
local current_match = pick.get_picker_matches().current
|
||||||
|
|
||||||
|
-- Safety check: only attempt deletion if the item has a valid buffer number
|
||||||
|
if current_match and current_match.bufnr then
|
||||||
|
local bufnr = current_match.bufnr
|
||||||
|
|
||||||
|
-- Safely delete the buffer
|
||||||
|
vim.api.nvim_buf_delete(bufnr, {})
|
||||||
|
|
||||||
|
-- Instantly remove it from the visible picker list
|
||||||
|
local buffer_items = pick.get_picker_items()
|
||||||
|
for i = #buffer_items, 1, -1 do
|
||||||
|
if buffer_items[i].bufnr == bufnr then
|
||||||
|
table.remove(buffer_items, i)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
pick.set_picker_items(buffer_items)
|
||||||
|
else
|
||||||
|
vim.notify("Current item is not a buffer", vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
end
|
||||||
}
|
}
|
||||||
end }
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd(":HighlightColors Off")
|
vim.cmd(":HighlightColors Off")
|
||||||
@@ -44,13 +78,14 @@ map("n", "<leader>h", ":lua MiniPick.builtin.help()<CR>")
|
|||||||
map("n", "<leader>d", ":lua MiniExtra.pickers.diagnostic()<CR>")
|
map("n", "<leader>d", ":lua MiniExtra.pickers.diagnostic()<CR>")
|
||||||
map("n", "<leader>ss", ":lua MiniPick.builtin.grep_live()<CR>")
|
map("n", "<leader>ss", ":lua MiniPick.builtin.grep_live()<CR>")
|
||||||
map("n", "<leader>tc", ":HighlightColors Toggle<CR>")
|
map("n", "<leader>tc", ":HighlightColors Toggle<CR>")
|
||||||
|
map("n", "<leader>pp", ":lua MiniSessions.select()<CR>")
|
||||||
|
map('n', '<leader>pa',
|
||||||
|
function()
|
||||||
|
-- Get the tail (:t) of the current working directory path (the folder name)
|
||||||
|
local session_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':t')
|
||||||
|
|
||||||
-- Highlight Overrides
|
-- Create/overwrite the session silently
|
||||||
-- local bg = "#1b1b1b"
|
require('mini.sessions').write(session_name)
|
||||||
-- local border = "#96A6C8"
|
print("Session '" .. session_name .. "' saved!")
|
||||||
-- vim.api.nvim_set_hl(0, "MiniPickBorder", { bg = bg, fg = border })
|
end
|
||||||
-- vim.api.nvim_set_hl(0, "MiniPickNormal", { bg = bg })
|
)
|
||||||
-- Completion popup background
|
|
||||||
-- vim.api.nvim_set_hl(0, "Pmenu", { bg = bg })
|
|
||||||
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = bg })
|
|
||||||
-- vim.api.nvim_set_hl(0, 'FloatBorder', { bg = bg, fg = border })
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
local term_win = nil
|
||||||
|
local term_buf = nil
|
||||||
|
|
||||||
|
local function toggle_term()
|
||||||
|
if term_win and vim.api.nvim_win_is_valid(term_win) then
|
||||||
|
vim.api.nvim_win_close(term_win, false)
|
||||||
|
term_win = nil
|
||||||
|
else
|
||||||
|
vim.cmd('botright vsplit')
|
||||||
|
term_win = vim.api.nvim_get_current_win()
|
||||||
|
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||||
|
vim.api.nvim_win_set_buf(term_win, term_buf)
|
||||||
|
else
|
||||||
|
vim.cmd('terminal')
|
||||||
|
term_buf = vim.api.nvim_get_current_buf()
|
||||||
|
end
|
||||||
|
vim.api.nvim_win_set_width(term_win, math.floor(vim.o.columns * 0.35))
|
||||||
|
vim.cmd('startinsert')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Jump to previous non-terminal buffer
|
||||||
|
local function prev_non_term_buf()
|
||||||
|
local cur = vim.api.nvim_get_current_buf()
|
||||||
|
local bufs = vim.fn.getbufinfo({ buflisted = 1 })
|
||||||
|
|
||||||
|
-- Walk buffer list in reverse to find last non-terminal buffer that isn't current
|
||||||
|
local history = vim.fn.execute('ls t') -- 't' flag = sort by last used time
|
||||||
|
local candidates = {}
|
||||||
|
for _, info in ipairs(bufs) do
|
||||||
|
local bufnr = info.bufnr
|
||||||
|
if bufnr ~= cur
|
||||||
|
and bufnr ~= term_buf
|
||||||
|
and vim.bo[bufnr].buftype ~= 'terminal'
|
||||||
|
then
|
||||||
|
table.insert(candidates, { bufnr = bufnr, lastused = info.lastused })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #candidates == 0 then
|
||||||
|
print('No previous non-terminal buffer')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Sort by lastused descending, pick the most recently used
|
||||||
|
table.sort(candidates, function(a, b) return a.lastused > b.lastused end)
|
||||||
|
vim.api.nvim_set_current_buf(candidates[1].bufnr)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Overrides init binding
|
||||||
|
map('n', '<leader>l', prev_non_term_buf, { desc = 'Go to previous non-terminal buffer' })
|
||||||
|
map('n', '<C-o>', function()
|
||||||
|
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||||
|
vim.api.nvim_set_current_buf(term_buf)
|
||||||
|
else
|
||||||
|
print('No terminal buffer open yet')
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
map('n', '<C-j>', toggle_term, { desc = 'Toggle terminal' })
|
||||||
|
|
||||||
|
-- terminal mode binds
|
||||||
|
map('t', '<C-j>', toggle_term, { desc = 'Toggle terminal' })
|
||||||
|
map('t', '<C-o>', '<C-\\><C-n><C-^>', { desc = 'Go to last buffer' })
|
||||||
@@ -45,7 +45,7 @@ bind e run-shell 'tmux popup -d "#{pane_current_path}" -xC -yC -w90% -h90% -E "~
|
|||||||
## Status bar design
|
## Status bar design
|
||||||
set -g status-justify left
|
set -g status-justify left
|
||||||
set -g status-position top
|
set -g status-position top
|
||||||
set -g status-bg '#181818'
|
set -g status-bg '#121212'
|
||||||
set -g status-fg '#DCD7BA'
|
set -g status-fg '#DCD7BA'
|
||||||
set -g status-left-length 20
|
set -g status-left-length 20
|
||||||
set -g status-right ' #[fg=colour232,bg="#af875f",bold]#{?client_prefix, [PFX] ,} #[fg="#1c1c1c",bg="#767676",bold][#S] '
|
set -g status-right ' #[fg=colour232,bg="#af875f",bold]#{?client_prefix, [PFX] ,} #[fg="#1c1c1c",bg="#767676",bold][#S] '
|
||||||
|
|||||||
Reference in New Issue
Block a user