Skip to content

[Bug]: wezterm CLI commands seem to run through shell, but it shouldn't #261

@mister-choo

Description

@mister-choo

Similar Issues

  • Before filing, I have searched for similar issues.

Neovim Version

NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1731601260

Multiplexer Integration

Wezterm

Multiplexer Version

wezterm version: 20241119-101432-4050072d x86_64-unknown-linux-gnu
Window Environment: X11 GNOME Shell
Lua Version: Lua 5.4

Steps to Reproduce

  1. Open nvim
  2. Create a wezterm split
  3. Navigate to split with direction keys

Expected Behavior

Navigation from wezterm pane to nvim pane to take the same amount of time as from nvim pane to wezterm

Actual Behavior

Navigating from nvim pane to wezterm pane happens with about 2 sec delay

Minimal Configuration to Reproduce

local root = vim.fn.fnamemodify('./.repro', ':p')

-- set stdpaths to use .repro
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
  vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end

-- bootstrap lazy
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    '--single-branch',
    'https://github.com/folke/lazy.nvim.git',
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  -- do not remove the colorscheme! it makes testing nicer
  'folke/tokyonight.nvim',
  'mrjones2014/smart-splits.nvim',
  -- add any other pugins here
}

require('lazy').setup(plugins, {
  root = root .. '/plugins',
})

require('smart-splits').setup({
  -- add any options here
})

vim.keymap.set('n', '<C-Left>', require('smart-splits').move_cursor_left)
vim.keymap.set('n', '<C-Down>', require('smart-splits').move_cursor_down)
vim.keymap.set('n', '<C-Up>', require('smart-splits').move_cursor_up)
vim.keymap.set('n', '<C-Right>', require('smart-splits').move_cursor_right)

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme! it makes testing nicer
vim.cmd([[colorscheme tokyonight]])

wezterm config:

local wezterm = require 'wezterm'
local config = {}
if wezterm.config_builder then
    config = wezterm.config_builder()
end

local function is_vim(pane)
    return pane:get_user_vars().IS_NVIM == 'true'
    -- return false
end

local direction_keys = {
    LeftArrow = 'Left',
    DownArrow = 'Down',
    UpArrow = 'Up',
    RightArrow = 'Right',
}

config.leader = { key = "a", mods = "CTRL" }

local function split_nav(key)
    return {
        key = key,
        mods = 'CTRL',
        action = wezterm.action_callback(function(win, pane)
            if is_vim(pane) then
                win:perform_action({ SendKey = { key = key, mods = 'CTRL' }, }, pane)
            else
                win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane)
            end
        end),
    }
end

config.keys = {
    {
        key = "v",
        mods = "LEADER",
        action = wezterm.action { SplitHorizontal = {
            domain = "CurrentPaneDomain" } }
    },
    split_nav('LeftArrow'),
    split_nav('RightArrow'),
    split_nav('DownArrow'),
    split_nav('UpArrow'),
}

return config

Additional Details and/or Screenshots

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions