Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ghostty/config
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ background = #000000

# navigate between splits (vim-style)
# super+h requires remapping "Hide Ghostty" in macOS keyboard settings
keybind = super+h=goto_split:left
keybind = super+j=goto_split:bottom
keybind = super+k=goto_split:top
keybind = super+l=goto_split:right
keybind = unconsumed:super+h=goto_split:left
keybind = unconsumed:super+j=goto_split:bottom
keybind = unconsumed:super+k=goto_split:top
keybind = unconsumed:super+l=goto_split:right

# resize splits
keybind = super+right=resize_split:right,50
Expand Down
23 changes: 17 additions & 6 deletions nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,31 @@ keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)

local function winnav(direction)
local win_directions = { h = "h", j = "j", k = "k", l = "l" }
vim.cmd("wincmd " .. win_directions[direction])
local before = vim.fn.winnr()
vim.cmd("wincmd " .. direction)
if vim.fn.winnr() == before then
local map = { h = "left", j = "bottom", k = "top", l = "right" }
vim.fn.system({
"osascript",
"-e",
string.format(
'tell application "Ghostty" to perform action "goto_split:%s" on focused terminal of selected tab of front window',
map[direction]
),
})
end
end

keymap("n", "<M-h>", function()
keymap("n", "<D-h>", function()
winnav("h")
end, opts)
keymap("n", "<M-j>", function()
keymap("n", "<D-j>", function()
winnav("j")
end, opts)
keymap("n", "<M-k>", function()
keymap("n", "<D-k>", function()
winnav("k")
end, opts)
keymap("n", "<M-l>", function()
keymap("n", "<D-l>", function()
winnav("l")
end, opts)

Expand Down