"====================================================================== " " html.vim - " " Created by skywind on 2023/09/26 " Last Modified: 2023/09/26 15:27:41 " "====================================================================== "---------------------------------------------------------------------- " locals "---------------------------------------------------------------------- setlocal expandtab " setlocal ts=2 sts=2 sw=2 " for emmet imap "---------------------------------------------------------------------- " navigator "---------------------------------------------------------------------- let b:navigator = { 'prefix': '' } let b:navigator_insert = { 'prefix': '' } let b:navigator.z = { \ 'name': '+zen-coding', \ ';': [';', 'expand-word'], \ ',': [',', 'expand-abbreviation'], \ 'u': ['u', 'update-tag'], \ 'd': ['d', 'balance-tag-inward'], \ 'D': ['D', 'balance-tag-outward'], \ 'n': ['n', 'next-edit-point'], \ 'N': ['N', 'prev-edit-point'], \ 'i': ['i', 'update-image-size'], \ 'm': ['m', 'merge-lines'], \ 'k': ['k', 'remove-tag'], \ 'j': ['j', 'split-join-tag'], \ '/': ['/', 'toggle-comment'], \ 'a': ['a', 'make-anchor-url'], \ 'A': ['A', 'quoted-text-url'], \ 'c': ['c', 'code-pretty'], \ } let b:navigator_insert.z = deepcopy(b:navigator.z) "---------------------------------------------------------------------- " switch function "---------------------------------------------------------------------- function! s:switch_css(name, values) let definition = {} let size = len(a:values) for index in range(size) let inext = index + 1 let inext = (inext >= size)? 0 : inext let word = a:values[index] let next = a:values[inext] let key = printf('\<%s\>\s*:\s*\<%s\>', a:name, word) let val = printf('%s: %s', a:name, next) let definition[key] = val endfor return definition endfunc "---------------------------------------------------------------------- " switch.vim "---------------------------------------------------------------------- let b:switch_custom_definitions = [ \ s:switch_css('position', ['static', 'fixed', 'absolute', 'relative']), \ s:switch_css('display', ['block', 'inline-block', 'none', 'flex', 'grid']), \ s:switch_css('flex-direction', ['row', 'row-reverse', 'column', 'column-reverse']), \ { \ '\\s*:\s*left': 'align: right', \ '\\s*:\s*right': 'align: center', \ '\\s*:\s*center': 'align: left', \ }, \ ]