You should really give klen's python-mode a try. It's basically a vim plugin which integrates most other plugins to create a nice python IDE.
Thanks @dpashkevich! :)
don't forget to set this on a key in your .vimrc
:
set pastetoggle=<F2>
(http://vim.wikia.com/wiki/Toggle_auto-indenting_for_code_paste)
Thanks @jontas! Didn't know about the second method with different "variable" and "function" names.
For the self-invocation, there is also
!function() {
console.log.bar();
}()
and the same without the exclamation mark but with a +
instead (have a look at the latest twitter boostrap javascripts - always a good inspiration source)
Extending on @dmedvinsky
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%80v.\+', -1)
endif
will emulate colorcolumn by simply coloring the overflowing characters.
@dpashkevich Hey! Great job :) Pretty short for not using any third party module!
@manveru ah that's a nice one too :)
@design48 glad you like it. I should probably make a protip out of that one :D
If that happens to you frequently, you can (ab)use vim's text expand feature. In your .vimrc:
iab modesl models
and from now on it should automagically correct that.
iab
is shortform for iabbrev
. There is also autocorrect.vim which aims to build a database full of such things (teh -> the etc.)
I have something similar to this, but I have it as a git alias (and vimdiff is the default difftool for me). Part of my .gitconfig
:
[merge]
tool = vimdiff
[alias]
vd = difftool --no-prompt
So I type git vd
and it basically does the same. Of course your way is a lot shorter :)
@tlehman always glad when I can amaze people with knowledge :D
VIM has actually one of the most advanced history systems I know of. If you want to know more about VIM's undo-branches, just head over to the wiki -> http://vim.wikia.com/wiki/Using_undo_branches
Achievements
674 Karma
70,653 Total ProTip Views

Forked 20

Honey Badger

Mongoose

Epidexipteryx

Cub

Walrus

Forked

Charity

Python 3

Note that you will need to install
Pillow
in order to use this script :) (theimport Image
part that is).If you already have
PIL
(the python image library) installed, you are also good to go.Pillow
is just a friendly (modern) fork with some bug fixes and easier installation :)