fix(nvim): add workaround for lack of OSC 7

We are working around the problem
of neovim not outputting OSC 7
properly. The issue link is as
follows https://github.com/neovim/neovim/issues/2252
chezmoi
sgoudham 2 years ago
parent d8ed2ef2c2
commit 011dee305e
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -1,11 +1,17 @@
local wk = require("which-key")
-- what a workaround (screw you @nekowinston :sob:)
-- https://github.com/wez/wezterm/discussions/2426
-- https://github.com/neovim/neovim/issues/2252
wk.register({
["0"] = { "0^", "" }
})
["<A-N>"] = { "<cmd>lua io.popen('wezterm cli split-pane --right --cwd .')<cr>", "All my homies hate OSC 7" },
["<A-M>"] = { "<cmd>lua io.popen('wezterm cli split-pane --bottom --cwd .')<cr>", "All my homies hate OSC 7" },
}, { mode = { "n", "i", "v", "t" } })
-- normal binds
wk.register({
["0"] = { "0^", "Start of Line" },
["<CR>"] = { "o<ESC>", "New Line Without Insert" },
["<C-s>"] = { "<cmd>write<cr>", "Save" },
["<C-d>"] = { "<C-d>zz", "Half page down" },
["<C-u>"] = { "<C-u>zz", "Half page up" },

@ -1,4 +1,4 @@
local wezterm = require 'wezterm';
local wezterm = require("wezterm")
local act = wezterm.action
local wsl_domains = wezterm.default_wsl_domains()
@ -19,8 +19,8 @@ local function get_os()
end
if get_os() == "windows" then
default_prog = { 'wsl.exe', '~', '-d', 'Ubuntu-20.04' }
default_domain = 'WSL:Ubuntu-20.04'
default_prog = { "wsl.exe", "~", "-d", "Ubuntu-20.04" }
default_domain = "WSL:Ubuntu-20.04"
end
-- Superscript/Subscript
@ -122,7 +122,14 @@ wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_wid
return {
{ Background = { Color = s_bg } },
{ Foreground = { Color = s_fg } },
{ Text = " " .. tab.tab_index + 1 .. ": " .. tab.active_pane.title .. numberStyle(count, "superscript") .. " " },
{
Text = " "
.. tab.tab_index + 1
.. ": "
.. tab.active_pane.title
.. numberStyle(count, "superscript")
.. " ",
},
{ Background = { Color = e_bg } },
{ Foreground = { Color = e_fg } },
{ Text = RIGHT_DIVIDER },
@ -131,12 +138,14 @@ end)
return {
color_scheme = "Catppuccin Mocha",
font = wezterm.font_with_fallback { "VictorMono Nerd Font" },
font = wezterm.font_with_fallback({ "VictorMono Nerd Font" }),
font_size = 14,
background = { {
source = { File = "/home/hammy/Pictures/astronaut.png", },
hsb = { brightness = 0.15, hue = 1.0, saturation = 0.1, },
} },
background = {
{
source = { File = "Pictures/astronaut.png" },
hsb = { brightness = 0.15, hue = 1.0, saturation = 0.1 },
},
},
default_domain = default_domain,
wsl_domains = wsl_domains,
@ -145,12 +154,13 @@ return {
window_padding = { top = 0, bottom = 0, left = 0, right = 0 },
adjust_window_size_when_changing_font_size = false,
window_decorations = "RESIZE",
window_close_confirmation = 'NeverPrompt',
window_close_confirmation = "NeverPrompt",
use_fancy_tab_bar = false,
tab_bar_at_bottom = true,
hide_tab_bar_if_only_one_tab = true,
tab_max_width = 32,
scrollback_lines = 1000000,
exit_behavior = "CloseOnCleanExit",
clean_exit_codes = { 130 },
@ -159,26 +169,53 @@ return {
keys = {
-- Fullscreen
{ key = 'F11', action = wezterm.action.ToggleFullScreen, },
{ key = "F11", action = wezterm.action.ToggleFullScreen },
-- Zoom
{ key = 'z', mods = 'ALT|SHIFT', action = wezterm.action.TogglePaneZoomState, },
{ key = "z", mods = "ALT|SHIFT", action = wezterm.action.TogglePaneZoomState },
-- Copy / Paste
{ key = 'C', mods = 'CTRL', action = wezterm.action.Copy },
{ key = 'V', mods = 'CTRL', action = act.PasteFrom 'Clipboard' },
{ key = "C", mods = "CTRL", action = wezterm.action.Copy },
{ key = "V", mods = "CTRL", action = act.PasteFrom("Clipboard") },
-- Open Pane
{ key = "n", mods = "ALT|SHIFT", action = act({ SplitHorizontal = { domain = "CurrentPaneDomain" } }), },
{ key = "m", mods = "ALT|SHIFT", action = act({ SplitVertical = { domain = "CurrentPaneDomain" } }), },
-- https://github.com/wez/wezterm/discussions/2426
-- https://github.com/neovim/neovim/issues/2252
{
key = "n",
mods = "ALT|SHIFT",
action = wezterm.action_callback(function(window, pane)
if pane:get_title() == "nvim" then
window:perform_action(act.SendKey({ key = "n", mods = "ALT|SHIFT" }), pane)
else
window:perform_action(act.SplitPane({ direction = "Right", size = { Percent = 50 } }), pane)
end
end),
},
{
key = "m",
mods = "ALT|SHIFT",
action = wezterm.action_callback(function(window, pane)
if pane:get_title() == "nvim" then
window:perform_action(act.SendKey({ key = "m", mods = "ALT|SHIFT" }), pane)
else
window:perform_action(act.SplitPane({ direction = "Down", size = { Percent = 50 } }), pane)
end
end),
},
-- Navigating Panes
{ key = 'h', mods = 'ALT|SHIFT', action = act.ActivatePaneDirection 'Left', },
{ key = 'l', mods = 'ALT|SHIFT', action = act.ActivatePaneDirection 'Right', },
{ key = 'k', mods = 'ALT|SHIFT', action = act.ActivatePaneDirection 'Up', },
{ key = 'j', mods = 'ALT|SHIFT', action = act.ActivatePaneDirection 'Down', },
{ key = "h", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Left") },
{ key = "l", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Right") },
{ key = "k", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Up") },
{ key = "j", mods = "ALT|SHIFT", action = act.ActivatePaneDirection("Down") },
-- Close Pane
{ key = 'c', mods = 'ALT|SHIFT', action = wezterm.action.CloseCurrentPane { confirm = false }, },
{ key = "c", mods = "ALT|SHIFT", action = wezterm.action.CloseCurrentPane({ confirm = false }) },
-- Swap Panes
{ key = 'i', mods = 'ALT|SHIFT', action = act.PaneSelect { alphabet = 'asdfghjkl;', mode = 'Activate' } },
{ key = 's', mods = 'ALT|SHIFT', action = act.PaneSelect { alphabet = 'asdfghjkl;', mode = 'SwapWithActive' } },
{ key = "i", mods = "ALT|SHIFT", action = act.PaneSelect({ alphabet = "asdfghjkl;", mode = "Activate" }) },
{
key = "s",
mods = "ALT|SHIFT",
action = act.PaneSelect({ alphabet = "asdfghjkl;", mode = "SwapWithActive" }),
},
-- Resize Panes
{ key = "LeftArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Left", 5 } }) },
{ key = "DownArrow", mods = "ALT|SHIFT", action = act({ AdjustPaneSize = { "Down", 5 } }) },
@ -188,8 +225,8 @@ return {
-- New Tab
{ key = "n", mods = "CTRL|SHIFT", action = act({ SpawnTab = "CurrentPaneDomain" }) },
-- Swap Tabs
{ key = 'h', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },
{ key = 'l', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(1) },
{ key = "h", mods = "CTRL|SHIFT", action = act.ActivateTabRelative(-1) },
{ key = "l", mods = "CTRL|SHIFT", action = act.ActivateTabRelative(1) },
-- Open Links
{
@ -206,5 +243,9 @@ return {
end),
}),
},
}
-- ScrollBack To Prompt
{ key = "UpArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(-1) },
{ key = "DownArrow", mods = "CTRL|SHIFT", action = act.ScrollToPrompt(1) },
},
}

Loading…
Cancel
Save