LiTWol @ Oleg Terenchuk

  • Contact
  • About me

User login

What is OpenID?
To prevent automated spam submissions leave this field empty.
  • Log in using OpenID
  • Cancel OpenID login
  • Request new password

litwol's tweets

  • Youth is spent learning to turn our brain on producing results. No one bothers teaching us how to turn it off. Damn you insomnia — 47 weeks 14 hours ago
  •  
  • 1 of 9
  • ››
more
Home

Developing PHP in VIM - VIM IDE for PHP

Submitted by litwol on Mon, 02/15/2010 - 22:18

I was going to write something long and smart about how its important to know what YOUR NEEDS are when it comes to coding and using specific IDEs and how do they satisfy them, but decided its best to cut to the chase and just post my VIM configs as requested by several from NYC Drupal User Group during our Feb 10 2010 monthly meetup.

VIM
Attached to this post ZIP file contains customized .vimrc and .vim folder which contains several plugins which make vim very useful when developing in PHP. Contents are dot files so you will not see them unless viewed through terminal or enable displaying hidden files on unix system. P.S. Windows users can use the same .vimrc and .vim but make sure to google for instructions where to place them correctly.

Place both .vimrc and .vim in your $HOME directory so each will have the following respective paths: ~/.vimrc and ~/.vim

CTAGS
Attached _.ctags.txt file is CTAGS customization to perform PHP language map to drupal specific file extensions such as .test, .module, etc... Instructions: Place this file into webroot of your website that you are developing and make sure to rename it to ".ctags" (no leading _ and no .txt, i added these to be able to upload the file). To generate tags file you will need to run the following command in your webroot where you placed .ctags file (without quotes): "ctags -R ."

Without this file ctags will not know how to handle drupal specific files and you will not be able to use IDE features like code completion and jump to resource definition

If it is not clear how to use the customized plugins and other features once installed, leave a comment with your question for me to reply to.

edit:Last notes of wisdom: Make sure you are using _vim_ 7.2 or later, not _vi_(see the missing _m_?). Thx Rob Loach.

AttachmentSizeHitsLast download
myvim.zip400.39 KB2359 hours 47 min ago
_.ctags_.txt50 bytes33910 hours 16 min ago
  • 4868 reads
Tags:
  • php ide
  • vim
  • vim php
  • vim php ide

4 reponses to "Developing PHP in VIM - VIM IDE for PHP"

1. Thanks a lot

Submitted by Fedir (not verified) on Thu, 04/01/2010 - 03:46.

Thanks, Oleg. Very handy configuration. Vim is awesome editor !

  • reply

2. If you are on ubuntu

Submitted by winston (not verified) on Sun, 03/21/2010 - 16:01.

I suggest installing vim-full. The default vim package tends to be more limited in functionality. Also the ctags package name may be different.

So:
sudo apt-get install vim-full exuberant-ctags

  • reply

3. Screen and VIM

Submitted by pat (not verified) on Sat, 03/13/2010 - 20:25.

hey litwol, thanks for the heads up on the vim and ctags configuration. i also started messing with Screen too. luckily you mentioned it during that meetup. As of now i got vim and screen configured but when i run vim in screen i can't get the colors highlighting to come up. it works outside of screen tho.

here is my ~/.screenrc config if anyone wants. im sure it can be better, but its a good starting point:

also when i split the screen, how do u scroll up/down in that specific window? cant seem to figure that out.

got all of this from:
http://bbs.archlinux.org/viewtopic.php?id=55618

------------- ~/.screenrc ----------------------
term xterm-256color
autodetach on
startup_message off
activity "%c activity -> %n%f %t"
caption always "%{= Wk}%-w%{= Bw}%n %t%{-}%+w %-="
vbell off
defscrollback 5000

bind c screen 1
bind 0 select 10

# F8 to turn the status bar off
#bindkey -k k8 hardstatus alwayslastline
# F9 to turn the status bar on
#bindkey -k k9 hardstatus alwaysignore
# F5 and F6 to move one screen forward or backward
#bind F7 to change focus window
bindkey -k k7 focus up
bindkey -k k8 focus down
bindkey -k k5 prev # change window with ctrl-left
bindkey -k k6 next # change window with ctrl-right

#let pgup/pgdn scroll under urxvt (see .Xdefaults)
bindkey "^[[5;2~" eval "copy" "stuff ^u"
bindkey -m "^[[5;2~" stuff ^u
bindkey -m "^[[6;2~" stuff ^d

hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

# Default screens
screen -t TAB1 1
split
focus down
screen -t TAB2 2
screen -t TAB3 3
select 2

  • reply

4. Installed!

Submitted by Rob Loach (not verified) on Mon, 02/15/2010 - 22:39.

When I ran "vi", I got a bunch of errors. Forgot this was for "vim" :-) .

So, you'll need:
sudo apt-get install vim ctags

  • reply

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.

More information about formatting options

To prevent automated spam submissions leave this field empty.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Recent posts

  • Developing PHP in VIM - VIM IDE for PHP
  • Creating custom fields using Drupal 7 field api
  • Creating 3d cube movieClip using Sprites and animating rotation through ActionsScript 3.0
  • Adding sprite from inside an external class onto stage and animating it using arrow key movement.
  • Playing with flash keyboard click events
  • Script to benchmark API execution time.
  • Very good dvcs guide
  • High throughput web architecture with drupal - *For authenticated users*
  • About me - Oleg Terenchuk
  • Note to self
  • Pre-generating drupal forms
  • Change memcached admin stats page
  • The cult of done

LiTWoL © Oleg Terenchuk - Hosted on Linode.com 360

I love Smashing Magazine!
Fervens Drupal theme by Leow Kah Thong. Designed by Design Disease and brought to you by Smashing Magazine.