powerman / vim-plugin-ruscmd

Vim plugin: support command mode in Russian keyboard layout
http://www.vim.org/scripts/script.php?script_id=3885
67 stars 15 forks source link

Double <C-ц> in nvim-tree #4

Open igorog opened 1 month ago

igorog commented 1 month ago

Double-clicking <C-W> in nvim-tree switches focus between panels. It didn’t work for me when I double-clicked <C-ц>with this config. Need to add: map unique <C-ц><C-ц> <C-W><C-W> in ruscmd.lua And... Thank you very much for such a useful plugin!

powerman commented 1 month ago

Well… In Vim 9.1 current plugin works (for switching between usual Vim windows). I suppose in Neovim it also should work (for switching between usual windows). Please check this. If it works, then it looks like nvim-tree specific issue… and in this case I'm unsure how to better handle it for now and it'll need some more investigation.

igorog commented 1 month ago

Well… In Vim 9.1 current plugin works (for switching between usual Vim windows). I suppose in Neovim it also should work (for switching between usual windows). Please check this. If it works, then it looks like nvim-tree specific issue… and in this case I'm unsure how to better handle it for now and it'll need some more investigation.

In order for panel switching to start working correctly in Neovim, you need to add one line to ruscmd.lua, which I wrote in my first message. And after this, the windows switch normally and on the Russian layout. I don’t know about Vim itself, how it works there. I can't check yet.

powerman commented 1 month ago

I've installed nvim-tree in Neovim - at a glance everything works as is. Can you please explain what exactly you're doing in details, what is a "panel" in nvim-tree, how do you open them, etc.

igorog commented 1 month ago

When you open a file in nvim-tree in split window, how do you switch between the tree view and the open file (in a split window)? For example, I switch using the keyboard shortcut <C-W><C-W> (you need to press it twice). And so, if the layout is in Russian, then switching between the file and the tree does not occur. To fix this, you need to add that line from my first post.

powerman commented 1 month ago

In this setup: изображение <C-W><C-W> in Russian layout jumps between all 4 windows.

Here is my setup (using Lazy):

return {
    {
        'nvim-tree/nvim-tree.lua',
        version = '*',
        lazy = false,
        dependencies = {
            'nvim-tree/nvim-web-devicons',
        },
        init = function()
            vim.g.loaded_netrw = 1
            vim.g.loaded_netrwPlugin = 1
            vim.opt.termguicolors = true
        end,
        config = function()
            require('nvim-tree').setup {}
        end,
    },
    'powerman/vim-plugin-ruscmd',
}
powerman commented 1 month ago

To fix this, you need to add that line from my first post.

At the moment this looks like a random change to me, which fixes something in your specific setup for unknown reason. To make this change I need to understand why exactly current implementation does not work in your setup, because root cause may be in your setup or conflict with some other plugin - and in some of these cases it should be fixed there (in your setup or some other plugin) instead.

So, please provide either more clear instruction what you're doing to trigger this issue, or, even better, a full repro.lua. You can use this one as a starting point and add to it minimal setup required to reproduce this issue:

--[[ Minimal config to reproduce issues ]]
--
--  Usage: `nvim -u repro.lua`

-- DO NOT change the paths and don't remove the colorscheme
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 = {
    'folke/tokyonight.nvim',
    -- add any other plugins here
}
require('lazy').setup(plugins, {
    root = root .. '/plugins',
})

vim.cmd.colorscheme 'tokyonight'
-- add anything else here
igorog commented 1 month ago

I have now completely clear installed [https://nvchad.com]NvChad(url) (this is a minimally customized Neovim) - it has the same problem. Single keys work perfectly (either in Russian or in English layout). But when it comes to keyboard shortcuts (paired with a<Control>or others) - the plugin stops working.

igorog commented 1 month ago

Почему-то удалился предыдущий коментарий? Раз тема касается русской раскладки, почему мы общаемся на английском? Итак, продолжу: Я начисто устанавливал и нвим и форки, не привнося в конфиги никаких изменений, и везде одиночные клавиши работают, а сочетания (с Контролом или Пробелом, например) - не работают, пока вручную не добавишь правки, наподобие как в первом моем посте. У меня Арч-линукс, и DWM в качестве WM (если это важно).

powerman commented 1 month ago

Ну, заодно практика в английском, двойная польза. :-)

Так что, repro сделаете? Пока у меня проблема не воспроизведётся - чинить нечего. Это же несложно, можно для начала просто добавить в repro выше оба плагина используя мой же пример ещё чуть выше и проверить, воспроизводится в таком виде у Вас или нет. Если нет - добавляйте в него части своего текущего конфига пока не воспроизведётся. Когда воспроизведётся пришлите получившийся repro.lua сюда и напишите точно что нужно нажимать после запуска nvim -u repro.lua чтобы увидеть проблему.

ОС/WM/etc. может иметь значение, но только если будет repro.lua и последовательность действий для воспроизведения, которая работает у Вас но всё ещё не работает у меня. Но тут скорее надо начинать со сравнения версии nvim.