diff options
| author | nsfisis <nsfisis@gmail.com> | 2022-12-18 18:44:07 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2022-12-18 18:44:10 +0900 |
| commit | f409c93c1d5c45b5b00eb1df979febd2e9c7a032 (patch) | |
| tree | 28d2a8859f9a3df97faa80170e9a88c478f1e35a | |
| parent | 4dfe35579ac34211b8ed0b3dcfc5ac9b320c49a8 (diff) | |
| download | dotfiles-f409c93c1d5c45b5b00eb1df979febd2e9c7a032.tar.gz dotfiles-f409c93c1d5c45b5b00eb1df979febd2e9c7a032.tar.zst dotfiles-f409c93c1d5c45b5b00eb1df979febd2e9c7a032.zip | |
neovim:asterisk: update mappings
| -rw-r--r-- | .config/nvim/lua/plugins.lua | 37 |
1 files 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 <expr> * My_asterisk('<Plug>(asterisk-z*)', 0) - omap <expr> * My_asterisk('<Plug>(asterisk-z*)', 0) - xmap <expr> * My_asterisk('<Plug>(asterisk-z*)', 0) - nmap <expr> g* My_asterisk('<Plug>(asterisk-gz*)', 0) - omap <expr> g* My_asterisk('<Plug>(asterisk-gz*)', 0) - xmap <expr> g* My_asterisk('<Plug>(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 <expr> # My_asterisk('<Plug>(asterisk-z*)', 1) - omap <expr> # My_asterisk('<Plug>(asterisk-z*)', 1) - xmap <expr> # My_asterisk('<Plug>(asterisk-z*)', 1) - nmap <expr> g# My_asterisk('<Plug>(asterisk-gz*)', 1) - omap <expr> g# My_asterisk('<Plug>(asterisk-gz*)', 1) - xmap <expr> g# My_asterisk('<Plug>(asterisk-gz*)', 1) - ]]) + opt = true, + keys = { + {'n', '<Plug>(asterisk-z*)'}, {'x', '<Plug>(asterisk-z*)'}, + {'n', '<Plug>(asterisk-gz*)'}, {'x', '<Plug>(asterisk-gz*)'}, + }, + setup = function() + vim.keymap.set({'n', 'x'}, '*', '<Plug>(asterisk-z*)') + vim.keymap.set({'n', 'x'}, 'g*', '<Plug>(asterisk-gz*)') end, } -- NOTE: it is a fork version of jremmen/vim-ripgrep |
