diff options
author | matveyt <35012635+matveyt@users.noreply.github.com> | 2022-07-17 14:14:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-17 04:14:04 -0700 |
commit | eb9b93b5e025386ec9431c9d35a4a073d6946d1d (patch) | |
tree | 4b371f7cf93aab052770590b9b995f94c8662fbd /runtime/lua/vim/_editor.lua | |
parent | aae11865e1f74678a6415703ce1e076d195a2c26 (diff) | |
download | rneovim-eb9b93b5e025386ec9431c9d35a4a073d6946d1d.tar.gz rneovim-eb9b93b5e025386ec9431c9d35a4a073d6946d1d.tar.bz2 rneovim-eb9b93b5e025386ec9431c9d35a4a073d6946d1d.zip |
feat(defaults): mouse=nvi #19290
Problem:
Since right-click can now show a popup menu, we can provide messaging to
guide users who expect 'mouse' to be disabled by default. So 'mouse' can
now be enabled by default.
Solution:
Do it.
Closes #15521
Diffstat (limited to 'runtime/lua/vim/_editor.lua')
-rw-r--r-- | runtime/lua/vim/_editor.lua | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index 7febad6ef6..c4cc151bca 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -810,6 +810,44 @@ function vim.deprecate(name, alternative, version, plugin, backtrace) end end +--- Create builtin mappings (incl. menus). +--- Called once on startup. +function vim._init_default_mappings() + -- mappings + + --@private + local function map(mode, lhs, rhs) + vim.api.nvim_set_keymap(mode, lhs, rhs, { noremap = true, desc = 'Nvim builtin' }) + end + + map('n', 'Y', 'y$') + -- Use normal! <C-L> to prevent inserting raw <C-L> when using i_<C-O>. #17473 + map('n', '<C-L>', '<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>') + map('i', '<C-U>', '<C-G>u<C-U>') + map('i', '<C-W>', '<C-G>u<C-W>') + map('x', '*', 'y/\\V<C-R>"<CR>') + map('x', '#', 'y?\\V<C-R>"<CR>') + -- Use : instead of <Cmd> so that ranges are supported. #19365 + map('n', '&', ':&&<CR>') + + -- menus + + -- TODO VimScript, no l10n + vim.cmd([[ + aunmenu * + vnoremenu PopUp.Cut "+x + vnoremenu PopUp.Copy "+y + anoremenu PopUp.Paste "+gP + vnoremenu PopUp.Paste "+P + vnoremenu PopUp.Delete "_x + nnoremenu PopUp.Select\ All ggVG + vnoremenu PopUp.Select\ All gg0oG$ + inoremenu PopUp.Select\ All <C-Home><C-O>VG + anoremenu PopUp.-1- <Nop> + anoremenu PopUp.How-to\ disable\ mouse <Cmd>help disable-mouse<CR> + ]]) +end + require('vim._meta') return vim |