You are not logged in.

#1 2009-12-27 10:23:58

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Vim for Webdevelopment

Hello guys,

I'd like to spend a deeper look on Vim as it should be a great editor for nearly everything.

The most of the time I'm working with CSS/HTML/JS/Django(Python). Does anyone of you have a well proved vimrc for this task area?

I just want to see what's possible concerning syntax completion, highlighting etc.

Thank you in advance. smile

Offline

#2 2009-12-27 11:58:23

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Vim for Webdevelopment

No.

smile

Really, customizing Vim is very subjective, if you want to "spend a deeper look" i advise you to experiment yourself (you're not lazy are you?). A good tip though would be the supertab plugin, that does a bunch of intelligent code completion. First hit in google.


ᶘ ᵒᴥᵒᶅ

Offline

#3 2009-12-27 13:50:01

ArchArael
Member
Registered: 2005-06-14
Posts: 504

Re: Vim for Webdevelopment

My suggestions:

HTML plugin: http://www.infynity.spodzone.com/vim/HTML/

Remap Esc to CapLock, here is my .Xmodmap:

remove Lock = Caps_Lock
keysym Caps_Lock = Escape

(Works only in X)

some useful .vimrc configurations:

"tab navigation like firefox
map  <C-Tab> :tabnext <CR>
imap <C-Tab> <ESC> :tabnext <CR>
map  <C-S-Tab> :tabprevious <CR>
imap <C-S-Tab> <ESC> :tabprevious <CR>
"useful abbreviations 
ab xmlver <?xml version="1.0" encoding="utf-8"?>
ab xmlnsp xmlns:mx="http://www.adobe.com/2006/mxml"
ab xmlcmt <!-- --><ESC>3hi
ab cdata  <![CDATA[ ]]><ESC>3hi
"===================================================================
" xhtml plugin tweaks
"===================================================================
let g:do_xhtml_mappings=1
let g:no_html_tab_mapping=1
let g:no_html_toolbar=1

I don't know for python but for php I use xdebug + debugger.vim. Check here it seems that there are plug-ins for python and django framework:

http://lucumr.pocoo.org/2007/4/2/vim-as … nvironment

Last edited by ArchArael (2009-12-27 13:54:39)

Offline

#4 2009-12-27 17:21:23

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Vim for Webdevelopment

Another way to swap Caps Lock and Esc is to add this to ~/.xinitrc:

setxkbmap -option caps:swapescape &

This way if for some bizarre reason one actually uses Caps Lock, it will still exist as Esc.

Offline

#5 2010-02-07 15:07:18

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Vim for Webdevelopment

I actually stared at my Caps Lock key for 2 seconds thinking, but then how will they type Control? :-)

Offline

#6 2010-02-07 16:05:43

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: Vim for Webdevelopment

These are mine. This effectively switches ESC and Caps Lock keys.

I put the xmodmap line into a script because I use this setup on demand only.

bp:~/bin$ cat SWAP_EC 
#!/bin/bash
#
# Swap Esc and Caps Lock keys.

xmodmap ~/.config/swapEscCL
bp:~/bin$ cat ~/.config/swapEscCL
! Swap caps lock and escape
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock

There is a thread here from which this was stolen mainly. tongue
But I forgot which one (too lazy to search).

Edit: And, yes, +1 for HTML.vim! big_smile

Last edited by bernarcher (2010-02-07 16:13:00)


To know or not to know ...
... the questions remain forever.

Offline

#7 2010-02-07 16:28:44

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Vim for Webdevelopment

You can always refer to http://dotfiles.org/ Some people put their dotfiles on github too.

Offline

#8 2010-02-07 19:11:29

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Vim for Webdevelopment

Berticus wrote:

You can always refer to http://dotfiles.org/

That's been dead for a while, hasn't it? http://web.archive.org/web/*/dotfiles.org

Or is it making sporadic reappearances?

EDIT: attempts just now to get through failed, as previous attempts have. And wayback doesn't have anything since 2008. But just now, trying a second time, I do get through to a 2010-dated page. So maybe it's coming back.

Last edited by Profjim (2010-02-07 19:13:25)

Offline

#9 2010-02-07 20:09:06

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Vim for Webdevelopment

Profjim wrote:

EDIT: attempts just now to get through failed, as previous attempts have. And wayback doesn't have anything since 2008. But just now, trying a second time, I do get through to a 2010-dated page. So maybe it's coming back.

It's been working for me since mid-January or so. I mean I can look through dotfiles (the important part), but I can't login or create an account. It seems they're using a pretty old database since my username doesn't seem to exist.

Offline

#10 2010-02-07 21:26:37

HashBox
Member
Registered: 2009-01-22
Posts: 271

Re: Vim for Webdevelopment

Sparkup is pretty cool, basically "Zen Coding" for VIM, which lets you write HTML with CSS selector-like syntax. Also has convenient shortcuts for doctype declarations etc, see http://github.com/rstacruz/sparkup

Other than that, if you aren't already aware of all the text objects vim has, get used to using 'cit' and 'ci>' to change text between <tag></tag> or inside <tag> respectively, or 'dit' and 'di>' etc. Very useful and makes for quick editing smile

Offline

#11 2010-02-08 12:05:32

danielrmt
Member
Registered: 2009-12-03
Posts: 34

Re: Vim for Webdevelopment

Vim will validate your HTML and PHP syntax after saving if you add this to your vimrc file

au BufWritePost *.html !tidy -eq %
au BufWritePost *.htm !tidy -eq %
au BufWritePost *.php !php -l %

Offline

Board footer

Powered by FluxBB