neoclide / coc-pairs

Basic auto pairs extension of coc.nvim
297 stars 14 forks source link

coc-pairs + golang no identation with curly bracket #43

Closed esn89 closed 4 years ago

esn89 commented 4 years ago

With coc-pairs enabled, my if statements lack the auto indentation when I hit enter:

if foo == bar {  <hit enter here>
I}

My cursor is right next to the closing curly bracket as indicated.

However, when I remove the coc-pairs extension, it behaves as intended:

if foo == bar {  <hit enter here>
        I

and my cursor is at the right spot. Any help would be appreciated.

chemzqm commented 4 years ago

Can't reproduce, since coc-pairs doesn't remap your enter key.

Try if foo == bar { <hit enter here>}

esn89 commented 4 years ago

Hi @chemzqm thanks for your reply.

I've made a gif illustrating what happens even if I include a space: https://i.imgur.com/Q5HtK3M.gif

Do you have your go settings that I can see? Or just your vimrc I can see in general?

chemzqm commented 4 years ago

Checkout your keymap for <CR> and &indentexpr

esn89 commented 4 years ago

I do not have remapped to anything weird. I did, but I commented it out:

~/.config/nvim rg "<CR>" behaviour.vim coc.vim filetypesettings.vim fzfsettings.vim init.vim mappings.vim nerdtree.vim statusline.vim                                                                                                                                             
mappings.vim
15:noremap <leader>t :tabnew<CR>
22:nnoremap <C-w>v :vsplit<CR>
23:nnoremap <C-w>s :split<CR>
27:nnoremap <leader>= :s/\(\w\+\)=\(\w\+\)/\1 = \2/g<CR>
29:nnoremap <Leader>cf :Currfind<CR>
30:nnoremap <Leader>o :Files<CR>
31:nnoremap <Leader>b :Buffers<CR>
32:nnoremap <Leader>f :Find<CR>
33:nnoremap <Leader>a :Ag<CR>
34:nnoremap <Leader>w :w<CR>
35:nnoremap <Leader>k :lprevious<CR>
36:nnoremap <Leader>v :PlugUpdate<CR>
53:"nnoremap <CR> G
82:nnoremap <Leader>h :set hlsearch!<CR>
85:nnoremap <A-k> :m .-2<CR>==
86:nnoremap <A-j> :m .+1<CR>==
87:inoremap <A-k> <Esc>:m .-2<CR>==gi
88:inoremap <A-j> <Esc>:m .+1<CR>==gi
89:vnoremap <A-j> :m '>+1<CR>gv=gv
90:vnoremap <A-k> :m '<-2<CR>gv=gv
92:"nnoremap <Leader>o :CocList files<CR>
93:"nnoremap <Leader>f :CocList grep<CR>
94:"nnoremap <Leader>b :CocList buffers<CR>
95:"nnoremap <Leader>cf :exe 'CocList -I --input='.expand('<cword>').' grep'<CR>

coc.vim
43:nnoremap <silent> K :call <SID>show_documentation()<CR>

As for indentexpr that is not even in my vimrc :(