[Nix-dev] .nix simple vim support

Marc Weber marco-oweber at gmx.de
Mon Apr 16 15:22:43 CEST 2007


This is nothing special but maybe useful.

Just in case anyone is interested.
I'm using these settings in .vim/ftplugin.
This folds the all-packages.nix by headlines.
(You can read more about folding by typing :h folding)
The last lines (gf-Handler) allows jumping to the default.nix file directly by
pressing gf on the folder which is imported 
You need some extra files which you can get here:
http://www.mawercer.de/marcweber/vim/installer/vimlib_gfhandler_installer_sourceme.vim
(:source <the dowbloaded file )
If you do not want to use the .vim dir as default you can save the files to any
diroctery you want. Then you have to add set runtimepath+=<dir> to your .vimrc


augroup DefaultNix
  autocmd BufRead,BufNewFile *.nix  setlocal ft=nix
augroup end

" don't fold if there are no heaaders (default.nix files)
if search('###','nw') > 0
  setlocal foldexpr=getline(v:lnum)=~'###'?'>1':1
  setlocal foldmethod=expr
  setlocal foldtext=getline(v:foldstart)
endif

" gf-Handler / to be able to jump to files using gf
noremap <buffer> gf :call vl#ui#navigation#gfHandler#HandleGF()<cr>
call vl#ui#navigation#gfHandler#AddGFHandler("[ expand(expand('%:h').'/'.expand('<cWORD>')).'/default.nix'" .
                                           \ ", expand(expand('%:h').'/'.expand('<cWORD>')) ]")

Marc



More information about the nix-dev mailing list