Thanks to visit codestin.com
Credit goes to github.com

Skip to content

powerman/ruscmd.nvim

Repository files navigation

ruscmd.nvim

License MIT Neovim 0.9+ Lua 5.1 Test Release

About

Neovim plugin to use NORMAL and CMDLINE modes with Russian keyboard layout.

With this plugin you can avoid switching between Russian/English keyboard layouts when you need to enter:

  • almost any command in NORMAL mode;
  • frequently used (it's configurable) command in Command-line mode.

Features

  • Supported Neovim versions: 0.9+.

  • Supported Russian keyboard layouts: ЙЦУКЕН.

  • Support all NORMAL mode keys except (keys are shown in English layout):

    Key English layout Russian layout
    Shift-\ | - to screen column [count] in the current line / - search forward
    / / - search forward . - repeat last change
    Shift-/ ? - search backward , - repeat latest f, t, F or T in opposite direction
    Shift-2 @ - execute the contents of register " - use {register} for next delete, yank or put
    Shift-4 $ - to the end of the line ; - repeat latest f, t, F or T [count] times
    Shift-6 ^ - to the first non-blank character of the line : - command-line mode
    Shift-7 & - repeat last substitute ? - search backward
  • Support user-provided global mappings. Neovim global default-mappings are enabled by default:

    • Y-default
    • v_Q-default
    • gc-default v_gc-default o_gc-default
    • gcc-default
    • ]d-default
    • [d-default
    • CTRL-W_d-default
    • K-lsp-default
  • Support user-provided command-line mode commands. These commands are enabled by default:

    • bd
    • bn
    • q
    • qa
    • w
    • wq
    • wqa

Installation

Install the plugin with your preferred package manager:

return {
    'powerman/ruscmd.nvim',
    opts = {
        -- Your configuration here, if any.
    },
}

Setup

You should call setup() to start using the plugin (package managers configured as shown above will do this for you).

require('ruscmd').setup {
    -- Your configuration here, if any.
}

Configuration

local defaults = {
    cabbrev = { 'bd', 'bn', 'q', 'qa', 'w', 'wq', 'wqa' },
    map = { -- :help default-mappings
        n = { 'Y', 'gc', 'gcc', ']d', '[d', '<C-W>d', 'K' },
        v = {},
        x = { 'Q', 'gc' },
        s = {},
        o = { 'gc' },
        i = {},
        l = {},
        c = {},
        t = {},
    },
}

Example. Add more commands and global mappings:

require('ruscmd').setup {
    cabbrev = { 'tabnew', 'Lazy' },
    map = {
        n = { 'sa', ']c', '[c' },
    },
}

Example. Disable default commands and global mappings:

require('ruscmd').setup {
    replace = true, -- If true then user-provided keys will replace defaults for these keys.
    cabbrev = {},
    map = {
        n = {},
        x = {},
        o = {},
    },
}

Usage

Just do not switch from Russian to English keyboard layout in most cases.

Troubleshooting

Command-line commands without args does not work

If simple commands without args like (:q) does not work then most likely reason is a conflict between cabbrev used by this plugin and cnoremap <CR> used by some other plugin (e.g. one implementing completions for the command-line mode).

The right fix is to ask that other plugin author to change cnoremap <CR> to cmap <CR>. Sometimes you can work around this in your nvim config, see example for nvim-cmp.

See also

About

Neovim plugin to use NORMAL and COMMAND modes in Russian keyboard layout

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages