A strange stuff of my gVim and emmet plugin - vim

I install gvim and its emmet plugin(win7 64bit,default _vimrc),but has some problem with it.
I found a strange stuff in my gVim. when I expand at a letter, my vim will pick one letter from the line next to the current line and push to the current cursor point. like this:
body { c| }
#wrap{position:relative....
(cursor at '|')when expand, it will pick the 'o' in 'position' to c and so problem comes.
but if I back to normal mode and expand,all will run perfect.
What a devil! If the next position of cursor in the next line is blank, the expand action will run with no mistake.
I just use vim a week, can somebody tell me the possible reason of this?

It looks like a bad installation but another thing seems off: Emmet's default leader combo is <C-y> so, if anything, Vim should insert a character from the line above (:help i_ctrl-y) not from the line below (:help i_ctrl-e).
I'd suggest insisting on the issue tracker.

Related

Move to the beginning of New Line - VIM

while in insert mode in vim how do i move to a new line correctly indented.
In many editors this action would be CTRL+ENTER
There is a similar stackoverflow question here however this answer takes you back to the start of the current line SO start of current line
So assuming this is my code, my cursor is just at the T in POST and i want to go to the start of the next line or next line with correct indentation if its a function(using snippets for function so now great concern).
#app.route('/add', method=['POST | '])
expected result
#app.route('/add', method=['POST'])
|
I would use <esc>o. Assuming you have filetype plugin indent on in your vimrc o will automatically go to the correct indent level.
Search for indentation and map to some keys, so you cannot search for every time.
/^^I
^I is tab

Why does vim sometimes display linebreaks incorrectly?

I have a long line of text in vim, soft-wrap is on, I've done :set linebreak, and breakat has the right value.
The problem is, when I edit some text in the middle of the "paragraph", the lines don't wrap at word boundaries anymore.
Example:
1) Cursor is in the middle of the line:
2) I type cw and the linebreaks change:
It stays like that when I go back to normal mode, but wraps correctly again when the cursor leaves the line.
This does not happen if I add text in the middle, or do a command like dw - seemingly just commands that delete some text and enter insert mode.
The problem began on a fresh install of Fedora 21, but my .vimrc is unchanged from my previous computer, where I did not have this problem.
How do I restore the correct behavior, or is this perhaps a bug in the Fedora package?
I believe, this is a bug, that has been fixed with 7.4.576

Vim jumps to last occurence of replacement argument

When I execute a replace command, e.g
:%s/toBeReplaced/Replacement/g
Vim jumps to the last occurence of toBeReplaced. This is quite irritating because I have to go back to the position where I was editing. I've quikly renamed my .vimrc to .vimrc_ in order to disable my personal .vimrc. The same thing happens, hence it seems to be vim's default behavior.
When a replacement command is executed, I want vim to stick at the position where I am editing at that moment. Is there any way to achieve this??
after you executed the :s, press :
``
will bring you back to the position before your run the cmd.

Vimrc settings to emulate Sublime's parenthesis auto-completion

How do I emulate Sublime text's auto complete behavior for curly braces {} on vim? Basically, when a parenthesis is opened, it should auto close in the same line, and when <CR> is pressed the cursor should go to the next line with a block indentation and } should fall in line with the original indention of the line containing the {. If my question is not clear, this is the default behavior of most code editors when dealing with {}.
The Automatically append closing characters page on the Vim Tips Wiki has everything from simplistic mappings to complete plugin solutions. There seem to be issues with the latest Vim 7.4 version, though.
There exist many plugins with similar features as Ingo pointed out.
lh-brackets, that I'm maintaining, has the features you describe:
{ inserts {} and moves the cursor in between (and also inserts a placeholder after the closing bracket
hitting <cr> while within a pair of curly-brackets will insert another newline in-between (and indent correctly)

Wrap long lines in Vim?

I've noticed that gq does not work when I paste in a long line. For example, with a textwidth=72 and formatoptions=tcroqbnl, gq refuses to wrap this (in insert mode, I pasted the entire label contents, and then exited insert mode with ESC):
<label for="contact_reason_1">To get assistance with or to confirm a tire replacement recommendation</label>
If I add a line break in (after "to", for example), it'll wrap then. The funny thing is if I join the line back together, it'll happily wrap it again. So VIM seems to somehow be remembering "oh, this is one paste, don't wrap it".
How do I turn that feature off? I'd like gq in command mode to always work. Taking l out of formatoptions did not seem to help (and it shouldn't, this isn't insert mode).
clarification
Yes, I'm using a motion command, in particular, gq<Right>. formatexpr and formatprog are both unset. If it matters, this is in gvim on Debian GNU/Linux, vim version 7.2p284.
steps to reproduce
Pop up gvim on an open file.
Press i to get into insert mode, then type This is a long line. A long line. But not wrappable yet. Or yet. Soon.
Press ESC, then I. Type Now putting text in front of the long line. note: there is a space after the final period, can't get SO to show it, except when this note is here. FUN.
Press ESC, then A. Type And some after. note: space before the And, same SO problem.
Press ESC one last time. Now try gq<Left>, note it only wraps And some after.; I can't get vim to wrap the rest of the line (without going into insert mode and doing a line break by hand, then it works).
Fixing this state is doable; putting a newline after "now" and then hitting undo makes line wrap work again. WTF.
gq isn't enough to wrap the text. You have to give it a motion over which to wrap (like gqj) or tell it to wrap the current line with gqq. Are you sure you're not just mistyping it?
If you aren't, what are the formatexpr and formatprg options set to, if anything?
Update
The problem is the b setting in formatoptions. That's telling Vim to only wrap the text added during the last insertion.
I find that if I select the line before doing the gq, it works fine. Doesn't gq want to be combined with some text selection operation to work?
UPDATE
I confirm the bug. Running vim -u NONE, my formatoptions are vt.
Maybe Bram Molenar or at least the vim community would be interested?

Resources