This commit is contained in:
max_richter 2023-02-25 17:12:20 +01:00
parent 265e4df8f3
commit 2f600e438b
19 changed files with 982 additions and 246 deletions

View File

@ -59,6 +59,9 @@ source $HOME/.dotfiles/configs/zsh/functions.zsh
## ALIASES ##
source $HOME/.dotfiles/configs/zsh/aliases.sh
## WEZTERM INTEGRATIONS ##
source $HOME/.dotfiles/configs/zsh/wezterm.sh
## LOADING PROGRAMS
export PATH="$PATH:$HOME/bin"
export PATH="$PATH:/usr/sbin"
@ -120,6 +123,7 @@ if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
# tmux attach-session -t $USER || tmux new-session -s $USER
fi
source "$HOME/."
export PNPM_HOME="$HOME/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"

View File

@ -1,13 +1,11 @@
require("max.core.bootstrap")
require("max.theme.statuscolumn");
require("max.core.plugins")
require("max.core.autocommands")
require("max.core.keymappings")
require("max.overlays")
require("max.core.options")
vim.cmd("colorscheme catppuccin")

View File

@ -1,75 +1,73 @@
{
"ChatGPT.nvim": { "branch": "main", "commit": "dac83f630fc6aafd256b149a2c2ae0d4466ec85e" },
"Comment.nvim": { "branch": "master", "commit": "eab2c83a0207369900e92783f56990808082eac2" },
"FixCursorHold.nvim": { "branch": "master", "commit": "70a9516a64668cbfe59f31b66d0a21678c5e9b12" },
"LuaSnip": { "branch": "master", "commit": "d404ec306bfa4cdb0c3605dbb17e8a93a9597337" },
"alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" },
"ChatGPT.nvim": { "branch": "main", "commit": "3f6fd348df53b9d15aa0a58709562cf0a3b4636a" },
"Comment.nvim": { "branch": "master", "commit": "6821b3ae27a57f1f3cf8ed030e4a55d70d0c4e43" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "f7c845749aba6096f041a73a26ba64f3817bab99" },
"alpha-nvim": { "branch": "main", "commit": "b6c7b5d9d6d2633722255abf2be3ecb8733e8d2d" },
"autolist.nvim": { "branch": "main", "commit": "f8b4c11b79b0fef77a64b03810839a1abbbc67d5" },
"boole.nvim": { "branch": "main", "commit": "f4f9996f91159e54b8f1893b20e2e599c91bc1bd" },
"catppuccin": { "branch": "main", "commit": "8769e767f12f5bf0b7d1250ee067088e7054809a" },
"catppuccin": { "branch": "main", "commit": "4175759297350557315987d479fb687a9f0b781f" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" },
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"copilot-cmp": { "branch": "master", "commit": "b732a58ac8b7287b981cd9f0d9c0f61e5e9d5760" },
"copilot.lua": { "branch": "master", "commit": "a54e7b11a2c6efc9ddd3f42e56cf7d9eed1a9683" },
"dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" },
"flit.nvim": { "branch": "main", "commit": "be110f9814a45788d10537fd59b3c76d956bb7ad" },
"friendly-snippets": { "branch": "main", "commit": "a6f7a1609addb4e57daa6bedc300f77f8d225ab7" },
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
"copilot-cmp": { "branch": "master", "commit": "976d687a97ed986c3043eccd4449a3cf2476f3d1" },
"copilot.lua": { "branch": "master", "commit": "ca68fc39f656d4025c5e0acc2faf07a28be3a389" },
"flit.nvim": { "branch": "main", "commit": "980e80e8fe44caaeb9de501c8e97a559b17db2f4" },
"friendly-snippets": { "branch": "main", "commit": "6fa50a94ba5378bb73013a6e163376d8e69bd8a5" },
"git-conflict.nvim": { "branch": "main", "commit": "80bc8931d4ed8c8c4d289a08e1838fcf4741408d" },
"git-worktree.nvim": { "branch": "master", "commit": "d7f4e2584e81670154f07ca9fa5dd791d9c1b458" },
"gitsigns.nvim": { "branch": "main", "commit": "ec4742a7eebf68bec663041d359b95637242b5c3" },
"lazy.nvim": { "branch": "main", "commit": "3d2dcb2d5ef99106c5ff412da88c6f59a9f8a693" },
"leap.nvim": { "branch": "main", "commit": "f565a9c4d92245d8b619235bebeaa73cc38aa40e" },
"gitsigns.nvim": { "branch": "main", "commit": "f388995990aba04cfdc7c3ab870c33e280601109" },
"lazy.nvim": { "branch": "main", "commit": "8077428e63feb0f3bf795d53b23ba1695b28ab0e" },
"leap.nvim": { "branch": "main", "commit": "9a69febb2e5a4f5f5a55dd2d7173098fde917bc5" },
"lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" },
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
"lspsaga.nvim": { "branch": "main", "commit": "46231733235e44e9c4b32ddd9de1e77e37bc377f" },
"lspsaga.nvim": { "branch": "main", "commit": "a626bdeedf2e601f8dcd9274b2d035dd4ee21165" },
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "53f3a8bdcb77d4a95b082fd57e12173f353c6c3e" },
"mason.nvim": { "branch": "main", "commit": "4952a48722b3fa01e03c67ab939d5b7d3037309e" },
"mini.nvim": { "branch": "main", "commit": "551a8726ab382cb02b1e925512162da478ff3811" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "8238865e1d9c61f1a260c290653f2c419503e0a9" },
"neodev.nvim": { "branch": "main", "commit": "70cab52c9d19e982f306716534e90c37a254b046" },
"neotest": { "branch": "master", "commit": "392808a91d6ee28d27cbfb93c9fd9781759b5d00" },
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "93e58e100f37ef4fb0f897deeed20599dae9d128" },
"mason.nvim": { "branch": "main", "commit": "01dfdfd36be77cb1195b60d580315bf4e2d8e62c" },
"mini.nvim": { "branch": "main", "commit": "4b565c1499332b226fe31fe0dac363a95d6f5ddc" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "74040b34278910d9b467fd914862e2a9a1ebacaa" },
"neotest": { "branch": "master", "commit": "b06b0ccbddc61acfe781689da969d2e0117b3dfe" },
"neotest-jest": { "branch": "main", "commit": "821bb227e31259307db30c88671a1c3724f78637" },
"neotest-vitest": { "branch": "main", "commit": "d6577b191e16c174bffbec1eadfcd65c22fdcc0d" },
"no-neck-pain.nvim": { "branch": "main", "commit": "26085b03b99bbd298fefe51ad65f1dd6debafb5e" },
"noice.nvim": { "branch": "main", "commit": "34f7cf628666c6eb0c93fbe8a0490e977ac78b7b" },
"no-neck-pain.nvim": { "branch": "main", "commit": "cefd610a8c0d6e96ca43c2dafc3736e169b49e33" },
"noice.nvim": { "branch": "main", "commit": "d8a1f3056ad713b5d471048f8d029264828e22c0" },
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
"null-ls.nvim": { "branch": "main", "commit": "8f5d730021497233c39d3adbf4b8043d4be163f8" },
"nvim-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" },
"null-ls.nvim": { "branch": "main", "commit": "689cdd78f70af20a37b5309ebc287ac645ae4f76" },
"nvim-cmp": { "branch": "main", "commit": "7a3b1e76f74934b12fda82158237c6ad8bfd3d40" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-dap": { "branch": "master", "commit": "0e376f00e7fac143e29e1017d2ac2cc3df13d185" },
"nvim-dap-ui": { "branch": "master", "commit": "885e958ff9de30cfbc359259eccf28cc493ad46b" },
"nvim-dap": { "branch": "master", "commit": "72684a4d70f0ecd45efe5ea76e9510e0b2e4d600" },
"nvim-dap-ui": { "branch": "master", "commit": "bdb94e3853d11b5ce98ec182e5a3719d5c0ef6fd" },
"nvim-dap-vscode-js": { "branch": "main", "commit": "e7c05495934a658c8aa10afd995dacd796f76091" },
"nvim-lspconfig": { "branch": "master", "commit": "902d6aa31450d26e11bedcbef8af5b6fe2e1ffe8" },
"nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" },
"nvim-scrollbar": { "branch": "main", "commit": "6a2065fbcd032075a06d2ab54508b69842bc4496" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "19aad0f41f47affbba1274f05e3c067e6d718e1e" },
"nvim-treesitter": { "branch": "master", "commit": "24d5be6e7192a855a0eba21829717614fa1cf54e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "249d90a84df63f3ffff65fcc06a45d58415672de" },
"nvim-lspconfig": { "branch": "master", "commit": "62856b20751b748841b0f3ec5a10b1e2f6a6dbc9" },
"nvim-notify": { "branch": "master", "commit": "9c987081390753b625e2d94e749e80e9b4a3e082" },
"nvim-recorder": { "branch": "main", "commit": "89c1fb1139fac0a4b42faf54beaf363be104550b" },
"nvim-scrollbar": { "branch": "main", "commit": "75210c554e935740448cfb532d8a671ae544bb1b" },
"nvim-toggleterm.lua": { "branch": "main", "commit": "1f47ea9cda973af3f1742a71841f3914f5b1469f" },
"nvim-treesitter": { "branch": "master", "commit": "ad8798795c71a00e796e1919c905a6bf815e9359" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "2f3583001e2bf793480f38cf0d055571787b0259" },
"nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
"nvim-ufo": { "branch": "main", "commit": "b70c9ef0f8e2673a11387a39185ff249e00df19f" },
"nvim-web-devicons": { "branch": "master", "commit": "2b96193abe4372e18e4f4533895a42a466d53c17" },
"persisted.nvim": { "branch": "main", "commit": "325cda4fb406601929fbc2084816dc5e49d5e5aa" },
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
"nvim-web-devicons": { "branch": "master", "commit": "4709a504d2cd2680fb511675e64ef2790d491d36" },
"persisted.nvim": { "branch": "main", "commit": "4d761446a43977aeab0a0744da3843ddfd6a357c" },
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"promise-async": { "branch": "main", "commit": "7fa127fa80e7d4d447e0e2c78e99af4355f4247b" },
"sniprun": { "branch": "master", "commit": "79806dad094770a1563ac0227c9692f7592df744" },
"rest.nvim": { "branch": "main", "commit": "0fdb69f328529b34a2279c14be63b3325dc52740" },
"sniprun": { "branch": "master", "commit": "6511fd71e751ed80ea374ef096ec5187682241cd" },
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
"telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" },
"telescope.nvim": { "branch": "master", "commit": "a486ac3e8fb2198f3636da1927ed57a28836fbd8" },
"todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" },
"translate.nvim": { "branch": "main", "commit": "7b2fd50c21ecfe536d572d62dcd3fa83acad3743" },
"trouble.nvim": { "branch": "main", "commit": "490f7fe6d227f4f7a64f00be8c7dcd7a508ed271" },
"undotree": { "branch": "master", "commit": "1a23ea84bd02c34f50d8e10a8b4bfc89597ffe4e" },
"vim-dadbod": { "branch": "master", "commit": "a09e40664e9cd30cd2b3f8866b796598302070f6" },
"trouble.nvim": { "branch": "main", "commit": "3b754285635a66a93aeb15fa71a23417d8997217" },
"undotree": { "branch": "master", "commit": "b6fdb95db53b7ceb23ddfe8a8211a3135d98eef0" },
"vim-dadbod": { "branch": "master", "commit": "389a2b0120f82b13d51ff7c07f5c13f9bc9f412f" },
"vim-dadbod-completion": { "branch": "master", "commit": "e71eb6140556c5ced80de6299a1fdfe22bd3c1b1" },
"vim-dadbod-ui": { "branch": "master", "commit": "f4ead480930a37dd2b0cf917a8c387ed36c2d86a" },
"which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" }
"vim-dadbod-ui": { "branch": "master", "commit": "caf45f54dad6150970331ac115e531524e418c7c" },
"which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" }
}

View File

@ -1,6 +1,5 @@
local luasnip = require("luasnip")
require("luasnip/loaders/from_vscode").lazy_load()
require("max.configs.snippets")
local lspkind = require("lspkind")
local cmp = require("cmp")

View File

@ -2,29 +2,19 @@ local mason = require("mason")
local mason_lsp = require("mason-lspconfig")
local lsp = require("lspconfig")
-- local null_ls = require("null-ls")
-- null_ls.setup({
-- sources = {
-- -- null_ls.builtins.formatting.stylua,
-- -- null_ls.builtins.code_actions.eslint_d,
-- -- null_ls.builtins.formatting.prettierd
-- -- require("null-ls").builtins.completion.spell,
-- },
-- })
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.eslint_d,
},
})
mason.setup()
mason_lsp.setup({
ensure_installed = { "sumneko_lua", "jsonls", "tsserver", "svelte", "cssls" },
ensure_installed = { "lua_ls", "jsonls", "tsserver", "svelte", "cssls", "prismals" },
})
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
local function on_attach(client, bufnr)
-- disable semantic tokens
-- client.server_capabilities.semanticTokensProvider = nil
if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
@ -63,7 +53,10 @@ custom_lsp.tsserver = {
root_dir = lsp.util.root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git"),
}
custom_lsp.sumneko_lua = {
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
custom_lsp.lua_ls = {
settings = {
Lua = {
runtime = {

View File

@ -45,9 +45,9 @@ local config = {
-- Disable sections and component separators
component_separators = "",
section_separators = "",
globalstatus = true,
theme = require("max.theme").name,
},
-- These are to remove the defaults
sections = {
lualine_a = {},
@ -130,6 +130,10 @@ ins_left({
},
})
ins_left {
require("recorder").recordingStatus
}
ins_left {
'lsp_progress',
display_components = { 'lsp_client_name', { 'title', 'percentage', 'message' } },
@ -151,9 +155,7 @@ ins_left {
title = { pre = '', post = ': ' },
lsp_client_name = { pre = '[', post = ']' },
spinner = { pre = '', post = '' },
message = { commenced = 'In Progress', completed = 'Completed' },
},
display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
timer = { progress_enddelay = 500, spinner = 1000, lsp_client_name_enddelay = 1000 },
spinner_symbols = { '🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 ' },
}

View File

@ -0,0 +1,15 @@
return {
"nvim-neo-tree/neo-tree.nvim",
cmd = "Neotree",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim"
},
init = function()
vim.g.neo_tree_remove_legacy_commands = 1
require("neo-tree").setup({
hide_root_node = true,
})
end,
}

View File

@ -0,0 +1,159 @@
return {
"nvim-tree/nvim-tree.lua",
cmd = "NvimTreeToggle",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
auto_reload_on_write = true,
create_in_closed_folder = false,
disable_netrw = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
ignore_buffer_on_setup = false,
open_on_setup = false,
open_on_setup_file = false,
open_on_tab = false,
sort_by = "name",
update_cwd = true,
reload_on_bufenter = true,
respect_buf_cwd = false,
view = {
adaptive_size = false,
width = 35,
hide_root_folder = true,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
mappings = {
list = {
{ key = "d", action = "trash" },
{ key = "D", action = "remove" },
},
},
},
renderer = {
add_trailing = false,
group_empty = true,
highlight_git = true,
highlight_opened_files = "none",
indent_markers = {
enable = true,
icons = {
corner = "",
edge = "",
none = "",
},
},
icons = {
webdev_colors = true,
git_placement = "signcolumn",
padding = " ",
symlink_arrow = "",
show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
},
glyphs = {
default = "",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md", "package.json" },
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {},
},
ignore_ft_on_setup = {},
system_open = {
cmd = "",
args = {},
},
diagnostics = {
enable = false,
show_on_dirs = false,
},
filters = {
dotfiles = false,
custom = {
"^.git$",
},
exclude = {},
},
git = {
enable = true,
ignore = false,
timeout = 400,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
open_file = {
quit_on_open = true,
resize_window = true,
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
trash = {
cmd = "trash",
require_confirm = true,
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
diagnostics = false,
git = false,
profile = false,
},
},
},
}

View File

@ -1,16 +1,3 @@
require("persisted").setup({
autoload = true,
before_save = function()
local tree = pcall(require, "nvim-tree")
if tree then
vim.cmd("Neotree close")
end
end,
after_save = function()
vim.cmd("Neotree show")
end,
after_source = function()
vim.lsp.stop_client(vim.lsp.get_active_clients())
vim.cmd("filetype detect")
end,
})

View File

@ -0,0 +1,38 @@
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({
cmd = "lazygit",
dir = "git_dir",
direction = "float",
float_opts = {
winblend = 0,
border = "shadow",
},
on_close = function()
Terminal:close()
end,
})
function _Lazygit_toggle()
lazygit:toggle()
end
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true })
local pnpm = Terminal:new({
dir = "git_dir",
direction = "float",
float_opts = {
winblend = 0,
padding = 10,
border = "shadow",
},
on_close = function()
Terminal:close()
end,
})
function _Pnpm_toggle()
pnpm:toggle()
end
vim.api.nvim_set_keymap("n", "<C-t>", "<cmd>lua _Pnpm_toggle()<CR>", { noremap = true, silent = true })

View File

@ -20,11 +20,11 @@ require("nvim-treesitter.configs").setup({
"tsx",
"go",
"lua",
"json",
"yaml",
"prisma",
},
highlight = { enable = true, disable = { "tsx" } },
highlight = { enable = true },
textobjects = {
select = {
enable = true,

View File

@ -30,12 +30,12 @@ map("n", "K", ":lua vim.lsp.buf.hover()<CR>", opts)
map("n", "<Leader>rn", ":lua vim.lsp.buf.rename()<CR>", opts)
map({ "n", "v" }, "<Leader>c", ":Lspsaga code_action<CR>", { silent = true })
map({ "n", "v" }, "<Leader>c", ":lua vim.lsp.buf.code_action()<CR>", { silent = true })
map({ "n", "v" }, "gr", ":Lspsaga lsp_finder<CR>", opts)
map("n", "<Leader>u", ":UndotreeToggle<CR>", opts)
map("n", "<Leader>wq", ":wqall!<CR>", opts)
map("n", "<Leader>li", ":LspInfo<CR>", opts)
map("n", "<Leader>lr", ":LspRestart<CR>", opts)
-- This is my [i]nspect section,
map("n", "<Leader>is", ":SymbolsOutline<cr>", opts) -- [i]nspect [s]ymbols
@ -92,6 +92,7 @@ map("v", "p", '"_dP', opts)
-- clear highlights after search
map("n", "<leader>cl", ":noh<CR>", opts);
map("n", "<leader>m", ":Mason<CR>", opts);
map("n", "<leader>l", ":Lazy<CR>", opts);

View File

@ -1,8 +1,15 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local g = vim.g
local opt = vim.opt
g.mapleader = " "
g.maplocalleader = " "
g.loaded_netrwPlugin = 1
g.loaded_netrw = 1
g.loaded_netrwSettings = 1
g.loaded_netrwFileHandlers = 1
g.loaded_netrw_gitignore = 1
opt.autowrite = true -- Enable auto write
opt.clipboard = "unnamedplus" -- Sync with system clipboard
opt.completeopt = "menu,menuone,noselect"

View File

@ -11,12 +11,14 @@ local plugins = {
---------------------
-- Theming Section --
---------------------
require("max.theme"),
--------------------
-- Layout Plugins --
--------------------
"nvim-lua/popup.nvim",
require("max.configs.neotree"),
{
"nvim-lualine/lualine.nvim",
lazy = false,
@ -42,12 +44,19 @@ local plugins = {
})
end
},
{ "shortcuts/no-neck-pain.nvim", cmd = "NoNeckPain", config = true },
{
"shortcuts/no-neck-pain.nvim",
cmd = "NoNeckPain",
config = true
},
{
"folke/noice.nvim",
event = "VeryLazy",
opts = {
lsp = {
progress = {
enabled = false
},
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
@ -69,19 +78,8 @@ local plugins = {
},
{
"stevearc/dressing.nvim",
enabled = false,
lazy = true,
init = function()
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.select = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.select(...)
end
---@diagnostic disable-next-line: duplicate-set-field
vim.ui.input = function(...)
require("lazy").load({ plugins = { "dressing.nvim" } })
return vim.ui.input(...)
end
end,
},
{
"folke/which-key.nvim",
@ -110,12 +108,16 @@ local plugins = {
require("gitsigns").setup()
end,
},
{
"akinsho/nvim-toggleterm.lua",
event = "VeryLazy",
config = function()
require("max.configs.toggleterm");
end,
},
{
"akinsho/git-conflict.nvim",
version = "*",
dependencies = {
"akinsho/nvim-toggleterm.lua",
},
event = "BufReadPost",
config = function()
require("git-conflict").setup()
@ -134,22 +136,6 @@ local plugins = {
dependencies = "kevinhwang91/promise-async",
config = require("max.configs.ufo"),
},
{
"nvim-neo-tree/neo-tree.nvim",
cmd = "Neotree",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim"
},
init = function()
vim.g.neo_tree_remove_legacy_commands = 1
require("neo-tree").setup({
hide_root_node = true,
highlight_background = "Normal",
})
end,
},
{
"goolord/alpha-nvim",
lazy = false,
@ -159,7 +145,7 @@ local plugins = {
}, -- startup screen
{
"numToStr/Comment.nvim",
event = "InsertEnter",
event = "BufReadPost",
config = function()
require("Comment").setup()
end,
@ -211,7 +197,7 @@ local plugins = {
"onsails/lspkind.nvim",
{ "lukas-reineke/lsp-format.nvim", config = true },
},
event = "InsertEnter",
event = "BufReadPost",
config = function()
require("max.configs.lsp")
end,
@ -252,11 +238,12 @@ local plugins = {
config = function()
require("boole").setup({
mappings = {
increment = '-',
decrement = '+'
increment = '+',
decrement = '-'
},
additions = {
{ "const", "let", "var" }
{ "const", "let", "var" },
{ "absolute", "relative", "fixed", "sticky" }
}
})
end,
@ -295,6 +282,23 @@ local plugins = {
--------------------
-- IDE Type Stuff --
--------------------
{
"rest-nvim/rest.nvim",
cmd = "RestNvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("rest-nvim").setup({})
end
},
{
"chrisgrieser/nvim-recorder",
event = "VeryLazy",
config = function()
require("recorder").setup({
logLevel = vim.log.levels.OFF,
})
end,
},
{
"jackMort/ChatGPT.nvim",
cmd = "ChatGPT",
@ -358,6 +362,39 @@ local plugins = {
},
}
local opts = { defaults = { lazy = true }, install = { colorscheme = { require("max.theme").name } } }
local opts = {
defaults = { lazy = true },
install = { colorscheme = { require("max.theme").name } },
change_detection = {
enabled = true, -- automatically check for config file changes and reload the ui
notify = true, -- get a notification when changes are found
},
performance = {
rtp = {
reset = true,
disabled_plugins = {
"gzip",
"zip",
"zipPlugin",
"fzf",
"tar",
"tarPlugin",
"getscript",
"getscriptPlugin",
"vimball",
"vimballPlugin",
"2html_plugin",
"matchit",
"matchparen",
"logiPat",
"rrhelper",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
},
},
}
}
require("lazy").setup(plugins, opts)

View File

@ -1,47 +0,0 @@
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({
cmd = "lazygit",
dir = "git_dir",
direction = "float",
float_opts = {
winblend = 0,
border = "shadow",
},
on_close = function()
Terminal:close()
end,
})
function _Lazygit_toggle()
lazygit:toggle()
end
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _Lazygit_toggle()<CR>", { noremap = true, silent = true })
local pnpm = Terminal:new({
cmd = "pnpm dev",
dir = "git_dir",
size = 5,
direction = "vertical",
})
function _Pnpm_toggle()
pnpm:toggle()
end
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _Pnpm_toggle()<CR>", { noremap = true, silent = true })
local chtConfig = Terminal:new({
cmd = "cht",
direction = "float",
})
function _ChtConfig_toggle()
chtConfig:toggle()
end
vim.api.nvim_set_keymap("n", "<Leader><C-l>", "<cmd>lua _ChtConfig_toggle()<CR>", { noremap = true, silent = true })
require("toggleterm").setup({
shade_terminals = true,
})

View File

@ -2,11 +2,9 @@ return {
"catppuccin/nvim",
name = "catppuccin",
lazy = false,
config = function()
vim.g.catppuccin_flavour = "frappe" -- latte, frappe, macchiato, mocha
require("catppuccin").setup({
transparent_background = true,
opts = {
-- transparent_background = true,
flavour = "mocha", -- latte, frappe, macchiato, mocha
compile = {
enabled = true,
path = vim.fn.stdpath("cache") .. "/catppuccin",
@ -39,8 +37,5 @@ return {
colored_indent_levels = false,
},
},
})
vim.cmd("colorscheme catppuccin")
end
}
} -- Enable Theming / Syntax

View File

@ -1 +1,2 @@
require("max.theme.statuscolumn")
return require("max.theme.catpuccin");

View File

@ -1,4 +1,34 @@
## ALIASIES ##
# This function emits an OSC 1337 sequence to set a user var
# associated with the current terminal pane.
# It requires the `base64` utility to be available in the path.
# This function is included in the wezterm shell integration script, but
# is reproduced here for clarity
__wezterm_set_user_var() {
if hash base64 2>/dev/null ; then
if [[ -z "${TMUX}" ]] ; then
printf "\033]1337;SetUserVar=%s=%s\007" "$1" `echo -n "$2" | base64`
else
# <https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it>
# Note that you ALSO need to add "set -g allow-passthrough on" to your tmux.conf
printf "\033Ptmux;\033\033]1337;SetUserVar=%s=%s\007\033\\" "$1" `echo -n "$2" | base64`
fi
fi
}
function _run_prog() {
# set PROG to the program being run
__wezterm_set_user_var "PROG" "$1"
# arrange to clear it when it is done
trap '__wezterm_set_user_var PROG ""' EXIT
# and now run the corresponding command, taking care to avoid looping
# with the alias definition
command "$@"
}
alias -s {yml,yaml,ts,json,js,vim,rc}=nvim
alias c="code ."
@ -11,8 +41,8 @@ alias pls='sudo -E env "PATH=$PATH"'
alias online="ping 1.1.1.1"
alias vim="nvim"
alias v="nvim"
alias vim="_run_prog nvim"
alias v="_run_prog nvim"
alias gcm="git commit -m "

519
configs/zsh/wezterm.sh Normal file
View File

@ -0,0 +1,519 @@
# shellcheck shell=bash
# This file hooks up shell integration for wezterm.
# It is suitable for zsh and bash.
#
# Although wezterm is mentioned here, the sequences used are not wezterm
# specific and may provide the same functionality for other terminals. Most
# terminals are good at ignoring OSC sequences that they don't understand, but
# if not there are some bypasses:
#
# WEZTERM_SHELL_SKIP_ALL - disables all
# WEZTERM_SHELL_SKIP_SEMANTIC_ZONES - disables zones
# WEZTERM_SHELL_SKIP_CWD - disables OSC 7 cwd setting
# WEZTERM_SHELL_SKIP_USER_VARS - disable user vars that capture information
# about running programs
# shellcheck disable=SC2166
if [ -z "${BASH_VERSION}" -a -z "${ZSH_NAME}" ] ; then
# Only for bash or zsh
return 0
fi
if [ "${WEZTERM_SHELL_SKIP_ALL}" = "1" ] ; then
return 0
fi
if [[ $- != *i* ]] ; then
# Shell integration is only useful in interactive sessions
return 0
fi
case "$TERM" in
linux | dumb )
# Avoid terminals that don't like OSC sequences
return 0
;;
esac
# This function wraps bash-preexec.sh so that it can be included verbatim
# in this file, even though it uses `return` to short-circuit in some cases.
__wezterm_install_bash_prexec() {
# bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions.
# https://github.com/rcaloras/bash-preexec
#
# 'preexec' functions are executed before each interactive command is
# executed, with the interactive command as its argument. The 'precmd'
# function is executed before each prompt is displayed.
#
# Author: Ryan Caloras (ryan@bashhub.com)
# Forked from Original Author: Glyph Lefkowitz
#
# V0.4.1
#
# General Usage:
#
# 1. Source this file at the end of your bash profile so as not to interfere
# with anything else that's using PROMPT_COMMAND.
#
# 2. Add any precmd or preexec functions by appending them to their arrays:
# e.g.
# precmd_functions+=(my_precmd_function)
# precmd_functions+=(some_other_precmd_function)
#
# preexec_functions+=(my_preexec_function)
#
# 3. Consider changing anything using the DEBUG trap or PROMPT_COMMAND
# to use preexec and precmd instead. Preexisting usages will be
# preserved, but doing so manually may be less surprising.
#
# Note: This module requires two Bash features which you must not otherwise be
# using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. If you override
# either of these after bash-preexec has been installed it will most likely break.
# Make sure this is bash that's running and return otherwise.
if [[ -z "${BASH_VERSION:-}" ]]; then
return 1;
fi
# Avoid duplicate inclusion
if [[ "${__bp_imported:-}" == "defined" ]]; then
return 0
fi
__bp_imported="defined"
# Should be available to each precmd and preexec
# functions, should they want it. $? and $_ are available as $? and $_, but
# $PIPESTATUS is available only in a copy, $BP_PIPESTATUS.
# TODO: Figure out how to restore PIPESTATUS before each precmd or preexec
# function.
__bp_last_ret_value="$?"
BP_PIPESTATUS=("${PIPESTATUS[@]}")
__bp_last_argument_prev_command="$_"
__bp_inside_precmd=0
__bp_inside_preexec=0
# Initial PROMPT_COMMAND string that is removed from PROMPT_COMMAND post __bp_install
__bp_install_string=$'__bp_trap_string="$(trap -p DEBUG)"\ntrap - DEBUG\n__bp_install'
# Fails if any of the given variables are readonly
# Reference https://stackoverflow.com/a/4441178
__bp_require_not_readonly() {
local var
for var; do
if ! ( unset "$var" 2> /dev/null ); then
echo "bash-preexec requires write access to ${var}" >&2
return 1
fi
done
}
# Remove ignorespace and or replace ignoreboth from HISTCONTROL
# so we can accurately invoke preexec with a command from our
# history even if it starts with a space.
__bp_adjust_histcontrol() {
local histcontrol
histcontrol="${HISTCONTROL//ignorespace}"
# Replace ignoreboth with ignoredups
if [[ "$histcontrol" == *"ignoreboth"* ]]; then
histcontrol="ignoredups:${histcontrol//ignoreboth}"
fi;
export HISTCONTROL="$histcontrol"
}
# This variable describes whether we are currently in "interactive mode";
# i.e. whether this shell has just executed a prompt and is waiting for user
# input. It documents whether the current command invoked by the trace hook is
# run interactively by the user; it's set immediately after the prompt hook,
# and unset as soon as the trace hook is run.
__bp_preexec_interactive_mode=""
# Trims leading and trailing whitespace from $2 and writes it to the variable
# name passed as $1
__bp_trim_whitespace() {
local var=${1:?} text=${2:-}
text="${text#"${text%%[![:space:]]*}"}" # remove leading whitespace characters
text="${text%"${text##*[![:space:]]}"}" # remove trailing whitespace characters
printf -v "$var" '%s' "$text"
}
# Trims whitespace and removes any leading or trailing semicolons from $2 and
# writes the resulting string to the variable name passed as $1. Used for
# manipulating substrings in PROMPT_COMMAND
__bp_sanitize_string() {
local var=${1:?} text=${2:-} sanitized
__bp_trim_whitespace sanitized "$text"
sanitized=${sanitized%;}
sanitized=${sanitized#;}
__bp_trim_whitespace sanitized "$sanitized"
printf -v "$var" '%s' "$sanitized"
}
# This function is installed as part of the PROMPT_COMMAND;
# It sets a variable to indicate that the prompt was just displayed,
# to allow the DEBUG trap to know that the next command is likely interactive.
__bp_interactive_mode() {
__bp_preexec_interactive_mode="on";
}
# This function is installed as part of the PROMPT_COMMAND.
# It will invoke any functions defined in the precmd_functions array.
__bp_precmd_invoke_cmd() {
# Save the returned value from our last command, and from each process in
# its pipeline. Note: this MUST be the first thing done in this function.
__bp_last_ret_value="$?" BP_PIPESTATUS=("${PIPESTATUS[@]}")
# Don't invoke precmds if we are inside an execution of an "original
# prompt command" by another precmd execution loop. This avoids infinite
# recursion.
if (( __bp_inside_precmd > 0 )); then
return
fi
local __bp_inside_precmd=1
# Invoke every function defined in our function array.
local precmd_function
for precmd_function in "${precmd_functions[@]}"; do
# Only execute this function if it actually exists.
# Test existence of functions with: declare -[Ff]
if type -t "$precmd_function" 1>/dev/null; then
__bp_set_ret_value "$__bp_last_ret_value" "$__bp_last_argument_prev_command"
# Quote our function invocation to prevent issues with IFS
"$precmd_function"
fi
done
return $__bp_last_ret_value
}
# Sets a return value in $?. We may want to get access to the $? variable in our
# precmd functions. This is available for instance in zsh. We can simulate it in bash
# by setting the value here.
__bp_set_ret_value() {
return ${1:-}
}
__bp_in_prompt_command() {
local prompt_command_array
IFS=$'\n;' read -rd '' -a prompt_command_array <<< "$PROMPT_COMMAND"
local trimmed_arg
__bp_trim_whitespace trimmed_arg "${1:-}"
local command trimmed_command
for command in "${prompt_command_array[@]:-}"; do
__bp_trim_whitespace trimmed_command "$command"
if [[ "$trimmed_command" == "$trimmed_arg" ]]; then
return 0
fi
done
return 1
}
# This function is installed as the DEBUG trap. It is invoked before each
# interactive prompt display. Its purpose is to inspect the current
# environment to attempt to detect if the current command is being invoked
# interactively, and invoke 'preexec' if so.
__bp_preexec_invoke_exec() {
# Save the contents of $_ so that it can be restored later on.
# https://stackoverflow.com/questions/40944532/bash-preserve-in-a-debug-trap#40944702
__bp_last_argument_prev_command="${1:-}"
# Don't invoke preexecs if we are inside of another preexec.
if (( __bp_inside_preexec > 0 )); then
return
fi
local __bp_inside_preexec=1
# Checks if the file descriptor is not standard out (i.e. '1')
# __bp_delay_install checks if we're in test. Needed for bats to run.
# Prevents preexec from being invoked for functions in PS1
if [[ ! -t 1 && -z "${__bp_delay_install:-}" ]]; then
return
fi
if [[ -n "${COMP_LINE:-}" ]]; then
# We're in the middle of a completer. This obviously can't be
# an interactively issued command.
return
fi
if [[ -z "${__bp_preexec_interactive_mode:-}" ]]; then
# We're doing something related to displaying the prompt. Let the
# prompt set the title instead of me.
return
else
# If we're in a subshell, then the prompt won't be re-displayed to put
# us back into interactive mode, so let's not set the variable back.
# In other words, if you have a subshell like
# (sleep 1; sleep 2)
# You want to see the 'sleep 2' as a set_command_title as well.
if [[ 0 -eq "${BASH_SUBSHELL:-}" ]]; then
__bp_preexec_interactive_mode=""
fi
fi
if __bp_in_prompt_command "${BASH_COMMAND:-}"; then
# If we're executing something inside our prompt_command then we don't
# want to call preexec. Bash prior to 3.1 can't detect this at all :/
__bp_preexec_interactive_mode=""
return
fi
local this_command
this_command=$(
export LC_ALL=C
HISTTIMEFORMAT= builtin history 1 | sed '1 s/^ *[0-9][0-9]*[* ] //'
)
# Sanity check to make sure we have something to invoke our function with.
if [[ -z "$this_command" ]]; then
return
fi
# Invoke every function defined in our function array.
local preexec_function
local preexec_function_ret_value
local preexec_ret_value=0
for preexec_function in "${preexec_functions[@]:-}"; do
# Only execute each function if it actually exists.
# Test existence of function with: declare -[fF]
if type -t "$preexec_function" 1>/dev/null; then
__bp_set_ret_value ${__bp_last_ret_value:-}
# Quote our function invocation to prevent issues with IFS
"$preexec_function" "$this_command"
preexec_function_ret_value="$?"
if [[ "$preexec_function_ret_value" != 0 ]]; then
preexec_ret_value="$preexec_function_ret_value"
fi
fi
done
# Restore the last argument of the last executed command, and set the return
# value of the DEBUG trap to be the return code of the last preexec function
# to return an error.
# If `extdebug` is enabled a non-zero return value from any preexec function
# will cause the user's command not to execute.
# Run `shopt -s extdebug` to enable
__bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command"
}
__bp_install() {
# Exit if we already have this installed.
if [[ "${PROMPT_COMMAND:-}" == *"__bp_precmd_invoke_cmd"* ]]; then
return 1;
fi
trap '__bp_preexec_invoke_exec "$_"' DEBUG
# Preserve any prior DEBUG trap as a preexec function
local prior_trap=$(sed "s/[^']*'\(.*\)'[^']*/\1/" <<<"${__bp_trap_string:-}")
unset __bp_trap_string
if [[ -n "$prior_trap" ]]; then
eval '__bp_original_debug_trap() {
'"$prior_trap"'
}'
preexec_functions+=(__bp_original_debug_trap)
fi
# Adjust our HISTCONTROL Variable if needed.
__bp_adjust_histcontrol
# Issue #25. Setting debug trap for subshells causes sessions to exit for
# backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash.
#
# Disabling this by default. It can be enabled by setting this variable.
if [[ -n "${__bp_enable_subshells:-}" ]]; then
# Set so debug trap will work be invoked in subshells.
set -o functrace > /dev/null 2>&1
shopt -s extdebug > /dev/null 2>&1
fi;
local existing_prompt_command
# Remove setting our trap install string and sanitize the existing prompt command string
existing_prompt_command="${PROMPT_COMMAND//$__bp_install_string[;$'\n']}" # Edge case of appending to PROMPT_COMMAND
existing_prompt_command="${existing_prompt_command//$__bp_install_string}"
__bp_sanitize_string existing_prompt_command "$existing_prompt_command"
# Install our hooks in PROMPT_COMMAND to allow our trap to know when we've
# actually entered something.
PROMPT_COMMAND=$'__bp_precmd_invoke_cmd\n'
if [[ -n "$existing_prompt_command" ]]; then
PROMPT_COMMAND+=${existing_prompt_command}$'\n'
fi;
PROMPT_COMMAND+='__bp_interactive_mode'
# Add two functions to our arrays for convenience
# of definition.
precmd_functions+=(precmd)
preexec_functions+=(preexec)
# Invoke our two functions manually that were added to $PROMPT_COMMAND
__bp_precmd_invoke_cmd
__bp_interactive_mode
}
# Sets an installation string as part of our PROMPT_COMMAND to install
# after our session has started. This allows bash-preexec to be included
# at any point in our bash profile.
__bp_install_after_session_init() {
# bash-preexec needs to modify these variables in order to work correctly
# if it can't, just stop the installation
__bp_require_not_readonly PROMPT_COMMAND HISTCONTROL HISTTIMEFORMAT || return
local sanitized_prompt_command
__bp_sanitize_string sanitized_prompt_command "$PROMPT_COMMAND"
if [[ -n "$sanitized_prompt_command" ]]; then
PROMPT_COMMAND=${sanitized_prompt_command}$'\n'
fi;
PROMPT_COMMAND+=${__bp_install_string}
}
# Run our install so long as we're not delaying it.
if [[ -z "${__bp_delay_install:-}" ]]; then
__bp_install_after_session_init
fi;
} # end of __wezterm_install_bash_prexec
# blesh provides it's own preexec mechanism which is recommended over bash-preexec
# See https://github.com/akinomyoga/ble.sh/wiki/Manual-%C2%A71-Introduction#user-content-fn-blehook for more details
if [[ ! -n "$BLE_VERSION" ]]; then
__wezterm_install_bash_prexec
fi
# This function emits an OSC 1337 sequence to set a user var
# associated with the current terminal pane.
# It requires the `base64` utility to be available in the path.
__wezterm_set_user_var() {
if hash base64 2>/dev/null ; then
if [[ -z "${TMUX}" ]] ; then
printf "\033]1337;SetUserVar=%s=%s\007" "$1" `echo -n "$2" | base64`
else
# <https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it>
# Note that you ALSO need to add "set -g allow-passthrough on" to your tmux.conf
printf "\033Ptmux;\033\033]1337;SetUserVar=%s=%s\007\033\\" "$1" `echo -n "$2" | base64`
fi
fi
}
# This function emits an OSC 7 sequence to inform the terminal
# of the current working directory. It prefers to use a helper
# command provided by wezterm if wezterm is installed, but falls
# back to a simple printf command otherwise.
__wezterm_osc7() {
if hash wezterm 2>/dev/null ; then
wezterm set-working-directory 2>/dev/null && return 0
# If the command failed (perhaps the installed wezterm
# is too old?) then fall back to the simple version below.
fi
printf "\033]7;file://%s%s\033\\" "${HOSTNAME}" "${PWD}"
}
# The semantic precmd and prexec functions generate semantic
# zones, marking up the prompt, the user input and the command
# output so that the terminal can better reason about the display.
__wezterm_semantic_precmd_executing=""
__wezterm_semantic_precmd() {
local ret="$?"
if [[ "$__wezterm_semantic_precmd_executing" != "0" ]] ; then
__wezterm_save_ps1="$PS1"
__wezterm_save_ps2="$PS2"
# Markup the left and right prompts so that the terminal
# knows that they are semantically prompt output.
if [[ -n "$ZSH_NAME" ]] ; then
PS1=$'%{\e]133;P;k=i\a%}'$PS1$'%{\e]133;B\a%}'
PS2=$'%{\e]133;P;k=s\a%}'$PS2$'%{\e]133;B\a%}'
else
PS1='\[\e]133;P;k=i\a\]'$PS1'\[\e]133;B\a\]'
PS2='\[\e]133;P;k=s\a\]'$PS2'\[\e]133;B\a\]'
fi
fi
if [[ "$__wezterm_semantic_precmd_executing" != "" ]] ; then
# Report last command status
printf "\033]133;D;%s;aid=%s\007" "$ret" "$$"
fi
# Fresh line and start the prompt
printf "\033]133;A;cl=m;aid=%s\007" "$$"
__wezterm_semantic_precmd_executing=0
}
function __wezterm_semantic_preexec() {
# Restore the original PS1/PS2
PS1="$__wezterm_save_ps1"
PS2="$__wezterm_save_ps2"
# Indicate that the command output begins here
printf "\033]133;C;\007"
__wezterm_semantic_precmd_executing=1
}
__wezterm_user_vars_precmd() {
__wezterm_set_user_var "WEZTERM_PROG" ""
__wezterm_set_user_var "WEZTERM_USER" "$(id -un)"
# Indicate whether this pane is running inside tmux or not
if [[ -n "${TMUX}" ]] ; then
__wezterm_set_user_var "WEZTERM_IN_TMUX" "1"
else
__wezterm_set_user_var "WEZTERM_IN_TMUX" "0"
fi
# You may set WEZTERM_HOSTNAME to a name you want to use instead
# of calling out to the hostname executable on every prompt print.
if [[ -z "${WEZTERM_HOSTNAME}" ]] ; then
if hash hostname 2>/dev/null ; then
__wezterm_set_user_var "WEZTERM_HOST" "$(hostname)"
elif hash hostnamectl 2>/dev/null ; then
__wezterm_set_user_var "WEZTERM_HOST" "$(hostnamectl hostname)"
fi
else
__wezterm_set_user_var "WEZTERM_HOST" "${WEZTERM_HOSTNAME}"
fi
}
__wezterm_user_vars_preexec() {
# Tell wezterm the full command that is being run
__wezterm_set_user_var "WEZTERM_PROG" "$1"
}
# Register the various functions; take care to perform osc7 after
# the semantic zones as we don't want to perturb the last command
# status before we've had a chance to report it to the terminal
if [[ -z "${WEZTERM_SHELL_SKIP_SEMANTIC_ZONES}" ]]; then
if [[ -n "$BLE_VERSION" ]]; then
blehook PRECMD+=__wezterm_semantic_precmd
blehook PREEXEC+=__wezterm_semantic_preexec
else
precmd_functions+=(__wezterm_semantic_precmd)
preexec_functions+=(__wezterm_semantic_preexec)
fi
fi
if [[ -z "${WEZTERM_SHELL_SKIP_USER_VARS}" ]]; then
if [[ -n "$BLE_VERSION" ]]; then
blehook PRECMD+=__wezterm_user_vars_precmd
blehook PREEXEC+=__wezterm_user_vars_preexec
else
precmd_functions+=(__wezterm_user_vars_precmd)
preexec_functions+=(__wezterm_user_vars_preexec)
fi
fi
if [[ -z "${WEZTERM_SHELL_SKIP_CWD}" ]] ; then
if [[ -n "$BLE_VERSION" ]]; then
blehook PRECMD+=__wezterm_osc7
else
precmd_functions+=(__wezterm_osc7)
fi
fi
true