0

I am using the vim console on windows.

Is there any good extension out there to autocmatically close HTML and/or CSS and possibly jquery tags?

like in eclipse when i got <p i press ctrl+space and it automatically puts me <p> </p> ?

CodeFanatic
  • 11,434
  • 1
  • 20
  • 38
  • That's not auto completion, but auto-closing of tags, brackets, etc., and you'll find some information on the [Vim Tips Wiki](http://vim.wikia.com/wiki/Automatically_append_closing_characters). – Ingo Karkat Feb 19 '14 at 09:57

1 Answers1

3

Vim comes with an auto complete of ctrl+p and ctrl+n.

It is for the variables and functions you have written.

If you want to add support for tags and jQuery / JavaScript functions you might want to create a text file, write all of the functions you use and want (After all, most of us use a small subset of each library we utilize) And then just load the file when an HTML file is created / loaded like so:

autocmd BufNewFile,BufRead *`<extention>` badd `<dir to file>`

the extension in your case can be .html or .js

Edit: If you don't want to do it yourself, try this: https://github.com/rogeliog/Vim-Snippets

And possibly read this question: How do I get vim to autocomplete my jQuery code?

Edit2: If you want to have the autocomplete with ctrl + space, try this:

inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
\ "\<lt>C-n>" :
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
imap <C-@> <C-Space>
Community
  • 1
  • 1
Stanimirovv
  • 3,064
  • 8
  • 32
  • 56