From 947f54c6ecc27c202ec95109e1ee3c1f8df7dd80 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 13 Jul 2023 14:36:54 +0200 Subject: [PATCH 1/4] change to newer autopairs alternative (nvim-autopairs) --- home/.config/nvim/autopairs.vim | 6 ++++++ home/.config/nvim/init.vim | 2 ++ home/.config/nvim/plugs.vim | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 home/.config/nvim/autopairs.vim diff --git a/home/.config/nvim/autopairs.vim b/home/.config/nvim/autopairs.vim new file mode 100644 index 0000000..c62191c --- /dev/null +++ b/home/.config/nvim/autopairs.vim @@ -0,0 +1,6 @@ +lua << EOF +require("nvim-autopairs").setup {} +local Rule = require('nvim-autopairs.rule') +local npairs = require('nvim-autopairs') +npairs.add_rule(Rule("<>","<>","rs")) +EOF diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index 2c06fe4..054ad8d 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -19,7 +19,9 @@ if vim.g.started_by_firenvim == true then vim.cmd('runtime common.vim') else vim.cmd('runtime common.vim') + vim.cmd('runtime plugs.vim') vim.cmd('runtime main.vim') + vim.cmd('runtime autopairs.vim') end if os.name() == "Windows" then diff --git a/home/.config/nvim/plugs.vim b/home/.config/nvim/plugs.vim index f44743e..60c387a 100644 --- a/home/.config/nvim/plugs.vim +++ b/home/.config/nvim/plugs.vim @@ -1,7 +1,7 @@ call plug#begin() Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } -Plug 'jiangmiao/auto-pairs' +Plug 'windwp/nvim-autopairs' Plug 'mhinz/vim-startify' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'psliwka/vim-smoothie' " scorll with STRG + d or STRG + u @@ -26,3 +26,7 @@ Plug 'lambdalisue/suda.vim' "Plug 'dense-analysis/ale' call plug#end() + +lua << EOF +require("nvim-autopairs").setup {} +EOF From 6d3d680158bae4f547d24d42c579f1fc5a8a218d Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 13 Jul 2023 14:54:42 +0200 Subject: [PATCH 2/4] fix autopairs completion --- home/.config/nvim/autopairs.vim | 4 ++++ home/.config/nvim/plugs.vim | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/home/.config/nvim/autopairs.vim b/home/.config/nvim/autopairs.vim index c62191c..e10220e 100644 --- a/home/.config/nvim/autopairs.vim +++ b/home/.config/nvim/autopairs.vim @@ -4,3 +4,7 @@ local Rule = require('nvim-autopairs.rule') local npairs = require('nvim-autopairs') npairs.add_rule(Rule("<>","<>","rs")) EOF + +" fix being not usable to select a completion item +inoremap coc#pum#visible() ? coc#pum#confirm() : + \ "\u\=v:lua.require'nvim-autopairs'.autopairs_cr()\" diff --git a/home/.config/nvim/plugs.vim b/home/.config/nvim/plugs.vim index 60c387a..ce691fd 100644 --- a/home/.config/nvim/plugs.vim +++ b/home/.config/nvim/plugs.vim @@ -26,7 +26,3 @@ Plug 'lambdalisue/suda.vim' "Plug 'dense-analysis/ale' call plug#end() - -lua << EOF -require("nvim-autopairs").setup {} -EOF From 9c82e73c693573d0997c298c0e0686482d44156c Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Fri, 14 Jul 2023 13:20:34 +0200 Subject: [PATCH 3/4] disable/enable nvim-autopairs with --- home/.config/nvim/autopairs.vim | 13 +++++++++---- home/.config/nvim/utils.lua | 11 +++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 home/.config/nvim/utils.lua diff --git a/home/.config/nvim/autopairs.vim b/home/.config/nvim/autopairs.vim index e10220e..a3cf6c5 100644 --- a/home/.config/nvim/autopairs.vim +++ b/home/.config/nvim/autopairs.vim @@ -1,10 +1,15 @@ +" off with +nmap :lua require('nvim-autopairs').disable() +" on with +nmap :lua require('nvim-autopairs').enable() + +" fix being not usable to select a completion item +inoremap coc#pum#visible() ? coc#pum#confirm() : + \ "\u\=v:lua.require'nvim-autopairs'.autopairs_cr()\" + lua << EOF require("nvim-autopairs").setup {} local Rule = require('nvim-autopairs.rule') local npairs = require('nvim-autopairs') npairs.add_rule(Rule("<>","<>","rs")) EOF - -" fix being not usable to select a completion item -inoremap coc#pum#visible() ? coc#pum#confirm() : - \ "\u\=v:lua.require'nvim-autopairs'.autopairs_cr()\" diff --git a/home/.config/nvim/utils.lua b/home/.config/nvim/utils.lua new file mode 100644 index 0000000..2ba735e --- /dev/null +++ b/home/.config/nvim/utils.lua @@ -0,0 +1,11 @@ +local utils = {} + +function M.map(mode, lhs, rhs, opts) + local options = { noremap = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +return utils From baa23f745d160c2301f852865695611f3547803d Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Fri, 14 Jul 2023 13:53:41 +0200 Subject: [PATCH 4/4] nvim coc goto with fzf --- home/.config/nvim/coc.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/home/.config/nvim/coc.vim b/home/.config/nvim/coc.vim index 9678931..a8f022f 100644 --- a/home/.config/nvim/coc.vim +++ b/home/.config/nvim/coc.vim @@ -60,6 +60,7 @@ nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) +nmap gt :CocCommand fzf-preview.CocOutline " Use leader + K to show documentation in preview window nnoremap K :call ShowDocumentation()