Created
June 3, 2018 16:29
-
-
Save tyru/448cd0c5839236a2390be2e042b35dd0 to your computer and use it in GitHub Desktop.
:set buftype=prompt
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
| function! s:run() abort | |
| new | |
| setlocal buftype=prompt | |
| function! s:TextEntered(text) | |
| if a:text == 'exit' || a:text == 'quit' | |
| stopinsert | |
| close | |
| else | |
| call append(line('$') - 1, 'Entered: "' . a:text . '"') | |
| " Reset 'modified' to allow the buffer to be closed. | |
| set nomodified | |
| endif | |
| endfunction | |
| call prompt_setcallback(bufnr(''), function('s:TextEntered')) | |
| call prompt_setprompt(bufnr(''), 'vimshell> ') | |
| endfunction | |
| call s:run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment