-2

Emmet plugin installed on my vim74.

Here are some tutorial from the mannual .
https://docs.emmet.io/customization/snippets/

Create snippets.json file in extensions folder to add or override snippets.

sudo find /  -name  'snippets.jsom'
nothing as output.

No snippets.json in my directories,i want to create it as the mannual say,which directory to put it in?

What does extensions folder mean?
Which directory is extensions folder for my vim and emmet?

tree  -L 2  /usr/share/vim
/usr/share/vim
├── addons
│   ├── doc
│   └── plugin
├── registry
│   └── vim-runtime.yaml
├── vim74
│   ├── autoload
│   ├── bugreport.vim
│   ├── bundle
│   ├── colors
│   ├── compiler
│   ├── debian.vim
│   ├── delmenu.vim
│   ├── doc
│   ├── evim.vim
│   ├── filetype.vim
│   ├── ftoff.vim
│   ├── ftplugin
│   ├── ftplugin.vim
│   ├── ftplugof.vim
│   ├── gvimrc_example.vim
│   ├── indent
│   ├── indent.vim
│   ├── indoff.vim
│   ├── keymap
│   ├── lang
│   ├── macros
│   ├── menu.vim
│   ├── mswin.vim
│   ├── optwin.vim
│   ├── plugin
│   ├── print
│   ├── rgb.txt
│   ├── scripts.vim
│   ├── spell
│   ├── synmenu.vim
│   ├── syntax
│   ├── tutor
│   └── vimrc_example.vim
├── vimfiles -> /etc/vim
├── vimrc -> /etc/vim/vimrc
└── vimrc.tiny -> /etc/vim/vimrc.tiny

tree -L 1  /usr/share/vim/vim74/autoload
/usr/share/vim/vim74/autoload
├── adacomplete.vim
├── ada.vim
├── ccomplete.vim
├── clojurecomplete.vim
├── csscomplete.vim
├── decada.vim
├── emmet
├── emmet.vim
├── getscript.vim
├── gnat.vim
├── gzip.vim
├── htmlcomplete.vim
├── javascriptcomplete.vim
├── netrwFileHandlers.vim
├── netrw_gitignore.vim
├── netrwSettings.vim
├── netrw.vim
├── paste.vim
├── phpcomplete.vim
├── python3complete.vim
├── pythoncomplete.vim
├── README.txt
├── rubycomplete.vim
├── spellfile.vim
├── sqlcomplete.vim
├── syntaxcomplete.vim
├── tar.vim
├── tohtml.vim
├── vimball.vim
├── xml
├── xmlcomplete.vim
└── zip.vim

2 directories, 30 files
tree -l 1  /usr/share/vim/vim74/plugin
1 [error opening dir]
/usr/share/vim/vim74/plugin
├── emmet.vim
├── getscriptPlugin.vim
├── gzip.vim
├── matchparen.vim
├── netrwPlugin.vim
├── README.txt
├── rrhelper.vim
├── spellfile.vim
├── tarPlugin.vim
├── tohtml.vim
├── vimballPlugin.vim
└── zipPlugin.vim
showkey
  • 482
  • 42
  • 140
  • 295

2 Answers2

1

The linked page says:

Please refer to README file bundled with your editor’s plugin to find out where Emmet looks for extensions.

When you read this sentence, what is the only reasonable thing to do? Reading your plugin's READMEof course! A README that says:

If you have installed the web-api for emmet-vim you can also add your own snippets using a custom snippets.json file.

Once you have installed the web-api add this line to your .vimrc:

let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.snippets_custom.json')), "\n"))

You can change the path to your snippets_custom.json according to your preferences.

Community
  • 1
  • 1
romainl
  • 186,200
  • 21
  • 280
  • 313
0

1.to install pathogen.vim

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

2.to edite snippets.json
copy https://github.com/emmetio/emmet/blob/master/lib/snippets.json and revise something for your customization.
I want to make html:5 expand as below.

<html lang="zh">
<head>
    <meta charset="gbk">
    <title></title>
</head>
<body>

</body>
</html>


vim  ~./vim/snippets.json
"variables": {
        "lang": "zh",
        "locale": "en-US",
        "charset": "gbk",
        "indentation": "\t",
        "newline": "\n"
    },

To list only part codes of it.

3.to edite your .vimrc to call snippets.json

vim .vimrc
let g:user_emmet_settings = webapi#json#decode(join(readfile(expand('~/.vim/snippets.json')), "\n"))
showkey
  • 482
  • 42
  • 140
  • 295