Mais conteúdo relacionado Semelhante a Vim for php (20) Vim for php2. About me
김예솔 at NAVER Labs
ngleader@gmail.com
XpressEngine Project Leader
#docker #php #hhvm #opensource #beer
3. What is VIM ?
Vi IMproved
Version 7.4.460 (Current)
Vim is a highly configurable text editor built to enable
efficient text editing. It is an improved version of the vi
editor distributed with most UNIX systems.
- http://www.vim.org
4. Why Vim ?
가볍고, 빠르다
터미널에서 실행 가능
다양한 부가기능
Vim Script와 함께 강력한 기능
XE 사용자 대응이 편하다
8. My Case
데스크탑을 ubuntu로...
Vim Cheat Sheet 출력
.vimrc 과 plugin 검색
훌륭한 멘토
10. Open & Save & Quit
$ vim ~/.vimrc
$ vim *.php
:e
:w :w!
:q :q!
12. Move
h j k l
:줄 번호
첫 줄 - gg 또는 :1
마지막 줄 - G 또는 :$
14. Mode
Visual Mode - v
Visual-Line Mode - Shift + v
Visual-Block Mode - CTRL + v
22. Plugin Manager
4 Vundle
https://github.com/gmarik/Vundle.vim
4 NeoBundle
https://github.com/Shougo/neobundle.vim
4 Pathogen
https://github.com/tpope/vim-pathogen
...
25. NERDTree
파일과 디렉토리 네비게이터
4 Plugin 'The-NERD-tree' => ~/.vimrc 추가
4 :so ~/.vimrc
4 :PluginInstall
4 :NERDTree
26. VIM + ctags
코드를 분석하여 함수, 변수 등을 DB화
이를 이용해 정의된 구현체로 이동 가능
코드 자동 완성에도 반영
27. Install
$ sudo yum -y install ctags
$ ctags -f .php.tags --languages=PHP -R
$ echo "set tags=.php.tags" >> ~/.vimrc
29. Taglist
코드 브라우져
functions, classes, structures, enumerations,
definitions 등을 보여주고 이동이 가능
Plugin 'taglist-plus'
:TList
32. PHP Syntax Check
nmap <leader>s :!clear && php -l %<CR>
"nmap" : 단축키 설정
"<leader>s" : 단축키
"<leader>" : prefix dafault
":!" shell script 실행
"clear && php -l %" : shell script
"%" : 현재 파일
"<CR>" : 실행
33. PHPQA
PHP quality checking tools
4 Syntax errors
4 Coding standard violations
4 Code coverage
https://github.com/joonty/vim-phpqa
34. Check Code Convension
https://github.com/squizlabs/PHP_CodeSniffer
$ composer global require "squizlabs/php_codesniffer=*"
or
$ pear install PHP_CodeSniffer
39. Text-Object
dit - delete inner tag
dib - delete inner '(' ')' block
diB - delete inner '{' '}' block
dab, daB, dat, cib, ciB, cit
42. Shell Script
1 에서 100 까지 입력
:r! for i in {1..100}; do echo $i; done
:r! php -r 'foreach(range(1,100) as $i) echo $i,"n";'