mattn / emmet-vim

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

class not expanding to className .js files #454

Open JensPauwels opened 5 years ago

JensPauwels commented 5 years ago

when i use .foo i get <div class="foo"></div> instead of <div className="foo"><div>

" Main configuration file for the Neovim editor.
set winwidth=109
set ignorecase
set autowriteall
set smartcase
set noswapfile
set autochdir
set showmatch
set guitablabel=\[%N\]\ %t\ %M 

" Configuration is modularized in plugins, check out the 'plugin' directory.
" Leader mapping is bound to space.
let mapleader="\<Space>"

" File-type specific leader is \.
let maplocalleader="\\"
let g:airline#extensions#tabline#fnamemod = ':t'
let ayucolor="dark"

" Loading vim configuration files for specific filetypes.
""filetype plugin indent on

" Even if loading plugins goes wrong, I still want my syntax highlighting.
syntax enable

" Using vim-plug to manage plugins and their post-installation hooks.
call plug#begin("~/.local/share/nvim/plugged")

" Editing Enhancements
Plug 'scrooloose/nerdtree'
Plug 'ayu-theme/ayu-vim'
Plug 'w0rp/ale'

Plug 'gregsexton/matchtag'
Plug 'pangloss/vim-javascript'
Plug 'ervandew/supertab'
Plug 'jiangmiao/auto-pairs'
Plug 'SirVer/ultisnips'
Plug 'mxw/vim-jsx'
Plug 'othree/jspc.vim'
Plug 'wokalski/autocomplete-flow'

Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi'
Plug 'yannickcr/eslint-plugin-react'

Plug 'roxma/nvim-yarp'
Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' }
Plug 'ctrlpvim/ctrlp.vim'
Plug 'mattn/emmet-vim', { 'for': ['javascript.jsx', 'javascript', 'html', 'css'] }

Plug 'tpope/vim-surround'                 " Change word surroundings
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-commentary'               " Comments stuff
Plug 'tpope/vim-repeat'

call plug#end()
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"

let g:javascript_plugin_flow = 1
let g:deoplete#enable_at_startup = 1
let g:deoplete#auto_complete_delay = 0
let g:echodoc_enable_at_startup=1
let g:SuperTabDefaultCompletionType = '<C-n>'
let NERDTreeShowBookmarks=1
let NERDTreeIgnore=['\.DS_Store', '\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr']
let NERDTreeChDirMode=0
let NERDTreeQuitOnOpen=0
let NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeKeepTreeInNewTab=1
let g:nerdtree_tabs_open_on_gui_startup=1
let g:nerdtree_tabs_open_on_console_startup=1
let g:ale_sign_error='‚óè'
let g:ale_sign_warning='.'
let g:ale_lint_on_enter=0
let g:ale_linters = {
    \ 'javascript': ['eslint']
    \ }

autocmd FileType html,css,javascript,jsx EmmetInstall
let g:user_emmet_install_global = 0
"Note that the trailing , still needs to be entered, so the new keymap would be <C-e>,.
let g:user_emmet_leader_key=','
let g:user_emmet_settings = {
\  'javascript.jsx' : {
\      'extends' : 'jsx',
\  },
\}

let g:SuperTabDefaultCompletionType = "<c-x><c-o>"

nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
map <Leader>n <plug>NERDTreeTabsToggle<CR>
"locate current file in NERDTree
map <leader>l :NERDTreeFind<cr>

vmap r "_dP
nnoremap zr zR
nnoremap zm zM

" Smarter pasting
nnoremap <Leader>p :set invpaste paste?<CR>
nnoremap <Leader>k ddkP
nnoremap <Leader>j ddp

" -- Smart indent when entering insert mode with i on empty lines --------------
function! IndentWithI()
  if len(getline('.')) == 0
    return "\"_ddO"
  else
    return "i"
  endif
endfunction
nnoremap <expr> i IndentWithI()

" Remap the increment and decrement features of Vim
nnoremap <A-a> <C-a>
nnoremap å <C-a>

nnoremap <A-x> <C-x>
nnoremap ≈ <C-x>

" Tab Shortcuts
nnoremap tk :tabfirst<CR>
nnoremap tn :tabnext<CR>
nnoremap tp :tabprev<CR>
nnoremap tj :tablast<CR>
nnoremap tnew :tabnew<CR>
nnoremap tc :CtrlSpaceTabLabel<CR>
nnoremap td :tabclose<CR>
noremap j gj
noremap k gk
nnoremap <Leader>so :source $MYVIMRC<CR>

nnoremap <CR> :nohlsearch<cr>
augroup AutoWrite
    autocmd! BufLeave * :update
augroup END<Paste>

if (has("nvim"))
  "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
  let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif

"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
  set termguicolors
endif
GerardKetuma commented 5 years ago

Getting same issue.

iovis commented 5 years ago

Me too, this used to work for me with the extends jsx fix

edgarjs commented 5 years ago

Same here, I had the same problem some months ago after updating my plugins. Then I updated after some weeks and it got fixed. I updated them again today and it stop expanding to className.

I followed the other issues (closed) instructions (like extending jsx) but still doesn't work. My filetype reported is javascript.jsx but when I move my cursor within a JSX block of code :echo emmet#getFileType() reports xml (outside of the JSX block it reports it as javascript.

Here's my vimrc file: https://github.com/edgarjs/vimfiles/blob/master/vimrc

This is such an awesome plugin btw!

edgarjs commented 5 years ago

I can confirm that by checking out this commit I can get it back to work:

Plug 'mattn/emmet-vim', { 'commit': 'd698f1658770ca5fa58c87e80421c8d65bbe9065' }

Seems like ae7d31f29080ad18073dda3530582dacb18475e6 broke it.

JensPauwels commented 5 years ago

@edgarjs i can confirm that this is a temp solution.

kkoomen commented 5 years ago

Having the same issue. I confirm @edgarjs his solution as well.

benlieb commented 4 years ago

This issue seems resolved in the version I just updated to.