From f409c93c1d5c45b5b00eb1df979febd2e9c7a032 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 18 Dec 2022 18:44:07 +0900 Subject: neovim:asterisk: update mappings --- .config/nvim/lua/plugins.lua | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 4fa0966..d72820d 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -289,35 +289,14 @@ packer.startup(function(use) -- Extend * and #. use { 'haya14busa/vim-asterisk', - config = function() - vim.cmd([[ - function! My_asterisk(ret, keeppos) - let g:asterisk#keeppos = a:keeppos - return a:ret - endfunction - ]]) - - -- Do not keep the relative cursor position. - vim.cmd([[ - nmap * My_asterisk('(asterisk-z*)', 0) - omap * My_asterisk('(asterisk-z*)', 0) - xmap * My_asterisk('(asterisk-z*)', 0) - nmap g* My_asterisk('(asterisk-gz*)', 0) - omap g* My_asterisk('(asterisk-gz*)', 0) - xmap g* My_asterisk('(asterisk-gz*)', 0) - ]]) - - -- Keep the relative cursor position (use offset like /s+1). - -- Note: I fix the search direction in typing 'n' and 'N', so there is no - -- difference between '*' and '#'. - vim.cmd([[ - nmap # My_asterisk('(asterisk-z*)', 1) - omap # My_asterisk('(asterisk-z*)', 1) - xmap # My_asterisk('(asterisk-z*)', 1) - nmap g# My_asterisk('(asterisk-gz*)', 1) - omap g# My_asterisk('(asterisk-gz*)', 1) - xmap g# My_asterisk('(asterisk-gz*)', 1) - ]]) + opt = true, + keys = { + {'n', '(asterisk-z*)'}, {'x', '(asterisk-z*)'}, + {'n', '(asterisk-gz*)'}, {'x', '(asterisk-gz*)'}, + }, + setup = function() + vim.keymap.set({'n', 'x'}, '*', '(asterisk-z*)') + vim.keymap.set({'n', 'x'}, 'g*', '(asterisk-gz*)') end, } -- NOTE: it is a fork version of jremmen/vim-ripgrep -- cgit v1.2.3-70-g09d2