GNU/Linux ◆ tmux-256color ◆ bash 806 views

Here I update the fzf-vim Vim plugin in pkgs/misc/vim-plugins/generated.nix automatically.

To do this, I just position the cursor on a derivation and press space, u, update-nix-fetchgit calls nix-prefetch-git and updates the nix expression with the new revision and hash and version.

The Vim script to do this is:

function! Preserve(command)
  let w = winsaveview()
  execute a:command
  call winrestview(w)
endfunction

" Update fetcher under cursor
autocmd FileType nix map <nowait> <leader>u :call Preserve("%!update-nix-fetchgit --location=" . line(".") . ":" . col("."))<CR>