Download - Vim for php
![Page 1: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/1.jpg)
Vim for <?PHP
![Page 2: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/2.jpg)
About me김예솔 at NAVER Labs
XpressEngine Project Leader
#docker #php #hhvm #opensource #beer
![Page 3: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/3.jpg)
What is VIM ?Vi IMprovedVersion 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
![Page 4: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/4.jpg)
Why Vim ?가볍고, 빠르다
터미널에서 실행 가능
다양한 부가기능
Vim Script와 함께 강력한 기능
XE 사용자 대응이 편하다
![Page 5: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/5.jpg)
KEYBOARD수 많은 단축키HARD TO LEARN
![Page 6: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/6.jpg)
싫어하는 계기가 될 수도 ...
![Page 7: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/7.jpg)
Goals4 어떤 활용이 가능한지4 Plugin 설치법4 vim script
![Page 8: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/8.jpg)
My Case데스크탑을 ubuntu로...
Vim Cheat Sheet 출력
.vimrc 과 plugin 검색
훌륭한 멘토
![Page 9: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/9.jpg)
Basic
![Page 10: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/10.jpg)
Open & Save & Quit
$ vim ~/.vimrc
$ vim *.php
:e
:w :w!
:q :q!
![Page 11: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/11.jpg)
Help:h {KEY WORD}
![Page 12: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/12.jpg)
Move
h j k l
:줄 번호
첫 줄 - gg 또는 :1
마지막 줄 - G 또는 :$
![Page 13: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/13.jpg)
Mode
Command Mode - esc
Bottom-line Mode - :
Insert Mode - i A o O I a
![Page 14: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/14.jpg)
Mode
Visual Mode - v
Visual-Line Mode - Shift + v
Visual-Block Mode - CTRL + v
![Page 15: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/15.jpg)
Copy & Paste
y yy Y
p P
![Page 16: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/16.jpg)
Multiple Copies
" , 1 , y" , 2 , y
" , 1 , p" , 2 , p
:reg
![Page 17: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/17.jpg)
Undo & Redou
CTRL + r
![Page 18: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/18.jpg)
Auto-CompletionCTRL + n
![Page 19: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/19.jpg)
Search
/{KEY WORD}
?{KEY WORD}
shift + 3
:%s/old/new/g
![Page 20: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/20.jpg)
Windows Split
:sp :vs:sp {fimeName}
CTRL + w , w CTRL + w , 방향
![Page 21: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/21.jpg)
VIM Plugins
![Page 22: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/22.jpg)
Plugin Manager4 Vundlehttps://github.com/gmarik/Vundle.vim
4 NeoBundlehttps://github.com/Shougo/neobundle.vim
4 Pathogenhttps://github.com/tpope/vim-pathogen
...
![Page 23: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/23.jpg)
Install Vundle
4 git clone
4 ~/.vimrc 추가
4 :so ~/.vimrc
4 :PluginInstall
![Page 24: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/24.jpg)
Usage
:PluginSearch {KEY WORD}
:PluginList
:PluginInstall
:PluginClean
![Page 25: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/25.jpg)
NERDTree파일과 디렉토리 네비게이터
4 Plugin 'The-NERD-tree' => ~/.vimrc 추가4 :so ~/.vimrc
4 :PluginInstall
4 :NERDTree
![Page 26: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/26.jpg)
VIM + ctags코드를 분석하여 함수, 변수 등을 DB화이를 이용해 정의된 구현체로 이동 가능
코드 자동 완성에도 반영
![Page 27: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/27.jpg)
Install
$ sudo yum -y install ctags
$ ctags -f .php.tags --languages=PHP -R
$ echo "set tags=.php.tags" >> ~/.vimrc
![Page 28: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/28.jpg)
Usage
CTRL + ] : 구현체로 이동
CTRL + t : 돌아오기
![Page 29: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/29.jpg)
Taglist코드 브라우져functions, classes, structures, enumerations, definitions 등을 보여주고 이동이 가능
Plugin 'taglist-plus'
:TList
![Page 30: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/30.jpg)
PHP Syntax Check1. $ vim check.php
2. CTRL + Z
3. $ php -l check.php
4. fg
![Page 31: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/31.jpg)
PHP Syntax Check:!php -l %
![Page 32: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/32.jpg)
PHP Syntax Checknmap <leader>s :!clear && php -l %<CR>
"nmap" : 단축키 설정"<leader>s" : 단축키"<leader>" : prefix dafault \":!" shell script 실행"clear && php -l %" : shell script"%" : 현재 파일"<CR>" : 실행
![Page 33: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/33.jpg)
PHPQAPHP quality checking tools
4 Syntax errors
4 Coding standard violations
4 Code coverage
https://github.com/joonty/vim-phpqa
![Page 34: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/34.jpg)
Check Code Convension
https://github.com/squizlabs/PHP_CodeSniffer
$ composer global require "squizlabs/php_codesniffer=*"
or
$ pear install PHP_CodeSniffer
![Page 35: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/35.jpg)
Phpunit
:!phpunit %
vimscript
![Page 36: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/36.jpg)
phpcomplete-extended
Composer Project의 Auto complete
https://github.com/m2mdas/phpcomplete-extended
![Page 37: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/37.jpg)
Etc
![Page 38: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/38.jpg)
코드 정렬
gg=G
<< 5> visual mode
:set paste
![Page 39: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/39.jpg)
Text-Object
dit - delete inner tagdib - delete inner '(' ')' blockdiB - delete inner '{' '}' block
dab, daB, dat, cib, ciB, cit
![Page 40: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/40.jpg)
Multiple Cursors
https://github.com/terryma/vim-multiple-cursors
CTRL + n 커서 선택
CTRL + x 커서 건너뛰기
![Page 41: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/41.jpg)
Jump
열었던 파일의 위치로 이동
CTRL + o
CTRL + i
:ju
![Page 42: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/42.jpg)
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";'
![Page 43: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/43.jpg)
.vimrchttps://gist.github.com/ngleader/28fea0312c5086d3acb4
![Page 44: Vim for php](https://reader034.vdocuments.mx/reader034/viewer/2022052601/559432861a28aba77e8b4646/html5/thumbnails/44.jpg)
Thank you