feat: some shit
This commit is contained in:
parent
7bf1d29cd6
commit
00822e03a4
45
.luarc.json
45
.luarc.json
@ -4,5 +4,50 @@
|
||||
"require",
|
||||
"vim",
|
||||
"pcall"
|
||||
],
|
||||
"Lua.workspace.library": [
|
||||
"/home/max/.config/nvim",
|
||||
"/home/max/.local/share/nvim/site",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/FixCursorHold.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/alpha-nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/catppuccin",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/copilot-cmp",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/copilot.lua",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/editorconfig-vim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/friendly-snippets",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/fwatch.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/fzf",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/impatient.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/leap.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/lspkind.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/neotest-jest",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/neotest-vitest",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/nvim-scrollview",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/nvim-toggleterm.lua",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/nvim-treesitter-textobjects",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/popup.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/projections.nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/vim-dadbod",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/vim-dadbod-ui",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/vim-surround",
|
||||
"/home/max/.asdf/installs/neovim/nightly/share/nvim/runtime",
|
||||
"/home/max/.asdf/installs/neovim/nightly/lib/nvim",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/catppuccin/after",
|
||||
"/home/max/.local/share/nvim/site/pack/packer/start/cmp_luasnip/after",
|
||||
"${3rd}/luassert/library"
|
||||
]
|
||||
}
|
32
configs/nvim/lua/configs/lsp-glsl.lua
Normal file
32
configs/nvim/lua/configs/lsp-glsl.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local status_ok, util = pcall(require, "lspconfig.util")
|
||||
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local default_capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
editsNearCursor = true,
|
||||
},
|
||||
},
|
||||
offsetEncoding = { 'utf-8', 'utf-16' },
|
||||
}
|
||||
|
||||
local default_config = {
|
||||
cmd = { 'glslls' }, -- GLSL lsp executable from (https://github.com/svenstaro/glsl-language-server
|
||||
filetypes = { 'glsl' },
|
||||
root_dir = util.root_pattern('compile_commands.json', '.git'),
|
||||
single_file_support = true,
|
||||
capabilities = default_capabilities,
|
||||
}
|
||||
|
||||
return {
|
||||
default_configs = default_config,
|
||||
commands = {},
|
||||
docs = {
|
||||
description = [[
|
||||
Basic LSP support for GLSL using glslls --stdio
|
||||
]]
|
||||
},
|
||||
}
|
@ -187,17 +187,17 @@ lsp.yamlls.setup({
|
||||
["https://raw.githubusercontent.com/quantumblacklabs/kedro/develop/static/jsonschema/kedro-catalog-0.17.json"] = "conf/**/*catalog*",
|
||||
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
|
||||
["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2-file-provider.json"] = "rules.yml",
|
||||
["https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/traefik-v2.json"] = "traefik.yml"
|
||||
["https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/traefik-v2.json"] = "traefik.yml"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
lsp.glslls.setup(require("configs.lsp-glsl"))
|
||||
|
||||
lsp.ltex.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
cmd = { os.getenv("HOME") .. "/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls" },
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "de",
|
||||
|
68
configs/nvim/lua/configs/sessions.lua
Normal file
68
configs/nvim/lua/configs/sessions.lua
Normal file
@ -0,0 +1,68 @@
|
||||
local Workspace = require("projections.workspace")
|
||||
local Session = require("projections.session")
|
||||
|
||||
require("projections").setup({
|
||||
workspaces = { "~/Projects" }, -- Default workspaces to search for
|
||||
patterns = { ".git", ".svn", ".hg" }, -- Patterns to search for, these are NOT regexp
|
||||
store_hooks = {
|
||||
pre = function()
|
||||
require("nvim-tree").close()
|
||||
end,
|
||||
},
|
||||
restore_hooks = {
|
||||
post = function()
|
||||
require("nvim-tree").open()
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>o", function()
|
||||
local find_projects = require("telescope").extensions.projections.projections
|
||||
find_projects({
|
||||
action = function(selection)
|
||||
-- chdir is required since there might not be a session file
|
||||
vim.fn.chdir(selection.value)
|
||||
Session.restore(selection.value)
|
||||
end,
|
||||
})
|
||||
end, { desc = "Find projects" })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "DirChangedPre", "VimLeavePre" }, {
|
||||
callback = function()
|
||||
Session.store(vim.loop.cwd())
|
||||
end,
|
||||
desc = "Store project session",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||
callback = function()
|
||||
if 0 then
|
||||
return
|
||||
end
|
||||
local session_info = Session.info(vim.loop.cwd())
|
||||
if session_info == nil then
|
||||
Session.restore_latest()
|
||||
else
|
||||
Session.restore(vim.loop.cwd())
|
||||
end
|
||||
end,
|
||||
desc = "Restore last session automatically",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("RestoreSession", function()
|
||||
local session_info = Session.info(vim.loop.cwd())
|
||||
if session_info == nil then
|
||||
Session.restore_latest()
|
||||
else
|
||||
Session.restore(vim.loop.cwd())
|
||||
end
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("SaveSession", function()
|
||||
Session.store(vim.loop.cwd())
|
||||
end, {})
|
||||
|
||||
-- Add workspace command
|
||||
vim.api.nvim_create_user_command("AddWorkspace", function()
|
||||
Workspace.add(vim.loop.cwd())
|
||||
end, {})
|
@ -18,7 +18,7 @@ local default = {
|
||||
"--column",
|
||||
"--smart-case",
|
||||
"--ignore-file",
|
||||
"workerMain.js",
|
||||
".gitignore",
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
@ -41,7 +41,7 @@ local default = {
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
file_ignore_patterns = { "node_modules" },
|
||||
file_ignore_patterns = { "node_modules", "*pnpm-lock*" },
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "truncate" },
|
||||
winblend = 0,
|
||||
@ -64,5 +64,6 @@ telescope.setup(default)
|
||||
-- telescope.load_extension("themes");
|
||||
--
|
||||
telescope.load_extension("harpoon")
|
||||
-- telescope.load_extension("command_center")
|
||||
telescope.load_extension("projections")
|
||||
telescope.load_extension("git_worktree")
|
||||
telescope.load_extension("notify")
|
||||
|
@ -23,7 +23,7 @@ map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options)
|
||||
map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", options)
|
||||
|
||||
map("n", "K", "<cmd>Lspsaga hover_doc<CR>", { silent = true })
|
||||
map("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", { silent = true })
|
||||
-- map("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", { silent = true })
|
||||
map("n", "<leader>e", "<cmd>Lspsaga show_cursor_diagnostics<CR>", { silent = true })
|
||||
map("n", "<Leader>rn", "<cmd>Lspsaga rename<CR>", options)
|
||||
map({ "n", "v" }, "<leader>c", "<cmd>Lspsaga code_action<CR>", { silent = true })
|
||||
|
@ -2,6 +2,7 @@
|
||||
-- General --
|
||||
-------------
|
||||
local set = vim.opt
|
||||
local g = vim.g;
|
||||
set.swapfile = false -- Don't use swapfile
|
||||
set.updatetime = 0 -- Faster completion
|
||||
set.encoding = "utf-8" -- The encoding displayed
|
||||
@ -40,6 +41,7 @@ set.ruler = true -- Show the cursor position all the time
|
||||
set.splitbelow = true -- Horizontal splits will automatically be below
|
||||
set.splitright = true -- Vertical splits will automatically be to the right
|
||||
set.conceallevel = 0 -- So that I can see `` in markdown files
|
||||
g.markdown_fenced_languages = { "javascript", "typescript", "bash", "lua", "go", "rust", "c", "cpp" }
|
||||
set.tabstop = 2 -- Insert 2 spaces for a tab
|
||||
set.number = true -- Line numbers
|
||||
set.background = "dark" -- tell vim what the background color looks like
|
||||
|
@ -73,15 +73,16 @@ return packer.startup(function(use)
|
||||
---------------------
|
||||
|
||||
use("junegunn/fzf")
|
||||
use({ "ggandor/leap.nvim",
|
||||
use({
|
||||
"ggandor/leap.nvim",
|
||||
config = function()
|
||||
local leap = require("leap")
|
||||
leap.add_default_mappings()
|
||||
leap.setup({})
|
||||
end })
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
config = function()
|
||||
require("configs.telescope")
|
||||
end,
|
||||
@ -97,7 +98,6 @@ return packer.startup(function(use)
|
||||
use("williamboman/mason-lspconfig.nvim")
|
||||
use("jose-elias-alvarez/null-ls.nvim")
|
||||
use("folke/lsp-colors.nvim")
|
||||
-- use("kosayoda/nvim-lightbulb")
|
||||
use({
|
||||
"folke/trouble.nvim",
|
||||
event = "BufRead",
|
||||
@ -189,7 +189,17 @@ return packer.startup(function(use)
|
||||
--------------------
|
||||
-- IDE Type Stuff --
|
||||
--------------------
|
||||
use("ThePrimeagen/vim-be-good")
|
||||
use({ "ThePrimeagen/git-worktree.nvim",
|
||||
config = function()
|
||||
require("git-worktree").setup()
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"GnikDroy/projections.nvim",
|
||||
config = function()
|
||||
require("configs.sessions")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Dap Debugger -- Have not yet been able to set this up
|
||||
-- use({ "mfussenegger/nvim-dap" })
|
||||
|
@ -28,6 +28,7 @@ set $grimshot $sway_scripts/grimshot
|
||||
set $screenclip wl-copy < "$($grimshot --notify save area $screenshot_dir/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png)"
|
||||
set $screenshot wl-copy < "$($grimshot --notify save screen $screenshot_dir/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png)"
|
||||
set $windowshot wl-copy < "$($grimshot --notify save window $screenshot_dir/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png)"
|
||||
set $screenvideo wf-recorder -g "$(slurp)" -f "$screenshot_dir/scrn-$(date +'%Y-%m-%d-%H-%M-%S').mp4"
|
||||
|
||||
# Default Programs
|
||||
set $term wezterm
|
||||
@ -272,6 +273,7 @@ input "1739:24385:Synaptics_TM2438-005" {
|
||||
bindsym $mod+s exec $screenshot
|
||||
# -- Area Screenshot
|
||||
bindsym $mod+Shift+s exec $screenclip
|
||||
bindsym $mod+Alt+s exec $screenvideo
|
||||
# -- Select Window
|
||||
bindsym $mod+Control+s exec $windowshot
|
||||
|
||||
|
@ -1,30 +1,146 @@
|
||||
local wezterm = require("wezterm")
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
|
||||
local padding = 30
|
||||
local default_prog
|
||||
local default_cwd
|
||||
local font_size
|
||||
local tab_font_size
|
||||
local initial_rows
|
||||
local inital_cols
|
||||
|
||||
local function scheme_for_appearance(appearance)
|
||||
if appearance:find("Dark") then
|
||||
return "3024 Night"
|
||||
if string.find(wezterm.target_triple, "windows") then
|
||||
default_prog = { "wsl.exe" };
|
||||
default_cwd = os.getenv("HOME");
|
||||
tab_font_size = 9.0;
|
||||
font_size = 10.7;
|
||||
initial_rows = 43;
|
||||
initial_cols = 180;
|
||||
end
|
||||
|
||||
if string.find(wezterm.target_triple, "darwin") then
|
||||
tab_font_size = 15.0;
|
||||
font_size = 16;
|
||||
initial_rows = 38;
|
||||
initial_cols = 120;
|
||||
end
|
||||
|
||||
local keys = {
|
||||
-- Keyboard Navigation
|
||||
--- delete words backwards
|
||||
{ key = "Backspace", mods = "CTRL", action = { SendKey = { key = "U", mods = "CTRL" } } },
|
||||
{ key = "Backspace", mods = "CMD", action = { SendKey = { key = "U", mods = "CTRL" } } },
|
||||
{ key = "Backspace", mods = "ALT", action = { SendKey = { key = "W", mods = "CTRL" } } },
|
||||
|
||||
--- home and end
|
||||
{ key = "LeftArrow", mods = "CTRL", action = { SendKey = { key = "Home" } } },
|
||||
{ key = "LeftArrow", mods = "CMD", action = { SendKey = { key = "Home" } } },
|
||||
{ key = "RightArrow", mods = "CTRL", action = { SendKey = { key = "End" } } },
|
||||
{ key = "RightArrow", mods = "CMD", action = { SendKey = { key = "End" } } },
|
||||
|
||||
--- move one word
|
||||
{ key = "LeftArrow", mods = "ALT", action = { SendKey = { key = "LeftArrow", mods = "CTRL" } } },
|
||||
{ key = "RightArrow", mods = "ALT", action = { SendKey = { key = "RightArrow", mods = "CTRL" } } },
|
||||
|
||||
--- ctrl + jk keyboard navigation
|
||||
{ key = "k", mods = "ALT", action = { SendKey = { key = "UpArrow" } } },
|
||||
{ key = "k", mods = "CMD", action = { SendKey = { key = "UpArrow" } } },
|
||||
{ key = "j", mods = "ALT", action = { SendKey = { key = "DownArrow" } } },
|
||||
{ key = "j", mods = "CMD", action = { SendKey = { key = "DownArrow" } } },
|
||||
|
||||
--- accept completion on ctrl|alt|cmd + .
|
||||
{ key = ".", mods = "CTRL", action = { SendKey = { key = "RightArrow" } } },
|
||||
{ key = ".", mods = "ALT", action = { SendKey = { key = "RightArrow" } } },
|
||||
{ key = ".", mods = "CMD", action = { SendKey = { key = "RightArrow" } } },
|
||||
|
||||
-- Fullscreen
|
||||
{ key = "Enter", mods = "CTRL", action = "ToggleFullScreen" },
|
||||
{ key = "Enter", mods = "CMD", action = "ToggleFullScreen" },
|
||||
{ key = "Enter", mods = "ALT", action = "ToggleFullScreen" },
|
||||
|
||||
-- Clear Screen
|
||||
{ key = "l", mods = "CMD", action = { SendKey = { key = "l", mods = "CTRL" } } },
|
||||
{ key = "l", mods = "ALT", action = { SendKey = { key = "l", mods = "CTRL" } } },
|
||||
{ key = "k", mods = "CMD", action = { SendKey = { key = "l", mods = "CTRL" } } },
|
||||
|
||||
-- Copy/Paste
|
||||
{ key = "c", mods = "ALT", action = "Copy" },
|
||||
{ key = "c", mods = "CMD", action = "Copy" },
|
||||
{ key = "v", mods = "ALT", action = "Paste" },
|
||||
{ key = "v", mods = "CMD", action = "Paste" },
|
||||
|
||||
-- Open New Window
|
||||
{ key = "t", mods = "CMD", action = { SpawnTab = "CurrentPaneDomain" } },
|
||||
{ key = "t", mods = "ALT", action = { SpawnTab = "CurrentPaneDomain" } },
|
||||
{ key = "n", mods = "CMD", action = "SpawnWindow" },
|
||||
{ key = "n", mods = "ALT", action = "SpawnWindow" },
|
||||
{ key = "w", mods = "ALT", action = { EmitEvent = "CloseCurrentTab" } },
|
||||
{ key = "w", mods = "CMD", action = { EmitEvent = "CloseCurrentTab" } },
|
||||
|
||||
-- Open the config
|
||||
{ key = ",", mods = "ALT", action = { SendString = "vim ~/.config/wezterm/wezterm.lua\r\n" } },
|
||||
{ key = ",", mods = "CMD", action = { SendString = "vim ~/.config/wezterm/wezterm.lua\r\n" } },
|
||||
};
|
||||
|
||||
-- ALT-Tab
|
||||
for i = 1, 9 do
|
||||
table.insert(keys, { key = tostring(i), mods = "ALT", action = wezterm.action { ActivateTab = i - 1 } })
|
||||
table.insert(keys, { key = tostring(i), mods = "CTRL", action = wezterm.action { ActivateTab = i - 1 } });
|
||||
end
|
||||
|
||||
-- Delegate close confirmation to some apps such as VIM, etc.
|
||||
wezterm.on("CloseCurrentTab", function(window, pane)
|
||||
function is_vim()
|
||||
local current_process = pane:get_title():upper()
|
||||
return current_process:sub(- #"NVIM") == "NVIM" or current_process:sub(1, #"NVIM") == "NVIM" or
|
||||
current_process:sub(- #"VIM") == "VIM" or current_process:sub(1, #"VIM") == "VIM" or
|
||||
current_process:sub(- #"VI") == "VI" or current_process:sub(1, #"VI") == "VI"
|
||||
end
|
||||
|
||||
if is_vim() then
|
||||
window:perform_action(wezterm.action {
|
||||
SendKey = { key = "Z", mods = "CTRL" }
|
||||
}, pane)
|
||||
else
|
||||
return "Catppuccin Latte"
|
||||
end
|
||||
window:perform_action(wezterm.action {
|
||||
CloseCurrentTab = { confirm = false }
|
||||
}, pane)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Colors
|
||||
local colors = {
|
||||
-- Tab Bar Ayu Mirage
|
||||
}
|
||||
|
||||
local color_schemes = {
|
||||
["Ayu"] = {
|
||||
background = "#0f1419",
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
font = wezterm.font("FiraCodeNerdFont"),
|
||||
font_size = 13,
|
||||
-- You can specify some parameters to influence the font selection;
|
||||
-- for example, this selects a Bold, Italic font variant.
|
||||
-- color_scheme = "Batman",
|
||||
use_fancy_tab_bar = false,
|
||||
hide_tab_bar_if_only_one_tab = true,
|
||||
alternate_buffer_wheel_scroll_speed = 1,
|
||||
color_scheme = scheme_for_appearance(wezterm.gui.get_appearance()),
|
||||
window_close_confirmation = "AlwaysPrompt",
|
||||
window_padding = {
|
||||
left = padding,
|
||||
right = padding,
|
||||
top = padding,
|
||||
bottom = padding,
|
||||
},
|
||||
-- General
|
||||
default_prog = default_prog,
|
||||
default_cwd = default_cwd,
|
||||
exit_behavior = "Close",
|
||||
|
||||
-- Key Bindings
|
||||
keys = keys,
|
||||
|
||||
-- Window
|
||||
initial_rows = initial_rows,
|
||||
initial_cols = initial_cols,
|
||||
window_padding = { left = 1, right = 1, top = 0, bottom = 0 },
|
||||
|
||||
-- Appearance and Colors
|
||||
color_scheme = "Ayu",
|
||||
colors = colors,
|
||||
color_schemes = color_schemes,
|
||||
window_decorations = "RESIZE",
|
||||
default_cursor_style = "SteadyBlock",
|
||||
audible_bell = "Disabled",
|
||||
font_size = font_size,
|
||||
harfbuzz_features = { "calt=0", "clig=0", "liga=0" },
|
||||
window_frame = { font_size = tab_font_size, }
|
||||
}
|
||||
|
||||
|
@ -1,146 +1,30 @@
|
||||
local wezterm = require 'wezterm'
|
||||
local act = wezterm.action
|
||||
local wezterm = require("wezterm")
|
||||
|
||||
local default_prog
|
||||
local default_cwd
|
||||
local font_size
|
||||
local tab_font_size
|
||||
local initial_rows
|
||||
local inital_cols
|
||||
local padding = 30
|
||||
|
||||
if string.find(wezterm.target_triple, "windows") then
|
||||
default_prog = { "wsl.exe" };
|
||||
default_cwd = os.getenv("HOME");
|
||||
tab_font_size = 9.0;
|
||||
font_size = 10.7;
|
||||
initial_rows = 43;
|
||||
initial_cols = 180;
|
||||
end
|
||||
|
||||
if string.find(wezterm.target_triple, "darwin") then
|
||||
tab_font_size = 15.0;
|
||||
font_size = 16;
|
||||
initial_rows = 38;
|
||||
initial_cols = 120;
|
||||
end
|
||||
|
||||
local keys = {
|
||||
-- Keyboard Navigation
|
||||
--- delete words backwards
|
||||
{ key = "Backspace", mods = "CTRL", action = { SendKey = { key = "U", mods = "CTRL" } } },
|
||||
{ key = "Backspace", mods = "CMD", action = { SendKey = { key = "U", mods = "CTRL" } } },
|
||||
{ key = "Backspace", mods = "ALT", action = { SendKey = { key = "W", mods = "CTRL" } } },
|
||||
|
||||
--- home and end
|
||||
{ key = "LeftArrow", mods = "CTRL", action = { SendKey = { key = "Home" } } },
|
||||
{ key = "LeftArrow", mods = "CMD", action = { SendKey = { key = "Home" } } },
|
||||
{ key = "RightArrow", mods = "CTRL", action = { SendKey = { key = "End" } } },
|
||||
{ key = "RightArrow", mods = "CMD", action = { SendKey = { key = "End" } } },
|
||||
|
||||
--- move one word
|
||||
{ key = "LeftArrow", mods = "ALT", action = { SendKey = { key = "LeftArrow", mods = "CTRL" } } },
|
||||
{ key = "RightArrow", mods = "ALT", action = { SendKey = { key = "RightArrow", mods = "CTRL" } } },
|
||||
|
||||
--- ctrl + jk keyboard navigation
|
||||
{ key = "k", mods = "ALT", action = { SendKey = { key = "UpArrow" } } },
|
||||
{ key = "k", mods = "CMD", action = { SendKey = { key = "UpArrow" } } },
|
||||
{ key = "j", mods = "ALT", action = { SendKey = { key = "DownArrow" } } },
|
||||
{ key = "j", mods = "CMD", action = { SendKey = { key = "DownArrow" } } },
|
||||
|
||||
--- accept completion on ctrl|alt|cmd + .
|
||||
{ key = ".", mods = "CTRL", action = { SendKey = { key = "RightArrow" } } },
|
||||
{ key = ".", mods = "ALT", action = { SendKey = { key = "RightArrow" } } },
|
||||
{ key = ".", mods = "CMD", action = { SendKey = { key = "RightArrow" } } },
|
||||
|
||||
-- Fullscreen
|
||||
{ key = "Enter", mods = "CTRL", action = "ToggleFullScreen" },
|
||||
{ key = "Enter", mods = "CMD", action = "ToggleFullScreen" },
|
||||
{ key = "Enter", mods = "ALT", action = "ToggleFullScreen" },
|
||||
|
||||
-- Clear Screen
|
||||
{ key = "l", mods = "CMD", action = { SendKey = { key = "l", mods = "CTRL" } } },
|
||||
{ key = "l", mods = "ALT", action = { SendKey = { key = "l", mods = "CTRL" } } },
|
||||
{ key = "k", mods = "CMD", action = { SendKey = { key = "l", mods = "CTRL" } } },
|
||||
|
||||
-- Copy/Paste
|
||||
{ key = "c", mods = "ALT", action = "Copy" },
|
||||
{ key = "c", mods = "CMD", action = "Copy" },
|
||||
{ key = "v", mods = "ALT", action = "Paste" },
|
||||
{ key = "v", mods = "CMD", action = "Paste" },
|
||||
|
||||
-- Open New Window
|
||||
{ key = "t", mods = "CMD", action = { SpawnTab = "CurrentPaneDomain" } },
|
||||
{ key = "t", mods = "ALT", action = { SpawnTab = "CurrentPaneDomain" } },
|
||||
{ key = "n", mods = "CMD", action = "SpawnWindow" },
|
||||
{ key = "n", mods = "ALT", action = "SpawnWindow" },
|
||||
{ key = "w", mods = "ALT", action = { EmitEvent = "CloseCurrentTab" } },
|
||||
{ key = "w", mods = "CMD", action = { EmitEvent = "CloseCurrentTab" } },
|
||||
|
||||
-- Open the config
|
||||
{ key = ",", mods = "ALT", action = { SendString = "vim ~/.config/wezterm/wezterm.lua\r\n" } },
|
||||
{ key = ",", mods = "CMD", action = { SendString = "vim ~/.config/wezterm/wezterm.lua\r\n" } },
|
||||
};
|
||||
|
||||
-- ALT-Tab
|
||||
for i = 1, 9 do
|
||||
table.insert(keys, { key = tostring(i), mods = "ALT", action = wezterm.action { ActivateTab = i - 1 } })
|
||||
table.insert(keys, { key = tostring(i), mods = "CTRL", action = wezterm.action { ActivateTab = i - 1 } });
|
||||
end
|
||||
|
||||
-- Delegate close confirmation to some apps such as VIM, etc.
|
||||
wezterm.on("CloseCurrentTab", function(window, pane)
|
||||
function is_vim()
|
||||
local current_process = pane:get_title():upper()
|
||||
return current_process:sub(- #"NVIM") == "NVIM" or current_process:sub(1, #"NVIM") == "NVIM" or
|
||||
current_process:sub(- #"VIM") == "VIM" or current_process:sub(1, #"VIM") == "VIM" or
|
||||
current_process:sub(- #"VI") == "VI" or current_process:sub(1, #"VI") == "VI"
|
||||
end
|
||||
|
||||
if is_vim() then
|
||||
window:perform_action(wezterm.action {
|
||||
SendKey = { key = "Z", mods = "CTRL" }
|
||||
}, pane)
|
||||
local function scheme_for_appearance(appearance)
|
||||
if appearance:find("Dark") then
|
||||
return "3024 Night"
|
||||
else
|
||||
window:perform_action(wezterm.action {
|
||||
CloseCurrentTab = { confirm = false }
|
||||
}, pane)
|
||||
return "Catppuccin Latte"
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Colors
|
||||
local colors = {
|
||||
-- Tab Bar Ayu Mirage
|
||||
}
|
||||
|
||||
local color_schemes = {
|
||||
["Ayu"] = {
|
||||
background = "#0f1419",
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
-- General
|
||||
default_prog = default_prog,
|
||||
default_cwd = default_cwd,
|
||||
exit_behavior = "Close",
|
||||
|
||||
-- Key Bindings
|
||||
keys = keys,
|
||||
|
||||
-- Window
|
||||
initial_rows = initial_rows,
|
||||
initial_cols = initial_cols,
|
||||
window_padding = { left = 1, right = 1, top = 0, bottom = 0 },
|
||||
|
||||
-- Appearance and Colors
|
||||
color_scheme = "Ayu",
|
||||
colors = colors,
|
||||
color_schemes = color_schemes,
|
||||
window_decorations = "RESIZE",
|
||||
default_cursor_style = "SteadyBlock",
|
||||
audible_bell = "Disabled",
|
||||
font_size = font_size,
|
||||
harfbuzz_features = { "calt=0", "clig=0", "liga=0" },
|
||||
window_frame = { font_size = tab_font_size, }
|
||||
font = wezterm.font("FiraCodeNerdFont"),
|
||||
font_size = 13,
|
||||
-- You can specify some parameters to influence the font selection;
|
||||
-- for example, this selects a Bold, Italic font variant.
|
||||
-- color_scheme = "Batman",
|
||||
use_fancy_tab_bar = false,
|
||||
hide_tab_bar_if_only_one_tab = true,
|
||||
alternate_buffer_wheel_scroll_speed = 1,
|
||||
color_scheme = scheme_for_appearance(wezterm.gui.get_appearance()),
|
||||
window_close_confirmation = "AlwaysPrompt",
|
||||
window_padding = {
|
||||
left = padding,
|
||||
right = padding,
|
||||
top = padding,
|
||||
bottom = padding,
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user