🖥 Using vim as a laravel/phpstorm developer
Tags: vim, laravel
Published: 2021-07-03 13:45:02

---
title: 🖥 Using vim as a laravel/phpstorm developer
published: true
description: My quick notes on how to use vim as a laravel developer
tags: vim, laravel
cover_image: https://images.unsplash.com/photo-1565898122623-be37b5f1e778?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1051&q=80
---
These are my quick notes on how to start seriously using vim as a laravel developer. My goal is to replace phpstorm w/ vim and match the feature set. For what I'm doing now, microservices in laravel/php, phpstorm is struggling to keep up.

My apologies they're a bit of a mess as they're undergoing, but wanted to get them out there if anyone has some feedback or suggestions I'd love to hear it!
![Screenshot of VIM Setup underway](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ntl8nvvpyrkposcyxe9k.png)
```
# Using vim as a laravel developer
Ok, using vim as a phpstorm replacment, this is prettyyyy close.

Here are the steps and the useful parts to know.

# First things first, install awesome-vim, this gets 90% of the stuff you need and its maintained
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh

# Next I'd say you're going to want phpunit baked in and here is an awesome plugin for that:
git clone https://github.com/c9s/phpunit.vim.git ~/.vim_runtime/my_plugins/phpunit.vim

# Run inside vim: -- this will let you click and drag panes to resize or jump between (learning vim more and being able to jump panes
# makes this unecessary, but i'm not that good yet.)
:set mouse=a

# So now some sections on easy key commands/shortcuts

## Splitting VIM screen Horizontally and Vertically
To open a new VIM window next to the existing one, press <Ctrl>+<w> then press <v>.

## Move panes around vim (left/right or top/bottom)
Ctrl w + L - Move the current window to the "far right"
Ctrl w + H - Move the current window to the "far left"
Ctrl w + J - Move the current window to the "very bottom"
Ctrl w + K - Move the current window to the "very top"

## Copying everything into clipboard
gg"*yG

## Indenting all the code
# Still need to look into a more serious formatter like:
https://github.com/vim-autoformat/vim-autoformat
gg=G

# AwesomeVIM Leader Key Shortcut
You'll see vim plugins mention <leader>, that <leader> for awesome view is "," so whenever you see leader hit that key.

## phpunit
### Set the path of phpunit (most cases for me, vendor/bin/phpunit)
let g:phpunit_bin = 'phpunit'

### Shortcuts
<leader>ta - Run all test cases
<leader>ts - Switch between source & test file
<leader>tf - Run current test case class

# Folding
`zo` to open folding
`zc` to close folding

# NerdTREE
<leader>nn - Toggles NerdTREE
While inside NerdTREE hit "m" to do a number of modifications from renaming, deleting or adding files.

# Terminal
Typing ":term" will open a terminal pane similar to phpstorm.

Of course you can reference https://github.com/amix/vimrc for more tips and tricks, such as <leader>w to write a file or <Ctrl+f> to fuzzy search for a file.
```

I'd like to make a video to accompany this setup to better describe how to use vim in this way so let me know if that's anything you'd like to see and best of luck in the new vim setup!