Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add start/stop/restart commands #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ These are some of the commands that can be run from Vim command line:
* `:TidalGenerateCompletions {path}`: Generate dictionary for Dirt-Samples
completion (path is optional).

* `:TidalStart`: Start GHCi/SuperCollider without running any commands

* `:TidalStop`: Stop GHCi/SuperCollider immediately

* `:TidalRestart`: Restart GHCi/SuperCollider

### Default bindings

Using one of these key bindings you can send lines to Tidal:
Expand Down
26 changes: 26 additions & 0 deletions plugin/tidal.vim
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,36 @@ function! s:TidalGenerateCompletions(path)
let &l:dictionary .= ',' . l:output_path
endfunction

function! s:TidalStart()
call s:TerminalOpen()
endfunction

function! s:TidalStop()
" TODO check if nvim and tmux work this way too
if s:tidal_term_ghci != -1
execute "bwipeout! " . s:tidal_term_ghci
let s:tidal_term_ghci = -1

if g:tidal_sc_enable == 1 && s:tidal_term_sc != -1
execute "bwipeout! " . s:tidal_term_sc
let s:tidal_term_sc = -1
endif
endif
endfunction

function! s:TidalRestart()
call s:TidalStop()
call s:TidalStart()
endfunction

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Setup key bindings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

command! -nargs=0 TidalStart call s:TidalStart()
command! -nargs=0 TidalStop call s:TidalStop()
command! -nargs=0 TidalRestart call s:TidalRestart()

command -bar -nargs=0 TidalConfig call s:TidalConfig()
command -range -bar -nargs=0 TidalSend <line1>,<line2>call s:TidalSendRange()
command -nargs=+ TidalSend1 call s:TidalSend(<q-args>)
Expand Down