Skip to content

Instantly share code, notes, and snippets.

@wolandark
Created June 20, 2024 23:33
Show Gist options
  • Save wolandark/ea90dd5fe71abe90d024a1347c36dad8 to your computer and use it in GitHub Desktop.
Save wolandark/ea90dd5fe71abe90d024a1347c36dad8 to your computer and use it in GitHub Desktop.
dict wrapper in vim9script. Gets word_under_cursor definition from wordnet and displays it in a split buffer
vim9script
def GetWord()
var word_under_cursor = expand('<cword>')
var result = system('dict -d wn ' .. word_under_cursor)
execute 'vnew'
setlocal buftype=nofile
setlocal bufhidden=hide
setlocal noswapfile
call setline(1, split(result, "\n"))
enddef
command! Dict call GetWord()
nnoremap <F2> :Dict<CR>
defcompile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment