initial commit
This commit is contained in:
commit
b89fda4fb1
6
stt/cheat.sh
Normal file
6
stt/cheat.sh
Normal file
@ -0,0 +1,6 @@
|
||||
echo hi
|
||||
date
|
||||
VIMST sleep 4000
|
||||
date
|
||||
echo bye
|
||||
VIMST ctrl l
|
3
stt/common.vim
Normal file
3
stt/common.vim
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
let g:mapleader = ' '
|
||||
set splitbelow splitright
|
1
stt/stt.vim
Symbolic link
1
stt/stt.vim
Symbolic link
@ -0,0 +1 @@
|
||||
stt8.vim
|
30
stt/stt8.vim
Normal file
30
stt/stt8.vim
Normal file
@ -0,0 +1,30 @@
|
||||
def g:SendRangeToTerminal(start_line: number, end_line: number)
|
||||
const terms = term_list()
|
||||
if terms->empty()
|
||||
echomsg "No Terminal windows found"
|
||||
return
|
||||
endif
|
||||
var line_num = start_line
|
||||
for line in getline(start_line, end_line)
|
||||
line_num += 1
|
||||
const spl_cmd = line->matchlist('\vVIMST (sleep|ctrl) ([0-9]+|[a-z])')
|
||||
if !spl_cmd->empty()
|
||||
const [_, cmd, arg1; _] = spl_cmd
|
||||
if cmd == "sleep"
|
||||
timer_start(str2nr(arg1), (_) => g:SendRangeToTerminal(line_num, end_line))
|
||||
return
|
||||
elseif cmd == "ctrl"
|
||||
terms[0]->term_sendkeys(nr2char(char2nr(arg1) - 96))
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
terms[0]->term_sendkeys(line .. "\<CR>")
|
||||
endfor
|
||||
enddef
|
||||
|
||||
command -range -bar SendToTerm :call g:SendRangeToTerminal(<line1>, <line2>)
|
||||
vnoremap <silent><leader>s :SendToTerm<CR>
|
||||
nnoremap <silent><leader>s :SendToTerm<CR>
|
||||
|
||||
autocmd BufNewFile,BufRead cheat.sh nnoremap <buffer> <CR> :SendToTerm \| norm j<CR>
|
||||
autocmd BufNewFile,BufRead cheat.sh nnoremap <buffer> <silent><2-LeftMouse> :SendToTerm<CR>
|
34
stt/stt9.vim
Normal file
34
stt/stt9.vim
Normal file
@ -0,0 +1,34 @@
|
||||
vim9script
|
||||
|
||||
def SendRangeToTerminal(start_line: number, end_line: number)
|
||||
const terms = term_list()
|
||||
if terms->empty()
|
||||
echomsg "No Terminal windows found"
|
||||
return
|
||||
endif
|
||||
var line_num = start_line
|
||||
for line in getline(start_line, end_line)
|
||||
line_num += 1
|
||||
const spl_cmd = line->matchlist('\vVIMST (sleep|ctrl) ([0-9]+|[a-z])')
|
||||
if !spl_cmd->empty()
|
||||
const [_, cmd, arg1; _] = spl_cmd
|
||||
if cmd == "sleep"
|
||||
timer_start(str2nr(arg1), (_) => SendRangeToTerminal(line_num, end_line))
|
||||
return
|
||||
elseif cmd == "ctrl"
|
||||
terms[0]->term_sendkeys(nr2char(char2nr(arg1) - 96))
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
terms[0]->term_sendkeys(line .. "\<CR>")
|
||||
endfor
|
||||
enddef
|
||||
|
||||
command -range -bar SendToTerm :call <SID>SendRangeToTerminal(<line1>, <line2>)
|
||||
vnoremap <silent><leader>s :SendToTerm<CR>
|
||||
nnoremap <silent><leader>s :SendToTerm<CR>
|
||||
|
||||
autocmd BufNewFile,BufRead cheat.sh {
|
||||
nnoremap <buffer> <CR> :SendToTerm \| norm j<CR>
|
||||
nnoremap <buffer> <silent><2-LeftMouse> :SendToTerm<CR>
|
||||
}
|
Loading…
Reference in New Issue
Block a user