From dd829bbad56e53a35d86e8e43165a92268339929 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 29 Oct 2020 20:15:18 +0100 Subject: neovim: configure smart completion --- user/nvim/coc-settings.json | 5 +++++ user/nvim/init.vim | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 user/nvim/coc-settings.json create mode 100644 user/nvim/init.vim (limited to 'user/nvim') diff --git a/user/nvim/coc-settings.json b/user/nvim/coc-settings.json new file mode 100644 index 00000000..718446b1 --- /dev/null +++ b/user/nvim/coc-settings.json @@ -0,0 +1,5 @@ +{ + "json.enable": true, + "suggest.enablePreview": true +} + diff --git a/user/nvim/init.vim b/user/nvim/init.vim new file mode 100644 index 00000000..0b2438d5 --- /dev/null +++ b/user/nvim/init.vim @@ -0,0 +1,25 @@ +set autoindent + +set background=light +set shiftwidth=2 +set tabstop=2 +set noexpandtab +set relativenumber +set smartcase + +" use for trigger completion and navigate to the next complete item +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~ '\s' +endfunction + +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() + +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" + +" use to trigger completion +inoremap coc#refresh() -- cgit 1.4.1