neoclide / coc-pairs Goto Github PK
View Code? Open in Web Editor NEWBasic auto pairs extension of coc.nvim
Basic auto pairs extension of coc.nvim
If I record a macro such as qq
i
this is a test "aaaaa"
<esc>
o
<esc>
q
, and then replay it with @q
, CoC inserts an extra "
.
It would be nice if it works when installing from npm
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!
Python has '''
or """
for multi-line string.
Cloud coc-pairs
add an option like https://github.com/Raimondi/delimitMate/blob/master/doc/delimitMate.txt#L84 ?
This is quite confusing for English speakers...
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.
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?
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):
{|}
This would be a really useful feature that would benefit especially those who write a lot of CSS.
function()|
just like smartinput, when user press <BS>
function|
the cursor is |
<Del>
is the same.
thanks!
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>
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.
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.
coc-pairs seems to interrupt in paste mode? Is there a way to disable it in paste mode?
Like pressing TAB...
remove paired characters
can do this feature?
I updated coc
to 0.0.46 and now receive an error
[coc.nvim] Error on active extension coc-pairs: coc_nvim_1.workspace.registerExprKeymap is not a function
on startup.
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
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
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.
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 ?
so user can add 《
, 》
, etc globally.
thanks!
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
I'm not entirely sure if I'm just missing something in my config here, but there's no way this is desirable:
(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.
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.
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?
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
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.
HI,
Is there a plan to support fly mode? like jiangmiao/auto-pairs does.
Thank you.
double-quote is used to write comments in vim-scipts. if a double-quote is entered at the beginning of a line in a vim-script no second quote should be added. vscode does it correctly.
If there's a lone quote, brace, parentheses, etc coc-pairs inserts two extra quotes instead of just one
Steps to reproduce:
'
in a bufferA
and type '
Expected behavior: a single quote is inserted, closing the pair.
Sympton: Just as the title said
When removing bracket like <
in consecutive brackets <>
, the latter >
won't be removed.
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?
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.
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
In MacOS, install the newest macvim/python3/node with homebrew. Then install coc.nvim and coc-pairs.
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
.
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 ()
.
When I type {}
, coc-pairs give me just {}
.
When I type []
, coc-pairs give me just []
.
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.
Steps to reproduce:
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)
@chemzqm only vim 8.2 patch 1-814, nvim OK
Originally posted by @fagcinsk in #59 (comment)
写scheme都是括号,虽然没有支持的lsp但是纯单词补全也很好用,
有个很难受的地方,比如有个hello单词,(he),输入he时弹出补全选项,tab选中hello,再输出右括号,会显示(hello)),多了一个右括号。
正常情况需要先按enter取消选项框,但是也可以直接输入接下来要输入的字符,省去了按enter的过程,可不可以做到按右括号的时候,单词右边有右括号只右移一格。
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?
Insert spaces before closing characters, only for [], (), {} like auto-pairs
input: {|} (press <SPACE> at |)
output: { | }
input: {|} (press <SPACE>foo} at |)
output: { foo }|
input: '|' (press <SPACE> at |)
output: ' |'
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.
|)
(|))
(|)
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.
such as: 《》、【】、「」、『』
I have tried setting blow in coc-setting.json:
{
"pairs.enableCharacters": ["(", "[", "{", "<", "'", "\"", "`", "《", "「"],
}
But it didn't work.
In MacOS, install the newest macvim/python3/node with homebrew. Then install coc.nvim and coc-pairs.
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
.
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 ()
.
When I type {}
, coc-pairs give me just {}
.
When I type []
, coc-pairs give me just []
.
I think it would be a good idea to have in the README some text explaining what's the difference between this plugin and other that are already well-known, like https://github.com/jiangmiao/auto-pairs. I'm currently using jiangmiao/auto-pairs since it correctly indents code when <CR>
is pressed, so I don't see any real benefits of using this plugin over the one I cited (because I can't really see a difference).
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:
{
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.