From 5c8a7dfae8bd143cfc94f27395a6623dbe5280f4 Mon Sep 17 00:00:00 2001 From: Joe Date: Tue, 5 Sep 2023 11:28:47 +0200 Subject: up --- .config/nvim/lua/bindings.lua | 69 ++++++++++++++++--------------------------- .config/nvim/lua/plug.lua | 2 +- 2 files changed, 27 insertions(+), 44 deletions(-) diff --git a/.config/nvim/lua/bindings.lua b/.config/nvim/lua/bindings.lua index 08d72e1..c77960f 100644 --- a/.config/nvim/lua/bindings.lua +++ b/.config/nvim/lua/bindings.lua @@ -1,6 +1,26 @@ -vim.call('which_key#register', '\\', 'g:which_key_map') -vim.g.which_key_map = {} -vim.keymap.set('n', 'c', '"_c', { noremap = true, silent = false }) +local wk = require("which-key") +wk.register({ + b = { ':Buffers', 'buffers', noremap = true, silent = true }, + c = { name = '+nerd-commenter' }, + d = { ':bd', 'close buffer', noremap = true, silent = false }, + e = { ':Files', 'files', noremap = true, silent = true }, + G = { ':FloatermNew lazygit', 'lazygit', noremap = true, silent = true }, + h = { ':Startify', 'startify', noremap = true, silent = true }, + k = { ':w:bp:bd #', 'write and close buffer', noremap = true, silent = false }, + p = { ':CocList -A --normal yank', 'CoC paste', noremap = true, silent = true }, + v = { ':FloatermNew vifm', 'vifm', noremap = true, silent = true }, + w = { ':w', 'write buffer', noremap = true, silent = false }, + x = { ':w:bp:bd #', 'write and close buffer', noremap = true, silent = false }, + q = { name = '+coc-fix-current' }, + r = { name = '+coc-rename' }, + g = { + name = 'grep', + a = { ':Ag', 'the_silver_searcher', noremap = true, silent = true }, + g = { ':Grep', 'grep', noremap = true, silent = true }, + r = { ':Rg', 'ripgrep', noremap = true, silent = true }, + }, +}, { prefix = '' }) + vim.keymap.set('n', 'M-;', ':call nerdcommenter#Comment(0,"toggle")', { noremap = true, silent = false }) vim.keymap.set('n', 'M-x', ':', { noremap = true, silent = false }) vim.keymap.set('n', '', ':bprevious', { noremap = true, silent = true }) @@ -14,20 +34,6 @@ vim.keymap.set('n', '', 'q', { noremap = true, silent = false }) vim.keymap.set('n', '*', '*zz', { noremap = true, silent = false }) vim.keymap.set('n', '', 'zz', { noremap = true, silent = false }) vim.keymap.set('n', '', 'zz', { noremap = true, silent = false }) -vim.keymap.set('n', '', ":WhichKey '\\'", { noremap = true, silent = true }) -vim.keymap.set('n', 'b', ':Buffers', { noremap = true, silent = true }) -vim.keymap.set('n', 'd', ':bd', { noremap = true, silent = false }) -vim.keymap.set('n', 'e', ':Files', { noremap = true, silent = true }) -vim.keymap.set('n', 'ga', ':Ag', { noremap = true, silent = true }) -vim.keymap.set('n', 'gg', ':Grep', { noremap = true, silent = false }) -vim.keymap.set('n', 'gr', ':Rg', { noremap = true, silent = true }) -vim.keymap.set('n', 'G', ':FloatermNew lazygit', { noremap = true, silent = true }) -vim.keymap.set('n', 'h', ':Startify', { noremap = true, silent = true }) -vim.keymap.set('n', 'k', ':w:bp:bd #', { noremap = true, silent = false }) -vim.keymap.set('n', 'p', ':CocList -A --normal yank', { noremap = true, silent = true }) -vim.keymap.set('n', 'v', ':FloatermNew vifm', { noremap = true, silent = true }) -vim.keymap.set('n', 'w', ':w', { noremap = true, silent = false }) -vim.keymap.set('n', 'x', ':w:bp:bd #', { noremap = true, silent = false }) vim.keymap.set('n', '', 'AirlineSelectTab1') vim.keymap.set('n', '', 'AirlineSelectTab2') vim.keymap.set('n', '', 'AirlineSelectTab3') @@ -38,32 +44,9 @@ vim.keymap.set('n', '', 'AirlineSelectTab7') vim.keymap.set('n', '', 'AirlineSelectTab8') vim.keymap.set('n', '', 'AirlineSelectTab9') vim.keymap.set('n', '', 'AirlineSelectTab10') -vim.keymap.set('i', ' ', 'pumvisible() ? "" : ""') -vim.keymap.set('i', ' ', 'pumvisible() ? "" : ""') -vim.keymap.set('i', ' ', 'pumvisible() ? asyncomplete#close_popup() : "\\"') +vim.keymap.set('i', '', 'pumvisible() ? "" : ""', { expr = true }) +vim.keymap.set('i', '', 'pumvisible() ? "" : ""', { expr = true }) +vim.keymap.set('i', '', 'pumvisible() ? asyncomplete#close_popup() : "\\"', { expr = true }) vim.g.floaterm_keymap_toggle = '' vim.g.floaterm_keymap_prev = '' vim.g.floaterm_keymap_next = '' -vim.cmd [[ -let g:which_key_map = { -\ 'b': 'buffers', -\ 'c': { 'name': '+nerd-commenter' }, -\ 'd': 'close-buffer', -\ 'e': 'files', -\ 'G': 'lazygit', -\ 'h': 'startify', -\ 'k': 'write-and-close-buffer', -\ 'p': 'coc-paste', -\ 'q': { 'name': '+coc-fix-current' }, -\ 'r': { 'name': '+coc-rename' }, -\ 'v': 'vifm', -\ 'w': 'write-buffer', -\ 'x': 'write-and-close-buffer', -\ 'g': { 'name': '+grep' } -\ } -let g:which_key_map.g = { -\ 'a': 'the_silver_searcher', -\ 'g': 'grep', -\ 'r': 'ripgrep' -\ } -]] diff --git a/.config/nvim/lua/plug.lua b/.config/nvim/lua/plug.lua index a2fe882..06b30a2 100644 --- a/.config/nvim/lua/plug.lua +++ b/.config/nvim/lua/plug.lua @@ -10,7 +10,7 @@ Plug('jceb/vim-orgmode') Plug('jiangmiao/auto-pairs') Plug('junegunn/fzf') Plug('junegunn/fzf.vim') -Plug('liuchengxu/vim-which-key') +Plug('folke/which-key.nvim') Plug('luochen1990/rainbow') Plug('mbbill/undotree') Plug('mg979/vim-visual-multi') -- cgit v1.2.3