diff --git a/src/.config/nvim/init.vim b/src/.config/nvim/init.vim index e58c434..644a703 100755 --- a/src/.config/nvim/init.vim +++ b/src/.config/nvim/init.vim @@ -55,6 +55,7 @@ au TermOpen * setlocal nonumber norelativenumber tnoremap " start debugger nnoremap dd :execute "Termdebug" $HOME .. "/.cache/termdebug/" .. expand("%:r"):Source + " compile function Compile() if exists(":Source") @@ -62,8 +63,28 @@ function Compile() endif execute "make ~/.cache/termdebug/" .. expand("%:r") .. " -f ~/.config/nvim/makefile" endfunction - nnoremap dc :call Compile() + +" write clipboard into input file +function WriteInput() + let inputfile=$HOME .. "/.cache/termdebug/input/" .. expand("%:r") + echo "Written input to '" .. inputfile .. "'." + call writefile(getreg('+', 1, 1), inputfile) +endfunction +nnoremap rw :call WriteInput() + +" start from input file +function RunInput() + Stop + Run + Source + let inputfile=$HOME .. "/.cache/termdebug/input/" .. expand("%:r") + let @x = join(readfile(inputfile), "\n") .. "\n\n" + Program + normal G"xp +endfunction +nnoremap ri :call RunInput() + " start, stop, continue forwards nnoremap rs :Run nnoremap rr :Stop @@ -86,8 +107,8 @@ vnoremap K :'<,'>Evaluate " tab, window management nnoremap w nnoremap W -" force exit (akin to ZZ, ZQ) -nnoremap ZF :qa! +" exit all (akin to ZZ, ZQ) +nnoremap ZF :qa " Plugins