日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

vim下php文件中自动缩排html代码

發布時間:2023/12/10 php 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vim下php文件中自动缩排html代码 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
問題:vim下怎樣在php文件中通過 = 命令自動縮排html代碼?解決:1、先說下html自動縮排 我的vim是7.4版本,已經包含了html.vim之類的縮排插件,但是縮排的時候<body> <head> 沒有進行縮排 在.vimrc中加入如下代碼即可對 <body> <head> 也進行縮排" html indent filetype indent on let g:html_indent_inctags = "body,head,tbody" " 縮進body head " let g:html_indent_script1 = "inc" " 縮進<script>標簽 " let g:html_indent_style1 = "inc" " 縮進<style>標簽2、解決php文件中html代碼縮進創建 ~/.vim/indent/php.vim 文件,如果沒有indent目錄,就先創建indent目錄 然后在 php.vim 文件中粘貼如下代碼并保存" Better indent support for PHP by making it possible to indent HTML sections " as well. if exists("b:did_indent")finish endif " This script pulls in the default indent/php.vim with the :runtime command " which could re-run this script recursively unless we catch that: if exists('s:doing_indent_inits')finish endif let s:doing_indent_inits = 1 runtime! indent/html.vim unlet b:did_indent runtime! indent/php.vim unlet s:doing_indent_inits function! GetPhpHtmlIndent(lnum)if exists('*HtmlIndent')let html_ind = HtmlIndent()elselet html_ind = HtmlIndentGet(a:lnum)endiflet php_ind = GetPhpIndent()" priority one for php indent scriptif php_ind > -1return php_indendifif html_ind > -1if getline(a:num) =~ "^<?" && (0< searchpair('<?', '', '?>', 'nWb')\ || 0 < searchpair('<?', '', '?>', 'nW'))return -1endifreturn html_indendifreturn -1 endfunction setlocal indentexpr=GetPhpHtmlIndent(v:lnum) setlocal indentkeys+=<>>3、在 .vimrc 中還需要添加 filetype indent on 打開根據文件類型自動縮進 在vim命令模式下中輸入 gg=G 即可完成自動縮排參考: http://www.vim.org/scripts/script.php?script_id=2075 http://blog.longwin.com.tw/2009/01/vim-indent-for-php-html-2009/ http://cache.baiducontent.com/c?m=9d78d513d9871af04fede53c5754c066680ec63c62c0d0642488c51fcf224f060738ece161645213d2b6617a45f4164bea8773296e5873a09bbfd91782a6d77376d33a44275ac01652c41edb901a73967cd64deedb58a0f8b26fd3e8c5d4ab000e8a44020ec2aac94d07608f34b64e26e4d2c30e4a01&p=c06ccc04969d12a05abd9b7e0b1791&newp=9370c64ad48703fa08e294780c4dcf231610db2151d6d7143b96c6&user=baidu&fm=sc&query=vim+php+html+indent&qid=a72951080000046d&p1=2


轉載于:https://www.cnblogs.com/zcube/p/4222410.html

總結

以上是生活随笔為你收集整理的vim下php文件中自动缩排html代码的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。