mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.43k stars 411 forks source link

Pressing ctrl+y+, doesn't work #148

Closed medinLaVie closed 3 years ago

medinLaVie commented 11 years ago

I installed everything according to the instructions. I put the emmet folder under bundle. When I tried sample as

Press "Insert" Type In "html:5" Press "ctrl"+"y"+","

But nothing happens. I tried other emmet shortcuts as well but none of them works.

mattn commented 11 years ago

Did you try "CTRL+y" and "," ?

mattn commented 11 years ago

Did you get fix?

zzxworld commented 11 years ago

i has same problem。on my macbook, os is osx 10.8.5。 in html file input html:5 or div and pressing ctrl+y+, but nothing happened change. here is my vim `runtimepath' :

runtimepath=~/.vim,~/.vim/bundle/emmet-vim,~/.vim/bundle/nerdtree,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,~/.vim/after
mattn commented 11 years ago

Did you try below?

  1. Press CTRL+y
  2. Press , without CTRL-y immediately
zzxworld commented 11 years ago

thanks, mattn. is work it.

mattn commented 11 years ago

@DMK2013 Same cause?

bonkey commented 11 years ago

Looks like I have that problem too. I use pathogen and removed all other plugins, tried different "let g:user_emmet_expandabbr_key", tried vim and MacVim and I have no idea what to verify more.

I have:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 16 2013 17:08:20)
MacOS X (unix) version
Included patches: 1-22
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +comments        +ex_extra        +insert_expand   +mouse           +netbeans_intg   +ruby            +terminfo        +wildignore
+arabic          +conceal         +extra_search    +jumplist        +mouseshape      +odbeditor       +scrollbind      +termresponse    +wildmenu
+autocmd         +cryptv          +farsi           +keymap          +mouse_dec       +path_extra      +signs           +textobjects     +windows
+balloon_eval    +cscope          +file_in_path    +langmap         -mouse_gpm       +perl            +smartindent     +title           +writebackup
+browse          +cursorbind      +find_in_path    +libcall         -mouse_jsbterm   +persistent_undo -sniff           +toolbar         -X11
++builtin_terms  +cursorshape     +float           +linebreak       +mouse_netterm   +postscript      +startuptime     +transparency    -xfontset
+byte_offset     +dialog_con_gui  +folding         +lispindent      +mouse_sgr       +printer         +statusline      +user_commands   +xim
+cindent         +diff            -footer          +listcmds        -mouse_sysmouse  +profile         -sun_workshop    +vertsplit       -xsmp
+clientserver    +digraphs        +fork()          +localmap        +mouse_urxvt     +python          +syntax          +virtualedit     -xterm_clipboard
+clipboard       +dnd             +fullscreen      -lua             +mouse_xterm     -python3         +tag_binary      +visual          -xterm_save
+cmdline_compl   -ebcdic          -gettext         +menu            +multi_byte      +quickfix        +tag_old_static  +visualextra     -xpm
+cmdline_hist    +emacs_tags      -hangul_input    +mksession       +multi_lang      +reltime         -tag_any_white   +viminfo
+cmdline_info    +eval            +iconv           +modify_fname    -mzscheme        +rightleft       +tcl             +vreplace
   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"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX -no-cpp-precomp  -g -O2 -U_FORTIFY_SOURCE -
D_FORTIFY_SOURCE=1     -I/System/Library/Frameworks/Tcl.framework/Headers  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_DARWIN_C_SOURCE=1
Linking: clang   -L.   -L.    -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lncurses -liconv -framework Cocoa   -fstack-protector -L/usr/loc
al/lib  -L/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -framework Python  -F/System/Library/Frameworks -framework Tcl -framew
ork CoreFoundation -framework Ruby

:imap shows:

i  <D-BS>      * <C-U>
i  <M-BS>      * <C-W>
i  <M-Down>    * <C-O>}
i  <D-Down>    * <C-End>
i  <M-Up>      * <C-O>{
i  <D-Up>      * <C-Home>
!  <M-Right>   * <C-Right>
!  <D-Right>   * <End>
!  <M-Left>    * <C-Left>
!  <D-Left>    * <Home>
i  <Plug>(EmmetAnchorizeSummary) * <C-R>=emmet#anchorizeURL(1)<CR>
i  <Plug>(EmmetAnchorizeURL) * <C-R>=emmet#anchorizeURL(0)<CR>
i  <Plug>(EmmetRemoveTag) * <C-R>=emmet#removeTag()<CR>
i  <Plug>(EmmetSplitJoinTag) * <Esc>:call emmet#splitJoinTag()<CR>
i  <Plug>(EmmetToggleComment) * <C-R>=emmet#toggleComment()<CR>
i  <Plug>(EmmetImageSize) * <C-R>=emmet#imageSize()<CR>
i  <Plug>(EmmetMovePrev) * <Esc>:call emmet#moveNextPrev(1)<CR>
i  <Plug>(EmmetMoveNext) * <Esc>:call emmet#moveNextPrev(0)<CR>
i  <Plug>(EmmetBalanceTagOutward) * <Esc>:call emmet#balanceTag(-1)<CR>
i  <Plug>(EmmetBalanceTagInward) * <Esc>:call emmet#balanceTag(1)<CR>
i  <Plug>(EmmetExpandWord) * <C-R>=emmet#expandAbbr(1,"")<CR>
i  <Plug>(EmmetExpandAbbr) * <C-R>=emmet#expandAbbr(0,"")<CR><Right>
i  <D-/>         <Esc><Plug>NERDCommenterToggle i
i  <C-Y>A        <Plug>(EmmetAnchorizeSummary)
i  <C-Y>a        <Plug>(EmmetAnchorizeURL)
i  <C-Y>k        <Plug>(EmmetRemoveTag)
i  <C-Y>j        <Plug>(EmmetSplitJoinTag)
i  <C-Y>/        <Plug>(EmmetToggleComment)
i  <C-Y>i        <Plug>(EmmetImageSize)
i  <C-Y>N        <Plug>(EmmetMovePrev)
i  <C-Y>n        <Plug>(EmmetMoveNext)
i  <C-Y>D        <Plug>(EmmetBalanceTagOutward)
i  <C-Y>d        <Plug>(EmmetBalanceTagInward)
i  <C-Y>;        <Plug>(EmmetExpandWord)
i  <C-Y>,        <Plug>(EmmetExpandAbbr)
mattn commented 11 years ago

@bonkey Did you try https://github.com/mattn/emmet-vim/issues/148#issuecomment-25338586 ?

bonkey commented 11 years ago

@mattn Yes, of course. But in meantime I tried to type 'C-Y' without any plugins on MacVim and I noticed that it didn't appear in any way, so I changed the leader to C-S:

let g:user_emmet_leader_key = '<c-s>'

and it somewhat worked. Somewhat because it works only with zen notation (EmmetExpandAbbr), but no other macros fire. It just types e.g. '^S/' for EmmetToggleComment.

mascip commented 11 years ago

I have the same problem and your solution works bonkey, thank you!

dixDel commented 11 years ago

Hello, none of the above solutions work for me. Here is my vim info: http://pastebin.com/2aNhaNrG Remapping does not work and nothing is displayed in the status bar.

mattn commented 11 years ago

Are you using something other plugins which uses <tab> key? ex: ultisnips

dixDel commented 11 years ago

Your plug-in works perfectly after starting with a fresh configuration. Sorry for the trouble and thanks for your work.

mattn commented 11 years ago

at all, can I close this issue?

mascip commented 11 years ago

Same here, it works. I'm not sure which other plugin caused problem, so I'll keep on using because it works for me. But your plugin works. You can close the ticket, thank you =)


I check email a couple times daily; to reach me sooner, you can send me a text message via this page: https://awayfind.com/mascip

On 15 October 2013 12:28, mattn notifications@github.com wrote:

at all, can I close this issue?

— Reply to this email directly or view it on GitHubhttps://github.com/mattn/emmet-vim/issues/148#issuecomment-26326594 .

jtmkrueger commented 10 years ago

I've found that timeoutlen=0 was killing this for me. I'm an avid <C-[> to escape user, and setting this made some things work a little quicker (mainly my status line color function). Commenting this line out of my .vimrc immediately returned the correct <C-y>, functionality.

noscripter commented 10 years ago

I got it, you need to search the keywords user_emmet_leader_key such as in this line.

let g:user_emmet_leader_key='<C-Z>'

just comment it out and you'll get the default <C-y>, shortcuts combination for emmet.

chemzqm commented 10 years ago

It would be better to put something like

    " redefine trigger key
    let g:user_emmet_leader_key='<C-Z>'

into Readme.md, as the people most likely to redefine that keystroke.

mattn commented 10 years ago

done

MortalCatalyst commented 10 years ago

I cannot resolve this. CTRL+Y , works. But as soon as I redefine it as suggested let g:user_emmet_leader_key= '<C-Z>' it actually deletes html:5

I removed ultisnips and retried but cannot get it to work with any other binding other than C-Y, which I can't use practically.

MortalCatalyst commented 10 years ago

Oh I rebound it to C-E but failed to realise I still needed to press ',' working now

mattn commented 10 years ago

g:user_emmet_leader_key mean leading key for combination of two key stroke.

first key: CTRL-Y second key: ,

You can change the first key CTRL-Y with using g:user_emmet_leader_key. If you set let g:user_emmet_leader_key = '<c-e>', you need to type <c-e>, for it. If you want to change the two key stroke as one key stroke, use let user_emmet_expandabbr_key = '<c-e>'.

ghost commented 10 years ago

I couldn't get Emmet working on macbook using any of the solutions above. However, step-by-step debugging of my .vimrc I discovered that 'set paste' was the culprit.

Commenting out 'set paste' in the .vimrc fixed it for me.

mattn commented 10 years ago

set paste disable all of key mappings. So you can't use any vim plugins which provide key mappings.

kgust commented 10 years ago

I remember this used to work for me. Now the behavior I'm getting is consistent with this...

:help i_CTRL-y  " Insert the character that is above the cursor

If there is nothing above, it inserts nothing and then a ','. Emmet works intermittently in MacVim but not in terminal vim.

kgust commented 10 years ago

By the way, I tried remapping to C-e and C-s but that doesn't seem to help terminal vim.

kuntau commented 10 years ago

Thanks @jtmkrueger. That solved my problem, hours wasted for troubleshooting :+1:

scardine commented 10 years ago

@kgust: same here (gvim on windows), have you solved it so far?

kgust commented 10 years ago

@scardine I wasn't able to get it to work like I wanted, so I installed vim-sparkup instead. No complaints so far.

scardine commented 10 years ago

@kgust I owe you a beer for the vim-sparkup tip. :-)

mattn commented 10 years ago

@kgust are you using insertmode?

jwhitley commented 9 years ago

Kudos to @jtmkrueger, that's also my issue. In my case, I've got some insert-mode specific autocmd trickery that switches timeoutlen to 0 only in insert-mode. That utterly defeats emmet's binding approach, since it's impossible to enter the follow-on character after a <C-y> mapping (e.g. <C-y>, to expand an emmet abbreviation).

I may see if I can do something horrible like create a wrapper prefix mapping (say, <C-e>) that resets timeoutlen to a non-zero value, then restores it when the emmet command is complete? If you hear evil cackling from miles away, you'll know I've succeeded. :smiling_imp:

jwhitley commented 9 years ago

Followup: AFAICT, it's impossible to create a Vim wrapper function that executes just the prefix of an existing keybinding, e.g. as a kind of passthru: <c-e>{blah} => <c-y>{blah}. This is because :normal bails if its command argument is incomplete, just as if <esc> or <C-c> were pressed.

However, as a tentative workaround, set timeoutlen=100 (vs zero) in insert mode seems to provide a happy medium where the keybinding works but returning to normal mode is still snappy.

mattn commented 9 years ago

I don't understand why you need the trick of fast esc.

mattn commented 9 years ago

@jwhitley I suggest https://github.com/kana/vim-arpeggio to you. :)

anthonybrown commented 9 years ago

@jtmkrueger thanks, commenting out the set timeoutlen=0 fixed my issues. emmet is working in both vim and macvim, both compiled from brew.

wsdjeg commented 9 years ago

your plugin is very usefull for me,thank you for you work

iolloyd commented 7 years ago

Increasing timeoutlen worked for me.

jngilman commented 6 years ago

mattn, thank you for the plug-in.

Newbies may have forgotten that they will need to quit and exit terminal then restart it to complete installation.

shengnoyi commented 5 years ago
  1. Try to type 'html:5' in insert mode.
  2. Back to normal mode.
  3. press 'Ctrl + Y + ,' if it works, it means the plugin can work but you need to set emmet-vim activated into insert mode.
mattn commented 5 years ago

you can expand with emmet on insert mode too.

nilknow commented 5 years ago

I can't use emmet on insert model, but can in normal model. I user CentosOs7 and vim7

harryghgim commented 4 years ago

If you installed emmet with vim-plug and somehow emmet is not working, try installing with Vundle. I soloved the issue with this.

speedy1812 commented 4 years ago

If your are installing with Vim-Plug, don't forget to run :PlugInstall, or whatever the analogous command is for your plugin manager. It may seem obvious, but I forgot to do so and was pulling my hair out for a while trying to figure out why the trigger key wasn't working. 🤦‍♂️

kjsf commented 4 years ago

I was having the same problem _let g:user_emmet_leaderkey wasnt changing my leader key but all i had to do is rerun terminal vim and the new assigned leader key works.

branquito commented 3 years ago

I've found that timeoutlen=0 was killing this for me. I'm an avid <C-[> to escape user, and setting this made some things work a little quicker (mainly my status line color function). Commenting this line out of my .vimrc immediately returned the correct <C-y>, functionality.

Oh God, how frustrated I was because it doesn't work but just in insert mode, and this was the culprit. Many thanks for this one!

danushk commented 3 years ago

in vimrc set timeoutlen=250, breaks ""+"<,>" Emmet trigger

even reloading vimrc with :source $MYVIMRC does not fix it - you have to :qa and run vim again to fix this.

ranelpadon commented 3 years ago

@jtmkrueger Thanks a lot for your tip!

@mattn Thanks for this excellent plugin. Just wondering if we could include a note/warning in the docs/README regarding the timeoutlen=0, or any value that is too low for the <C-Y>, key sequences? This caused me few hours of troubleshooting which just led to nowhere, which could be easily avoided if possible conflicts with timeoutlen setting was emphasized in the docs.

This issue was filed on Sep 2013 (7 years ago), but still pester lots of people up to now based on the comments here. An improved README could easily prevent this. Having zero or very low timeout value for key sequences is pretty common among Vim/Tmux users. :)

spfroc commented 2 years ago

Did you try below?

  1. Press CTRL+y
  2. Press , without CTRL-y immediately

Thanks, it works!

ghost commented 2 years ago

Did you try below?

  1. Press CTRL+y
  2. Press , without CTRL-y immediately

Thanks bro!