sebdah / vim-delve

Neovim / Vim integration for Delve
MIT License
502 stars 24 forks source link

Add `g:delve_instructions_file` as an config option. #42

Closed burik666 closed 3 years ago

burik666 commented 3 years ago

I want to manually start dlv in terminal. For this I need to know where the instructions file.

I wrote a small function that saves dlv.init to the root of the project. ~/.vimrc:

function! SaveDlvInit()
    let instructions = delve#getInitInstructions()
    if len(instructions) > 0
        let root = trim(system("dirname $(go env GOMOD)"))
        let g:delve_instructions_file = root."/"."dlv.init"
        call delve#writeInstructionsFile()
    else
        call delve#removeInstructionsFile()
    endif
endfunction

autocmd FileType go autocmd BufWritePost * call SaveDlvInit()