Created
June 20, 2024 23:33
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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