So happy that I know how to use VIM. Why? Because sometimes I need to edit files on the remote host.
Maybe your IDE can’t successfully connect to the remote host and you end up with SSH and CLI commands.
My current scenario is implementing a payment gateway and using localhost as host is ignored 😦 I ended up coding on the shared hosting via SSH, but without slowdown thanks to VIM skills.
In insert mode I incidentally pressed Ctrl+d and VIM removed one shiftwidth indentation. To revert just press Ctrl+t
Pretty handy. Always learning/improving my vim-fu.
This post is more of a reminder/cheatsheet for myself.
Whenever in doubt or have question check VIM :help.
For help with tags use :help tagstack
- Jump to a tag Ctrl+]
- Jump back Ctrl+Shift+o
- List tags g[
After watching VIM as PHP IDE I revisited my config, specifically pimped ctags according to articles Vim Autocompletion for PHP and Exuberant ctags with PHP in Vim
So my current $HOME/.ctags is:
--regex-PHP=/abstract class ([^ ]*)/\1/c/
--regex-PHP=/interface ([^ ]*)/\1/c/
--regex-PHP=/trait ([^ ]*)/\1/c/
--regex-PHP=/(public |static |abstract |protected |private )+ function +([^ \(]*)/\2/f/
Had some issues with listing files from modules/ via CtrlP so I ended up writing my own user command for.
let g:ctrlp_user_command = 'find %s -type f -not \( -path "*/.svn/*" -o -path "*/.git/*" -o -path "*/vendor/*" -o -path "*/.idea/*" -o -path "*/cache/*" \)'
Thanks CtrlP for the ctrlp_user_command var 😉