Giter Club home page Giter Club logo

coc-pairs's Introduction

Neoclide

Neoclide is a rework of Nyaovim, the reason is I want it have best user experience.

Neoclide is an editor built with web technologies while emebed with neovim.

Neoclide is in early development, which means it could break easily, and you should not take it seriously.

Since I use Mac only, something could break on other platform, I need your help!

What have done

  • Global session save and restore
  • Fixed copy/paste behaviour
  • Fixed drag and click position calculate
  • Fixed trigger of VimLeave event
  • Background transparent support
  • Improved input method support
  • Improved cursor support
  • Accessable editor state object
  • Automatic resize handler, no screen blink

How to use

Since it's in early age, no prebuild currently avaiable, you have to use it from souce code.

  • Clone this repository

  • Run following commands to install dependencies and build code

    npm run dep
    npm run build
    
  • To start the app, use:

    npm run app
    

LICENSE

Copyright 2016 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

coc-pairs's People

Contributors

atomdmac avatar chemzqm avatar cigrainger avatar escorponox avatar fannheyward avatar iron-e avatar liubang avatar mad-s avatar magurotuna avatar voldikss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

coc-pairs's Issues

Does not work with <C-h>

Plugin works as expected for <BS> but does not work for the <C-h> which is a handy way to not reach out for Backspace. Any idea on how to make it work?

Won't remove the consecutive paired bracket when removing the previous bracket.

Sympton: Just as the title said

When removing bracket like < in consecutive brackets <> , the latter > won't be removed.

imap: :verbose imap <bs>
image

OS: macOS High Sierra 10.13.6
CocInfo:

## versions

vim version: VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 12 2019 19:32:02)
node version: v12.4.0
coc.nvim version: 0.0.67-3ebf5fd812
term: iTerm.app
platform: darwin

vimrc:
https://paste.ubuntu.com/p/RGXXfRmYhw/

coc-settings:

{
  "languageserver":{
    "ccls": {
      "command": "ccls_",
      "filetypes": ["c", "cpp", "cc", "cuda", "objc", "objcpp"],
      "rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"],
      "initializationOptions": {
         "cache": {
           "directory": "/tmp/.ccls-cache"
         }
       }
    },
    "bash": {
      "command": "bash-language-server",
      "args": ["start"],
      "filetypes": ["sh"],
      "ignoredRootPaths": ["~"]
    },
    "rls": {
      "command": "rustup",
      "args": ["run", "nightly", "rls"],
      "filetypes": ["rust"],
      "settings": { },
      "enable": true,
      "trace.server": "verbose",
      "rootPatterns": ["Cargo.toml"]
    },
    "fortran": {
      "command": "fortls",
      "args": ["--symbol_skip_mem", "--incrmental_sync", "--autocomplete_no_prefix"],
      "filetypes": ["f77", "f", "f90", "f95", "f03", "F77", "F", "F90", "F95", "F03"],
      "enable": true
    }
  }
}

Need I provide more information?

Undefined variable: pairs

I'm trying to change default option using:

let pairs.disableLanguages = []
let pairs.enableCharacters = ["(", "[", "{", "<", "'", "\"", "`"]

But I got undefined variable message, what's the right way to change options?

Support Python f-strings

Thanks for this plugin, it works exactly as I'd like an auto-pairs plugin to work. Better than the other ones I've tried.

One thing I noticed is that it doesn't recognize Python f-strings. Typing f" just gives one quote...it would be great if it were recognized to work the same as a standard string.

Thanks!

Plugin doesn't work if installed via vim-plug

As the title says. When I install the extension via vim plug:

Plug 'neoclide/coc-pairs', {'do': 'yarn install --frozen-lockfile'}

and try and let it auto pair a {, (, or [, it does nothing. CocList extensions shows that the extension is running.

When I install the extension via CocInstall coc-pairs, the extension immediately works.

Incorrect behaviour on JS template literals

coc-pairs does not recognise JS template literals and fails to add a missing backtick (`) when one is immediately typed next to a function name without a space.

e.g. When the following is typed, no '`' is added after 'css`'

import { css } from 'styled-components';

const myMixin = css`
// should add another ` above

Duplicate right brace `{}}` when type `{}`

Software

In MacOS, install the newest macvim/python3/node with homebrew. Then install coc.nvim and coc-pairs.

minimum vimrc

Use vim-plug as plugin manager.

Here's .vimrc:

source ~/.vim/autoload/plug.vim
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()

Just install :CocInstall coc-pairs.

Description

When I type {}, coc-pairs give me one more duplicate {}}.
When I type [], coc-pairs give me one more duplicate []].

When I type "", coc-pairs give me just "".
When I type '', coc-pairs give me just ''.
When I type (), coc-pairs give me just ().

Expect Behaviour

When I type {}, coc-pairs give me just {}.
When I type [], coc-pairs give me just [].

Interaction with macros

I was having trouble recording a macro and noticed it appears to be due to the insertion of pairs.

With this extension on running :normal O('') produces a list that looks something like the following:

    (')''')
    ('')'')
    ('')
    (')''')
    ('')'')
    (')''')
    (')''')
    (')''')
    (')''')

Turning it off produces the sequence you'd expect.

('')
('')
('')

It's no biggie, I can turn it off when recording complex macros or use a different plugin but perhaps you do know why this is happening.

Two quotes insteead of one

Hello, great plugin, absolutely loving it. So the thing is, let's say I have word with cursor at the beginning:
|some_word
If i type single quote ' it will insert two single quotes:
''some_word
But, in vs code, it will insert only one quote. Again, thanks

Duplicate right brace when type `{}` actually give me `{}}`

Software

In MacOS, install the newest macvim/python3/node with homebrew. Then install coc.nvim and coc-pairs.

minimum vimrc

Use vim-plug as plugin manager.

Here's .vimrc:

source ~/.vim/autoload/plug.vim
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()

Just install :CocInstall coc-pairs.

Description

When I type {}, coc-pairs give me one more duplicate {}}.
When I type [], coc-pairs give me one more duplicate []].

When I type "", coc-pairs give me just "".
When I type '', coc-pairs give me just ''.
When I type (), coc-pairs give me just ().

Expect Behaviour

When I type {}, coc-pairs give me just {}.
When I type [], coc-pairs give me just [].

Support for using vim-endwise

vim-endwise is not an auto-pair plugin but I'm having some difficulty using it with

inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

Is there anyway to make them work together?

coc-pairs breaks repeat with dot

I notice coc-pairs breaks some of my frequently vim actions with dot repeat.

For example: I want to repeat a change by ciw[change]esc keystrokes.

First, print('foo', 'foo2') into print('foo').

Then I used dot to repeat ciw[change]esc keystrokes with other function print('foo', 'foo2'), but It never work as I expect.

print('foo', 'foo2') might become into print('fofooo', 'foo2') or print('foo'foo, 'foo2') depend on where the pointer is.

I guess coc-pairs might use escape key between my keystrokes so that it also break the repeat action in vim.
I really appreciate your work with Neovim community, hope this will could be fixed easily. Thank you so much.

keyword autocomplete

Thanks a lot for this plugin.
It works out of the box and it's great.

Is it possible to provide keyword based autocomplete for languages where def, do, end etc. keywords are used.
i.e. when we typedef ... it also put end on the third line and put cursor on 2nd line.

Some of this functionality can be achieved by snippets. However it would be really helpful to have do................end autocompletion out of the box for languages like elixir.

Or this is a non-feature for this plugin ?

Autocompletion breaks closing pair

coc-pairs version: 1.2.21
coc version: d5471449bf58978d0ac77b2c7c756d062a5788e4 (What's on the release branch right now)

CocOpenLog

2020-06-04T13:47:33.655 DEBUG (pid:150402) [workspace] - buffer created 1
2020-06-04T13:47:33.657 DEBUG (pid:150402) [events] - Event: BufEnter [ 1 ]
2020-06-04T13:47:33.658 DEBUG (pid:150402) [events] - Event: BufWinEnter [ 1, 1000 ]
2020-06-04T13:47:33.691 INFO (pid:150402) [services] - registered service "eslint"
2020-06-04T13:47:33.691 DEBUG (pid:150402) [extensions] - activate: coc-eslint
2020-06-04T13:47:33.694 DEBUG (pid:150402) [extensions] - activate: coc-marketplace
2020-06-04T13:47:33.697 DEBUG (pid:150402) [extensions] - activate: coc-pairs
2020-06-04T13:47:33.828 DEBUG (pid:150402) [extensions] - activate: coc-prettier
2020-06-04T13:47:33.836 INFO (pid:150402) [services] - registered service "reason"
2020-06-04T13:47:33.836 DEBUG (pid:150402) [extensions] - activate: coc-reason
2020-06-04T13:47:33.861 DEBUG (pid:150402) [languages] - created service source snippets
2020-06-04T13:47:33.862 DEBUG (pid:150402) [languages] - created service source snippets-source
2020-06-04T13:47:33.863 DEBUG (pid:150402) [extensions] - activate: coc-snippets
2020-06-04T13:47:34.065 DEBUG (pid:150402) [extensions] - activate: coc-sql
2020-06-04T13:47:34.152 DEBUG (pid:150402) [languages] - created service source coc-webpack
2020-06-04T13:47:34.153 DEBUG (pid:150402) [extensions] - activate: coc-webpack
2020-06-04T13:47:34.154 INFO (pid:150402) [plugin] - coc.nvim 0.0.78-d5471449bf initialized with node: v13.0.1 after 523ms
2020-06-04T13:47:35.547 DEBUG (pid:150402) [events] - Event: InsertEnter [ 1 ]
2020-06-04T13:47:36.385 DEBUG (pid:150402) [events] - Event: InsertCharPre [ "'" ]
2020-06-04T13:47:36.387 DEBUG (pid:150402) [events] - Event: InsertCharPre [ "'" ]
2020-06-04T13:47:36.387 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 1, 2 ] ]
2020-06-04T13:47:36.390 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 1, col: 2, changedtick: 4, pre: "'" } ]
2020-06-04T13:47:37.212 DEBUG (pid:150402) [events] - Event: InsertCharPre [ 'h' ]
2020-06-04T13:47:37.214 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 1, 3 ] ]
2020-06-04T13:47:37.215 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 1, col: 3, changedtick: 5, pre: "'h" } ]
2020-06-04T13:47:37.218 DEBUG (pid:150402) [completion] - trigger completion with {
  word: 'h',
  bufnr: 1,
  col: 1,
  synname: '',
  filepath: '',
  blacklist: [],
  line: "'h'",
  filetype: '',
  linenr: 1,
  input: 'h',
  colnr: 3,
  changedtick: 5,
  triggerCharacter: 'h'
}
2020-06-04T13:47:37.230 DEBUG (pid:150402) [completion-complete] - Source "around" takes 4ms
2020-06-04T13:47:37.230 DEBUG (pid:150402) [completion-complete] - Source "buffer" takes 3ms
2020-06-04T13:47:37.230 DEBUG (pid:150402) [completion-complete] - Source "file" takes 3ms
2020-06-04T13:47:37.289 DEBUG (pid:150402) [completion-complete] - Source "snippets" takes 64ms
2020-06-04T13:47:37.499 DEBUG (pid:150402) [events] - Event: InsertCharPre [ 't' ]
2020-06-04T13:47:37.500 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 1, 4 ] ]
2020-06-04T13:47:37.501 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 1, col: 4, changedtick: 6, pre: "'ht" } ]
2020-06-04T13:47:37.504 DEBUG (pid:150402) [completion] - trigger completion with {
  word: 'ht',
  bufnr: 1,
  col: 1,
  synname: '',
  filepath: '',
  blacklist: [],
  line: "'ht'",
  filetype: '',
  linenr: 1,
  input: 'ht',
  colnr: 4,
  changedtick: 6,
  triggerCharacter: 't'
}
2020-06-04T13:47:37.508 DEBUG (pid:150402) [completion-complete] - Source "around" takes 1ms
2020-06-04T13:47:37.508 DEBUG (pid:150402) [completion-complete] - Source "buffer" takes 0ms
2020-06-04T13:47:37.508 DEBUG (pid:150402) [completion-complete] - Source "file" takes 0ms
2020-06-04T13:47:37.568 DEBUG (pid:150402) [completion-complete] - Source "snippets" takes 61ms
2020-06-04T13:47:38.849 DEBUG (pid:150402) [events] - Event: InsertCharPre [ 't' ]
2020-06-04T13:47:38.850 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 1, 5 ] ]
2020-06-04T13:47:38.850 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 1, col: 5, changedtick: 7, pre: "'htt" } ]
2020-06-04T13:47:38.853 DEBUG (pid:150402) [completion] - trigger completion with {
  word: 'htt',
  bufnr: 1,
  col: 1,
  synname: '',
  filepath: '',
  blacklist: [],
  line: "'htt'",
  filetype: '',
  linenr: 1,
  input: 'htt',
  colnr: 5,
  changedtick: 7,
  triggerCharacter: 't'
}
2020-06-04T13:47:38.857 DEBUG (pid:150402) [completion-complete] - Source "around" takes 1ms
2020-06-04T13:47:38.857 DEBUG (pid:150402) [completion-complete] - Source "buffer" takes 1ms
2020-06-04T13:47:38.857 DEBUG (pid:150402) [completion-complete] - Source "file" takes 1ms
2020-06-04T13:47:38.918 DEBUG (pid:150402) [completion-complete] - Source "snippets" takes 61ms
2020-06-04T13:47:40.097 DEBUG (pid:150402) [events] - Event: InsertCharPre [ 'p' ]
2020-06-04T13:47:40.098 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 1, 6 ] ]
2020-06-04T13:47:40.099 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 1, col: 6, changedtick: 8, pre: "'http" } ]
2020-06-04T13:47:40.102 DEBUG (pid:150402) [completion] - trigger completion with {
  word: 'http',
  bufnr: 1,
  col: 1,
  synname: '',
  filepath: '',
  blacklist: [],
  line: "'http'",
  filetype: '',
  linenr: 1,
  input: 'http',
  colnr: 6,
  changedtick: 8,
  triggerCharacter: 'p'
}
2020-06-04T13:47:40.105 DEBUG (pid:150402) [completion-complete] - Source "around" takes 0ms
2020-06-04T13:47:40.105 DEBUG (pid:150402) [completion-complete] - Source "buffer" takes 0ms
2020-06-04T13:47:40.105 DEBUG (pid:150402) [completion-complete] - Source "file" takes 0ms
2020-06-04T13:47:40.165 DEBUG (pid:150402) [completion-complete] - Source "snippets" takes 61ms
2020-06-04T13:47:40.631 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 1, 7 ] ]
2020-06-04T13:47:41.289 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 2, 1 ] ]
2020-06-04T13:47:41.291 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 2, col: 1, changedtick: 9, pre: '' } ]
2020-06-04T13:47:41.923 DEBUG (pid:150402) [events] - Event: InsertCharPre [ "'" ]
2020-06-04T13:47:41.924 DEBUG (pid:150402) [events] - Event: InsertCharPre [ "'" ]
2020-06-04T13:47:41.924 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 2, 2 ] ]
2020-06-04T13:47:41.925 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 2, col: 2, changedtick: 11, pre: "'" } ]
2020-06-04T13:47:42.322 DEBUG (pid:150402) [events] - Event: InsertCharPre [ 'h' ]
2020-06-04T13:47:42.323 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 2, 3 ] ]
2020-06-04T13:47:42.324 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 2, col: 3, changedtick: 12, pre: "'h" } ]
2020-06-04T13:47:42.325 DEBUG (pid:150402) [completion] - trigger completion with {
  word: 'h',
  bufnr: 1,
  col: 1,
  synname: '',
  filepath: '',
  blacklist: [],
  line: "'h'",
  filetype: '',
  linenr: 2,
  input: 'h',
  colnr: 3,
  changedtick: 12,
  triggerCharacter: 'h'
}
2020-06-04T13:47:42.328 DEBUG (pid:150402) [completion-complete] - Source "around" takes 1ms
2020-06-04T13:47:42.328 DEBUG (pid:150402) [completion-complete] - Source "buffer" takes 1ms
2020-06-04T13:47:42.328 DEBUG (pid:150402) [completion-complete] - Source "file" takes 1ms
2020-06-04T13:47:42.388 DEBUG (pid:150402) [completion-complete] - Source "snippets" takes 60ms
2020-06-04T13:47:42.388 INFO (pid:150402) [completion-complete] - Results from: around
2020-06-04T13:47:42.392 DEBUG (pid:150402) [events] - Event: MenuPopupChanged [
  {
    col: 1,
    row: 2,
    scrollbar: false,
    completed_item: {},
    width: 15,
    height: 1,
    size: 1
  },
  1
]
2020-06-04T13:47:42.393 DEBUG (pid:150402) [events] - Event: TextChangedP [ 1, { lnum: 2, col: 3, changedtick: 12, pre: "'h" } ]
2020-06-04T13:47:42.596 DEBUG (pid:150402) [events] - Event: InsertCharPre [ 't' ]
2020-06-04T13:47:42.597 DEBUG (pid:150402) [events] - Event: MenuPopupChanged [
  {
    col: 1,
    row: 2,
    scrollbar: false,
    completed_item: {},
    width: 15,
    height: 1,
    size: 1
  },
  1
]
2020-06-04T13:47:42.598 DEBUG (pid:150402) [events] - Event: TextChangedP [ 1, { lnum: 2, col: 4, changedtick: 17, pre: "'ht" } ]
2020-06-04T13:47:42.602 DEBUG (pid:150402) [events] - Event: CompleteDone [ {} ]
2020-06-04T13:47:42.603 DEBUG (pid:150402) [events] - Event: MenuPopupChanged [
  {
    col: 1,
    row: 2,
    scrollbar: false,
    completed_item: {},
    width: 15,
    height: 1,
    size: 1
  },
  1
]
2020-06-04T13:47:42.840 DEBUG (pid:150402) [events] - Event: InsertCharPre [ 't' ]
2020-06-04T13:47:42.841 DEBUG (pid:150402) [events] - Event: MenuPopupChanged [
  {
    col: 1,
    row: 2,
    scrollbar: false,
    completed_item: {},
    width: 15,
    height: 1,
    size: 1
  },
  1
]
2020-06-04T13:47:42.841 DEBUG (pid:150402) [events] - Event: TextChangedP [ 1, { lnum: 2, col: 5, changedtick: 24, pre: "'htt" } ]
2020-06-04T13:47:42.844 DEBUG (pid:150402) [events] - Event: CompleteDone [ {} ]
2020-06-04T13:47:42.844 DEBUG (pid:150402) [events] - Event: MenuPopupChanged [
  {
    col: 1,
    row: 2,
    scrollbar: false,
    completed_item: {},
    width: 15,
    height: 1,
    size: 1
  },
  1
]
2020-06-04T13:47:43.287 DEBUG (pid:150402) [events] - Event: CompleteDone [ {} ]
2020-06-04T13:47:43.288 DEBUG (pid:150402) [events] - Event: InsertCharPre [ "'" ]
2020-06-04T13:47:43.289 DEBUG (pid:150402) [events] - Event: CursorMovedI [ 1, [ 2, 6 ] ]
2020-06-04T13:47:43.290 DEBUG (pid:150402) [events] - Event: TextChangedI [ 1, { lnum: 2, col: 6, changedtick: 25, pre: "'htt'" } ]
2020-06-04T13:47:46.887 DEBUG (pid:150402) [events] - Event: CompleteDone [ {} ]
2020-06-04T13:47:46.888 DEBUG (pid:150402) [events] - Event: InsertLeave [ 1 ]
2020-06-04T13:47:46.891 DEBUG (pid:150402) [events] - Event: CursorMoved [ 1, [ 2, 5 ] ]
2020-06-04T13:48:29.755 DEBUG (pid:150402) [events] - Event: CursorHold [ 1 ]
2020-06-04T13:49:04.784 DEBUG (pid:150402) [events] - Event: VimResized [ 265, 35 ]
2020-06-04T13:49:04.784 DEBUG (pid:150402) [events] - Event: CursorHold [ 1 ]
2020-06-04T13:49:04.835 DEBUG (pid:150402) [events] - Event: VimResized [ 265, 36 ]

vimrc:

set nocompatible
set runtimepath^=/home/adan/.vim/plugged/coc.nvim
filetype plugin indent on
syntax on
set hidden

let $NVIM_COC_LOG_LEVEL = 'debug'

version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun  4 2020 12:12:02)
Included patches: 1-902

Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       -tcl
-autoservername    +folding           +multi_byte        +termguicolors
+balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
+browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              -perl              +title
+clientserver      +job               +persistent_undo   +toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           -python            +visual
+conceal           +linebreak         +python3/dyn       +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       -lua               +ruby/dyn          +wildmenu
+dialog_con_gui    +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       +X11
+dnd               +mouse             +sound             -xfontset
-ebcdic            +mouseshape        +spell             +xim
+emacs_tags        +mouse_dec         +startuptime       +xpm
+eval              +mouse_gpm         +statusline        +xsmp_interact
+ex_extra          -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16   -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -L/home/adan/.rbenv/versions/2.6.4/lib  -fstack-protector-strong -rdynamic -Wl,-export-dynamic  -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo  -lselinux  -lcanberra -lacl -lattr -lgpm -ldl           

CocInfo

## versions

vim version: VIM - Vi IMproved 8.2 8020902
node version: v13.0.1
coc.nvim version: 0.0.78-d5471449bf
coc.nivm directory: /home/adan/.vim/plugged/coc.nvim
term: dumb
platform: linux

## Output channel: prettier


## Output channel: snippets

[Info 2:29:28 PM] Using ultisnips directories: UltiSnips /home/ad
[Info 2:29:28 PM] Using ultisnips python command: pyx

image

image

How to add custom pairs?

I wonder how we can add custom pairs specific to filetype or manually.

It roughly relates to pairs.enableCharacters, but the coc-settings.json is rather global. I want to enable specific pair characters only for certain filetypes, e.g., $..$ for tex.

Can we add some configuration point like b:coc_pairs_enabled as we already have b:coc_pairs_disabled? I tried :call coc#config('pairs.enableCharacters', ["(", "[", "{", "'", "\"", "", "$"])` for markdown files, but it didn't work as initialization happens once prior to that.

Insert line when <CR> is pressed

When I create a JSON file, the curly braces are autocompleted:

{}

When I press <CR>, it would be nice if it added a new line inside so I don't have to leave insert mode just to add a new line with <c-O>:

{
  <cursor>
}

The actual behavior is:

{
}

Duplicate pairs when autocomplete menu is open

I'm getting duplicate pairs in Vim 8.1.2292. This seems to only appear when an autocomplete suggestion menu is open.

Plugin list:

  • coc.vim
  • Vim-Jinja2-Syntax
  • vim-polyglot
  • sensible
  • vim-commentary
  • vim-surround
  • nerdtree

Duplicates

Using parentheses after insert mode abbreviations will not trigger the abbreviation

I set iabbrev pritn print in my vimrc, but the abbreviation didn't expand after I typed pritn(.

In Learn Vimscript the Hard Way, the author says that

Vim will substitute an abbreviation when you type any "non-keyword character" after an abbreviation.

Other non-keyword characters work fine, such as ,. Like the discussion in https://vi.stackexchange.com/questions/10649/expand-abbreviation-when-the-following-non-keyword-character-is-mapped-to-someth, the problem seems to lay in the mapping.

Add pairing for Ruby

I don't know if this is within the scope of this extension but adding functionality similar to the vim-endwise plugin would be great. The plugin currently has compatibility issues with CoC and I'd rather stop using it if possible.

Insert close brace on new line if CR is pressed between braces

I'm not entirely sure if I'm just missing something in my config here, but there's no way this is desirable:

braces

(not sure why the gif is playing much slower here than the original video, sorry for that)

I have to exit insert mode and press k and re enter insert mode and tab in every time I create a new function. That's actually less ergonomic than not having braces inserted at all.

Pairs does not play well with macros or repeat

In normal mode type qm then insert a paired character i(<esc>
output: ()
Undo then play the macro @m
output (())

It happens with repeat too.
i(
output: ()
<del><esc>
output: (
.
output ``
Repeat ends up being just delete.

Installing error

I'm getting the following when trying to install:

[coc.nvim] Error on active extension coc-pairs: coc_nvim_1.workspace.registerExprKeymap is not a function 

CocInfo

## versions                                                                              
                                                                                    
vim version: NVIM v0.3.1                                                                 
node version: v8.9.0                                                                     
coc.nvim version: 0.0.46                                                                 
term: xterm-256color                                                                     
platform: linux                                                                          
                                                                                         
## Error messages                                                                        
                                                                                         
## Output channel: prettier                                                              
                                                                                         
## Output channel: highlight                                                             
[Info  - 15:41:03] Highlight server running in node v8.9.0 

Option for disable feature: Inserting characters instead of paired character when the previous content ends with two inserting characters

Whenever I call a variable that its length is greater than 2 inside a pair (like when passing variable into a function call), I can't get out of the pair without hit <CR>, although I havent touched the auto completion yet.

The reason is some variables are too short and hiting <TAB> and auto complete and then <CR> is slower than typing myself. I want it always check for jumping out of the pair.

Vscode behavior:
Peek 2019-12-18 04-35

coc-nvim:
Peek 2019-12-18 04-31

coc-pairs + golang no identation with curly bracket

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.

PHP starting tag support

It would be nice for coc-pairs to detect php file type and have a special support for < as the 1st character of the 1st or 2nd line (because 1st line sometimes contains a shebang) that would delete the closing > if the next character is ?.

The issue is whenever I type < at the beginning of a PHP file coc-pairs adds the closing angular bracket > which is not only cumbersome to delete each time the user creates a new class but also prevents some popular (e.g. honza's] PHP snippets from working correctly, e.g. <? expands to the following (notice the closing bracket):

<?php

VISUAL>

paste mode

coc-pairs seems to interrupt in paste mode? Is there a way to disable it in paste mode?

Support fly mode?

HI,
Is there a plan to support fly mode? like jiangmiao/auto-pairs does.
Thank you.

Error after recent update

Hi,

Just noticed an error appear in my neovim:

[coc.nvim] Error on active extension coc-pairs: TypeError: doc.getVar is not a function

It appeared after a recent (automatic) update of the extension, I tried uninstalling coc-pairs
and reinstalling it again and the same error appears

backspace makes coc-pairs panic

Steps to reproduce:

  1. Open a file.
  2. Type something.
  3. Trigger backspace key.

Error log:

2019-04-01T15:12:45.342 INFO (pid:5773) [completion-complete] - Results from: pyls,snippets,word
2019-04-01T15:12:48.344 ERROR (pid:5773) [attach] - Error on "doKeymap": TypeError: res[0] is not iterable
    at /Users/damnever/dotfiles/config/coc/extensions/node_modules/coc-pairs/lib/index.js:117:43
    at Generator.next (<anonymous>)
    at fulfilled (/Users/damnever/dotfiles/config/coc/extensions/node_modules/tslib/tslib.js:104:62)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
2019-04-01T15:12:48.432 INFO (pid:5773) [completion-complete] - Results from: snippets,around,word
2019-04-01T15:12:49.083 ERROR (pid:5773) [attach] - Error on "doKeymap": TypeError: res[0] is not iterable
    at /Users/damnever/dotfiles/config/coc/extensions/node_modules/coc-pairs/lib/index.js:117:43
    at Generator.next (<anonymous>)
    at fulfilled (/Users/damnever/dotfiles/config/coc/extensions/node_modules/tslib/tslib.js:104:62)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Feature request: Add an empty line when pressing Enter (and the cursor is in between two brackets)

This is a feature present in VSCode. It enables the user to instantly start typing (without having to create the empty line themselves) after pressing Enter.

Here's an example:

Initial cursor position (pipe represents the cursor):
{|}

  1. After pressing Enter in insert mode, this happens
    image

  2. The desired effect would be as follows:
    image

This would be a really useful feature that would benefit especially those who write a lot of CSS.

coc补全和coc-pairs有个不舒服的地方

写scheme都是括号,虽然没有支持的lsp但是纯单词补全也很好用,

有个很难受的地方,比如有个hello单词,(he),输入he时弹出补全选项,tab选中hello,再输出右括号,会显示(hello)),多了一个右括号。
正常情况需要先按enter取消选项框,但是也可以直接输入接下来要输入的字符,省去了按enter的过程,可不可以做到按右括号的时候,单词右边有右括号只右移一格。

Support Chinese characters

such as: 《》、【】、「」、『』
I have tried setting blow in coc-setting.json:

{
  "pairs.enableCharacters": ["(", "[", "{", "<", "'", "\"", "`", "《", "「"],
}

But it didn't work.

Extra pair added when appending to single quote

If there's a lone quote, brace, parentheses, etc coc-pairs inserts two extra quotes instead of just one

Steps to reproduce:

  1. insert a single ' in a buffer
  2. append to the end of the line with A and type '
  3. two new quotes are inserted, leaving three in total

Expected behavior: a single quote is inserted, closing the pair.

coc-pairs not closing HTML and JSX tags

I installed coc-pairs with :CocInstall coc-pairs and the extension is not working in any files including HTML. So far I have also used it in .tsx and it doesn't work.

I expect coc-pairs to close HTML and JSX tags.

image

Option to add closing bracket only at the end of the line

Although coc-pairs is smart enough to avoid extra closing brackets in most cases during editing, there are still cases when it fails to do so. I wonder whether it is possible to configure coc-pairs to auto-complete only at the end of the line.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.