Development

SymfonyAndVim

You must first sign up to be able to contribute.

Coding symfony with Vim

This page is devoted to resources for those choosing to code symfony projects with Vim.

The Vim website

Useful plugins for Vim:

* You might have to add the following two lines to your .vimrc file for this to work:

filetype on
filetype plugin on

Useful additions to your .vimrc file:

Convert Tabs to Spaces

In adherence with the symfony standard of 2 spaces per tab:

From A Collection of Vim Tips | Ayman Hourieh's Blog

Placing the following in your .vimrc will replace tabs with 2 spaces when tab key is pressed, when indenting, and auto-indenting. this can be very useful while working with Python code for example, as it stops tabs from sneaking into files.

set et
set sw=2
set sts=2
set smarttab

PHP code folding

let php_folding = 1

Code folding commands

  • zo: open fold (if cursor is on the fold line)
  • zc: close the closest fold
  • zR: open all folds
  • zM: close all folds
  • zj: move to start of next fold
  • zk: move to end of previous fold

Set line numbers on

Useful for finding the source of those errors -- what errors?! ;)

set number

Automatically delete trailing DOS-returns and whitespace

Useful for automatically removing trailing whitespace.

autocmd BufRead * silent! %s/[\r \t]\+$//
autocmd BufEnter *.php :%s/[ \t\r]\+$//e

Display trailing spaces, tabs and end of lines

Useful to edit Yaml files. End of lines will be displayed as a blue «$», trailing spaces as «-» and tabs as «^I».

set list
set listchars=trail:-