Viewed   65 times

I've added some simple inoremap commands to my .vimrc to help with parens and brackets completion, but I only want them to apply to php files.

 inoremap ( ()<Esc>i
 inoremap { {<CR>}<Esc>ko
 inoremap <? <?php ?><Esc><Left>i

How to I set these commands to be active only when I'm editing a .php file?

 Answers

3

Use autocmd FileType:

autocmd FileType php,c,java inoremap ( ()<Esc>i
Sunday, November 27, 2022
3

I have found that Netbeans has better code completion than Aptana. When I was working with codeigniter, Netbeans would code complete for my static methods in models where Aptana wouldn't.

Since my posting of this, JetBrains has released PHPStorm and has your rapid fire intellisense, as well as even better type hinting. It is absolutely superior to all others IMHO. I've been using EAP 2.0 for several months now for free.

Sunday, September 18, 2022
 
abbot
 
2

I figured it out, leaving as an example in case someone tries this in the future:

If I want to match column "n", I just need to match anything of column "n-1" and then do my criteria for column n. The following expression finds all lines that have column 35 not equal to space.

^.{34}[^ ]
Saturday, September 10, 2022
 
lacco
 
3

You can execute windo set nodiff noscrollbind and then close the second window.

Update: there is a diffoff command. Use windo diffoff, not what I wrote in previous line.

Monday, November 21, 2022
2

It's possible, but most people don't.

vim is a fairly generic editor, that said, it does contain some "code completion" features such as word completion, etcetera, but nothing like the likes of, say, Delphi's IDE.

Such a system could be added by scripting vim - vim can directly run several scripting languages that make this easy, or you could send the file through an external script.

Friday, September 23, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :