Mercurial > vim_plugins > core
comparison autoload/core.vim @ 1:7c5bd18befd2 default tip
Some basic usage
| author | Luka Sitas <lsitas@avatarasoftware.com> |
|---|---|
| date | Tue, 10 Mar 2026 21:31:17 -0400 |
| parents | 7bb5f650cfb7 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:7bb5f650cfb7 | 1:7c5bd18befd2 |
|---|---|
| 1 " autoload/core.vim | 1 " autoload/core.vim |
| 2 " Functions are loaded on demand | 2 " Functions are loaded on demand |
| 3 | 3 if exists('g:loaded_core') |
| 4 if exists('*core#greet') | |
| 5 finish | 4 finish |
| 6 endif | 5 endif |
| 6 let g:loaded_core = 1 | |
| 7 | 7 |
| 8 function! core#greet() abort | 8 function! core#PopupCommand(command) |
| 9 echo g:core_greeting | 9 let buf = term_start(a:command, {'hidden': 1, 'term_finish': 'close'}) |
| 10 let winid = popup_create(buf, {'minwidth': 120, 'minheight': 28}) | |
| 10 endfunction | 11 endfunction |
| 12 | |
| 13 function! core#ReadOnlyPopup(content) | |
| 14 let lines = split(a:content, "\n") | |
| 15 let winid = popup_create(lines, {'minwidth':120, 'minheight':28}) | |
| 16 let buf = winbufnr(winid) | |
| 17 call setbufvar(buf, '&modifiable', 0) | |
| 18 call setbufvar(buf, '&bufhidden', 'wipe') | |
| 19 return winid | |
| 20 endfunction | |
| 21 | |
| 22 function! core#ExecuteCommand(command) | |
| 23 " a:command is a shell command string, e.g. 'hg status' | |
| 24 return system(a:command . ' 2>&1') | |
| 25 endfunction |
