2022-01-19

Miscellaneous

Dispatch.vim

Dispatch.vim is one of my favorite extensions for (g)Vim, it works equally well inside the Windows Terminal and the Git for Windows terminal emulator.

  • Open File Explorer

Vim dispatch can be installed with a Vim plugin manager and it provides a set of commands for running external programs asynchronously. On Windows, for instance, I can open the file explorer with:

   :Start start .

or set the following remap in my .vimrc

    nnoremap <leader>ee <esc>:Start start .<cr>
    
  • Python REPL

I can also open the Python REPL with the py command even when Python isn't included in the PATH, by typing:

   :Start py

Bibliography

Pubs is a command-line program useful when you have to create a well-organised bibliographic database. It's possible to set VIM as the default text editor, after the command:

   $ pubs conf

the option edit_cmd can be set equal to vim.

This program is particularly appealing to me due to its relatively straightforward integration with vim-notes. You can attach a note to a particular manuscript with :

   $ pubs note citekey

To make this note compatible with vim-notes/wintermnote, the first line of the file should include the filename without extension. Inside my .vimrc I have the following code block:

    autocmd BufNewFile *.txt  :call CheckNoteFile()

    function! CheckNoteFile()
       let filename = expand("%:p:t")
       let basename = substitute(filename,".txt","","g")
       if (getline("1") !~ basename)
          exe "normal!ggO".basename
       endif
    endfunction
   

PDF

GVim :hardcopy command can be used to generate PDF files, it supports also Emojis and Unicode characters.