use scwrypts to render helm templates in vim :terminal buffer

This commit is contained in:
Wryn (yage) Wagner 2023-11-11 07:16:43 -07:00
parent 8be73904a0
commit 592fe48004
3 changed files with 35 additions and 2 deletions

View File

@ -3,7 +3,11 @@ let escapeTmuxPaneID = g:escapeTmuxSession . ":0.0"
let escapeCommandOutputs = ['tmux', 'split-pane-vertical', 'split-pane-horizontal'] let escapeCommandOutputs = ['tmux', 'split-pane-vertical', 'split-pane-horizontal']
function ExecuteCommand(args = '', output = '', flavor = 'shell') function ExecuteScwrypt(scwrypt = '', args = '', output = '', syntax = 'bash')
call ExecuteCommand('scwrypts ' . a:scwrypt . ' -- ' . a:args, a:output, 'shell', a:syntax)
endfunction
function ExecuteCommand(args = '', output = '', flavor = 'shell', syntax = 'bash')
let output = a:output let output = a:output
if output == '' if output == ''
let output = GetPrefferredCommandOutput() let output = GetPrefferredCommandOutput()
@ -16,9 +20,11 @@ function ExecuteCommand(args = '', output = '', flavor = 'shell')
call system("tmux send-keys -t ".g:escapeTmuxPaneID." '".command."' Enter") call system("tmux send-keys -t ".g:escapeTmuxPaneID." '".command."' Enter")
silent call system("tmux display-popup -E 'tmux a -t ".g:escapeTmuxSession."' &") silent call system("tmux display-popup -E 'tmux a -t ".g:escapeTmuxSession."' &")
elseif output == 'split-pane-horizontal' elseif output == 'split-pane-horizontal'
execute "botright terminal " . command execute "botright terminal " . command
let &l:syntax=a:syntax
elseif output == 'split-pane-vertical' elseif output == 'split-pane-vertical'
execute "botright vertical terminal " . command execute "botright vertical terminal " . command
let &l:syntax=a:syntax
else else
execute "!" . command execute "!" . command
endif endif

View File

@ -84,9 +84,31 @@ augroup file_specific_command_overrides
autocmd FileType python nnoremap <Leader>ec :call ExecuteCommand('python %:p', 'split-pane-vertical')<CR> autocmd FileType python nnoremap <Leader>ec :call ExecuteCommand('python %:p', 'split-pane-vertical')<CR>
autocmd FileType python nnoremap <Leader>ei :call ExecuteCommand('bpython -qi %:p', 'split-pane-vertical')<CR> autocmd FileType python nnoremap <Leader>ei :call ExecuteCommand('bpython -qi %:p', 'split-pane-vertical')<CR>
autocmd FileType yaml nnoremap <Leader>ec :call ExecuteScwrypt(
\ '-n --name helm/get-template --group scwrypts --type zsh'
\ , '--template-filename %:p', 'split-pane-vertical'
\ , 'yaml'
\)<CR>
autocmd FileType yaml nnoremap <Leader>ei :call ExecuteScwrypt(
\ '-n --name helm/get-template --group scwrypts --type zsh'
\ , '--raw --template-filename %:p', 'split-pane-vertical'
\ , 'yaml'
\)<CR>
autocmd FileType yaml nnoremap <Leader>eb :call ExecuteScwrypt(
\ '-n --name helm/update-dependencies --group scwrypts --type zsh'
\ , '--template-filename %:p', 'split-pane-vertical'
\ , 'yaml'
\)<CR>
augroup end augroup end
" }}} " }}}
" --- notes for meeeeee ----
" {{{
" need to adapt this for helm execution;
" should check for values.test.yaml or tests/default.yaml
" echom 'quicktest' | execute 'vertical terminal helm template directus . --debug --values values.yaml --values values.test.yaml --show-only %' | set syntax=yaml
" }}}
" --- organization overrides ------------------------------------------ " --- organization overrides ------------------------------------------
" {{{ " {{{
@ -95,6 +117,8 @@ source $WRYNVIMPATH/override/rentdynamics.vim
source $WRYNVIMPATH/override/directus.vim source $WRYNVIMPATH/override/directus.vim
" }}} " }}}
"
"
syntax on syntax on

View File

@ -23,6 +23,9 @@ nnoremap <Leader>q q:
" \s previous selection command " \s previous selection command
nnoremap <Leader>s :'<,'> nnoremap <Leader>s :'<,'>
" \m to set buffer to modifiable
nnoremap <Leader>m :set modifiable<CR>
" (e)dit / (s)ource vimrc " (e)dit / (s)ource vimrc
nnoremap <Leader>ev :tabedit $WRYNVIMRC<CR> nnoremap <Leader>ev :tabedit $WRYNVIMRC<CR>
nnoremap <Leader>sv :source $MYVIMRC<CR> nnoremap <Leader>sv :source $MYVIMRC<CR>