Skip to content

Commit

Permalink
feat: support headless mode (#199)
Browse files Browse the repository at this point in the history
Co-authored-by: Subhaditya Nath <sn03.general@gmail.com>
  • Loading branch information
kkoomen and subnut committed Dec 19, 2020
1 parent 447003a commit ec4d1c4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,21 @@ let g:doge_python_settings = {

- `single_quotes`: Whether or not to use single quotes for the multi-line comments openers and closers

# FAQ
# Headless mode

If you're running your vim commands inside a docker, CI or similar environments
with commands such as `vim +PlugInstall +qall > /dev/null` then you probably
want to use headless mode. This will not spawn any terminals, progress bars etc
and will simply run any process by vim-doge in the background.

This feature can be enabled by passing in `{ 'headless': 1 }` into the
`doge#install()` like so: `doge#install({ 'headless': 1 })`.

Example using vim-plug:

```vim
Plug 'kkoomen/vim-doge', {'do': { ->doge#install({ 'headless': 1 }) }}
```

# Help

Expand Down
10 changes: 9 additions & 1 deletion autoload/doge.vim
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ endfunction

"" @public
" Install the necessary dependencies.
function! doge#install() abort
function! doge#install(...) abort
for l:filename in ['vim-doge', 'vim-doge.exe']
let l:filepath = g:doge_dir . '/bin/' . l:filename
if filereadable(l:filepath)
Expand Down Expand Up @@ -212,6 +212,14 @@ function! doge#install() abort
let l:term_height = 4
endif

if len(a:000) > 0
if get(a:000[0], 'headless', 0)
call system(l:command)
call s:report_result(v:shell_error)
return
endif
endif

if has('nvim') && exists(':terminal') == 2
" neovim with :terminal support
" vint: next-line -ProhibitUnusedVariable
Expand Down

0 comments on commit ec4d1c4

Please sign in to comment.