用ALE替換了Syntastic

栏目: 编程工具 · 发布时间: 6年前

内容简介:習慣頻繁地保存源碼,但是每次保存都有明顯的卡頓,於是用Vim自己的調優功能跟蹤了一下。依次執行以下命令:然後執行保存操作,再執行以下命令:

習慣頻繁地保存源碼,但是每次保存都有明顯的卡頓,於是用Vim自己的調優功能跟蹤了一下。

依次執行以下命令:

:profile start profile.log
:profile file *
:profile func *

然後執行保存操作,再執行以下命令:

:profile pause
:noautocmd qall!

在當前目錄下生成的文件profile.log里,看到執行時間最長的是Syntastic的函數,禁用這個擴展後保存果然比原來快多了。

但是Syntastic是個很有用的擴展,所以Google一下有沒有異步執行的方法,偶然發現了ALE,主要特性就是異步執行。試用之後覺得很好用,就把前者卸了。

ALE的初始配置如下:

" ALE
let g:ale_sign_column_always = 1
let g:ale_set_highlights = 0
let g:airline#extensions#ale#enabled = 1
"自定義errorwarning圖標
let g:ale_sign_error = '✗'
let g:ale_sign_warning = '⚠'
" 顯示Linter名稱,出錯或警告等相關信息
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
" PHP
let g:ale_php_phpcs_standard = 'PSR2'
let g:ale_php_phpmd_ruleset = '~/.phpmd.xml'
" 普通模式下,sp前往上一個錯誤或警告,sn前往下一個錯誤或警告
nmap sp <Plug>(ale_previous_wrap)
nmap sn <Plug>(ale_next_wrap)
" 觸發/關閉語法檢查
nmap <Leader>at :ALEToggle<CR>
" 查看錯誤或警告的詳細信息
nmap <Leader>ad :ALEDetail<CR>

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Flow-Based Programming (2nd Edition)

Flow-Based Programming (2nd Edition)

CreateSpace / 2010-5-14 / $69.95

Written by a pioneer in the field, this is a thorough guide to the cost- and time-saving advantages of Flow-Based Programming. It explains the theoretical underpinnings and application of this program......一起来看看 《Flow-Based Programming (2nd Edition)》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具