raimondi / delimitmate Goto Github PK
View Code? Open in Web Editor NEWVim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
Home Page: http://www.vim.org/scripts/script.php?script_id=2754
Vim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
Home Page: http://www.vim.org/scripts/script.php?script_id=2754
The problem came from the commit a751498...
I blame this code (autoload/delimitMate.vim):
inoremap <buffer> <Left> <C-R>=delimitMate#FlushBuffer()<CR><Left>
inoremap <buffer> <Right> <C-R>=delimitMate#FlushBuffer()<CR><Right>
inoremap <buffer> <Up> <C-R>=delimitMate#FlushBuffer()<CR><Up>
inoremap <buffer> <Down> <C-R>=delimitMate#FlushBuffer()<CR><Down>
I can't get expand_space or rexpand_cr to work correctly. I've tried with the latest release on vim.org and from github.
vimrc:
set nocompatible
let b:delimitMate_expand_space = ""
let b:delimitMate_expand_cr = ""
TestMappings output:
*b:delimitMate_autoclose = 1
*b:delimitMate_expand_space =
*b:delimitMate_expand_cr =
Open & close: (|)
Delete: |
Exit: ()|
Space: ( |)
Delete space: (|)
Visual-L: (v)
Visual-R: (v)
Car return: (
|)
Delete car return: (
|)
Open & close: {|}
Delete: |
Exit: {}|
Space: { |}
Delete space: {|}
Visual-L: {v}
Visual-R: {v}
Car return: {
|}
Delete car return: {
|}
Open & close: [|]
Delete: |
Exit: []|
Space: [ |]
Delete space: [|]
Visual-L: [v]
Visual-R: [v]
Car return: [
|]
Delete car return: [
|]
Open & close: "|"
Delete: "|
Exit: ""|
Space: " |"
Delete space: "|"
Visual: "v"
Car return: "
|"
Delete car return: "
|"
Open & close: '|'
Delete: '|
Exit: ''|
Space: ' |'
Delete space: '|'
Visual: 'v'
Car return: '
|'
Delete car return: '
|'
Open & close: |
Delete: | Exit:``| Space:
| Delete space:
| Visual:
v Car return:
| Delete car return:
|`
in the docs, it say S-BS will not work from terminal, but BS alone also doesn't work. it only deletes the opening delimiter.
i type open delimiter, then delimiteMate complete it, type some stuff in between delimiters, hit escape to get me to normal mode, type 'O' (shift-o) to add new line above and then 'O' is displayed at the cursor position for several seconds before the line is added. this doesn't happen under macvim. no mapping is present for 'O' or s-o. i have the same environment and DelimitMateTest results as in #42 .
it's not exactly broken behavior, but these forced pauses do interrupt my flow.
The current approach brakes undo, redo, etc., there's a plug-in that doesn't but I don't like how it behaves.
If the option to expand on is enabled, the endwise.vim script won't work.
def foo<CR>
Normally this would be expanded to
def foo
|
end
Where "|" indicates the cursor position.
No end
is inserted.
Code enclosed between tags:
'^%(!)'
Code enclosed between tags, published and then changed to the four spaces format:
'^\%(\!\)'
Code preceded by four spaces:
'^\%(\!\)'
In insertmode, input
["
this will output
["|"]
"|" is the cursor position
then enter <End><Esc>, It should be
[""]
but It expand as below
[""]"]
fun! Test() "{{{
startinsert
call feedkeys("["<End><Esc>")
endfunction "}}}
call Test()
Strangely, the previous version did not do this. However, the latest version overrides a pre-existing DEL key mapping, which I need because I have a special keyboard ( long story ).
some ideas/random thoughts for improving/extending visual wrapping
1. using markers for inserting delimiters
not sure if it would make any difference, but just wondering if the visual mode wrapping would potentially not break redo (as the help doc says it does?) if it used <` and
>` to navigate to the start and end of the visual selection to insert delimiters?
execute 'keepjumps normal! `>a' . rd
execute 'keepjumps normal! `<i' . ld
basing that assumption on another vim plugin (LatexBox) which I don't think breaks redo and provides some similar wrapping features.
2. normal-mode wrapping
Any chance of adding (optional?) normal-mode mappings which apply the wrapping to the current word so you don't have to enter visual mode to wrap a single word?
not a huge deal of course for me to add some mappings like this:
nnoremap <buffer> <Leader>( viw:call delimitMate#Visual("(")<cr>
would just be easier to have an option...
3. repeated/multiple wrappings
Would be good if the wrapping could be repeated (e.g. if you want to nest a selection in two delimiters, same or different). Not sure if this is widely useful, but there are definite cases for me wanting to insert 3 "
characters in python documentation or two ```, '
pairs in LaTeX, and reselecting the text 2-3 times would make it not worth using the visual wrapping. Other possible cases (though I have not had the need myself) would be wrapping in different delimiters, e.g. turning `hello` into `[ 'hello' ]`
.
command or a preceding number (so you'd type 3\"
to wrap some text in three quotation marks on either end)Happens every time I hit the backspace key in insert mode.
DelimitMateTest also fails. Doesn't happen in every file, but easily reproducible and every time in a given buffer.
=DelimitMate_BS()
E117: Unknown function: DelimitMate_BS
Press ENTER or type command to continue
E15: Invalid expression: DelimitMate_BS()
Press ENTER or type command to continue
I have "lett delimitMate_expand_cr = 1" inside my vimrc, but when I press after opening a parentheses, it doesn't automatically indent for me. Example:
After typing,
int main() {|
I hit enter expecting to see
int main() {
|
}
yet it looks like this:
int main() {
|}
Is this some sort of bad configuration on my part?
s:variables aren't the best choice to store per buffer settings, duh!
One of the features I like most is the S-Tab feature to exit [], "" and such.
I had an old version from 6 months ago that worked really well. But now I've done a git clone from your repository and it works only if a filetype isn't set.
To test, open vim, press (|) and , you have ()|. Run ":set ft=python", press (|) and now you get ( |).
Could this be a plugin conflict? How do I debug it?
when using vim in a terminal, with timeout not set, then "imap <C-[>OC " causes strange behavior when exiting insert mode by pressing Esc : -- INSERT -- stay on screen until I press a key (which is not 'O' of course)
set timeout resolve the problem
At least with my config of vim from http://github.com/jahson/vimdotfiles
:imap <Right> returns "i <Right> *@<C-R>=delimitMate#Finish()<CR><Right>" but there is no calls to delimitMate#Finish when I press <Right>. <Up>, <Down> and <Left> works like a charm.
Just that. I'll remove visual wrapping, surround.vim offers a much better implementation and works great.
The cursor can't be moved to the left using the arrow key after a delimiter has been typed.
Suggested by Kenneth Love, this would allow Python docstrings to be completed bydelimitMate.
"""string => """string"""
Errors pop-up any time a | is added to quotes or matchpairs.
I've noticed that i loose <BS> default behavior sometimes.
Turns out that it's caused by SuperTab.vim, though not really sure.
Steps to reproduce:
Start typing in insert mode, hit "Tab" so that completion list appears
Hit "BS" few times
Hit "ESC" to get to normal mode.
Go to insert, type (, so that () appear
Typing "BS" after that - inside () doesn't remove bracket.
:verbose imap <BS> shows nothing
Is it possible to workaround it somehow? Thanks
I have "lett delimitMate_expand_cr = 1" inside my vimrc, but when I press after opening a parentheses, it doesn't automatically indent for me. Example:
After typing,
int main() {|
I hit enter expecting to see
int main() {
|
}
yet it looks like this:
int main() {
|}
Is this some sort of bad configuration on my part?
Movements doesn't work on expansions, it might be nice if they did.
tabbing should jump out of the delimiter:
'hello => 'hello'
(["value => (["value"])
{"key: "value => {"key": "value"}
backspace immediately after a delimiter should set a single delimiter:
' => ''
' => '
[ => []
[ => [
It is not possible to get russian (for example) letters that are on the same key as "pairs" - э mess with ", х - { and [, ъ - } and ], etc.
P.S. Thanks for the wonderful plugin
E225: global mapping already exists for <80>kd
Using the latest version 2.4.1, I am trying to create a matchpair for erb, so in my vimrc, I have the following:
let delimitMate_matchpairs = "(:),[:],{:},<%:%>"
It works when inserting text:
<% test %>
but after I hit ESC, I get:
<% test %>>
Is there something I'm doing wrong or a setting I'm not setting (I am just using the defaults, aside from the one mentioned.)
Thanks
Dan
sorry. I accidentally closed the previously opened issue with the same title. I don't know how to un-close it, but I answered your last question there.
Given the following code: (| == cursor here)
while (1) {
for (i=0;i<10;i++){|
}
when I hit return I get the following code:
while (1) {
for (i=0;i<10;i++){
|
}
}
Since I have smarttab on I expected the following:
while (1) {
for (i=0;i<10;i++){
|
}
}
Is that an easy thing to fix or is it pretty complicated? Or am I missing a config option to fix that?
(tested on the latest devel version and a mostly virgin .vimrc (turned on a few options for testing like smarttab))
When the completion menu is visible, and can be used to select an entry without inserting it. The current delimitMate mappings of these keys break this functionality. Imho, the mappings should be defined like
inoremap pumvisible() ? "" : "=delimitMate#Finish()"
inoremap pumvisible() ? "" : "=delimitMate#Finish()"
This way the pop-up menu works like expected.
apostrophe's should be detected by whether or not they immediately follow a letter:
I'm => I'm
I 'm => I 'm'
dog's => dog's
dog 's => dog 's'
dogs' => dogs'
dogs ' => dogs ''
(we)'ll => (we)'ll'
type: f(f(f(;<END><ESC>
result: f(f(f()));)))
type: f(f(f(; <HOME><ESC>
result: )))(f()))
This is happening on Cygwin Vim version 7.3.3. Doesn't happen on Windows native Gvim 7.3. Nice plug btw. I thought it might be janky but then I tried gvim. I can understand cygwin is probably the lowest on the list of priorities :) Would be nice to have it fixed anyway.
Sometimes, I have a single left quote and want to finish it with a right quote, but typing in the right quote adds two quotes instead of one.
This is a conflict with IsForbidden() and insert mode.
That and quotes too. Right?
Disable completion inside some syntax groups like "Comment", "String", etc.
i frequently find that i need to jump to the middle of a line and add a conditional or some or structure that requires a matchpair around some of the text. so i might want to change something like:
func($var);
into
if (func($var)) {
but in the process of making the change i get to this point
if ()func($var)
and because issue #42 is outstanding, the backspace actually deletes the opening parens:
if )func($var)
i think having an option to only autoclose if there is nothing to the right of the opening matchpair would make things a lot easier.
hello, I can't seem to get delimitmate to work in tandem with latex suite, but i've had it work elsewhere when not in tex files. I can't tell if its a bug on one side or another, or perhaps just an unforseen interaction bteween the two, how would i determine this?
Redo doesn't work as expected.
When starting vim, I always get an error about the visual mapping. This patch fixes that:
diff --git a/autoload/delimitMate.vim b/autoload/delimitMate.vim
index 7671f3d..5532e89 100644
--- a/autoload/delimitMate.vim
+++ b/autoload/delimitMate.vim
@@ -653,7 +653,7 @@ function! delimitMate#VisualMaps() " {{{
let vleader = b:_l_delimitMate_visual_leader
" Wrap the selection with matching pairs, but do nothing if blockwise visual mode is active:
for del in b:_l_delimitMate_right_delims + b:_l_delimitMate_left_delims + b:_l_delimitMate_quotes_list
- exec "silent vnoremap <unique> <silent> <buffer> <expr> " . vleader . del . ' delimitMate#Visual("' . escape(del, '")') . '")'
+ exec "silent! vnoremap <unique> <silent> <buffer> <expr> " . vleader . del . ' delimitMate#Visual("' . escape(del, '")') . '")'
endfor
endfunction "}}}
There are no help information on delimitMateBalance.
If I have "hello)" and I type a "(" before the "h", it should not add the extra ending delimiter ")" since there's already an unbalanced ending delimiter.
Let's say we have the following abbreviation
:iab up user_path
And I type up(. The result will be:
up()
Rather than:
user_path()
Thanks,
Bogdan.
[hello] there
gives
[hello]]there]]]]]]
this also happens with "(".
Thanks!
This is needed for completion.
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.