Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Friday, 27 March 2009

Introducing Zmrok

It was neither sleep, nor science. It was pure art. Ladies and Gentleman, I present you the Zmrok colour scheme:



features:
  • it looks good
    • well, I like it ;-)
  • it's small:
    • it's hackable
    • it's easily portable to other editors


Source can be viewed and downloaded at my mercurial repo or vim.org.

Zmrok is Polish for twilight, check out TextMate's (or pastie.org's) twilight colour scheme if you still wonder why it's named this way ;)

Sunday, 14 December 2008

Open source is great

I'm proud and happy to proclaim my Russian PLansliterated vimscript dead. Some nice guy have taken a look at it and developed a superior solution, so Russian PLansliterated shared a destiny of my pygments' lexer for Scala.

An interesting meta-solution emerges:
  1. Realize that you have a quite general problem
  2. Write 15-30 min hack solution to it. It may work a little crappy, but it's good if it's easy to read and extend.
  3. Open source it
  4. Wait...
  5. Next time you'll have the same problem someone has improved your solution beyond the recognition, so you can dump the old one.


It seems that improving something that exists is psychologically easier that starting from scratch. My new slides about Scala (download them, browse the source or watch them online) were made using pygments with new shiny lexer developed by someone pissed off by quality of an old one. Open Source is great, isn't it?

Friday, 2 May 2008

organize your python imports in vim

My first script at vim.sf.net. You can grab it here. Source code of it and unittests (nose is great!) are on my mercurial repo.

Have fun!

Friday, 1 February 2008

Vim stuff

Vim is great, but quite hard to master. My experience is that there usually is a lot of "how did you do that?" when working with another vimmer. There goes a random list of some useful commands I taught (or learned) recently:

^rX in command and insert mode.
Puts the content of X register. Typical use case: select something with * and then :%s/^r//new stuff/g

punctuation: ; and ,
repeats last tTfF motion, like everyone's favourite dot repeats last command

rectangle visual mode
^v or quadruple1 click. Often easier and faster, than macros

macros
q. Everyone know them :help q

^o
Jumps intro normal mode for one command. Typical usecase: editing middle of the line ^oo.

^v any_key in insert and command mode
Puts the Vim representation for that key. Useful for editing .vimrc

J in normal mode
joins current line and next line

^a ^x in normal mode
increment/decrement a number

& and \1, \2...
in to part of substitution

"*
X11 clipboard

^p ^n and ^xlot_of_keys like ^xf
completions

autocmds in your .vimrc
see .vimrc examples below

not a command: Wombat
My text is brilliant
My vim is pure.
I saw a Wombat.
Of that I'm sure.
[...]

You're beautiful. You're beautiful.
You're beautiful, it's true.




Some macros from my .vimrc that I found very useful:

" done with current line
inoremap <c-cr> <c-o&ht;o

"XML, HTML, JSP
autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap <C-b> <Esc>"tciw<<C-o>"tp><CR></<C-o>"tp><Esc>O
autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap <C-a> <Esc>"tciw<></><Esc>"tPF>"tPla
autocmd FileType xml,html,xhtml,jsp,htmldjango inoremap <C-s> <ESC>"tciw</><ESC>h"tPa<Space><Space><Left>


Side note: python syntaxfile file (at least in vim 7.0 in my SuSE) seems to be a little outdated:
autocmd FileType python syn keyword Constant True False None
autocmd FileType python syn keyword Keyword with


Meta tip:
type :help one_or_two_random_keys from time to time. prefix with i_ for insert mode stuff.


1 - yes. QUAD-ruple. Click, click, click, click. Four clicks in a row %-| . Open Office does have quadruple click too. Who uses mouse, anyway...