vim-plugin-ruscmd icon indicating copy to clipboard operation
vim-plugin-ruscmd copied to clipboard

Double <C-ц> in nvim-tree

Open igorog opened this issue 1 year ago • 10 comments

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!

igorog avatar Sep 15 '24 09:09 igorog

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.

powerman avatar Sep 15 '24 09:09 powerman

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.

igorog avatar Sep 16 '24 00:09 igorog

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.

powerman avatar Sep 17 '24 10:09 powerman

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.

igorog avatar Sep 18 '24 11:09 igorog

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 avatar Sep 18 '24 13:09 powerman

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

powerman avatar Sep 18 '24 14:09 powerman

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 avatar Sep 21 '24 10:09 igorog

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

igorog avatar Sep 21 '24 10:09 igorog

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

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

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

powerman avatar Sep 21 '24 12:09 powerman

@igorog Я для Neovim сделал новый плагин: https://github.com/powerman/ruscmd.nvim. Но в процессе работы над ним нашёл ещё более продвинутый вариант, который автоматически создаёт русские маппинги для всех существующих: https://github.com/Wansmer/langmapper.nvim (как раз собирался реализовать эту фичу в своём, но теперь в этом нет смысла). В результате подключил оба - мой использую для команд (вроде :wq), потому что langmapper это вообще не поддерживает, а langmapper для всего остального. Вот пример, как я всё это добавил в свой конфиг: https://github.com/powerman/config.nvim/commit/e7b41f69f3c2682ca4b2c0b55a7626b252e26623

powerman avatar Nov 16 '24 21:11 powerman