Skip to content

Instantly share code, notes, and snippets.

@cynipe
Created December 25, 2022 16:40
Show Gist options
  • Save cynipe/f74d34264672951adce01f569dc08373 to your computer and use it in GitHub Desktop.
Save cynipe/f74d34264672951adce01f569dc08373 to your computer and use it in GitHub Desktop.
weztermおためし
local wezterm = require 'wezterm'
wezterm.on('open_in_nvim', function(window, pane)
local pane_buffer = pane:get_lines_as_text(10000)
local name = os.tmpname()
local file = io.open(name, 'w+')
file:write(pane_buffer)
file:flush()
file:close()
window:perform_action(
wezterm.action({
SpawnCommandInNewTab = { args = { 'nvim', name, '-c', 'call cursor(10000,0)' } },
}),
pane
)
wezterm.sleep_ms(1000)
os.remove(name)
end)
return {
font = wezterm.font('Cica'),
use_ime = true,
font_size = 12.0,
color_scheme = 'Solarized Dark (base16)',
adjust_window_size_when_changing_font_size = false,
window_background_opacity = 0.85,
-- binding
leader = { key = 't', mods = 'CTRL', timeout_milliseconds = 1000 },
keys = {
-- Send 'CTRL-T' to the terminal when pressing CTRL-T, CTRL-T
{ key = 't', mods = 'LEADER|CTRL', action = wezterm.action.SendString '\x24' },
-- copy modeもどき
{ key = '[', mods = 'LEADER|CTRL', action = wezterm.action { EmitEvent = 'open_in_nvim' } },
-- pane分割
{ key = '"', mods = 'LEADER|SHIFT', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' } },
{ key = '|', mods = 'LEADER|SHIFT', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' } },
-- pane移動
{ key = 'w', mods = 'LEADER|CTRL', action = wezterm.action.PaneSelect },
{ key = 'n', mods = 'LEADER|CTRL', action = wezterm.action.RotatePanes 'Clockwise' },
{ key = 'p', mods = 'LEADER|CTRL', action = wezterm.action.RotatePanes 'CounterClockwise' },
{ key = 'j', mods = 'LEADER|CTRL', action = wezterm.action { ActivatePaneDirection = 'Down' } },
{ key = 'k', mods = 'LEADER|CTRL', action = wezterm.action { ActivatePaneDirection = 'Up' } },
{ key = 'h', mods = 'LEADER|CTRL', action = wezterm.action { ActivatePaneDirection = 'Left' } },
{ key = 'l', mods = 'LEADER|CTRL', action = wezterm.action { ActivatePaneDirection = 'Right' } },
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment