2017-03-24 31 views
-2

Emmet插件安裝在我的vim74上。將snippets.json文件放入哪個目錄進行自定義?

這裏是一些手冊mannual。
https://docs.emmet.io/customization/snippets/

在extensions文件夾中創建snippets.json文件以添加或覆蓋片段。

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

在我的目錄中沒有snippets.json,我想創建它作爲mannual說,哪個目錄放入它?

extensions文件夾是什麼意思?
哪個目錄是我的vim和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 

回答

0

1.to安裝pathogen.vim

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

2.to edite snippets.json
複製https://github.com/emmetio/emmet/blob/master/lib/snippets.json和修改的東西爲你定製。
我想使html:5展開如下。

<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" 
    }, 

僅列出其部分代碼。

3.to edite你的.vimrc到snippets.json調用

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

所鏈接的頁面說:

請參考您的編輯器的插件捆綁的README文件,以找出埃米特查找擴展的。

當你讀到這句話,什麼是唯一合理的事是什麼?當然,請閱讀您的插件README!一個README,上面寫着:

如果您已經安裝了web-api埃米特 - VIM你也可以使用自定義添加自己的代碼段snippets.json文件。

一旦你已經安裝了web-api這一行添加到您的.vimrc

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

您可以根據您的喜好路徑更改爲snippets_custom.json

相關問題