0

Here is the test.html file which in editing status:

enter image description here

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <div id="box1"></div>
    <div id="box2"></div>
    <script charset="utf-8" type="text/javascript">
       var oBox1 = document.getElementById("box1");
       var oBox2 = document.getElementById("box2");
       oBox1

    </script>
</body>
</html>

I want to add .innerHTML in oBox1,why can't add it ? If i remove the following setting in .vimrc ,.innerHTML can added at the end of oBox1,but i can't call auto completion with double ,.

autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType javascript inoremap  .  <C-X><C-O>

Paste all the setting in my .vimrc:

set nowritebackup
set clipboard^=unnamed,unnamedplus
set ruler
set noundofile
set autochdir
set tabstop=4
set sts=4
set expandtab
set softtabstop=4
set shiftwidth=4
set mouse=a
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
autocmd BufRead  +  exec "%s/\t/    /g"
set backspace=indent,eol,start
set fo+=w
set wrap
autocmd FileType * setlocal textwidth=120

autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType javascript inoremap  .  <C-X><C-O>

set number

set guifont=Bitstream\ Vera\ Sans\ Mono\ 14
set guifontwide=Noto\ Sans\ CJK\ SC\ 14

execute pathogen#infect()
execute pathogen#helptags()
syntax on
"filetype plugin indent on
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-f>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsSnippetDirectories=['/home/debian/.vim/bundle/vim-snippets/UltiSnips']
let g:UltiSnipsEnableSnipMate=0
" list all snippets for current filetype
let g:UltiSnipsListSnippets="<c-l>"


let g:emmet_html5 = 1  
let mapleader = ','
let g:user_emmet_leader_key = ','
let g:user_emmet_install_global = 1
set linespace=4
1
  • 1
    You might want to edit the Post to include the output of ":set" when you are editing "test.html" , which then will include "filetype" & "syntax" & "omnifunc" , active at that Exact time.
    – Prem
    Jan 4 at 10:30

1 Answer 1

0
  1. Your test.html is most likely to have the html filetype assigned, so I wouldn't expect those two autocommands to have any effect in this context, as they would only be triggered for a different filetype.

  2. "If you have to press a key for it to happen, it is not 'auto'."

  3. It is not evident from the existing info why you expect ,, to trigger completion.

  4. With $ vim --clean test.html, completion is triggered by <C-x><C-o>, as expected. You should add your whole config to your question to help us clear this out. We are missing a lot of context, here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.