A simple, functional Neovim/Vim "keywordprg command" authoring utility. If you have a command line program that you want to use as a keywordprg, this plugin will quickly make that desire a reality.
If using vim-plug, place the following line in the Plugin section of your inti.vim / vimrc:
" ~/.vimrc
Plug 'pappasam/vim-keywordprg-commands'
Then run the Ex command:
:PlugInstall
I personally use vim-packager, so if you'd like to go down the "package" rabbit hole, I suggest giving that a try.
From within Vim, type:
:help keywordprg_commands
This plugin provides no mappings of its own, but it is intended to be used alongside Vim's built-in keywordprg. You should associate keywordprg commands Vim's keywordprg configuration value. For the plugin's provided commands, this can be done in your init.vim / vimrc as follows:
augroup custom_keywordprg
autocmd!
autocmd FileType markdown,rst,tex,txt setlocal keywordprg=:DefEng
autocmd FileType python setlocal keywordprg=:Pydoc
augroup end
For the above filetypes, if you type K
while in normal mode, your keywordprg
command will be used to look up the word under the cursor. If you type K
while in visual mode, your keywordprg command will be used to look your visual
selection.
Use g:vim_keywordprg_commands
to create and configure new keywordprg commands. See its documentation by typing :help g:vim_keywordprg_commands
.
Creating commands is super easy, but this plugin does come with some command implementations to get you started:
:DefEng
look up a word's English definition using dict-wn. This uses a locally-installed version of wordnet.:SynEng
look up a word's English synonyms using dict-moby-thesaurus. This uses a locally installed version of moby-thesaurus.:Pydoc
look up a Python keyword using pydoc.
This plugin prioritizes simplicity and ease of use on a POSIX-compliant system. Support for Windows and other non-Unix derivatives is out of scope.
Samuel Roeca samuel.roeca@gmail.com