├── ftdetect └── hipack.vim ├── ftplugin └── hipack.vim ├── indent └── hipack.vim ├── README.rst └── syntax └── hipack.vim /ftdetect/hipack.vim: -------------------------------------------------------------------------------- 1 | " Author: Adrián Pérez de Castro 2 | " License: GPLv3 3 | " Todo: 4 | " - Try to detect hipack mode from file contents 5 | autocmd BufRead,BufNewFile *.hi setfiletype hipack 6 | -------------------------------------------------------------------------------- /ftplugin/hipack.vim: -------------------------------------------------------------------------------- 1 | " Author: Adrián Pérez de Castro 2 | " License: GPLv3 3 | 4 | setlocal commentstring=\#\ %s 5 | setlocal iskeyword+=36-46,!,59-64 6 | setlocal shiftwidth=4 7 | setlocal tabstop=4 8 | -------------------------------------------------------------------------------- /indent/hipack.vim: -------------------------------------------------------------------------------- 1 | " Author: Adrián Pérez de Castro 2 | " License: GPLv3 3 | " Todo: 4 | " - Increase indentation when opening new lines inside an unterminated list 5 | 6 | if exists("b:did_indent") 7 | finish 8 | endif 9 | 10 | setlocal cindent 11 | setlocal cinkeys=0#,{,0},!^F,o,O 12 | setlocal cinoptions={0,}0,L0,J1,j1,+0 13 | setlocal nolisp 14 | 15 | let b:did_indent = 1 16 | 17 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ========== 2 | hipack-vim 3 | ========== 4 | 5 | This is a Vim_ plug-in that provides file format detection and syntax 6 | highlighting for files which contain HiPack_-formatted content. The 7 | format is often used for configuration files, and for data interchange. 8 | 9 | 10 | Installation 11 | ============ 12 | 13 | Using NeoBundle_ 14 | ---------------- 15 | 16 | 1. Add ``NeoBundle 'aperezdc/hipack-vim'`` to ``~/.vimrc`` 17 | 18 | 19 | Using Vundle_ 20 | ------------- 21 | 22 | 1. Add ``Plugin 'aperezdc/hipack-vim'`` to ``~/.vimrc`` 23 | 2. Run ``vim +PluginInstall +qall`` 24 | 25 | Using Pathogen_ 26 | --------------- 27 | 28 | Execute the following commands: 29 | 30 | 1. ``cd ~/.vim/bundle`` 31 | 2. ``git clone https://github.com/aperezdc/hipack-vim`` 32 | 33 | .. _vim: http://www.vim.org 34 | .. _neobundle: https://github.com/Shougo/neobundle.vim 35 | .. _vundle: https://github.com/gmarik/vundle 36 | .. _pathogen: https://github.com/tpope/vim-pathogen 37 | .. _hipack: http://hipack.org 38 | -------------------------------------------------------------------------------- /syntax/hipack.vim: -------------------------------------------------------------------------------- 1 | " Author: Adrián Pérez de Castro 2 | " License: GPLv3 3 | 4 | if version < 600 5 | syntax clear 6 | elseif exists("b:current_syntax") 7 | finish 8 | endif 9 | 10 | let s:cpo_save = &cpo 11 | set cpo&vim 12 | 13 | syntax case match 14 | syntax sync minlines=100 15 | 16 | syntax match hipackIdentError "\<[^:[:space:]]\+\>" contained 17 | syntax keyword hipackTodo TODO FIXME XXX NB NOTE contained 18 | syntax region hipackComment start="#" end="$" contains=hipackTodo,@Spell 19 | syntax region hipackDict transparent fold matchgroup=hipackDictBound start="{" end="}" contains=ALLBUT,hipackColonError,hipackIdentError 20 | syntax region hipackList transparent matchgroup=hipackListBound start="\[" end="\]" contains=ALL 21 | syntax region hipackString start=/"/ skip=/\\"/ end=/"/ contains=NONE 22 | syntax match hipackNumber "\<[-+]\?\d\+\(\.\d\+\)\?\([eE][-+]\?\d\+\)\?" 23 | syntax match hipackNumber "\<0[xX]\x\+" 24 | syntax match hipackNumber "\<0\o\+" 25 | syntax keyword hipackBoolean true True false False 26 | syntax match hipackComma "," 27 | syntax match hipackColon ":" 28 | syntax match hipackColonError ":" contained 29 | syntax match hipackAnnot ":\<[^:\[\]\{\}\,[:space:]]\+\>" 30 | 31 | highlight default link hipackTodo Todo 32 | highlight default link hipackComment Comment 33 | highlight default link hipackColon Operator 34 | highlight default link hipackComma Operator 35 | highlight default link hipackNumber Number 36 | highlight default link hipackBoolean Boolean 37 | highlight default link hipackString String 38 | highlight default link hipackAnnot Macro 39 | highlight default link hipackDictBound Structure 40 | highlight default link hipackListBound Structure 41 | 42 | highlight default link hipackColonError Error 43 | highlight default link hipackIdentError Error 44 | 45 | let b:current_syntax = 'hipack' 46 | let &cpo = s:cpo_save 47 | unlet s:cpo_save 48 | --------------------------------------------------------------------------------