From 592fe480049d046cdc4db325887f1b48a0f8d044 Mon Sep 17 00:00:00 2001 From: yage Date: Sat, 11 Nov 2023 07:16:43 -0700 Subject: [PATCH] use scwrypts to render helm templates in vim :terminal buffer --- vim/execute.vim | 10 ++++++++-- vim/formatting.vim | 24 ++++++++++++++++++++++++ vim/rc.vim | 3 +++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/vim/execute.vim b/vim/execute.vim index e816487..0e18e70 100644 --- a/vim/execute.vim +++ b/vim/execute.vim @@ -3,7 +3,11 @@ let escapeTmuxPaneID = g:escapeTmuxSession . ":0.0" 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 if output == '' let output = GetPrefferredCommandOutput() @@ -16,9 +20,11 @@ function ExecuteCommand(args = '', output = '', flavor = 'shell') call system("tmux send-keys -t ".g:escapeTmuxPaneID." '".command."' Enter") silent call system("tmux display-popup -E 'tmux a -t ".g:escapeTmuxSession."' &") elseif output == 'split-pane-horizontal' - execute "botright terminal " . command + execute "botright terminal " . command + let &l:syntax=a:syntax elseif output == 'split-pane-vertical' execute "botright vertical terminal " . command + let &l:syntax=a:syntax else execute "!" . command endif diff --git a/vim/formatting.vim b/vim/formatting.vim index 77023c6..1fa57b4 100644 --- a/vim/formatting.vim +++ b/vim/formatting.vim @@ -84,9 +84,31 @@ augroup file_specific_command_overrides autocmd FileType python nnoremap ec :call ExecuteCommand('python %:p', 'split-pane-vertical') autocmd FileType python nnoremap ei :call ExecuteCommand('bpython -qi %:p', 'split-pane-vertical') + + autocmd FileType yaml nnoremap ec :call ExecuteScwrypt( + \ '-n --name helm/get-template --group scwrypts --type zsh' + \ , '--template-filename %:p', 'split-pane-vertical' + \ , 'yaml' + \) + autocmd FileType yaml nnoremap ei :call ExecuteScwrypt( + \ '-n --name helm/get-template --group scwrypts --type zsh' + \ , '--raw --template-filename %:p', 'split-pane-vertical' + \ , 'yaml' + \) + autocmd FileType yaml nnoremap eb :call ExecuteScwrypt( + \ '-n --name helm/update-dependencies --group scwrypts --type zsh' + \ , '--template-filename %:p', 'split-pane-vertical' + \ , 'yaml' + \) 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 ------------------------------------------ " {{{ @@ -95,6 +117,8 @@ source $WRYNVIMPATH/override/rentdynamics.vim source $WRYNVIMPATH/override/directus.vim " }}} +" +" syntax on diff --git a/vim/rc.vim b/vim/rc.vim index e5ccdaa..393992b 100644 --- a/vim/rc.vim +++ b/vim/rc.vim @@ -23,6 +23,9 @@ nnoremap q q: " \s previous selection command nnoremap s :'<,'> +" \m to set buffer to modifiable +nnoremap m :set modifiable + " (e)dit / (s)ource vimrc nnoremap ev :tabedit $WRYNVIMRC nnoremap sv :source $MYVIMRC