Hidden gems inside your VIM Distribution
Have you ever looked into what comes with your VIM distribution?
To do so just :echo $VIMRUNTIME inside VIM and open that directory in your terminal.
Games and strange stuff
The $VIMRUNTIME directory holds a macros directory which contains useful and some strange stuff.
- A recent version of matchit.vim is available here.
No need to use an external version justruntime macros/matchit.viminside your .vimrc - There's a Conway's Game Of Life implementation available:
Startvim, then:runtime macros/life/life.vimand pressg - Tower of Hanoi anyone?
:runtime macros/hanoi/hanoi.vimand again pressg - Maze solver. A little more involving to make it run:
Open terminal and go to your $VIMRUNTIMEcd macros/maze && make && ./maze > maze.out
input30and press entervim maze.outthen:runtime macros/maze/maze_mactheng
- Menu in gvim for a lot of shell functions:
:runtime macros/shellmenu.vim
- Text justification via
:runtime macros/justify.vimthen:Justify
Working with Git
VIM contains a filetype plugin for git commits (made by Tim Pope).
If you commit with VIM as your editor you can set ft=gitcommit and then use :DiffGitCached to generate a diff with your changes.
Also availabe is a useful plugin for handling interactive rebases with git. Insert the following into your .vimrc:
augroup vim_config autocmd FileType gitrebase call LoadGitrebaseBindings() augroup ENDfun! LoadGitrebaseBindings() nnoremap
P :Pick nnoremap S :Squash nnoremap C :Cycle endfun
If you git rebase -i you can then use P, S or C to Pick, Squash or Cycle through the available options.
Have fun,
Frank
Mehr? Aktuelle Artikel oder alle Artikel im Archiv.