Yii 1.1: yii vim eclimd how it works

8 followers

I want to create a wiki page, and therefore im opening this discussion on this forum, for answering all questions and see other opinions, how do you use vim with yii.

At first, i work with vim. I have a script file for opening saved session and custom bindings for every project.

#!/bin/bash
if [[ $# != 1 ]]
then
    zenity --title "Vim IDE usage error" --error --text "Usage: vim_ide /path/to/project/dir."
    exit 1
fi
 
if [[ ! -e "$1/.vim/ide.vim" ]]
then
    zenity --title "Vim IDE usage error" --error --text "'$1' is not a Vim IDE project directory."
    exit 1
fi
 
cd "$1" || { zenity --title "Vim IDE usage error" --error --text "Can't change current directory to Vim IDE project directory '$1'."; exit 1; }
 
vim --class=IDE -S .vim/ide.vim --servername vim

My every project has .vim folder under the root folder. there need to be one file at start .vim/ide.vim (just create it before start in project root dir.

set sessionoptions-=options
au VimLeave * :mksession! .vim/ide.session
    if getfsize(".vim/ide.session") >= 0
        source .vim/ide.session
    endif

Above is a default code for every project. But sometimes i have several bindings in this file, for example binding deployng files to production server

nmap <f3> :execute "Nwrite ftp://username@*.*.60.252/httpdocs/".expand("%")<CR> //Now i can upload files via ftp to production server. 
nmap <f12> :! cd /home/alex/site.com/yii-version/protected/tests/ && phpunit  ./functional/AdminPanelTest.php<cr> // i run tests when i code

Update: today i use awesome tool git and awesome tool git-ftp and my upload command is

nmap <leader>u :!git ftp push -A -vv -u username -p pass ftp://www.example.com/httpdocs/<cr>

git-ftp awesome tool, you can push your project to ftp, (much low cost hosters have it) and use power of git for your projects.

And i open project with next command $~/ide.sh /path/to/project . And it opens my project with all opened files, and tabs saved on last exit.

I use tabs for my code process. Next tabs i see on my every project:

Tests tab | Controllers Tab | Layouts tab | Views Tab | Model Tab | Temporary working tab

i use shortcuts for switching between them:

<leader>t - tests tab
<leader>c - controllers tab
<leader>l - layouts tab
<leader>v - views tab
<leader>m - model tab
<leader>w - working tab

For explorering i also have some bindings:

<leader>sv - slplit window and open Views folder
<leader>sc - slplit window and open Controllers folder
<leader>st - slplit window and open Tests folder
<leader>sm - slplit window and open Models folder
// also i use leader>v to explore folder without splitting.
// or if im editing model file and want to open another model, i just use <leader>e which makes :Explore command and open current folder for me
<leader>cm - open main config for yii project

What about my autocomplete ?

I use eclimd plugin and it has good eclipse autocomplete funcional. I see small window with preview variables which function needs. And preview window closes when i leave current insert mode. ss

Im open to discuss and share my experience. Forum Topic

Total 1 comment

#2953 report it
RusAlex at 2011/03/01 07:55am
this is my vim configs

https://github.com/RusAlex/myvim

Leave a comment

Please to leave your comment.

Write new article
  • Written by: RusAlex
  • Category: How-tos
  • Yii Version: 1.1
  • Votes: +10
  • Viewed: 7,549 times
  • Created on: Feb 25, 2011
  • Last updated: Jul 20, 2011
  • Tags: vim, eclimd, vimrc