Skip to content

Commit cf91d84

Browse files
committed
Moving sunaku/tmux-navigate plugins configurations to its plugin file.
After moving to Lua based configs and the Lazy plugin-manager, plugins can now be configured separately instead of globally. Signed-off-by: Yoni Bettan <yonibettan@gmail.com>
1 parent 8cb38e3 commit cf91d84

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

dotfiles/nvim/init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
require("config.options")
22
require("config.autocmds")
33
require("config.mappings")
4-
require("config.tmux")
54

65
require("config.lazy")

dotfiles/nvim/lua/config/tmux.lua

Lines changed: 0 additions & 16 deletions
This file was deleted.

dotfiles/nvim/lua/plugins/tmux-navigate.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,22 @@
22
return {
33
{
44
'sunaku/tmux-navigate',
5+
config = function()
6+
if vim.env.TMUX then
7+
local function tmux_or_split(wincmd, tmuxdir)
8+
local previous = vim.fn.winnr()
9+
vim.cmd("wincmd " .. wincmd)
10+
if previous == vim.fn.winnr() then
11+
vim.fn.system("tmux select-pane -" .. tmuxdir)
12+
vim.cmd("redraw!")
13+
end
14+
end
15+
16+
vim.keymap.set("n", "<C-h>", function() tmux_or_split("h", "L") end, { silent = true })
17+
vim.keymap.set("n", "<C-j>", function() tmux_or_split("j", "D") end, { silent = true })
18+
vim.keymap.set("n", "<C-k>", function() tmux_or_split("k", "U") end, { silent = true })
19+
vim.keymap.set("n", "<C-l>", function() tmux_or_split("l", "R") end, { silent = true })
20+
end
21+
end,
522
},
623
}

0 commit comments

Comments
 (0)